Merge branch 'master' into 'master'

Fix: Misc fixes, examine cleanup

See merge request 2009scape/2009scape!236
This commit is contained in:
Ceikry 2021-08-26 21:57:38 +00:00
commit 15cc641f63
5 changed files with 357 additions and 355 deletions

View file

@ -46116,7 +46116,7 @@
{
"requirements": "{1,70}",
"ge_buy_limit": "10",
"examine": "\tGuthan the Infested's platebody armour.",
"examine": "Guthan the Infested's platebody armour.",
"durability": null,
"low_alchemy": "112000",
"high_alchemy": "168000",
@ -46371,7 +46371,7 @@
{
"requirements": "{1,70}",
"ge_buy_limit": "10",
"examine": "\tTorag the Corrupted's platebody armour.",
"examine": "Torag the Corrupted's platebody armour.",
"durability": null,
"low_alchemy": "112000",
"high_alchemy": "168000",
@ -48202,7 +48202,7 @@
},
{
"requirements": "{1,70}",
"examine": "\tGuthan the Infested's platebody armour.",
"examine": "Guthan the Infested's platebody armour.",
"durability": null,
"low_alchemy": "112000",
"high_alchemy": "168000",
@ -48218,7 +48218,7 @@
},
{
"requirements": "{1,70}",
"examine": "\tGuthan the Infested's platebody armour.",
"examine": "Guthan the Infested's platebody armour.",
"durability": null,
"low_alchemy": "112000",
"high_alchemy": "168000",
@ -48234,7 +48234,7 @@
},
{
"requirements": "{1,70}",
"examine": "\tGuthan the Infested's platebody armour.",
"examine": "Guthan the Infested's platebody armour.",
"durability": null,
"low_alchemy": "112000",
"high_alchemy": "168000",
@ -48250,7 +48250,7 @@
},
{
"requirements": "{1,70}",
"examine": "\tGuthan the Infested's platebody armour.",
"examine": "Guthan the Infested's platebody armour.",
"durability": null,
"low_alchemy": "112000",
"high_alchemy": "168000",
@ -48267,7 +48267,7 @@
{
"requirements": "{1,70}",
"ge_buy_limit": "10",
"examine": "\tGuthan the Infested's platebody armour.",
"examine": "Guthan the Infested's platebody armour.",
"durability": null,
"low_alchemy": "112000",
"high_alchemy": "168000",
@ -49000,7 +49000,7 @@
},
{
"requirements": "{1,70}",
"examine": "\tTorag the Corrupted's platebody armour.",
"examine": "Torag the Corrupted's platebody armour.",
"durability": null,
"low_alchemy": "112000",
"high_alchemy": "168000",
@ -49016,7 +49016,7 @@
},
{
"requirements": "{1,70}",
"examine": "\tTorag the Corrupted's platebody armour.",
"examine": "Torag the Corrupted's platebody armour.",
"durability": null,
"low_alchemy": "112000",
"high_alchemy": "168000",
@ -49032,7 +49032,7 @@
},
{
"requirements": "{1,70}",
"examine": "\tTorag the Corrupted's platebody armour.",
"examine": "Torag the Corrupted's platebody armour.",
"durability": null,
"low_alchemy": "112000",
"high_alchemy": "168000",
@ -49048,7 +49048,7 @@
},
{
"requirements": "{1,70}",
"examine": "\tTorag the Corrupted's platebody armour.",
"examine": "Torag the Corrupted's platebody armour.",
"durability": null,
"low_alchemy": "112000",
"high_alchemy": "168000",
@ -49065,7 +49065,7 @@
{
"requirements": "{1,70}",
"ge_buy_limit": "10",
"examine": "\tTorag the Corrupted's platebody armour.",
"examine": "Torag the Corrupted's platebody armour.",
"durability": null,
"low_alchemy": "112000",
"high_alchemy": "168000",
@ -68784,7 +68784,7 @@
{
"shop_price": "54",
"ge_buy_limit": "1000",
"examine": "\tStill needs two more ingredients.",
"examine": "Still needs two more ingredients.",
"grand_exchange_price": "77",
"durability": null,
"name": "Part mud pie",
@ -110850,21 +110850,21 @@
"id": "12184"
},
{
"examine": "Chick: A fluffy chick.Bird: Lovely blue plumage.Owl: A fantastic saradomin owl.",
"examine": "A fantastic saradomin owl.",
"durability": null,
"name": "Saradomin owl",
"archery_ticket_price": "0",
"id": "12185"
},
{
"examine": "Chick: A fluffy chick.Bird: Lovely red plumage.Hawk: A stately zamorak hawk.",
"examine": "A stately zamorak hawk.",
"durability": null,
"name": "Zamorak hawk",
"archery_ticket_price": "0",
"id": "12186"
},
{
"examine": "Chick: A fluffy chick.Bird: Lovely green plumage.Raptor: An impressive Guthix raptor.",
"examine": "An impressive Guthix raptor.",
"durability": null,
"name": "Guthix raptor",
"archery_ticket_price": "0",
@ -112506,63 +112506,63 @@
"id": "12502"
},
{
"examine": "Chick: A fluffy chick.Bird: Lovely blue plumage.Owl: A fantastic saradomin owl.",
"examine": "A fluffy chick.",
"durability": null,
"name": "Saradomin chick",
"archery_ticket_price": "0",
"id": "12503"
},
{
"examine": "Chick: A fluffy chick.Bird: Lovely blue plumage.Owl: A fantastic saradomin owl.",
"examine": "Lovely blue plumage.",
"durability": null,
"name": "Saradomin bird",
"archery_ticket_price": "0",
"id": "12504"
},
{
"examine": "Chick: A fluffy chick.Bird: Lovely blue plumage.Owl: A fantastic saradomin owl.",
"examine": "A fantastic saradomin owl.",
"durability": null,
"name": "Saradomin owl",
"archery_ticket_price": "0",
"id": "12505"
},
{
"examine": "Chick: A fluffy chick.Bird: Lovely red plumage.Hawk: A stately zamorak hawk.",
"examine": "A fluffy chick.",
"durability": null,
"name": "Zamorak chick",
"archery_ticket_price": "0",
"id": "12506"
},
{
"examine": "Chick: A fluffy chick.Bird: Lovely red plumage.Hawk: A stately zamorak hawk.",
"examine": "Lovely red plumage.",
"durability": null,
"name": "Zamorak bird",
"archery_ticket_price": "0",
"id": "12507"
},
{
"examine": "Chick: A fluffy chick.Bird: Lovely red plumage.Hawk: A stately zamorak hawk.",
"examine": "A stately zamorak hawk.",
"durability": null,
"name": "Zamorak hawk",
"archery_ticket_price": "0",
"id": "12508"
},
{
"examine": "Chick: A fluffy chick.Bird: Lovely green plumage.Raptor: An impressive Guthix raptor.",
"examine": "A fluffy chick.",
"durability": null,
"name": "Guthix chick",
"archery_ticket_price": "0",
"id": "12509"
},
{
"examine": "Chick: A fluffy chick.Bird: Lovely green plumage.Raptor: An impressive Guthix raptor.",
"examine": "Lovely green plumage.",
"durability": null,
"name": "Guthix bird",
"archery_ticket_price": "0",
"id": "12510"
},
{
"examine": "Chick: A fluffy chick.Bird: Lovely green plumage.Raptor: An impressive Guthix raptor.",
"examine": "An impressive Guthix raptor.",
"durability": null,
"name": "Guthix raptor",
"archery_ticket_price": "0",

View file

@ -349,7 +349,7 @@
},
{
"npc_id": "108",
"loc_data": "{2941,9779,0,1,0}-{2934,9776,0,1,0}-{2934,9768,0,1,0}-{2934,9757,0,1,0}-{2930,9752,0,1,0}"
"loc_data": "{2941,9779,0,1,0}-{2934,9776,0,1,0}-{2934,9768,0,1,0}-{2934,9757,0,1,0}-{2930,9752,0,1,0}-{2732,3225,0,1,0}-{2729,3224,0,1,0}-{2719,3223,0,1,0}-{2722,3220,0,1,0}-{2724,3216,0,1,0}-{2721,3213,0,1,0}-{2713,3217,0,1,0}"
},
{
"npc_id": "109",

View file

@ -330,6 +330,7 @@ public enum Consumables {
MAGIC_ESS(new Potion(new int[] {11491, 11489}, new SkillEffect(Skills.MAGIC,3,0))),
SANFEW(new Potion(new int[] {10925, 10927, 10929, 10931}, new MultiEffect(new RestoreEffect(8,0.25), new PrayerEffect(8,0.25), new RemoveStateEffect(EntityState.POISONED.ordinal()), new RemoveStateEffect("disease")))),
SUPER_ENERGY(new Potion(new int[] {3016, 3018, 3020, 3022}, new EnergyEffect(20))),
BLAMISH_OIL(new FakeConsumable(1582, new String[] {"You know... I'd really rather not."})),
/** Barbarian Mixes */
PRAYERMIX(new BarbarianMix(new int[] {11467, 11465}, new MultiEffect(new PrayerEffect(7, 0.25), new HealingEffect(6)))),

View file

@ -1,328 +1,328 @@
package core.game.interaction.item;
import core.game.content.dialogue.DialogueAction;
import core.game.content.dialogue.DialogueInterpreter;
import core.game.content.dialogue.DialoguePlugin;
import core.game.content.global.GodBook;
import core.game.node.entity.skill.Skills;
import core.game.interaction.NodeUsageEvent;
import core.game.interaction.OptionHandler;
import core.game.interaction.UseWithHandler;
import core.game.node.Node;
import core.game.node.entity.player.Player;
import core.game.node.item.GroundItem;
import core.game.node.item.Item;
import core.game.node.item.ItemPlugin;
import core.game.system.task.Pulse;
import rs09.game.world.GameWorld;
import core.game.world.update.flag.context.Animation;
import core.plugin.Plugin;
import core.plugin.Initializable;
import rs09.plugin.PluginManager;
/**
* Handles the god books.
* @author Vexia
*/
@Initializable
public class GodBookPlugin extends OptionHandler {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (GodBook book : GodBook.values()) {
book.getDamagedBook().getDefinition().getHandlers().put("option:check", this);
book.getBook().getDefinition().getHandlers().put("option:preach", this);
}
PluginManager.definePlugins(new PageHandler(), new GodBookDialogue(), new GodBookItem(), new SymbolBlessHandler());
return this;
}
@Override
public boolean handle(Player player, Node node, String option) {
GodBook book = GodBook.forItem(node.asItem(), option.equalsIgnoreCase("check"));
if (book != null) {
switch (option) {
case "check":
String[] messages = new String[4];
for (int i = 0; i < messages.length; i++) {
messages[i] = book.hasPage(player, node.asItem(), i + 1) ? "The " + getNumberName(i + 1) + " page is in the book." : "The " + getNumberName(i + 1) + " page is missing.";
}
player.getDialogueInterpreter().sendDialogue(messages);
return true;
case "preach":
player.getDialogueInterpreter().open("god-book", book);
return true;
}
}
return true;
}
/**
* Handles the blessing of a symbol with a god book.
* @author Vexia
*/
public class SymbolBlessHandler extends UseWithHandler {
/**
* Constructs a new {@code SymbolBlessHandler} {@code Object}
*/
public SymbolBlessHandler() {
super(1716);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (GodBook book : GodBook.values()) {
addHandler(book.getBook().getId(), ITEM_TYPE, this);
}
return this;
}
@Override
public boolean handle(NodeUsageEvent event) {
Player player = event.getPlayer();
GodBook book = GodBook.forItem(event.getUsedItem(), false);
if (book == null) {
return false;
}
final Item symbol = event.getUsedWith().asItem();
if (player.getSkills().getLevel(Skills.PRAYER) < 50) {
player.sendMessage("You need a Prayer level of at least 50 in order to do this.");
return true;
}
if (player.getSkills().getPrayerPoints() < 4) {
player.sendMessage("You need at least 4 prayer points in order to do this.");
return true;
}
if (book == GodBook.BOOK_OF_BALANCE) {
player.getDialogueInterpreter().sendOptions("Select an Option", "Unholy symbol", "Holy symbol");
player.getDialogueInterpreter().addAction(new DialogueAction() {
@Override
public void handle(Player player, int buttonId) {
bless(player, symbol, buttonId == 1 ? GodBook.UNHOLY_BOOK : GodBook.HOLY_BOOK);
}
});
return true;
}
bless(player, symbol, book);
return true;
}
/**
* Blesses a symbol.
* @param player the player.
* @param book the book.
*/
private void bless(Player player, Item symbol, GodBook book) {
if (!player.getInventory().containsItem(symbol)) {
return;
}
if (player.getInventory().get(symbol.getSlot()) == null) {
return;
}
player.getInventory().replace(book.getBlessItem()[0], symbol.getSlot());
player.getSkills().decrementPrayerPoints(4);
}
}
/**
* A god book item.
* @author Vexia
*/
public class GodBookItem extends ItemPlugin {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (GodBook book : GodBook.values()) {
register(book.getDamagedBook().getId());
}
return this;
}
@Override
public boolean canPickUp(Player player, GroundItem item, int type) {
if (player.hasItem(item.asItem())) {
player.sendMessage("You do not need more than one incomplete book.");
return false;
}
return true;
}
}
/**
* Handles the god book dialogue.
* @author Vexia
*/
public static class GodBookDialogue extends DialoguePlugin {
/**
* The partnership messages.
*/
private static final String[][] PARTNERSHIPS = new String[][] { { "In the name of Saradomin,", "protector of us all,", " I now join you in the eyes of Saradomin." }, { "Light and dark,", "day and night,", "Balance arises from constrast.", "I unify thee in the name of Guthix." }, { "May your union not be harmonious,", "but may your conflicts make you stronger,", "in Zamorak's name,", "now two are one." } };
/**
* The last rite messages.
*/
private static final String[][] LAST_RITES = new String[][] { { "Thy cause was false,", "thy skills did lack;", "See you in Lumbridge when you get back." }, { "Thy death was not in vain,", "For it brought some balance to the world.", "May guthix bring thee rest." }, { "The weak deserve to die,", "so the strong may flourish.", "This is the creed of Zamorak." } };
/**
* The blessing messages.
*/
private static final String[][] BLESSINGS = new String[][] { { "Go in peace in the name of Saradomin;", "may his glory shine upon you like the sun." }, { "Mayest thou walk the path,", "and never fall,", "For Guthix walks beside thee on thy journey.", "May Guthix bring thee peace." }, { "May you reject all safe paths,", "and embrace all challenges.", "Zamorak bring you strength." } };
/**
* The preaching messages.
*/
private static final String[][] PREACH = new String[][] { { "Protect yourself,", "protect your friends.", "Mine is the glory that never ends.", "This is Saradomin's wisdom." }, { "Thee trees,", "the earth,", "the sky,", "the waters:", "All play their part upon this land.", "May Guthix bring thee balance." }, { "Battles are not lost and won;", "They simply remove the weak from the equation.", "Zamorak give me strength!" } };
private static final Animation[] ANIMATIONS = new Animation[] { new Animation(1335), new Animation(1337), new Animation(1336) };
/**
* The god book.
*/
private GodBook book;
/**
* Constructs a new {@code GodBookDialogue} {@code Object}
*/
public GodBookDialogue() {
/**
* empty.
*/
}
/**
* Constructs a new {@code GodBookDialogue} {@code Object}
* @param player the player.
*/
public GodBookDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new GodBookDialogue(player);
}
@Override
public boolean open(Object... args) {
book = (GodBook) args[0];
options("Wedding Ceremony", "Last Rites", "Blessings", "Preach");
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
String[][] data = null;
switch (buttonId) {
case 1:
data = PARTNERSHIPS;
break;
case 2:
data = LAST_RITES;
break;
case 3:
data = BLESSINGS;
break;
case 4:
data = PREACH;
break;
}
say(data);
end();
break;
}
return true;
}
/**
* Says the messages for the type.
* @param data the data.
*/
private void say(String[][] data) {
if (player.inCombat()) {
player.sendMessage("You can't do that while in combat.");
return;
}
final String[] messages = data[book.ordinal()];
final Animation animation = ANIMATIONS[book.ordinal()];
player.animate(animation);
player.lock();
GameWorld.getPulser().submit(new Pulse(2, player) {
int index = 0;
@Override
public boolean pulse() {
player.animate(animation);
player.sendChat(messages[index]);
return index++ >= messages.length - 1;
}
@Override
public void stop() {
super.stop();
player.unlock();
}
});
}
@Override
public int[] getIds() {
return new int[] { DialogueInterpreter.getDialogueKey("god-book") };
}
}
/**
* The page handler.
* @author Vexia
*/
public class PageHandler extends UseWithHandler {
/**
* Constructs a new {@code PageHandler} {@code Object}
*/
public PageHandler() {
super(3839, 3841, 3843);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (GodBook book : GodBook.values()) {
for (Item i : book.getPages()) {
addHandler(i.getId(), ITEM_TYPE, this);
}
}
return this;
}
@Override
public boolean handle(NodeUsageEvent event) {
GodBook book = GodBook.forItem(event.getUsedItem(), true);
Player player = event.getPlayer();
if (book != null && book.isPage(event.getUsedWith().asItem())) {
book.insertPage(player, event.getUsedItem(), event.getUsedWith().asItem());
return true;
}
return false;
}
}
/**
* Gets the number name.
* @param i the integer to check.
* @return the number name.
*/
private String getNumberName(int i) {
return i == 1 ? "first" : i == 2 ? "second" : i == 3 ? "third" : "fourth";
}
}
package core.game.interaction.item;
import core.game.content.dialogue.DialogueAction;
import core.game.content.dialogue.DialogueInterpreter;
import core.game.content.dialogue.DialoguePlugin;
import core.game.content.global.GodBook;
import core.game.node.entity.skill.Skills;
import core.game.interaction.NodeUsageEvent;
import core.game.interaction.OptionHandler;
import core.game.interaction.UseWithHandler;
import core.game.node.Node;
import core.game.node.entity.player.Player;
import core.game.node.item.GroundItem;
import core.game.node.item.Item;
import core.game.node.item.ItemPlugin;
import core.game.system.task.Pulse;
import rs09.game.world.GameWorld;
import core.game.world.update.flag.context.Animation;
import core.plugin.Plugin;
import core.plugin.Initializable;
import rs09.plugin.PluginManager;
/**
* Handles the god books.
* @author Vexia
*/
@Initializable
public class GodBookPlugin extends OptionHandler {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (GodBook book : GodBook.values()) {
book.getDamagedBook().getDefinition().getHandlers().put("option:check", this);
book.getBook().getDefinition().getHandlers().put("option:preach", this);
}
PluginManager.definePlugins(new PageHandler(), new GodBookDialogue(), new GodBookItem(), new SymbolBlessHandler());
return this;
}
@Override
public boolean handle(Player player, Node node, String option) {
GodBook book = GodBook.forItem(node.asItem(), option.equalsIgnoreCase("check"));
if (book != null) {
switch (option) {
case "check":
String[] messages = new String[4];
for (int i = 0; i < messages.length; i++) {
messages[i] = book.hasPage(player, node.asItem(), i + 1) ? "The " + getNumberName(i + 1) + " page is in the book." : "The " + getNumberName(i + 1) + " page is missing.";
}
player.getDialogueInterpreter().sendDialogue(messages);
return true;
case "preach":
player.getDialogueInterpreter().open("god-book", book);
return true;
}
}
return true;
}
/**
* Handles the blessing of a symbol with a god book.
* @author Vexia
*/
public class SymbolBlessHandler extends UseWithHandler {
/**
* Constructs a new {@code SymbolBlessHandler} {@code Object}
*/
public SymbolBlessHandler() {
super(1716);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (GodBook book : GodBook.values()) {
addHandler(book.getBook().getId(), ITEM_TYPE, this);
}
return this;
}
@Override
public boolean handle(NodeUsageEvent event) {
Player player = event.getPlayer();
GodBook book = GodBook.forItem(event.getUsedItem(), false);
if (book == null) {
return false;
}
final Item symbol = event.getUsedWith().asItem();
if (player.getSkills().getLevel(Skills.PRAYER) < 50) {
player.sendMessage("You need a Prayer level of at least 50 in order to do this.");
return true;
}
if (player.getSkills().getPrayerPoints() < 4) {
player.sendMessage("You need at least 4 prayer points in order to do this.");
return true;
}
if (book == GodBook.BOOK_OF_BALANCE) {
player.getDialogueInterpreter().sendOptions("Select an Option", "Unholy symbol", "Holy symbol");
player.getDialogueInterpreter().addAction(new DialogueAction() {
@Override
public void handle(Player player, int buttonId) {
bless(player, symbol, buttonId == 1 ? GodBook.UNHOLY_BOOK : GodBook.HOLY_BOOK);
}
});
return true;
}
bless(player, symbol, book);
return true;
}
/**
* Blesses a symbol.
* @param player the player.
* @param book the book.
*/
private void bless(Player player, Item symbol, GodBook book) {
if (!player.getInventory().containsItem(symbol)) {
return;
}
if (player.getInventory().get(symbol.getSlot()) == null) {
return;
}
player.getInventory().replace(book.getBlessItem()[0], symbol.getSlot());
player.getSkills().decrementPrayerPoints(4);
}
}
/**
* A god book item.
* @author Vexia
*/
public class GodBookItem extends ItemPlugin {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (GodBook book : GodBook.values()) {
register(book.getDamagedBook().getId());
}
return this;
}
@Override
public boolean canPickUp(Player player, GroundItem item, int type) {
if (player.hasItem(item.asItem())) {
player.sendMessage("You do not need more than one incomplete book.");
return false;
}
return true;
}
}
/**
* Handles the god book dialogue.
* @author Vexia
*/
public static class GodBookDialogue extends DialoguePlugin {
/**
* The partnership messages.
*/
private static final String[][] PARTNERSHIPS = new String[][] { { "In the name of Saradomin,", "protector of us all,", " I now join you in the eyes of Saradomin." }, { "Light and dark,", "day and night,", "Balance arises from contrast.", "I unify thee in the name of Guthix." }, { "May your union not be harmonious,", "but may your conflicts make you stronger,", "in Zamorak's name,", "now two are one." } };
/**
* The last rite messages.
*/
private static final String[][] LAST_RITES = new String[][] { { "Thy cause was false,", "thy skills did lack;", "See you in Lumbridge when you get back." }, { "Thy death was not in vain,", "For it brought some balance to the world.", "May Guthix bring thee rest." }, { "The weak deserve to die,", "so the strong may flourish.", "This is the creed of Zamorak." } };
/**
* The blessing messages.
*/
private static final String[][] BLESSINGS = new String[][] { { "Go in peace in the name of Saradomin;", "may his glory shine upon you like the sun." }, { "Mayest thou walk the path,", "and never fall,", "For Guthix walks beside thee on thy journey.", "May Guthix bring thee peace." }, { "May you reject all safe paths,", "and embrace all challenges.", "Zamorak bring you strength." } };
/**
* The preaching messages.
*/
private static final String[][] PREACH = new String[][] { { "Protect yourself,", "protect your friends.", "Mine is the glory that never ends.", "This is Saradomin's wisdom." }, { "Thee trees,", "the earth,", "the sky,", "the waters:", "All play their part upon this land.", "May Guthix bring thee balance." }, { "Battles are not lost and won;", "They simply remove the weak from the equation.", "Zamorak give me strength!" } };
private static final Animation[] ANIMATIONS = new Animation[] { new Animation(1335), new Animation(1337), new Animation(1336) };
/**
* The god book.
*/
private GodBook book;
/**
* Constructs a new {@code GodBookDialogue} {@code Object}
*/
public GodBookDialogue() {
/**
* empty.
*/
}
/**
* Constructs a new {@code GodBookDialogue} {@code Object}
* @param player the player.
*/
public GodBookDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new GodBookDialogue(player);
}
@Override
public boolean open(Object... args) {
book = (GodBook) args[0];
options("Wedding Ceremony", "Last Rites", "Blessings", "Preach");
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
String[][] data = null;
switch (buttonId) {
case 1:
data = PARTNERSHIPS;
break;
case 2:
data = LAST_RITES;
break;
case 3:
data = BLESSINGS;
break;
case 4:
data = PREACH;
break;
}
say(data);
end();
break;
}
return true;
}
/**
* Says the messages for the type.
* @param data the data.
*/
private void say(String[][] data) {
if (player.inCombat()) {
player.sendMessage("You can't do that while in combat.");
return;
}
final String[] messages = data[book.ordinal()];
final Animation animation = ANIMATIONS[book.ordinal()];
player.animate(animation);
player.lock();
GameWorld.getPulser().submit(new Pulse(2, player) {
int index = 0;
@Override
public boolean pulse() {
player.animate(animation);
player.sendChat(messages[index]);
return index++ >= messages.length - 1;
}
@Override
public void stop() {
super.stop();
player.unlock();
}
});
}
@Override
public int[] getIds() {
return new int[] { DialogueInterpreter.getDialogueKey("god-book") };
}
}
/**
* The page handler.
* @author Vexia
*/
public class PageHandler extends UseWithHandler {
/**
* Constructs a new {@code PageHandler} {@code Object}
*/
public PageHandler() {
super(3839, 3841, 3843);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (GodBook book : GodBook.values()) {
for (Item i : book.getPages()) {
addHandler(i.getId(), ITEM_TYPE, this);
}
}
return this;
}
@Override
public boolean handle(NodeUsageEvent event) {
GodBook book = GodBook.forItem(event.getUsedItem(), true);
Player player = event.getPlayer();
if (book != null && book.isPage(event.getUsedWith().asItem())) {
book.insertPage(player, event.getUsedItem(), event.getUsedWith().asItem());
return true;
}
return false;
}
}
/**
* Gets the number name.
* @param i the integer to check.
* @return the number name.
*/
private String getNumberName(int i) {
return i == 1 ? "first" : i == 2 ? "second" : i == 3 ? "third" : "fourth";
}
}

View file

@ -35,7 +35,8 @@ public enum FinishedPotion {
STRONG_WEAPON_POISON(UnfinishedPotion.STRONG_WEAPON_POISON, new Item(223), 73, 165, new Item(5937)),
SUPER_STRONG_WEAPON_POISON(UnfinishedPotion.SUPER_STRONG_WEAPON_POISON, new Item(6018), 82, 190, new Item(5940)),
STRONG_ANTIPOISON(UnfinishedPotion.STRONG_ANTIPOISON, new Item(6049), 68, 155, new Item(5945)),
SUPER_STRONG_ANTIPOISON(UnfinishedPotion.SUPER_STRONG_ANTIPOISON, new Item(6051), 79, 177.5, new Item(5954));
SUPER_STRONG_ANTIPOISON(UnfinishedPotion.SUPER_STRONG_ANTIPOISON, new Item(6051), 79, 177.5, new Item(5954)),
BLAMISH_OIL(UnfinishedPotion.HARRALANDER, new Item(1581), 25, 80, new Item(1582));
/**
* Represents the unfinished potion.