mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-19 13:00:19 -07:00
More bank reworks
Updated dialogues for non-standard banker NPCs Sirsal Bankers now have their own dialogue plugin that prepares us for possible Lunar Diplomacy quest implementation Thrown out the legacy Java dialogue plugin for standard banker NPCs Added a dialogue for the Bounty Hunter roving banker Fixed broken bank option on some bankers Fixed Eniola not charging players 20 runes of one type for each banking session Limited secondary bank capabilities to stationary bankers, i.e. those who have either a desk, a table or a booth available nearby Added ContentAPI calls related to bank interfaces and Ironman mode checks & restrictions Streamlined dialogue creation by limiting the amount of boilerplate required Changed the plugin loading logic so that it informs the dev why a dialogue plugin might've failed to load in addition to not preventing other plugins being loaded when one fails to do so
This commit is contained in:
parent
17fde7f9e1
commit
c7c97ea176
32 changed files with 1727 additions and 704 deletions
|
|
@ -10,7 +10,9 @@ import core.plugin.PluginType;
|
|||
import rs09.game.content.dialogue.DialogueFile;
|
||||
import rs09.game.content.dialogue.IfTopic;
|
||||
import rs09.game.content.dialogue.Topic;
|
||||
import rs09.game.system.SystemLogger;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static api.DialUtilsKt.splitLines;
|
||||
|
|
@ -169,14 +171,44 @@ public abstract class DialoguePlugin implements Plugin<Player> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public abstract DialoguePlugin newInstance(Player player);
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
try {
|
||||
Class<?> classReference = Class.forName(this.getClass().getCanonicalName());
|
||||
|
||||
return (DialoguePlugin)classReference
|
||||
.getDeclaredConstructor(Player.class)
|
||||
.newInstance(player);
|
||||
} catch (ClassNotFoundException
|
||||
| IllegalAccessException
|
||||
| IllegalArgumentException
|
||||
| NoSuchMethodException
|
||||
| InvocationTargetException
|
||||
| InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the dialogue.
|
||||
* @param args The arguments.
|
||||
* @return {@code True} if the dialogue plugin succesfully opened.
|
||||
*/
|
||||
public abstract boolean open(Object... args);
|
||||
public boolean open(Object... args) {
|
||||
if (args.length > 0 && args[0] instanceof NPC) {
|
||||
npc = (NPC)args[0];
|
||||
}
|
||||
|
||||
if (npc == null) {
|
||||
SystemLogger.logWarn(
|
||||
args[0].getClass().getSimpleName() +
|
||||
"Is not assigning an NPC. Whoever did that should fix it."
|
||||
);
|
||||
}
|
||||
|
||||
player.getDialogueInterpreter().handle(0, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the progress of this dialogue..
|
||||
|
|
|
|||
|
|
@ -1,78 +0,0 @@
|
|||
package core.game.content.dialogue;
|
||||
|
||||
import core.game.node.entity.npc.NPC;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
/**
|
||||
* Represents the emerald benedict dialogue.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class EmeraldBenedictDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code EmeraldBenedictDialogue} {@code Object}.
|
||||
*/
|
||||
public EmeraldBenedictDialogue() {
|
||||
/**
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code EmeraldBenedictDialogue} {@code Object}.
|
||||
* @param player the player.
|
||||
*/
|
||||
public EmeraldBenedictDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new EmeraldBenedictDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
npc = (NPC) args[0];
|
||||
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Got anything you don't want to lose?");
|
||||
stage = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
switch (stage) {
|
||||
case 0:
|
||||
interpreter.sendOptions("Select an Option", "Yes actually, can you help?", "Yes, but can you show me my PIN settings?", "Yes thanks, and I'll keep hold of it too.");
|
||||
stage = 1;
|
||||
break;
|
||||
case 1:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
end();
|
||||
player.getBank().open();
|
||||
break;
|
||||
case 2:
|
||||
end();
|
||||
break;
|
||||
case 3:
|
||||
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Yes thanks, and I'll keep hold of it too.");
|
||||
stage = 99;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 99:
|
||||
end();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { 2271 };
|
||||
}
|
||||
}
|
||||
|
|
@ -1,297 +0,0 @@
|
|||
package core.game.interaction.object;
|
||||
|
||||
import core.game.content.dialogue.DialoguePlugin;
|
||||
import core.game.content.dialogue.FacialExpression;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.npc.NPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.IronmanMode;
|
||||
import core.game.node.entity.player.link.appearance.Gender;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import rs09.game.ge.GrandExchangeOffer;
|
||||
import rs09.game.ge.GrandExchangeRecords;
|
||||
import rs09.game.world.GameWorld;
|
||||
|
||||
/**
|
||||
* Represents the plugin used for anything related to banking.
|
||||
*
|
||||
* @author Vexia
|
||||
* @author Emperor
|
||||
*/
|
||||
@Initializable
|
||||
public final class BankingPlugin extends OptionHandler {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
new BankerDialogue().init();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
player.sendChat(":crab: :crab: :crab: RETARDED PLUGIN IS GONE :crab: :crab: :crab:");
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the dialogue plugin used for all bankers.
|
||||
*
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
public static final class BankerDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* Represents the banker npc ids.
|
||||
*/
|
||||
private static final int[] NPC_IDS = {44, 45, 166, 494, 495, 496, 497, 498, 499, 902, 1036, 1360, 1702, 2163, 2164, 2354, 2355, 2568, 2569, 2570, 2619, 3046, 3198, 3199, 4296, 5257, 5258, 5259, 5260, 5383, 5488, 5776, 5777, 5898, 5912, 5913, 6200, 6362, 6532, 6533, 6534, 6535, 6538, 7049, 7050, 7445, 7446, 7605};
|
||||
|
||||
/**
|
||||
* Represents the id to use.
|
||||
*/
|
||||
private int id;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code BankerDialogue} {@code Object}.
|
||||
*/
|
||||
public BankerDialogue() {
|
||||
/**
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code BankerDialoguePlugin} {@code Object}.
|
||||
*
|
||||
* @param player the player.
|
||||
*/
|
||||
public BankerDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new BankerDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
if (args[0] instanceof NPC) {
|
||||
setId(((NPC) args[0]).getId());
|
||||
} else {
|
||||
setId((int) args[0]);
|
||||
}
|
||||
interpreter.sendDialogues(id, FacialExpression.HALF_GUILTY, "Good day, How may I help you?");
|
||||
GrandExchangeRecords records = GrandExchangeRecords.getInstance(player);
|
||||
for (GrandExchangeRecords.OfferRecord r : records.getOfferRecords()) {
|
||||
GrandExchangeOffer o = records.getOffer(r);
|
||||
if (o != null && (o.getWithdraw()[0] != null || o.getWithdraw()[1] != null)) {
|
||||
stage = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
switch (stage) {
|
||||
case -1:
|
||||
interpreter.sendDialogues(id, FacialExpression.HALF_GUILTY, "Before we go any further, I should inform you that you", "have items ready for collection from the Grand Exchange.");
|
||||
stage = 0;
|
||||
break;
|
||||
case 0:
|
||||
if(player.getAttribute("UnlockedSecondaryBank",false)){
|
||||
interpreter.sendOptions("What would you like to say?", "I'd like to access my bank account, please.", "I'd like to check my PIN settings.", "I'd like to see my collection box.", "I'd like to switch to my " + (player.useSecondaryBank ? "primary": "secondary") + " bank account.", "What is this place?");
|
||||
stage = 10;
|
||||
}
|
||||
else if(!player.getAttribute("UnlockedSecondaryBank",false)){
|
||||
interpreter.sendOptions("What would you like to say?", "I'd like to access my bank account, please.", "I'd like to check my PIN settings.", "I'd like to see my collection box.", "Can I open a second bank account?", "What is this place?");
|
||||
stage = 20;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
interpreter.sendDialogues(id, FacialExpression.HALF_GUILTY, "This is a branch of the Bank of " + GameWorld.getSettings().getName() + ". We have", "branches in many towns.");
|
||||
stage = 2;
|
||||
break;
|
||||
case 2:
|
||||
interpreter.sendOptions("What would you like to say?", "And what do you do?", "Didn't you used to be called the Bank of Varrock?");
|
||||
stage = 3;
|
||||
break;
|
||||
case 3:
|
||||
if (buttonId == 1) {
|
||||
player("And what do you do?");
|
||||
stage = 4;
|
||||
} else if (buttonId == 2) {
|
||||
player("Didn't you used to be called the Bank of Varrock?");
|
||||
stage = 5;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
interpreter.sendDialogues(id, FacialExpression.HALF_GUILTY, "We will look after your items and money for you.", "Leave your valuables with us if you want to keep them", "safe.");
|
||||
stage = 100;
|
||||
break;
|
||||
case 5:
|
||||
interpreter.sendDialogues(id, FacialExpression.HALF_GUILTY, "Yes we did, but people kept on coming into our", "signs were wrong. They acted as if we didn't know", "what town we were in or something.");
|
||||
stage = 100;
|
||||
break;
|
||||
case 6:
|
||||
player.useSecondaryBank = !player.useSecondaryBank;
|
||||
interpreter.sendDialogues(id, FacialExpression.HALF_GUILTY, "I've switched you over to your " + (player.useSecondaryBank ? "secondary" : "primary") + " bank account");
|
||||
stage = 100;
|
||||
break;
|
||||
case 7:
|
||||
interpreter.sendDialogues(id, FacialExpression.WORRIED, "A second account??? What is four hundred and ninety","six slots not enough for you??? What are","you even hoarding?");
|
||||
stage = 8;
|
||||
break;
|
||||
case 8:
|
||||
player(FacialExpression.ANNOYED,"Listen, an entrepreneur like me needs","a lot of space for my business ventures");
|
||||
stage = 9;
|
||||
break;
|
||||
case 9:
|
||||
interpreter.sendDialogues(id, FacialExpression.ANNOYED,"Oh an entrepreneur eh? Well I guess a rich","entrepreneur like you can afford the fee","for opening a second bank account");
|
||||
stage = 11;
|
||||
break;
|
||||
case 11:
|
||||
player(FacialExpression.LAUGH,"Well of course I can, a " + (player.isMale() ? "man" : "woman") + " of my","status could afford a measly bank fee");
|
||||
stage = 12;
|
||||
break;
|
||||
case 12:
|
||||
interpreter.sendDialogues(id,FacialExpression.FRIENDLY,"Okay then, that'll be a one time","fee of five million gold coins, we just need","your payment and for you to sign here");
|
||||
stage = 13;
|
||||
break;
|
||||
case 13:
|
||||
player(FacialExpression.ANGRY,"FIVE MILLION!?!");
|
||||
stage = 14;
|
||||
break;
|
||||
case 14:
|
||||
npcl(FacialExpression.FRIENDLY, "Yes, Five million. These banks are very expensive to upkeep and maintain, but that is the final price. Can't someone with your stature and wealth afford such a trivial fee?");
|
||||
stage = 15;
|
||||
break;
|
||||
case 15:
|
||||
interpreter.sendOptions("Put your money where your mouth is?","Yes","No");
|
||||
stage = 16;
|
||||
break;
|
||||
case 16:
|
||||
if(buttonId == 1 && player.getInventory().contains(995,5000000)){
|
||||
player(FacialExpression.ANGRY_WITH_SMILE,"Haha yes, just a trivial fee haha.","just a drop in the bucket...");
|
||||
stage = 21;
|
||||
}
|
||||
if(buttonId == 2 || !player.getInventory().contains(995,5000000)){
|
||||
player(FacialExpression.AFRAID,"Well of course I can, let me just get it out of... my bank","uhhhhhh... haha...");
|
||||
stage = 17;
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
interpreter.sendDialogues(id,FacialExpression.HALF_ROLLING_EYES,"You know I can see your bank, right?");
|
||||
stage = 18;
|
||||
break;
|
||||
case 18:
|
||||
player("Yeah... I'll uhh, I'll be back later");
|
||||
stage = 100;
|
||||
break;
|
||||
case 21:
|
||||
interpreter.sendDialogues(id,FacialExpression.AMAZED,"Wow I've never even SEEN thi- I mean *ahem*","give me one minute while I process this.");
|
||||
stage = 22;
|
||||
break;
|
||||
case 22:
|
||||
if(player.getInventory().remove(new Item(995,5000000))) {
|
||||
player.getGameAttributes().setAttribute("/save:UnlockedSecondaryBank",true);
|
||||
interpreter.sendDialogues(id,FacialExpression.FRIENDLY,"You're all set! Whenever you want to switch to","your second bank account just ask","a teller and we'll swap it over for","you");
|
||||
stage = 100;
|
||||
} else {
|
||||
end();
|
||||
}
|
||||
break;
|
||||
case 100:
|
||||
end();
|
||||
break;
|
||||
case 999:
|
||||
options("Yes.", "No.");
|
||||
stage = 1000;
|
||||
break;
|
||||
case 1000:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
end();
|
||||
break;
|
||||
case 2:
|
||||
end();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
switch (interfaceId) {
|
||||
case 234:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
player.getBankPinManager().openType(buttonId);
|
||||
end();
|
||||
break;
|
||||
case 4:
|
||||
player("I'd like to switch to my " + (player.useSecondaryBank ? "primary": "secondary") + " bank account");
|
||||
stage = 6;
|
||||
break;
|
||||
case 5:
|
||||
player("What is this place?");
|
||||
stage = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 20:
|
||||
switch (interfaceId) {
|
||||
case 234:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
player.getBankPinManager().openType(buttonId);
|
||||
end();
|
||||
break;
|
||||
case 4:
|
||||
player("Can I open a second bank account?");
|
||||
stage = 7;
|
||||
break;
|
||||
case 5:
|
||||
player("What is this place?");
|
||||
stage = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return NPC_IDS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the id.
|
||||
*
|
||||
* @return The id.
|
||||
*/
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the id.
|
||||
*
|
||||
* @param id The id to set.
|
||||
*/
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +1,8 @@
|
|||
package core.game.interaction.`object`
|
||||
|
||||
import api.getUsedOption
|
||||
import core.game.world.map.RegionManager.getObject
|
||||
import core.plugin.Initializable
|
||||
import core.game.interaction.OptionHandler
|
||||
import core.plugin.Plugin
|
||||
import core.cache.def.impl.SceneryDefinition
|
||||
import api.openBankAccount
|
||||
import core.game.content.global.shop.CulinomancerShop
|
||||
import core.game.node.scenery.SceneryBuilder
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.Node
|
||||
import core.game.world.map.Location
|
||||
import org.rs09.consts.Scenery
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
|
|
@ -19,16 +11,18 @@ import rs09.game.interaction.InteractionListener
|
|||
* @author Ceikry
|
||||
*/
|
||||
class CulinoChestListener : InteractionListener {
|
||||
val CULINO_CHEST = Scenery.CHEST_12309
|
||||
companion object {
|
||||
private const val CULINO_CHEST = Scenery.CHEST_12309
|
||||
}
|
||||
|
||||
override fun defineListeners() {
|
||||
on(CULINO_CHEST, SCENERY, "buy-items","buy-food"){player, _ ->
|
||||
CulinomancerShop.openShop(player, food = getUsedOption(player).toLowerCase() == "buy-food")
|
||||
on(CULINO_CHEST, SCENERY, "buy-items", "buy-food"){player, _ ->
|
||||
CulinomancerShop.openShop(player, food = getUsedOption(player).lowercase() == "buy-food")
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(CULINO_CHEST, SCENERY, "bank"){player, _ ->
|
||||
player.bank.open()
|
||||
openBankAccount(player)
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import rs09.game.system.SystemLogger;
|
|||
import rs09.net.packet.PacketWriteQueue;
|
||||
import rs09.net.packet.in.ItemOnGroundItemPacket;
|
||||
import rs09.net.packet.in.QuickChatPacketHandler;
|
||||
import rs09.net.packet.in.RunScriptPacketHandler;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import core.game.node.entity.impl.Projectile
|
|||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.HintIconManager
|
||||
import core.game.node.entity.player.link.IronmanMode
|
||||
import core.game.node.entity.player.link.TeleportManager
|
||||
import core.game.node.entity.player.link.audio.Audio
|
||||
import core.game.node.entity.player.link.emote.Emotes
|
||||
|
|
@ -48,7 +49,10 @@ import org.rs09.consts.NPCs
|
|||
import rs09.game.content.dialogue.DialogueFile
|
||||
import rs09.game.content.dialogue.SkillDialogueHandler
|
||||
import rs09.game.content.global.GlobalKillCounter
|
||||
import rs09.game.content.global.shops.Shops
|
||||
import rs09.game.ge.GrandExchangeRecords
|
||||
import rs09.game.interaction.InteractionListeners
|
||||
import rs09.game.interaction.inter.ge.StockMarket
|
||||
import rs09.game.node.entity.skill.slayer.SlayerManager
|
||||
import rs09.game.system.SystemLogger
|
||||
import rs09.game.system.config.ItemConfigParser
|
||||
|
|
@ -469,7 +473,7 @@ fun itemDefinition(id: Int): ItemDefinition {
|
|||
* @author vddCore
|
||||
*/
|
||||
fun hasOption(node: Node, option: String): Boolean {
|
||||
return when(node) {
|
||||
return when (node) {
|
||||
is NPC -> node.definition.hasAction(option)
|
||||
is Scenery -> node.definition.hasAction(option)
|
||||
is Item -> node.definition.hasAction(option)
|
||||
|
|
@ -1570,7 +1574,7 @@ fun dumpBeastOfBurden(player: Player) {
|
|||
*
|
||||
* @author bushtail
|
||||
*/
|
||||
fun getFamiliarBoost(player : Player, skill : Int) : Int {
|
||||
fun getFamiliarBoost(player: Player, skill: Int): Int {
|
||||
return player.familiarManager.getBoost(skill)
|
||||
}
|
||||
|
||||
|
|
@ -1662,7 +1666,7 @@ fun getPathableRandomLocalCoordinate(target: Entity, radius: Int, center: Locati
|
|||
* @param player the player whose task we are checking.
|
||||
* @return the slayer task.
|
||||
*/
|
||||
fun getSlayerTask(player : Player) : Tasks? {
|
||||
fun getSlayerTask(player: Player): Tasks? {
|
||||
return SlayerManager.getInstance(player).task
|
||||
}
|
||||
|
||||
|
|
@ -1672,7 +1676,7 @@ fun getSlayerTask(player : Player) : Tasks? {
|
|||
* @param player the player whose task we are checking.
|
||||
* @return the name of the slayer task.
|
||||
*/
|
||||
fun getSlayerTaskName(player : Player) : String {
|
||||
fun getSlayerTaskName(player: Player): String {
|
||||
return SlayerManager.getInstance(player).taskName
|
||||
}
|
||||
|
||||
|
|
@ -1682,7 +1686,7 @@ fun getSlayerTaskName(player : Player) : String {
|
|||
* @param player the player whose task we are checking.
|
||||
* @return the remaining kills of the slayer task.
|
||||
*/
|
||||
fun getSlayerTaskKillsRemaining(player : Player) : Int {
|
||||
fun getSlayerTaskKillsRemaining(player: Player): Int {
|
||||
return SlayerManager.getInstance(player).amount
|
||||
}
|
||||
|
||||
|
|
@ -1692,7 +1696,7 @@ fun getSlayerTaskKillsRemaining(player : Player) : Int {
|
|||
* @param player the player whose master we are checking.
|
||||
* @return the slayer master as NPC.
|
||||
*/
|
||||
fun getSlayerMaster(player : Player) : NPC {
|
||||
fun getSlayerMaster(player: Player): NPC {
|
||||
return findNPC(SlayerManager.getInstance(player).master?.npc as Int) as NPC
|
||||
}
|
||||
|
||||
|
|
@ -1702,12 +1706,12 @@ fun getSlayerMaster(player : Player) : NPC {
|
|||
* @param player the player whose master we are checking.
|
||||
* @return the slayer master location as String.
|
||||
*/
|
||||
fun getSlayerMasterLocation(player : Player) : String {
|
||||
return when(getSlayerMaster(player).id) {
|
||||
fun getSlayerMasterLocation(player: Player): String {
|
||||
return when (getSlayerMaster(player).id) {
|
||||
NPCs.CHAELDAR_1598 -> "Zanaris"
|
||||
NPCs.DURADEL_8275 -> "Shilo Village"
|
||||
NPCs.MAZCHNA_8274 -> "Canifis"
|
||||
NPCs.TURAEL_8273 -> "Taverly"
|
||||
NPCs.TURAEL_8273 -> "Taverley"
|
||||
NPCs.VANNAKA_1597 -> "Edgeville Dungeon"
|
||||
else -> "The Backrooms"
|
||||
}
|
||||
|
|
@ -1719,8 +1723,8 @@ fun getSlayerMasterLocation(player : Player) : String {
|
|||
* @param player the player whose task tip we are checking.
|
||||
* @return the task tip as String.
|
||||
*/
|
||||
fun getSlayerTip(player : Player) : Array<out String> {
|
||||
return if(hasSlayerTask(player)) {
|
||||
fun getSlayerTip(player: Player): Array<out String> {
|
||||
return if (hasSlayerTask(player)) {
|
||||
SlayerManager.getInstance(player).task?.tip!!
|
||||
} else {
|
||||
arrayOf("You need something new to hunt.")
|
||||
|
|
@ -1733,7 +1737,7 @@ fun getSlayerTip(player : Player) : Array<out String> {
|
|||
* @param player the player whose task flags we are checking.
|
||||
* @return the task flags as Int.
|
||||
*/
|
||||
fun getSlayerTaskFlags(player : Player) : Int {
|
||||
fun getSlayerTaskFlags(player: Player): Int {
|
||||
return SlayerManager.getInstance(player).flags.taskFlags
|
||||
}
|
||||
|
||||
|
|
@ -1743,10 +1747,247 @@ fun getSlayerTaskFlags(player : Player) : Int {
|
|||
* @param player the player whose task we are checking.
|
||||
* @return has task as Boolean.
|
||||
*/
|
||||
fun hasSlayerTask(player : Player) : Boolean {
|
||||
fun hasSlayerTask(player: Player): Boolean {
|
||||
return SlayerManager.getInstance(player).hasTask()
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a player plays in a specific Ironman mode.
|
||||
*
|
||||
* @param player Player whose Ironman status to check.
|
||||
* @param restriction The Ironman restriction level to check the player against.
|
||||
* @return Whether the player is restricted to the provided Ironman mode.
|
||||
*/
|
||||
fun hasIronmanRestriction(player: Player, restriction: IronmanMode): Boolean {
|
||||
return player.ironmanManager.isIronman
|
||||
&& player.ironmanManager.mode.ordinal >= restriction.ordinal
|
||||
}
|
||||
|
||||
/**
|
||||
* Conditionally executes an action based on the player's Ironman status.
|
||||
*
|
||||
* @param player Player whose action to restrict.
|
||||
* @param restriction Ironman mode that will be used as the restriction criterion.
|
||||
* @param action The action to be restricted.
|
||||
*/
|
||||
fun restrictForIronman(player: Player, restriction: IronmanMode, action: () -> Unit) {
|
||||
if (!player.ironmanManager.checkRestriction(restriction)) {
|
||||
action()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the given player's Grand Exchange interface.
|
||||
*
|
||||
* @author vddCore
|
||||
* @param player The player whose Grand Exchange interface to open.
|
||||
*/
|
||||
fun openGrandExchange(player: Player) {
|
||||
restrictForIronman(player, IronmanMode.ULTIMATE) {
|
||||
StockMarket.openFor(player)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player has any items to collect from the Grand Exchange
|
||||
*
|
||||
* @author vddCore
|
||||
* @param player The player whose Grand Exchange collection box to inspect.
|
||||
*/
|
||||
fun hasAwaitingGrandExchangeCollections(player: Player): Boolean {
|
||||
val records = GrandExchangeRecords.getInstance(player)
|
||||
|
||||
for (record in records.offerRecords) {
|
||||
val offer = records.getOffer(record)
|
||||
|
||||
return offer != null
|
||||
&& offer.withdraw[0] != null
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the given player's Grand Exchange collection box.
|
||||
*
|
||||
* It will send a prohibition message to Ultimate Ironmen.
|
||||
*
|
||||
* @author vddCore
|
||||
* @param player The player whose collection box to open.
|
||||
*/
|
||||
fun openGrandExchangeCollectionBox(player: Player) {
|
||||
restrictForIronman(player, IronmanMode.ULTIMATE) {
|
||||
GrandExchangeRecords.getInstance(player).openCollectionBox()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the given player's bank account. If the player has a PIN set,
|
||||
* the PIN interface will be shown first.
|
||||
*
|
||||
* It will send a prohibition message to Ultimate Ironmen.
|
||||
*
|
||||
* @author vddCore
|
||||
* @param player The player whose bank account to open.
|
||||
*/
|
||||
fun openBankAccount(player: Player) {
|
||||
restrictForIronman(player, IronmanMode.ULTIMATE) {
|
||||
player.bank.open()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the given player's bank deposit box interface.
|
||||
*
|
||||
* It will send a prohibition message to Ultimate Ironmen.
|
||||
*
|
||||
* @author vddCore
|
||||
* @param player The player whose bank account to open.
|
||||
*/
|
||||
fun openDepositBox(player: Player) {
|
||||
restrictForIronman(player, IronmanMode.ULTIMATE) {
|
||||
player.bank.openDepositBox()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the given player's bank PIN settings interface.
|
||||
*
|
||||
* It will send a prohibition message to Ultimate Ironmen.
|
||||
*
|
||||
* @author vddCore
|
||||
* @param player The player whose PIN settings to open.
|
||||
*/
|
||||
fun openBankPinSettings(player: Player) {
|
||||
restrictForIronman(player, IronmanMode.ULTIMATE) {
|
||||
player.bankPinManager.openSettings()
|
||||
}
|
||||
}
|
||||
|
||||
enum class SecondaryBankAccountActivationResult {
|
||||
SUCCESS,
|
||||
ALREADY_ACTIVE,
|
||||
NOT_ENOUGH_MONEY,
|
||||
INTERNAL_FAILURE
|
||||
}
|
||||
/**
|
||||
* Activates the secondary bank account and handles all the fees required.
|
||||
*
|
||||
* @author vddCore
|
||||
* @param player The player whose secondary bank account to activate.
|
||||
* @returns Whether the operation was successful or not.
|
||||
*/
|
||||
fun activateSecondaryBankAccount(player: Player): SecondaryBankAccountActivationResult {
|
||||
if (hasIronmanRestriction(player, IronmanMode.ULTIMATE)) {
|
||||
return SecondaryBankAccountActivationResult.INTERNAL_FAILURE
|
||||
}
|
||||
|
||||
if (hasActivatedSecondaryBankAccount(player)) {
|
||||
return SecondaryBankAccountActivationResult.ALREADY_ACTIVE
|
||||
}
|
||||
|
||||
val cost = 5000000
|
||||
val coinsInInventory = amountInInventory(player, Items.COINS_995)
|
||||
val coinsInBank = amountInBank(player, Items.COINS_995)
|
||||
val coinsTotal = coinsInInventory + coinsInBank
|
||||
|
||||
if (cost > coinsTotal) {
|
||||
return SecondaryBankAccountActivationResult.NOT_ENOUGH_MONEY
|
||||
}
|
||||
|
||||
val operationResult = if (cost > coinsInInventory) {
|
||||
val amountToTakeFromBank = cost - coinsInInventory
|
||||
|
||||
removeItem(player, Item(Items.COINS_995, coinsInInventory), Container.INVENTORY)
|
||||
&& removeItem(player, Item(Items.COINS_995, amountToTakeFromBank), Container.BANK)
|
||||
} else {
|
||||
removeItem(player, Item(Items.COINS_995, cost))
|
||||
}
|
||||
|
||||
return if (operationResult) {
|
||||
setAttribute(player, "/save:UnlockedSecondaryBank", true)
|
||||
SecondaryBankAccountActivationResult.SUCCESS
|
||||
} else {
|
||||
sendMessage(player, "$cost;$coinsInInventory;$coinsInBank;$coinsTotal")
|
||||
SecondaryBankAccountActivationResult.INTERNAL_FAILURE
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player has unlocked their secondary bank account.
|
||||
*
|
||||
* @author vddCore
|
||||
* @param player The player whose secondary bank activation status to inspect.
|
||||
* @return Secondary bank activation status.
|
||||
*/
|
||||
fun hasActivatedSecondaryBankAccount(player: Player): Boolean {
|
||||
return getAttribute(player, "UnlockedSecondaryBank", false)
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles between the player's primary and/or secondary bank account.
|
||||
* Has no effect if the secondary bank account hasn't been activated.
|
||||
*
|
||||
* It will send a prohibition message to Ultimate Ironmen.
|
||||
*
|
||||
* @author vddCore
|
||||
* @param player The player whose bank accounts to toggle.
|
||||
*/
|
||||
fun toggleBankAccount(player: Player) {
|
||||
restrictForIronman(player, IronmanMode.ULTIMATE) {
|
||||
if (!hasActivatedSecondaryBankAccount(player)) {
|
||||
return@restrictForIronman
|
||||
}
|
||||
|
||||
player.useSecondaryBank = !player.useSecondaryBank
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a player is currentl using their secondary bank account.
|
||||
*
|
||||
* @author vddCore
|
||||
* @param player The player whose bank account toggle state to inspect.
|
||||
*/
|
||||
fun isUsingSecondaryBankAccount(player: Player): Boolean {
|
||||
return player.useSecondaryBank
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns 'primary' or 'secondary' strings based on which
|
||||
* bank account is activated for the given user.
|
||||
*
|
||||
* @author vddCore
|
||||
* @param player The player whose bank account name to retrieve.
|
||||
* @param invert Whether to invert the return value.
|
||||
* @return Bank account name according to the given criteria.
|
||||
*/
|
||||
fun getBankAccountName(player: Player, invert: Boolean = false): String {
|
||||
return if (isUsingSecondaryBankAccount(player)) {
|
||||
if (invert) "primary" else "secondary"
|
||||
} else {
|
||||
if (invert) "secondary" else "primary"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a shop for the given NPC in the provided player's context.
|
||||
*
|
||||
* @author vddCore
|
||||
* @param player The player serving as the shop context.
|
||||
* @param npc The NPC ID whose shop to open.
|
||||
*/
|
||||
fun openNpcShop(player: Player, npc: Int): Boolean {
|
||||
val shop = Shops.shopsByNpc[npc]
|
||||
|
||||
if (shop != null) {
|
||||
shop.openFor(player)
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Skill Dialogue builder.
|
||||
* @param player the player to send the dialogue for.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,120 @@
|
|||
package rs09.game.content.dialogue.region.bountyhunter
|
||||
|
||||
import api.*
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.IronmanMode
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.content.dialogue.IfTopic
|
||||
import rs09.game.content.dialogue.Topic
|
||||
import rs09.tools.END_DIALOGUE
|
||||
import rs09.tools.START_DIALOGUE
|
||||
|
||||
/**
|
||||
* Provides dialogue tree for Maximillian Sackville,
|
||||
* the Bounty Hounter roving banker.
|
||||
*
|
||||
* @author vddCore
|
||||
*/
|
||||
@Initializable
|
||||
class MaximillianSackvilleDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when (stage) {
|
||||
START_DIALOGUE -> when {
|
||||
hasIronmanRestriction(player, IronmanMode.ULTIMATE) -> {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"My apologies, dear ${if (player.isMale) "sir" else "madam"}, " +
|
||||
"our services are not available for Ultimate ${if (player.isMale) "Ironmen" else "Ironwomen"}."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
else -> {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Good day, how may I help you?"
|
||||
).also {
|
||||
if (hasAwaitingGrandExchangeCollections(player)) {
|
||||
stage++
|
||||
} else {
|
||||
stage += 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Before we go any further, I should inform you that you " +
|
||||
"have items ready for collection from the Grand Exchange."
|
||||
).also { stage++ }
|
||||
|
||||
2 -> playerl(
|
||||
FacialExpression.ASKING,
|
||||
"Who are you?"
|
||||
).also { stage++ }
|
||||
|
||||
3 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"How inconsiderate of me, dear ${if (player.isMale) "sir" else "madam"}. " +
|
||||
"My name is Maximillian Sackville and I conduct operations here on behalf " +
|
||||
"of The Bank of Gielinor."
|
||||
).also { stage++ }
|
||||
|
||||
4 -> showTopics(
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to access my bank account.", 10),
|
||||
IfTopic(
|
||||
FacialExpression.NEUTRAL,
|
||||
"I'd like to switch to my ${getBankAccountName(player, true)} bank account.",
|
||||
11,
|
||||
hasActivatedSecondaryBankAccount(player)
|
||||
),
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to check my PIN settings.", 12),
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to collect items.", 13),
|
||||
Topic(FacialExpression.ASKING, "Aren't you afraid of working in the Wilderness?", 5)
|
||||
)
|
||||
|
||||
5 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"While the Wilderness is quite a dangerous place, The Bank of Gielinor offers " +
|
||||
"us - roving bankers - extraordinary benefits for our hard work in hazardous environments."
|
||||
).also { stage++ }
|
||||
|
||||
6 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"This allows us to provide our services to customers regardless of their current " +
|
||||
"whereabouts. Our desire to serve is stronger than our fear of the Wilderness."
|
||||
).also { stage = END_DIALOGUE }
|
||||
|
||||
10 -> {
|
||||
openBankAccount(player)
|
||||
end()
|
||||
}
|
||||
|
||||
11 -> {
|
||||
toggleBankAccount(player)
|
||||
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Naturally. You can now access your ${getBankAccountName(player)} bank account."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
12 -> {
|
||||
openBankPinSettings(player)
|
||||
end()
|
||||
}
|
||||
|
||||
13 -> {
|
||||
openGrandExchangeCollectionBox(player)
|
||||
end()
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun getIds() = intArrayOf(NPCs.BANKER_6538)
|
||||
}
|
||||
|
|
@ -1,63 +1,208 @@
|
|||
package rs09.game.content.dialogue.region.lunarisle
|
||||
|
||||
import api.hasSealOfPassage
|
||||
import api.*
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.IronmanMode
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.ge.GrandExchangeRecords
|
||||
import rs09.game.content.dialogue.IfTopic
|
||||
import rs09.game.content.dialogue.Topic
|
||||
import rs09.tools.END_DIALOGUE
|
||||
import rs09.tools.START_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author qmqz
|
||||
* Handles Sirsal banker dialogue tree.
|
||||
*
|
||||
* @author vddCore
|
||||
*/
|
||||
@Initializable
|
||||
class SirsalBankerDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
|
||||
if (hasSealOfPassage(player)) {
|
||||
npc(FacialExpression.FRIENDLY, "Good day, how may I help you?").also { stage = 0 }
|
||||
} else {
|
||||
player(FacialExpression.FRIENDLY, "Hi, I...").also { stage = 2 }
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
class SirsalBankerDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when(stage){
|
||||
0 -> options("I'd like to access my bank account, please.",
|
||||
"I'd like to check my PIN settings.",
|
||||
"I'd like to collect items.",
|
||||
"What is this place?").also { stage++ }
|
||||
when (stage) {
|
||||
START_DIALOGUE -> if (hasSealOfPassage(player)) {
|
||||
if (hasIronmanRestriction(player, IronmanMode.ULTIMATE)) {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"My apologies, dear ${if (player.isMale) "sir" else "madam"}, " +
|
||||
"our services are not available for Ultimate ${if (player.isMale) "Ironmen" else "Ironwomen"}"
|
||||
).also { stage = END_DIALOGUE }
|
||||
} else {
|
||||
|
||||
1 -> when (buttonId) {
|
||||
1 -> end().also { player.bank.open() }
|
||||
2 -> end().also { player.bankPinManager.openSettings() }
|
||||
3 -> end().also { GrandExchangeRecords.getInstance(player).openCollectionBox() }
|
||||
4 -> player(FacialExpression.HALF_ASKING, "What is this place?").also { stage = 5 }
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Good day, how may I help you?"
|
||||
).also {
|
||||
if (hasAwaitingGrandExchangeCollections(player)) {
|
||||
stage++
|
||||
} else {
|
||||
stage += 2
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
playerl(FacialExpression.HALF_WORRIED, "Hi, I...")
|
||||
stage = 30
|
||||
}
|
||||
|
||||
2 -> npc(FacialExpression.ANNOYED, "What are you doing here, Fremennik?!").also { stage++ }
|
||||
3 -> player(FacialExpression.WORRIED, "I have a seal of pass...").also { stage++ }
|
||||
4 -> npc(FacialExpression.ANNOYED, "No you do not! Begone!").also { stage = 99}
|
||||
1 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Before we go any further, I should inform you that you " +
|
||||
"have items ready for collection from the Grand Exchange."
|
||||
).also { stage++ }
|
||||
|
||||
5 -> npcl(FacialExpression.FRIENDLY, "This is a branch of the Bank of Gielinor. We have branches in many towns.").also { stage++ }
|
||||
6 -> player(FacialExpression.FRIENDLY, "And what do you do?").also { stage++ }
|
||||
7 -> npcl(FacialExpression.FRIENDLY, "We will look after your items and money for you. Leave your valuables with us if you want to keep them safe.").also { stage = 99 }
|
||||
2 -> showTopics(
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to access my bank account, please.", 10),
|
||||
IfTopic(
|
||||
FacialExpression.NEUTRAL,
|
||||
"I'd like to switch to my ${getBankAccountName(player, true)} bank account.",
|
||||
13,
|
||||
hasActivatedSecondaryBankAccount(player)
|
||||
),
|
||||
IfTopic(
|
||||
FacialExpression.NEUTRAL,
|
||||
"I'd like to open a secondary bank account.",
|
||||
20,
|
||||
!hasActivatedSecondaryBankAccount(player)
|
||||
),
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to check my PIN settings.", 11),
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to collect items.", 12),
|
||||
Topic(FacialExpression.ASKING, "What is this place?", 3),
|
||||
)
|
||||
|
||||
99 -> end()
|
||||
3 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"This is a branch of the Bank of Gielinor. We have branches in many towns."
|
||||
).also { stage++ }
|
||||
|
||||
4 -> playerl(
|
||||
FacialExpression.ASKING,
|
||||
"And what do you do?"
|
||||
).also { stage++ }
|
||||
|
||||
5 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"We will look after your items and money for you. " +
|
||||
"Leave your valuables with us if you want to keep them safe."
|
||||
).also { stage = END_DIALOGUE }
|
||||
|
||||
10 -> {
|
||||
openBankAccount(player)
|
||||
end()
|
||||
}
|
||||
|
||||
11 -> {
|
||||
openBankPinSettings(player)
|
||||
end()
|
||||
}
|
||||
|
||||
12 -> {
|
||||
openGrandExchangeCollectionBox(player)
|
||||
end()
|
||||
}
|
||||
|
||||
13 -> {
|
||||
toggleBankAccount(player)
|
||||
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Your active bank account has been switched. " +
|
||||
"You can now access your ${getBankAccountName(player)} account."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
20 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Certainly. We offer secondary accounts to all our customers."
|
||||
).also { stage++ }
|
||||
|
||||
21 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"The secondary account comes with a standard fee of 5,000,000 coins. The fee is non-refundable " +
|
||||
"and account activation is permanent."
|
||||
).also { stage++ }
|
||||
|
||||
22 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"If your inventory does not contain enough money to cover the costs, we will complement " +
|
||||
"the amount with the money inside your primary bank account."
|
||||
).also { stage++ }
|
||||
|
||||
23 -> npcl(
|
||||
FacialExpression.ASKING,
|
||||
"Knowing all this, would you like to proceed with opening your secondary bank account?"
|
||||
).also { stage++ }
|
||||
|
||||
24 -> showTopics(
|
||||
Topic(FacialExpression.NEUTRAL, "Yes, I am still interested.", 25),
|
||||
Topic(FacialExpression.NEUTRAL, "Actually, I've changed my mind.", 26)
|
||||
)
|
||||
|
||||
25 -> {
|
||||
when (activateSecondaryBankAccount(player)) {
|
||||
SecondaryBankAccountActivationResult.ALREADY_ACTIVE -> {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Your bank account was already activated, there is no need to pay twice."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
SecondaryBankAccountActivationResult.INTERNAL_FAILURE -> {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"I must apologize, the transaction was not successful. Please check your " +
|
||||
"primary bank account and your inventory - if there's money missing, please " +
|
||||
"screenshot your chat box and contact the game developers."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
SecondaryBankAccountActivationResult.NOT_ENOUGH_MONEY -> {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"It appears that you do not have the money necessary to cover the costs " +
|
||||
"associated with opening a secondary bank account. I will be waiting here " +
|
||||
"until you do."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
SecondaryBankAccountActivationResult.SUCCESS -> {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Your secondary bank account has been opened and can be accessed through any " +
|
||||
"of the Bank of Gielinor's employees. Thank you for choosing our services."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
26 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Very well. Should you decide a secondary bank account is needed, do not hesitate to " +
|
||||
"contact any of the Bank of Gielinor's stationary employees. We will be happy to help."
|
||||
).also { stage = END_DIALOGUE }
|
||||
|
||||
30 -> npcl(
|
||||
FacialExpression.ANNOYED,
|
||||
"What are you doing here, Fremennik?!"
|
||||
).also { stage++ }
|
||||
|
||||
31 -> playerl(
|
||||
FacialExpression.WORRIED,
|
||||
"I have a Seal of Pass..."
|
||||
).also { stage++ }
|
||||
|
||||
32 -> npcl(
|
||||
FacialExpression.ANGRY,
|
||||
"No you don't! Begone!"
|
||||
).also { stage = END_DIALOGUE }
|
||||
|
||||
/* TODO: Is the above related to Lunar Diplomacy? */
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return SirsalBankerDialogue(player)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(NPCs.SIRSAL_BANKER_4519)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
package rs09.game.content.dialogue.region.ooglog
|
||||
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.tools.END_DIALOGUE
|
||||
import rs09.tools.START_DIALOGUE
|
||||
|
||||
/**
|
||||
* Provides dialogue tree for Balnea NPC involved in the
|
||||
* "As a first resort..." quest.
|
||||
*
|
||||
* @author vddCore
|
||||
*/
|
||||
@Initializable
|
||||
class BalneaDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when (stage) {
|
||||
START_DIALOGUE -> playerl(
|
||||
FacialExpression.FRIENDLY,
|
||||
"Hi there!"
|
||||
).also { stage++ }
|
||||
|
||||
1 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"I'm ever so busy at the moment; please come back after the grand opening."
|
||||
).also { stage++ }
|
||||
|
||||
2 -> playerl(
|
||||
FacialExpression.HALF_ASKING,
|
||||
"What grand reopening?"
|
||||
).also { stage++ }
|
||||
|
||||
3 -> npcl(
|
||||
FacialExpression.ANNOYED,
|
||||
"I'm sorry, I really can't spare the time to talk to you."
|
||||
).also { stage++ }
|
||||
|
||||
4 -> playerl(
|
||||
FacialExpression.THINKING,
|
||||
"Uh, sure."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
/* TODO: "As a First Resort..." quest dialogue file is required here. */
|
||||
return true
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray = intArrayOf(NPCs.BALNEA_7047)
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package rs09.game.content.dialogue.region.ooglog
|
||||
|
||||
import api.sendNPCDialogue
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.tools.END_DIALOGUE
|
||||
import rs09.tools.START_DIALOGUE
|
||||
|
||||
/**
|
||||
* Provides dialogue tree for the Ogress Bankers in the city of Oo'glog.
|
||||
*
|
||||
* @author vddCore
|
||||
*/
|
||||
@Initializable
|
||||
class OgressBankerDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
override fun getIds(): IntArray = intArrayOf(
|
||||
NPCs.OGRESS_BANKER_7049,
|
||||
NPCs.OGRESS_BANKER_7050
|
||||
)
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when (stage) {
|
||||
START_DIALOGUE -> npcl(
|
||||
FacialExpression.ANNOYED,
|
||||
"..."
|
||||
).also { stage++ }
|
||||
|
||||
1 -> playerl(
|
||||
FacialExpression.ANNOYED,
|
||||
"Excuse me, can I get some service here, please?"
|
||||
).also { stage++ }
|
||||
|
||||
2 -> npcl(
|
||||
FacialExpression.ANGRY,
|
||||
"GRAAAAAH! You go away, human! Me too busy with training to talk to puny thing like you."
|
||||
).also { stage++ }
|
||||
|
||||
3 -> sendNPCDialogue(
|
||||
player,
|
||||
NPCs.BALNEA_7047,
|
||||
"I do apologise, sir. We're temporarily unable to meet your banking needs.",
|
||||
FacialExpression.NEUTRAL,
|
||||
).also { stage++ }
|
||||
|
||||
4 -> sendNPCDialogue(
|
||||
player,
|
||||
NPCs.BALNEA_7047,
|
||||
"We'll be open as soon as we realize our customer experience goals " +
|
||||
"and can guarantee the high standards of service that you expect from all " +
|
||||
"branches of the Bank of Gielinor.",
|
||||
FacialExpression.NEUTRAL
|
||||
).also { stage++ }
|
||||
|
||||
5 -> playerl(
|
||||
FacialExpression.THINKING,
|
||||
"What did you just say to me?"
|
||||
).also { stage++ }
|
||||
|
||||
6 -> sendNPCDialogue(
|
||||
player,
|
||||
NPCs.BALNEA_7047,
|
||||
"We're closed until I can teach these wretched creatures some manners.",
|
||||
FacialExpression.ANNOYED
|
||||
).also { stage++ }
|
||||
|
||||
7 -> playerl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Ah, right. Good luck with that."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
/* TODO: "As a First Resort..." quest dialogue file is required here. */
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,167 @@
|
|||
package rs09.game.content.dialogue.region.ourania
|
||||
|
||||
import api.*
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.IronmanMode
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.Components
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.content.dialogue.Topic
|
||||
import rs09.tools.END_DIALOGUE
|
||||
import rs09.tools.START_DIALOGUE
|
||||
|
||||
@Initializable
|
||||
class EniolaDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when (stage) {
|
||||
START_DIALOGUE -> if (hasIronmanRestriction(player, IronmanMode.ULTIMATE)) {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"My apologies, dear ${if (player.isMale) "sir" else "madam"}, " +
|
||||
"our services are not available for Ultimate ${if (player.isMale) "Ironmen" else "Ironwomen"}."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
else {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Good day, how may I help you?"
|
||||
).also {
|
||||
if (hasAwaitingGrandExchangeCollections(player)) {
|
||||
stage++
|
||||
} else {
|
||||
stage += 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Before we go any further, I should inform you that you " +
|
||||
"have items ready for collection from the Grand Exchange."
|
||||
).also { stage++ }
|
||||
|
||||
2 -> playerl(FacialExpression.ASKING, "Who are you?")
|
||||
.also { stage++ }
|
||||
|
||||
3 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"How frightfully rude of me, my dear ${if (player.isMale) "sir" else "lady"}. " +
|
||||
"My name is Eniola and I work for that excellent enterprise, the Bank of Gielinor."
|
||||
).also { stage++ }
|
||||
|
||||
4 -> showTopics(
|
||||
Topic(FacialExpression.HALF_THINKING, "If you work for the bank, what are you doing here?", 10),
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to access my bank account, please.", 30),
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to check my PIN settings.", 31),
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to see my collection box.", 32),
|
||||
Topic(FacialExpression.NEUTRAL, "Never mind.", END_DIALOGUE)
|
||||
)
|
||||
|
||||
10 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"My presence here is the start of a new enterprise of travelling banks. " +
|
||||
"I, and others like me, will provide you with the convenience of having " +
|
||||
"bank facilities where they will be of optimum use to you."
|
||||
).also { stage++ }
|
||||
|
||||
11 -> playerl(
|
||||
FacialExpression.ASKING,
|
||||
"So... What are you doing here?"
|
||||
).also { stage++ }
|
||||
|
||||
12 -> npcl(
|
||||
FacialExpression.HALF_GUILTY,
|
||||
"The Z.M.I. - that is - the Zamorakian Magical Institute, required my services " +
|
||||
"upon discovery of this altar."
|
||||
).also { stage++ }
|
||||
|
||||
13 -> npcl(
|
||||
FacialExpression.HALF_GUILTY,
|
||||
"We at the Bank of Gielinor are a neutral party and are willing to offer our " +
|
||||
"services regardless of affiliation. So that is why I am here."
|
||||
).also { stage++ }
|
||||
|
||||
14 -> playerl(
|
||||
FacialExpression.ASKING,
|
||||
"Can I access my bank account by speaking to you?"
|
||||
).also { stage++ }
|
||||
|
||||
15 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Of course, dear ${if (player.isMale) "sir" else "lady"}. However, I must inform you " +
|
||||
"that because the Z.M.I. are paying for my services, they require anyone not part of " +
|
||||
"the Institute to pay an access fee to open their bank account."
|
||||
).also { stage++ }
|
||||
|
||||
16 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"But, as our goal as travelling bankers is to make our customers' lives more convenient, " +
|
||||
"we have accomodated to your needs."
|
||||
).also { stage++ }
|
||||
|
||||
17 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"We know you will be busy creating runes and do not wish " +
|
||||
"to carry money with you."
|
||||
).also { stage++ }
|
||||
|
||||
18 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"The charge to open your account is the small amount of twenty of one type of rune. " +
|
||||
"The type of rune is up to you."
|
||||
).also { stage++ }
|
||||
|
||||
19 -> npcl(
|
||||
FacialExpression.HALF_ASKING,
|
||||
"Would you like to pay the price of twenty runes to open " +
|
||||
"your bank account?"
|
||||
).also { stage++ }
|
||||
|
||||
20 -> showTopics(
|
||||
Topic(FacialExpression.NEUTRAL, "Yes, please.", 30),
|
||||
Topic(FacialExpression.SUSPICIOUS, "Let me open my account and then I'll give you the runes.", 21),
|
||||
Topic(FacialExpression.ANNOYED, "No way! I'm not paying to withdraw my own stuff.", 22)
|
||||
)
|
||||
|
||||
21 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"It's not that I don't trust you, old ${if (player.isMale) "chap" else "girl"}, " +
|
||||
"but as the old adage goes: 'Payment comes before friends'."
|
||||
).also { stage = END_DIALOGUE }
|
||||
|
||||
22 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"I'm sorry to hear that, dear ${if (player.isMale) "sir" else "madam"}. "
|
||||
).also { stage++ }
|
||||
|
||||
23 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Should you reconsider, because I believe this service offers excellent " +
|
||||
"value for the price, do not hesitate to contact me."
|
||||
).also { stage = END_DIALOGUE }
|
||||
|
||||
30 -> {
|
||||
setAttribute(player, "zmi:bankaction", "open")
|
||||
openInterface(player, Components.BANK_CHARGE_ZMI_619)
|
||||
end()
|
||||
}
|
||||
|
||||
31 -> {
|
||||
openBankPinSettings(player)
|
||||
end()
|
||||
}
|
||||
|
||||
32 -> {
|
||||
setAttribute(player, "zmi:bankaction", "collect")
|
||||
openInterface(player, Components.BANK_CHARGE_ZMI_619)
|
||||
end()
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray = intArrayOf(NPCs.ENIOLA_6362)
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package rs09.game.content.dialogue.region.ourania
|
||||
|
||||
import api.openInterface
|
||||
import api.restrictForIronman
|
||||
import api.setAttribute
|
||||
import core.game.node.entity.player.link.IronmanMode
|
||||
import org.rs09.consts.Components
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
/**
|
||||
* Handles special banking interactions for Eniola at ZMI altar area.
|
||||
*
|
||||
* @author vddCore
|
||||
*/
|
||||
class EniolaListener : InteractionListener {
|
||||
override fun defineListeners() {
|
||||
on(NPCs.ENIOLA_6362, NPC, "bank") { player, _ ->
|
||||
restrictForIronman(player, IronmanMode.ULTIMATE) {
|
||||
setAttribute(player, "zmi:bankaction", "open")
|
||||
openInterface(player, Components.BANK_CHARGE_ZMI_619)
|
||||
}
|
||||
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(NPCs.ENIOLA_6362, NPC, "collect") { player, _ ->
|
||||
restrictForIronman(player, IronmanMode.ULTIMATE) {
|
||||
setAttribute(player, "zmi:bankaction", "collect")
|
||||
openInterface(player, Components.BANK_CHARGE_ZMI_619)
|
||||
}
|
||||
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +1,15 @@
|
|||
package rs09.game.content.dialogue.region.piscatoris
|
||||
|
||||
import api.addItemOrDrop
|
||||
import api.sendItemDialogue
|
||||
import api.*
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.IronmanMode
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.content.dialogue.IfTopic
|
||||
import rs09.game.content.dialogue.Topic
|
||||
import rs09.game.content.global.shops.Shops
|
||||
import rs09.game.node.entity.npc.BankerNPC
|
||||
import rs09.tools.END_DIALOGUE
|
||||
import rs09.tools.START_DIALOGUE
|
||||
|
||||
|
|
@ -23,65 +21,95 @@ import rs09.tools.START_DIALOGUE
|
|||
*/
|
||||
@Initializable
|
||||
class ArnoldLydsporDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
npc(FacialExpression.FRIENDLY, "Ah, you come back! What you want from Arnold, heh?")
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when (stage) {
|
||||
START_DIALOGUE -> showTopics(
|
||||
Topic("Can you open my bank account, please?", 2),
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to check my bank PIN settings.", 3),
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to collect items.", 4),
|
||||
Topic("Would you like to trade?", 5),
|
||||
START_DIALOGUE -> npcl(
|
||||
FacialExpression.FRIENDLY,
|
||||
"Ah, you come back! What you want from Arnold, heh?"
|
||||
).also { stage++ }
|
||||
|
||||
1 -> showTopics(
|
||||
IfTopic(
|
||||
FacialExpression.ASKING,
|
||||
"Can you open my bank account, please?",
|
||||
2,
|
||||
!hasIronmanRestriction(player, IronmanMode.ULTIMATE)
|
||||
),
|
||||
|
||||
IfTopic(
|
||||
FacialExpression.NEUTRAL,
|
||||
"I'd like to check my bank PIN settings.",
|
||||
3,
|
||||
!hasIronmanRestriction(player, IronmanMode.ULTIMATE)
|
||||
),
|
||||
IfTopic(
|
||||
FacialExpression.NEUTRAL,
|
||||
"I'd like to collect items.",
|
||||
4,
|
||||
!hasIronmanRestriction(player, IronmanMode.ULTIMATE)
|
||||
),
|
||||
Topic(FacialExpression.ASKING, "Would you like to trade?", 5),
|
||||
Topic(FacialExpression.FRIENDLY, "Nothing, I just came to chat.", 7)
|
||||
)
|
||||
|
||||
2 -> BankerNPC.attemptBank(player, npc)
|
||||
.also { end() }
|
||||
2 -> {
|
||||
openBankAccount(player)
|
||||
end()
|
||||
}
|
||||
|
||||
/* TODO change when PIN management is re-worked
|
||||
* TODO and the relevant ContentAPI call is created
|
||||
*/
|
||||
3 -> player.bankPinManager.openSettings()
|
||||
.also { end() }
|
||||
3 -> {
|
||||
openBankPinSettings(player)
|
||||
end()
|
||||
}
|
||||
|
||||
4 -> BankerNPC.attemptCollect(player, npc)
|
||||
.also { end() }
|
||||
4 -> {
|
||||
openGrandExchangeCollectionBox(player)
|
||||
end()
|
||||
}
|
||||
|
||||
5 -> npc(FacialExpression.FRIENDLY, "Ja, I have wide range of stock...")
|
||||
.also { stage++ }
|
||||
|
||||
6 -> Shops.shopsByNpc[NPCs.ARNOLD_LYDSPOR_3824]?.openFor(player)
|
||||
.also { end() }
|
||||
|
||||
7 -> npcl(FacialExpression.FRIENDLY,
|
||||
"Ah, that is nice - always I like to chat, but"
|
||||
+ " Herr Caranos tell me to get back to work!"
|
||||
+ " Here, you been nice, so have a present."
|
||||
5 -> npcl(
|
||||
FacialExpression.FRIENDLY,
|
||||
"Ja, I have wide range of stock..."
|
||||
).also { stage++ }
|
||||
|
||||
8 -> sendItemDialogue(player, Items.CABBAGE_1965, "Arnold gives you a cabbage.")
|
||||
.also {
|
||||
6 -> {
|
||||
openNpcShop(player, NPCs.ARNOLD_LYDSPOR_3824)
|
||||
end()
|
||||
}
|
||||
|
||||
7 -> npcl(FacialExpression.FRIENDLY,
|
||||
"Ah, that is nice - always I like to chat, but " +
|
||||
"Herr Caranos tell me to get back to work! " +
|
||||
"Here, you been nice, so have a present."
|
||||
).also { stage++ }
|
||||
|
||||
8 -> sendItemDialogue(
|
||||
player,
|
||||
Items.CABBAGE_1965,
|
||||
"Arnold gives you a cabbage."
|
||||
).also {
|
||||
addItemOrDrop(player, Items.CABBAGE_1965)
|
||||
stage++
|
||||
}
|
||||
|
||||
9 -> player(FacialExpression.HALF_THINKING, "A cabbage?")
|
||||
.also { stage++ }
|
||||
9 -> playerl(
|
||||
FacialExpression.HALF_THINKING,
|
||||
"A cabbage?"
|
||||
).also { stage++ }
|
||||
|
||||
10 -> npc("Ja, cabbage is good for you!")
|
||||
.also { stage++ }
|
||||
10 -> npcl(
|
||||
FacialExpression.HAPPY,
|
||||
"Ja, cabbage is good for you!"
|
||||
).also { stage++ }
|
||||
|
||||
11 -> player(FacialExpression.NEUTRAL, "Um... Thanks!")
|
||||
.also { stage = END_DIALOGUE }
|
||||
11 -> playerl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Um... Thanks!"
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun newInstance(player: Player?): DialoguePlugin = ArnoldLydsporDialogue(player)
|
||||
override fun getIds(): IntArray = ArnoldLydsporListener.NPC_IDS
|
||||
override fun getIds(): IntArray = intArrayOf(NPCs.ARNOLD_LYDSPOR_3824)
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package rs09.game.content.dialogue.region.piscatoris
|
||||
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.interaction.InteractionListener
|
||||
import rs09.game.node.entity.npc.BankerNPC
|
||||
|
||||
/**
|
||||
* Provides banker interactions for Arnold Lydspor
|
||||
*
|
||||
* @author vddCore
|
||||
*/
|
||||
@Initializable
|
||||
class ArnoldLydsporListener : InteractionListener {
|
||||
companion object {
|
||||
val NPC_IDS = intArrayOf(NPCs.ARNOLD_LYDSPOR_3824)
|
||||
}
|
||||
|
||||
override fun defineListeners() {
|
||||
on(NPC_IDS, NPC, "bank", handler = BankerNPC::attemptBank)
|
||||
on(NPC_IDS, NPC, "collect", handler = BankerNPC::attemptCollect)
|
||||
/* Talk-to handled by NPCTalkListener */
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
package rs09.game.content.dialogue.region.roguesden
|
||||
|
||||
import api.*
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.IronmanMode
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.content.dialogue.IfTopic
|
||||
import rs09.game.content.dialogue.Topic
|
||||
import rs09.tools.END_DIALOGUE
|
||||
import rs09.tools.START_DIALOGUE
|
||||
|
||||
/**
|
||||
* Handles Emerald Benedict's dialogue tree.
|
||||
*
|
||||
* @author vddCore
|
||||
*/
|
||||
@Initializable
|
||||
class EmeraldBenedictDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when (stage) {
|
||||
START_DIALOGUE -> if(hasIronmanRestriction(player, IronmanMode.ULTIMATE)) {
|
||||
npcl(
|
||||
FacialExpression.ANNOYED,
|
||||
"Get lost, tin can."
|
||||
).also { stage = END_DIALOGUE }
|
||||
} else {
|
||||
npcl(
|
||||
FacialExpression.SUSPICIOUS,
|
||||
"Got anything you don't want to lose?"
|
||||
).also {
|
||||
if (hasAwaitingGrandExchangeCollections(player)) {
|
||||
stage++
|
||||
} else {
|
||||
stage += 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1 -> npcl(
|
||||
FacialExpression.SUSPICIOUS,
|
||||
"By the way, a little bird told me you got some stuff waiting for you " +
|
||||
"on the Grand Exchange."
|
||||
).also { stage++ }
|
||||
|
||||
2 -> showTopics(
|
||||
Topic(FacialExpression.ASKING, "Yes, actually. Can you help?", 3),
|
||||
IfTopic(
|
||||
FacialExpression.ASKING,
|
||||
"Yes, but can you switch my bank accounts?",
|
||||
4,
|
||||
hasActivatedSecondaryBankAccount(player)
|
||||
),
|
||||
Topic(FacialExpression.ASKING, "Yes, but can you show me my PIN settings?", 5),
|
||||
Topic(FacialExpression.ASKING, "Yes, but can you show me my collection box?", 6),
|
||||
Topic(FacialExpression.ANNOYED, "Yes, thanks. And I'll keep hold of it too.", END_DIALOGUE)
|
||||
)
|
||||
|
||||
3 -> {
|
||||
openBankAccount(player)
|
||||
end()
|
||||
}
|
||||
|
||||
4 -> {
|
||||
toggleBankAccount(player)
|
||||
npcl(
|
||||
FacialExpression.SUSPICIOUS,
|
||||
"Sure thing. Feel free to rummage through whatever's in your ${getBankAccountName(player)} now."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
5 -> {
|
||||
openBankPinSettings(player)
|
||||
end()
|
||||
}
|
||||
|
||||
6 -> {
|
||||
openGrandExchangeCollectionBox(player)
|
||||
end()
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray = intArrayOf(NPCs.EMERALD_BENEDICT_2271)
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package rs09.game.content.dialogue.region.roguesden
|
||||
|
||||
import api.openBankAccount
|
||||
import api.openGrandExchangeCollectionBox
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
/**
|
||||
* Handles Emerald Benedict's only available interaction.
|
||||
*
|
||||
* @author vddCore
|
||||
*/
|
||||
class EmeraldBenedictListener : InteractionListener {
|
||||
override fun defineListeners() {
|
||||
on(NPCs.EMERALD_BENEDICT_2271, NPC, "bank") { player, _ ->
|
||||
openBankAccount(player)
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(NPCs.EMERALD_BENEDICT_2271, NPC, "collect") { player, _ ->
|
||||
openGrandExchangeCollectionBox(player)
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package rs09.game.content.dialogue.region.wguild
|
||||
|
||||
import api.*
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.IronmanMode
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.content.dialogue.IfTopic
|
||||
import rs09.game.content.dialogue.Topic
|
||||
import rs09.tools.END_DIALOGUE
|
||||
import rs09.tools.START_DIALOGUE
|
||||
|
||||
/**
|
||||
* Provides a dialogue tree for Jade inside Warriors' Guild.
|
||||
*
|
||||
* @author vddCore
|
||||
*/
|
||||
@Initializable
|
||||
class JadeDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when (stage) {
|
||||
START_DIALOGUE -> if (hasIronmanRestriction(player, IronmanMode.ULTIMATE)) {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Greetings, warrior. I wish I could help you, but " +
|
||||
"our services are not available for Ultimate ${if (player.isMale) "Ironmen" else "Ironwomen"}."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
else {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Greetings warrior, how may I help you?"
|
||||
).also {
|
||||
if (hasAwaitingGrandExchangeCollections(player)) {
|
||||
stage++
|
||||
} else {
|
||||
stage += 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Before we go any further, I should inform you that you " +
|
||||
"have items ready for collection from the Grand Exchange."
|
||||
).also { stage++ }
|
||||
|
||||
2 -> showTopics(
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to access my bank account, please.", 10),
|
||||
IfTopic(
|
||||
FacialExpression.NEUTRAL,
|
||||
"I'd like to switch to my ${getBankAccountName(player, true)} bank account.",
|
||||
13,
|
||||
hasActivatedSecondaryBankAccount(player)
|
||||
),
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to check my PIN settings.", 11),
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to see my collection box.", 12),
|
||||
Topic(FacialExpression.ASKING, "How long have you worked here?", 3)
|
||||
)
|
||||
|
||||
3 -> npcl(
|
||||
FacialExpression.FRIENDLY,
|
||||
"Oh, ever since the Guild opened. I like it here."
|
||||
).also { stage++ }
|
||||
|
||||
4 -> playerl(
|
||||
FacialExpression.ASKING,
|
||||
"Why's that?"
|
||||
).also { stage++ }
|
||||
|
||||
5 -> npcl(
|
||||
FacialExpression.FRIENDLY,
|
||||
"Well... What with all these warriors around, there's not much chance of my bank being robbed, is there?"
|
||||
).also { stage = 2 }
|
||||
|
||||
10 -> {
|
||||
openBankAccount(player)
|
||||
end()
|
||||
}
|
||||
|
||||
11 -> {
|
||||
openBankPinSettings(player)
|
||||
end()
|
||||
}
|
||||
|
||||
12 -> {
|
||||
openGrandExchangeCollectionBox(player)
|
||||
end()
|
||||
}
|
||||
|
||||
13 -> {
|
||||
toggleBankAccount(player)
|
||||
npcl(
|
||||
FacialExpression.FRIENDLY,
|
||||
"Of course! Your ${getBankAccountName(player)} account is now active!"
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray = intArrayOf(NPCs.JADE_4296)
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
package rs09.game.content.dialogue
|
||||
package rs09.game.content.dialogue.region.worldwide.bank
|
||||
|
||||
import api.*
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import api.dumpBeastOfBurden
|
||||
import api.dumpContainer
|
||||
import api.sendMessage
|
||||
import rs09.game.content.dialogue.DialogueFile
|
||||
import rs09.tools.START_DIALOGUE
|
||||
|
||||
/**
|
||||
|
|
@ -13,7 +13,6 @@ import rs09.tools.START_DIALOGUE
|
|||
* @author vddCore
|
||||
*/
|
||||
class BankDepositDialogue : DialogueFile() {
|
||||
|
||||
override fun handle(componentID: Int, buttonID: Int) {
|
||||
when (stage) {
|
||||
START_DIALOGUE -> options(
|
||||
|
|
@ -52,6 +51,5 @@ class BankDepositDialogue : DialogueFile() {
|
|||
4 -> end()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
package rs09.game.content.dialogue
|
||||
package rs09.game.content.dialogue.region.worldwide.bank
|
||||
|
||||
import api.*
|
||||
import core.game.content.dialogue.DialogueInterpreter
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import api.openInterface
|
||||
import api.sendDialogue
|
||||
import api.sendItemDialogue
|
||||
import core.game.node.item.Item
|
||||
import org.rs09.consts.Components
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.content.dialogue.DialogueFile
|
||||
import rs09.tools.START_DIALOGUE
|
||||
|
||||
/**
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
package rs09.game.content.dialogue.region.worldwide.bank
|
||||
|
||||
import api.*
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.IronmanMode
|
||||
import core.plugin.Initializable
|
||||
import rs09.game.content.dialogue.IfTopic
|
||||
import rs09.game.content.dialogue.Topic
|
||||
import rs09.game.node.entity.npc.BankerNPC
|
||||
import rs09.tools.END_DIALOGUE
|
||||
import rs09.tools.START_DIALOGUE
|
||||
|
||||
@Initializable
|
||||
class BankerDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when (stage) {
|
||||
START_DIALOGUE -> when {
|
||||
hasIronmanRestriction(player, IronmanMode.ULTIMATE) -> {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"My apologies, dear ${if (player.isMale) "sir" else "madam"}, " +
|
||||
"our services are not available for Ultimate ${if (player.isMale) "Ironmen" else "Ironwomen"}"
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
else -> {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Good day, how may I help you?"
|
||||
).also {
|
||||
if (hasAwaitingGrandExchangeCollections(player)) {
|
||||
stage++
|
||||
} else {
|
||||
stage += 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Before we go any further, I should inform you that you " +
|
||||
"have items ready for collection from the Grand Exchange."
|
||||
).also { stage++ }
|
||||
|
||||
2 -> showTopics(
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to access my bank account, please.", 10),
|
||||
IfTopic(
|
||||
FacialExpression.NEUTRAL,
|
||||
"I'd like to switch to my ${getBankAccountName(player, true)} bank account.",
|
||||
13,
|
||||
hasActivatedSecondaryBankAccount(player)
|
||||
),
|
||||
IfTopic(
|
||||
FacialExpression.NEUTRAL,
|
||||
"I'd like to open a secondary bank account.",
|
||||
20,
|
||||
!hasActivatedSecondaryBankAccount(player)
|
||||
),
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to check my PIN settings.", 11),
|
||||
Topic(FacialExpression.NEUTRAL, "I'd like to collect items.", 12),
|
||||
Topic(FacialExpression.ASKING, "What is this place?", 3),
|
||||
)
|
||||
|
||||
3 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"This is a branch of the Bank of Gielinor. We have branches in many towns."
|
||||
).also { stage++ }
|
||||
|
||||
4 -> playerl(
|
||||
FacialExpression.ASKING,
|
||||
"And what do you do?"
|
||||
).also { stage++ }
|
||||
|
||||
5 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"We will look after your items and money for you. " +
|
||||
"Leave your valuables with us if you want to keep them safe."
|
||||
).also { stage = END_DIALOGUE }
|
||||
|
||||
10 -> {
|
||||
openBankAccount(player)
|
||||
end()
|
||||
}
|
||||
|
||||
11 -> {
|
||||
openBankPinSettings(player)
|
||||
end()
|
||||
}
|
||||
|
||||
12 -> {
|
||||
openGrandExchangeCollectionBox(player)
|
||||
end()
|
||||
}
|
||||
|
||||
13 -> {
|
||||
toggleBankAccount(player)
|
||||
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Your active bank account has been switched. " +
|
||||
"You can now access your ${getBankAccountName(player)} account."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
20 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Certainly. We offer secondary accounts to all our customers."
|
||||
).also { stage++ }
|
||||
|
||||
21 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"The secondary account comes with a standard fee of 5,000,000 coins. The fee is non-refundable " +
|
||||
"and account activation is permanent."
|
||||
).also { stage++ }
|
||||
|
||||
22 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"If your inventory does not contain enough money to cover the costs, we will complement " +
|
||||
"the amount with the money inside your primary bank account."
|
||||
).also { stage++ }
|
||||
|
||||
23 -> npcl(
|
||||
FacialExpression.ASKING,
|
||||
"Knowing all this, would you like to proceed with opening your secondary bank account?"
|
||||
).also { stage++ }
|
||||
|
||||
24 -> showTopics(
|
||||
Topic(FacialExpression.NEUTRAL, "Yes, I am still interested.", 25),
|
||||
Topic(FacialExpression.NEUTRAL, "Actually, I've changed my mind.", 26)
|
||||
)
|
||||
|
||||
25 -> {
|
||||
when (activateSecondaryBankAccount(player)) {
|
||||
SecondaryBankAccountActivationResult.ALREADY_ACTIVE -> {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Your bank account was already activated, there is no need to pay twice."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
SecondaryBankAccountActivationResult.INTERNAL_FAILURE -> {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"I must apologize, the transaction was not successful. Please check your " +
|
||||
"primary bank account and your inventory - if there's money missing, please " +
|
||||
"screenshot your chat box and contact the game developers."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
SecondaryBankAccountActivationResult.NOT_ENOUGH_MONEY -> {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"It appears that you do not have the money necessary to cover the costs " +
|
||||
"associated with opening a secondary bank account. I will be waiting here " +
|
||||
"until you do."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
SecondaryBankAccountActivationResult.SUCCESS -> {
|
||||
npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Your secondary bank account has been opened and can be accessed through any " +
|
||||
"of the Bank of Gielinor's employees. Thank you for choosing our services."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
26 -> npcl(
|
||||
FacialExpression.NEUTRAL,
|
||||
"Very well. Should you decide a secondary bank account is needed, do not hesitate to " +
|
||||
"contact any of the Bank of Gielinor's stationary employees. We will be happy to help."
|
||||
).also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray = BankerNPC.NPC_IDS
|
||||
}
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
package rs09.game.content.quest.members.thefremenniktrials
|
||||
|
||||
import api.*
|
||||
import api.addItem
|
||||
import api.dumpContainer
|
||||
import api.questStage
|
||||
import api.removeItem
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.interaction.`object`.BankingPlugin
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import core.plugin.Initializable
|
||||
|
|
|
|||
|
|
@ -0,0 +1,99 @@
|
|||
package rs09.game.interaction.inter.bank
|
||||
|
||||
import api.*
|
||||
import core.game.component.Component
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.item.Item
|
||||
import org.rs09.consts.Components
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.interaction.InterfaceListener
|
||||
|
||||
/**
|
||||
* Handles bank charge interface for Eniola at ZMI altar.
|
||||
* @author vddCore
|
||||
*/
|
||||
class BankChargeInterface : InterfaceListener {
|
||||
companion object {
|
||||
private const val BUTTON_AIR_RUNE = 28
|
||||
private const val BUTTON_MIND_RUNE = 29
|
||||
private const val BUTTON_WATER_RUNE = 30
|
||||
private const val BUTTON_EARTH_RUNE = 31
|
||||
private const val BUTTON_FIRE_RUNE = 32
|
||||
private const val BUTTON_BODY_RUNE = 33
|
||||
private const val BUTTON_COSMIC_RUNE = 34
|
||||
private const val BUTTON_CHAOS_RUNE = 35
|
||||
private const val BUTTON_ASTRAL_RUNE = 36
|
||||
private const val BUTTON_LAW_RUNE = 37
|
||||
private const val BUTTON_DEATH_RUNE = 38
|
||||
private const val BUTTON_BLOOD_RUNE = 39
|
||||
private const val BUTTON_NATURE_RUNE = 40
|
||||
private const val BUTTON_SOUL_RUNE = 41
|
||||
|
||||
private val RUNE_BUTTONS = intArrayOf(
|
||||
BUTTON_AIR_RUNE, BUTTON_MIND_RUNE, BUTTON_WATER_RUNE, BUTTON_EARTH_RUNE,
|
||||
BUTTON_FIRE_RUNE, BUTTON_BODY_RUNE, BUTTON_COSMIC_RUNE, BUTTON_CHAOS_RUNE,
|
||||
BUTTON_ASTRAL_RUNE, BUTTON_LAW_RUNE, BUTTON_DEATH_RUNE, BUTTON_BLOOD_RUNE,
|
||||
BUTTON_NATURE_RUNE, BUTTON_SOUL_RUNE
|
||||
)
|
||||
|
||||
private val BUTTON_TO_RUNE = hashMapOf(
|
||||
BUTTON_AIR_RUNE to Items.AIR_RUNE_556,
|
||||
BUTTON_MIND_RUNE to Items.MIND_RUNE_558,
|
||||
BUTTON_WATER_RUNE to Items.WATER_RUNE_555,
|
||||
BUTTON_EARTH_RUNE to Items.EARTH_RUNE_557,
|
||||
BUTTON_FIRE_RUNE to Items.FIRE_RUNE_554,
|
||||
BUTTON_BODY_RUNE to Items.BODY_RUNE_559,
|
||||
BUTTON_COSMIC_RUNE to Items.COSMIC_RUNE_564,
|
||||
BUTTON_CHAOS_RUNE to Items.CHAOS_RUNE_562,
|
||||
BUTTON_ASTRAL_RUNE to Items.ASTRAL_RUNE_9075,
|
||||
BUTTON_LAW_RUNE to Items.LAW_RUNE_563,
|
||||
BUTTON_DEATH_RUNE to Items.DEATH_RUNE_560,
|
||||
BUTTON_BLOOD_RUNE to Items.BLOOD_RUNE_565,
|
||||
BUTTON_NATURE_RUNE to Items.NATURE_RUNE_561,
|
||||
BUTTON_SOUL_RUNE to Items.SOUL_RUNE_566
|
||||
)
|
||||
}
|
||||
|
||||
private fun handleButtonClick(
|
||||
player: Player,
|
||||
component: Component,
|
||||
opcode: Int,
|
||||
buttonID: Int,
|
||||
slot: Int,
|
||||
itemID: Int
|
||||
): Boolean {
|
||||
if (buttonID !in RUNE_BUTTONS) return true
|
||||
|
||||
val runeItemId = BUTTON_TO_RUNE[buttonID]
|
||||
|
||||
runeItemId?.let {
|
||||
if (amountInInventory(player, it) < 20) {
|
||||
sendNPCDialogue(
|
||||
player,
|
||||
NPCs.ENIOLA_6362,
|
||||
"I'm afraid you don't have the necessary runes with you at this time, so " +
|
||||
"I can't allow you to access your account. Please bring 20 runes of one type " +
|
||||
"and you'll be able to open your bank.",
|
||||
FacialExpression.NEUTRAL
|
||||
)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
if (removeItem(player, Item(it, 20))) {
|
||||
when (getAttribute(player, "zmi:bankaction", "")) {
|
||||
"open" -> openBankAccount(player)
|
||||
"collect" -> openGrandExchangeCollectionBox(player)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun defineInterfaceListeners() {
|
||||
on(Components.BANK_CHARGE_ZMI_619, ::handleButtonClick)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +1,16 @@
|
|||
package rs09.game.interaction.inter
|
||||
package rs09.game.interaction.inter.bank
|
||||
|
||||
import api.*
|
||||
import api.animate
|
||||
import api.dumpBeastOfBurden
|
||||
import api.runWorldTask
|
||||
import api.sendMessage
|
||||
import core.game.component.Component
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.skill.summoning.familiar.FamiliarManager
|
||||
import org.rs09.consts.Animations
|
||||
import org.rs09.consts.Components
|
||||
import rs09.game.interaction.InterfaceListener
|
||||
import rs09.game.interaction.util.BankUtils
|
||||
|
||||
private const val BUTTON_DEPOSIT_BOB = 13
|
||||
|
||||
private const val MENU_ELEMENT = 11
|
||||
private const val OP_AMOUNT_ONE = 155
|
||||
private const val OP_AMOUNT_FIVE = 196
|
||||
private const val OP_AMOUNT_TEN = 124
|
||||
private const val OP_AMOUNT_ALL = 199
|
||||
private const val OP_AMOUNT_X = 234
|
||||
private const val OP_EXAMINE = 168
|
||||
|
||||
/**
|
||||
* Allows the user to interact with the
|
||||
* Bank Deposit Box interface
|
||||
|
|
@ -27,6 +18,17 @@ private const val OP_EXAMINE = 168
|
|||
* @author vddCore
|
||||
*/
|
||||
class BankDepositBoxInterface : InterfaceListener {
|
||||
companion object {
|
||||
private const val BUTTON_DEPOSIT_BOB = 13
|
||||
|
||||
private const val MENU_ELEMENT = 11
|
||||
private const val OP_AMOUNT_ONE = 155
|
||||
private const val OP_AMOUNT_FIVE = 196
|
||||
private const val OP_AMOUNT_TEN = 124
|
||||
private const val OP_AMOUNT_ALL = 199
|
||||
private const val OP_AMOUNT_X = 234
|
||||
private const val OP_EXAMINE = 168
|
||||
}
|
||||
|
||||
private fun handleDepositBoxMenu(player: Player, component: Component, opcode: Int, buttonID: Int, slot: Int, itemID: Int): Boolean {
|
||||
val item = player.inventory.get(slot)
|
||||
|
|
@ -49,7 +51,10 @@ class BankDepositBoxInterface : InterfaceListener {
|
|||
// Needs to have a callback here because the depositing moment is independent from the world task.
|
||||
player.bank::refreshDepositBoxInterface
|
||||
)
|
||||
OP_AMOUNT_ALL -> player.bank.addItem(slot, player.inventory.getAmount(item))
|
||||
OP_AMOUNT_ALL -> player.bank.addItem(
|
||||
slot,
|
||||
player.inventory.getAmount(item)
|
||||
)
|
||||
else -> player.debug("Unknown deposit box menu opcode $opcode")
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +67,10 @@ class BankDepositBoxInterface : InterfaceListener {
|
|||
|
||||
override fun defineInterfaceListeners() {
|
||||
on(Components.BANK_DEPOSIT_BOX_11, ::handleDepositBoxMenu)
|
||||
on(Components.BANK_DEPOSIT_BOX_11, BUTTON_DEPOSIT_BOB) { player, _, _, _, _, _ ->
|
||||
on(
|
||||
Components.BANK_DEPOSIT_BOX_11,
|
||||
BUTTON_DEPOSIT_BOB
|
||||
) { player, _, _, _, _, _ ->
|
||||
dumpBeastOfBurden(player); true
|
||||
}
|
||||
}
|
||||
|
|
@ -1,58 +1,58 @@
|
|||
package rs09.game.interaction.inter
|
||||
package rs09.game.interaction.inter.bank
|
||||
|
||||
import api.*
|
||||
import core.game.component.Component
|
||||
import core.game.node.entity.player.Player
|
||||
import org.rs09.consts.Components
|
||||
import org.rs09.consts.Items
|
||||
import rs09.ServerConstants
|
||||
import rs09.game.content.dialogue.BankHelpDialogue
|
||||
import rs09.game.content.dialogue.BankDepositDialogue
|
||||
import rs09.game.content.dialogue.region.worldwide.bank.BankDepositDialogue
|
||||
import rs09.game.content.dialogue.region.worldwide.bank.BankHelpDialogue
|
||||
import rs09.game.interaction.InterfaceListener
|
||||
import rs09.game.interaction.util.BankUtils
|
||||
|
||||
private const val MAIN_BUTTON_CLOSE = 10
|
||||
private const val MAIN_BUTTON_INSERT_MODE = 14
|
||||
private const val MAIN_BUTTON_NOTE_MODE = 16
|
||||
private const val MAIN_BUTTON_BOB_DEPOSIT = 18
|
||||
private const val MAIN_BUTTON_SEARCH_BANK = 20
|
||||
private const val MAIN_BUTTON_HELP = 23
|
||||
|
||||
private const val MENU_ELEMENT = 73
|
||||
private const val OP_AMOUNT_ONE = 155
|
||||
private const val OP_AMOUNT_FIVE = 196
|
||||
private const val OP_AMOUNT_TEN = 124
|
||||
private const val OP_AMOUNT_LAST_X = 199
|
||||
private const val OP_AMOUNT_X = 234
|
||||
private const val OP_AMOUNT_ALL = 168
|
||||
private const val OP_AMOUNT_ALL_BUT_ONE = 166
|
||||
private const val OP_EXAMINE = 9
|
||||
|
||||
private const val BANK_TAB_1 = 41
|
||||
private const val BANK_TAB_2 = 39
|
||||
private const val BANK_TAB_3 = 37
|
||||
private const val BANK_TAB_4 = 35
|
||||
private const val BANK_TAB_5 = 33
|
||||
private const val BANK_TAB_6 = 31
|
||||
private const val BANK_TAB_7 = 29
|
||||
private const val BANK_TAB_8 = 27
|
||||
private const val BANK_TAB_9 = 25
|
||||
|
||||
private val BANK_TABS = intArrayOf(
|
||||
BANK_TAB_1, BANK_TAB_2, BANK_TAB_3,
|
||||
BANK_TAB_4, BANK_TAB_5, BANK_TAB_6,
|
||||
BANK_TAB_7, BANK_TAB_8, BANK_TAB_9
|
||||
)
|
||||
|
||||
private const val OP_SET_TAB = 155
|
||||
private const val OP_COLLAPSE_TAB = 196
|
||||
|
||||
/**
|
||||
* Allows the user to interact with the Bank Interface.
|
||||
*
|
||||
* @author vddCore
|
||||
*/
|
||||
class BankInterface : InterfaceListener {
|
||||
companion object {
|
||||
private const val MAIN_BUTTON_CLOSE = 10
|
||||
private const val MAIN_BUTTON_INSERT_MODE = 14
|
||||
private const val MAIN_BUTTON_NOTE_MODE = 16
|
||||
private const val MAIN_BUTTON_BOB_DEPOSIT = 18
|
||||
private const val MAIN_BUTTON_SEARCH_BANK = 20
|
||||
private const val MAIN_BUTTON_HELP = 23
|
||||
|
||||
private const val MENU_ELEMENT = 73
|
||||
private const val OP_AMOUNT_ONE = 155
|
||||
private const val OP_AMOUNT_FIVE = 196
|
||||
private const val OP_AMOUNT_TEN = 124
|
||||
private const val OP_AMOUNT_LAST_X = 199
|
||||
private const val OP_AMOUNT_X = 234
|
||||
private const val OP_AMOUNT_ALL = 168
|
||||
private const val OP_AMOUNT_ALL_BUT_ONE = 166
|
||||
private const val OP_EXAMINE = 9
|
||||
|
||||
private const val BANK_TAB_1 = 41
|
||||
private const val BANK_TAB_2 = 39
|
||||
private const val BANK_TAB_3 = 37
|
||||
private const val BANK_TAB_4 = 35
|
||||
private const val BANK_TAB_5 = 33
|
||||
private const val BANK_TAB_6 = 31
|
||||
private const val BANK_TAB_7 = 29
|
||||
private const val BANK_TAB_8 = 27
|
||||
private const val BANK_TAB_9 = 25
|
||||
|
||||
private val BANK_TABS = intArrayOf(
|
||||
BANK_TAB_1, BANK_TAB_2, BANK_TAB_3,
|
||||
BANK_TAB_4, BANK_TAB_5, BANK_TAB_6,
|
||||
BANK_TAB_7, BANK_TAB_8, BANK_TAB_9
|
||||
)
|
||||
|
||||
private const val OP_SET_TAB = 155
|
||||
private const val OP_COLLAPSE_TAB = 196
|
||||
}
|
||||
|
||||
private fun onBankInterfaceOpen(player: Player, component: Component): Boolean {
|
||||
player.bank.sendBankSpace();
|
||||
|
|
@ -104,10 +104,31 @@ class BankInterface : InterfaceListener {
|
|||
OP_AMOUNT_ONE -> runWorldTask { player.bank.takeItem(slot, 1) }
|
||||
OP_AMOUNT_FIVE -> runWorldTask { player.bank.takeItem(slot, 5) }
|
||||
OP_AMOUNT_TEN -> runWorldTask { player.bank.takeItem(slot, 10) }
|
||||
OP_AMOUNT_LAST_X -> runWorldTask { player.bank.takeItem(slot, player.bank.lastAmountX) }
|
||||
OP_AMOUNT_X -> runWorldTask { BankUtils.transferX(player, slot, true) }
|
||||
OP_AMOUNT_ALL -> runWorldTask { player.bank.takeItem(slot, player.bank.getAmount(item)) }
|
||||
OP_AMOUNT_ALL_BUT_ONE -> runWorldTask { player.bank.takeItem(slot, player.bank.getAmount(item) - 1) }
|
||||
OP_AMOUNT_LAST_X -> runWorldTask {
|
||||
player.bank.takeItem(
|
||||
slot,
|
||||
player.bank.lastAmountX
|
||||
)
|
||||
}
|
||||
OP_AMOUNT_X -> runWorldTask {
|
||||
BankUtils.transferX(
|
||||
player,
|
||||
slot,
|
||||
true
|
||||
)
|
||||
}
|
||||
OP_AMOUNT_ALL -> runWorldTask {
|
||||
player.bank.takeItem(
|
||||
slot,
|
||||
player.bank.getAmount(item)
|
||||
)
|
||||
}
|
||||
OP_AMOUNT_ALL_BUT_ONE -> runWorldTask {
|
||||
player.bank.takeItem(
|
||||
slot,
|
||||
player.bank.getAmount(item) - 1
|
||||
)
|
||||
}
|
||||
OP_EXAMINE -> sendMessage(player, item.definition.examine)
|
||||
else -> player.debug("Unknown bank menu opcode $opcode")
|
||||
}
|
||||
|
|
@ -152,7 +173,7 @@ class BankInterface : InterfaceListener {
|
|||
|
||||
on(Components.BANK_V2_HELP_767) { player, component, opcode, buttonID, slot, itemID ->
|
||||
when (buttonID) {
|
||||
MAIN_BUTTON_CLOSE -> player.bank.open()
|
||||
MAIN_BUTTON_CLOSE -> openBankAccount(player)
|
||||
}
|
||||
|
||||
return@on true
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package rs09.game.interaction.npc
|
||||
|
||||
import api.isEquipped
|
||||
import api.openDepositBox
|
||||
import api.sendNPCDialogue
|
||||
import api.setInterfaceText
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
|
|
@ -16,7 +17,7 @@ class NPCDepositListener : InteractionListener {
|
|||
if (isEquipped(player, Items.FREMENNIK_SEA_BOOTS_1_14571) ||
|
||||
isEquipped(player, Items.FREMENNIK_SEA_BOOTS_2_14572) ||
|
||||
isEquipped(player, Items.FREMENNIK_SEA_BOOTS_3_14573)) {
|
||||
player.bank.openDepositBox()
|
||||
openDepositBox(player)
|
||||
setInterfaceText(player, "Peer the Seer's Deposits", 11, 12)
|
||||
} else {
|
||||
sendNPCDialogue(player, NPCs.PEER_THE_SEER_1288,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import core.game.world.map.Location
|
|||
import org.rs09.consts.NPCs
|
||||
import org.rs09.consts.Scenery
|
||||
import rs09.ServerConstants
|
||||
import rs09.game.ge.GrandExchangeRecords
|
||||
import rs09.game.interaction.InteractionListener
|
||||
import rs09.game.node.entity.npc.BankerNPC
|
||||
import rs09.game.world.repository.Repository
|
||||
|
|
@ -22,7 +21,7 @@ import rs09.game.world.repository.Repository
|
|||
*
|
||||
* @author vddCore
|
||||
*/
|
||||
class BankBoothHandler : InteractionListener {
|
||||
class BankBoothListener : InteractionListener {
|
||||
|
||||
companion object {
|
||||
val INOPERABLE_BANK_BOOTHS = intArrayOf(
|
||||
|
|
@ -89,7 +88,7 @@ class BankBoothHandler : InteractionListener {
|
|||
it.faceLocation(node.location)
|
||||
openDialogue(player, it.id, NPC(it.id, it.location))
|
||||
} else {
|
||||
player.dialogueInterpreter.open(NPCs.BANKER_494)
|
||||
openDialogue(player, NPCs.BANKER_494)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -104,7 +103,7 @@ class BankBoothHandler : InteractionListener {
|
|||
return true
|
||||
}
|
||||
|
||||
player.bank.open()
|
||||
openBankAccount(player)
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
@ -127,7 +126,7 @@ class BankBoothHandler : InteractionListener {
|
|||
return true
|
||||
}
|
||||
|
||||
GrandExchangeRecords.getInstance(player).openCollectionBox()
|
||||
openGrandExchangeCollectionBox(player)
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
package rs09.game.interaction.`object`
|
||||
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.IronmanMode
|
||||
import org.rs09.consts.Scenery
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
private val BANK_CHESTS = intArrayOf(
|
||||
Scenery.BANK_CHEST_3194,
|
||||
Scenery.BANK_CHEST_4483,
|
||||
Scenery.BANK_CHEST_10562,
|
||||
Scenery.BANK_CHEST_14382,
|
||||
Scenery.BANK_CHEST_16695,
|
||||
Scenery.BANK_CHEST_16696,
|
||||
Scenery.BANK_CHEST_21301,
|
||||
Scenery.BANK_CHEST_27662,
|
||||
Scenery.BANK_CHEST_27663
|
||||
)
|
||||
|
||||
/**
|
||||
* Allows the user to interact with Bank Chests.
|
||||
*
|
||||
* @author vddCore
|
||||
*/
|
||||
class BankChestHandler : InteractionListener {
|
||||
private fun useBankChest(player: Player, node: Node): Boolean {
|
||||
if (player.ironmanManager.checkRestriction(IronmanMode.ULTIMATE)) {
|
||||
return true
|
||||
}
|
||||
|
||||
player.bank.open()
|
||||
return true
|
||||
}
|
||||
|
||||
override fun defineListeners() {
|
||||
on(BANK_CHESTS, SCENERY, "bank", "use", handler = ::useBankChest)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package rs09.game.interaction.`object`
|
||||
|
||||
import api.openBankAccount
|
||||
import org.rs09.consts.Scenery
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
private val BANK_CHESTS = intArrayOf(
|
||||
Scenery.BANK_CHEST_3194, Scenery.BANK_CHEST_4483,
|
||||
Scenery.BANK_CHEST_10562, Scenery.BANK_CHEST_14382,
|
||||
Scenery.BANK_CHEST_16695, Scenery.BANK_CHEST_16696,
|
||||
Scenery.BANK_CHEST_21301, Scenery.BANK_CHEST_27662,
|
||||
Scenery.BANK_CHEST_27663
|
||||
)
|
||||
|
||||
/**
|
||||
* Allows the user to interact with Bank Chests.
|
||||
*
|
||||
* @author vddCore
|
||||
*/
|
||||
class BankChestListener : InteractionListener {
|
||||
override fun defineListeners() {
|
||||
on(BANK_CHESTS, SCENERY, "bank", "use") { player, node ->
|
||||
openBankAccount(player)
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package rs09.game.interaction.`object`
|
||||
|
||||
import api.restrictForIronman
|
||||
import core.game.component.CloseEvent
|
||||
import core.game.component.Component
|
||||
import core.game.container.access.InterfaceContainer
|
||||
|
|
@ -25,13 +26,10 @@ private val BANK_DEPOSIT_BOXES = intArrayOf(
|
|||
*
|
||||
* @author vddCore
|
||||
*/
|
||||
class BankDepositBoxHandler : InteractionListener {
|
||||
class BankDepositBoxListener : InteractionListener {
|
||||
|
||||
private fun openDepositBox(player: Player, node: Node) : Boolean {
|
||||
if (player.ironmanManager.checkRestriction(IronmanMode.ULTIMATE)) {
|
||||
return true
|
||||
}
|
||||
|
||||
restrictForIronman(player, IronmanMode.ULTIMATE) {
|
||||
player.interfaceManager.open(Component(Components.BANK_DEPOSIT_BOX_11)).closeEvent = CloseEvent { p, _ ->
|
||||
p.interfaceManager.openDefaultTabs()
|
||||
return@CloseEvent true
|
||||
|
|
@ -50,6 +48,7 @@ class BankDepositBoxHandler : InteractionListener {
|
|||
"Deposit-1"
|
||||
), 11, 15, 5, 7
|
||||
)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
@ -1,41 +1,53 @@
|
|||
package rs09.game.node.entity.npc
|
||||
|
||||
import api.getScenery
|
||||
import api.hasSealOfPassage
|
||||
import api.openDialogue
|
||||
import api.*
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.npc.AbstractNPC
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.IronmanMode
|
||||
import core.game.world.map.Direction
|
||||
import core.game.world.map.Location
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.ge.GrandExchangeRecords
|
||||
import rs09.game.interaction.InteractionListener
|
||||
import rs09.game.interaction.`object`.BankBoothHandler
|
||||
import rs09.game.interaction.`object`.BankBoothListener
|
||||
|
||||
/**
|
||||
* Provides dialogue tree for all generic banker NPCs as well as
|
||||
* handles all the common interactions like 'bank' and 'collect'.
|
||||
*
|
||||
* @author vddCore
|
||||
*/
|
||||
@Initializable
|
||||
class BankerNPC : AbstractNPC, InteractionListener {
|
||||
companion object {
|
||||
private const val LUNAR_ISLE_BANK_REGION = 8253
|
||||
|
||||
val SPECIAL_NPC_IDS = intArrayOf(
|
||||
NPCs.SIRSAL_BANKER_4519, NPCs.FADLI_958, NPCs.BANK_TUTOR_4907, NPCs.JADE_4296,
|
||||
NPCs.EMERALD_BENEDICT_2271, NPCs.OGRESS_BANKER_7049, NPCs.OGRESS_BANKER_7050,
|
||||
NPCs.ARNOLD_LYDSPOR_3824,
|
||||
|
||||
/* Maximillian Sackville - Near Wilderness bounty-hunter area. */
|
||||
NPCs.BANKER_6538
|
||||
)
|
||||
|
||||
val NPC_IDS = intArrayOf(
|
||||
NPCs.BANKER_44, NPCs.BANKER_45, NPCs.BANKER_494, NPCs.BANKER_495, NPCs.BANKER_496, NPCs.BANKER_497,
|
||||
NPCs.BANKER_498, NPCs.BANKER_499, NPCs.BANKER_1036, NPCs.BANKER_1360, NPCs.BANKER_2163, NPCs.BANKER_2164,
|
||||
NPCs.BANKER_2354, NPCs.BANKER_2355, NPCs.BANKER_2568, NPCs.BANKER_2569, NPCs.BANKER_2570, NPCs.BANKER_3198,
|
||||
NPCs.BANKER_3199, NPCs.BANKER_5258, NPCs.BANKER_5259, NPCs.BANKER_5260, NPCs.BANKER_5261, NPCs.BANKER_5776,
|
||||
NPCs.BANKER_5777, NPCs.BANKER_5912, NPCs.BANKER_5913, NPCs.BANKER_6200, NPCs.BANKER_6532, NPCs.BANKER_6533,
|
||||
NPCs.BANKER_6534, NPCs.BANKER_6535, NPCs.BANKER_6538, NPCs.BANKER_7445, NPCs.BANKER_7446, NPCs.BANKER_7605,
|
||||
NPCs.BANKER_6534, NPCs.BANKER_6535, NPCs.BANKER_7445, NPCs.BANKER_7446, NPCs.BANKER_7605,
|
||||
NPCs.GUNDAI_902,
|
||||
|
||||
NPCs.BANK_TUTOR_4907, NPCs.JADE_4296,
|
||||
NPCs.GHOST_BANKER_1702, NPCs.GNOME_BANKER_166, NPCs.NARDAH_BANKER_3046, NPCs.MAGNUS_GRAM_5488
|
||||
)
|
||||
|
||||
NPCs.GHOST_BANKER_1702, NPCs.GNOME_BANKER_166, NPCs.NARDAH_BANKER_3046,
|
||||
NPCs.OGRESS_BANKER_7049, NPCs.OGRESS_BANKER_7050, NPCs.SIRSAL_BANKER_4519,
|
||||
|
||||
NPCs.FADLI_958, NPCs.MAGNUS_GRAM_5488
|
||||
private val ALL_BANKER_NPC_IDS = intArrayOf(
|
||||
*SPECIAL_NPC_IDS,
|
||||
*NPC_IDS
|
||||
)
|
||||
|
||||
/**
|
||||
|
|
@ -60,17 +72,13 @@ class BankerNPC : AbstractNPC, InteractionListener {
|
|||
fun attemptBank(player: Player, node: Node): Boolean {
|
||||
val npc = node as NPC
|
||||
|
||||
if (player.ironmanManager.checkRestriction(IronmanMode.ULTIMATE)) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (checkLunarIsleRestriction(player, node)) {
|
||||
openDialogue(player, npc.id, npc)
|
||||
return true
|
||||
}
|
||||
|
||||
npc.faceLocation(null)
|
||||
player.bank.open()
|
||||
openBankAccount(player)
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
@ -78,17 +86,13 @@ class BankerNPC : AbstractNPC, InteractionListener {
|
|||
fun attemptCollect(player: Player, node: Node): Boolean {
|
||||
val npc = node as NPC
|
||||
|
||||
if (player.ironmanManager.checkRestriction(IronmanMode.ULTIMATE)) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (checkLunarIsleRestriction(player, node)) {
|
||||
openDialogue(player, npc.id, npc)
|
||||
return true
|
||||
}
|
||||
|
||||
npc.faceLocation(null)
|
||||
GrandExchangeRecords.getInstance(player).openCollectionBox()
|
||||
openGrandExchangeCollectionBox(player)
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
@ -107,7 +111,7 @@ class BankerNPC : AbstractNPC, InteractionListener {
|
|||
val boothLocation = location.transform(side)
|
||||
val sceneryObject = getScenery(boothLocation)
|
||||
|
||||
if (sceneryObject != null && sceneryObject.id in BankBoothHandler.BANK_BOOTHS) {
|
||||
if (sceneryObject != null && sceneryObject.id in BankBoothListener.BANK_BOOTHS) {
|
||||
return Pair(side, boothLocation.transform(side, 1))
|
||||
}
|
||||
}
|
||||
|
|
@ -142,12 +146,12 @@ class BankerNPC : AbstractNPC, InteractionListener {
|
|||
}
|
||||
|
||||
override fun defineListeners() {
|
||||
on(NPC_IDS, NPC, "bank", handler = Companion::attemptBank)
|
||||
on(NPC_IDS, NPC, "collect", handler = Companion::attemptCollect)
|
||||
on(ALL_BANKER_NPC_IDS, NPC, "bank", handler = Companion::attemptBank)
|
||||
on(ALL_BANKER_NPC_IDS, NPC, "collect", handler = Companion::attemptCollect)
|
||||
}
|
||||
|
||||
override fun defineDestinationOverrides() {
|
||||
setDest(NPC, NPC_IDS, "bank", "collect", "talk-to", handler = ::provideDestinationOverride)
|
||||
setDest(NPC, ALL_BANKER_NPC_IDS, "bank", "collect", "talk-to", handler = ::provideDestinationOverride)
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
|
|
@ -163,5 +167,5 @@ class BankerNPC : AbstractNPC, InteractionListener {
|
|||
}
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray = NPC_IDS
|
||||
override fun getIds(): IntArray = ALL_BANKER_NPC_IDS
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package core.net.packet.`in`
|
||||
package rs09.net.packet.`in`
|
||||
|
||||
import api.sendDialogue
|
||||
import core.game.node.entity.player.Player
|
||||
|
|
@ -25,7 +25,6 @@ import rs09.game.node.entity.player.info.login.PlayerSaver
|
|||
import rs09.game.system.SystemLogger
|
||||
import rs09.game.system.SystemLogger.logStartup
|
||||
import rs09.game.world.GameWorld
|
||||
import java.util.*
|
||||
import java.util.function.Consumer
|
||||
|
||||
/**
|
||||
|
|
@ -126,30 +125,37 @@ object ClassScanner {
|
|||
|
||||
@JvmStatic
|
||||
fun loadSideEffectfulPlugins() {
|
||||
try {
|
||||
loadedPlugins!!.clear()
|
||||
loadPluginsFrom(scanResults)
|
||||
logStartup("We still have $numPlugins legacy plugins being loaded.")
|
||||
} catch (t: Throwable) {
|
||||
SystemLogger.logErr("Error initializing Plugins -> " + t.localizedMessage + " for file -> " + lastLoaded)
|
||||
t.printStackTrace()
|
||||
} catch (e: Exception) {
|
||||
SystemLogger.logErr("Error initializing Plugins -> " + e.localizedMessage + " for file -> " + lastLoaded)
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadPluginsFrom(scanResults: ScanResult) {
|
||||
scanResults.getClassesWithAnnotation("core.plugin.Initializable").forEach(Consumer { p: ClassInfo ->
|
||||
val clazz = p.loadClass().newInstance()
|
||||
if(clazz is Plugin<*>) definePlugin(clazz)
|
||||
try {
|
||||
val clazz = p.loadClass().getDeclaredConstructor().newInstance()
|
||||
if (clazz is Plugin<*>) {
|
||||
definePlugin(clazz)
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
SystemLogger.logErr("Failed to load plugin ${p.name}.");
|
||||
|
||||
if (t is NoSuchMethodException && p.superclass.simpleName == DialoguePlugin::class.simpleName) {
|
||||
SystemLogger.logErr(
|
||||
"Make sure the constructor signature matches " +
|
||||
"`${p.simpleName}(player: Player? = null) : DialoguePlugin(player)'."
|
||||
)
|
||||
}
|
||||
|
||||
t.printStackTrace()
|
||||
}
|
||||
})
|
||||
|
||||
scanResults.getClassesWithAnnotation("rs09.game.ai.general.scriptrepository.PlayerCompatible").forEach { res ->
|
||||
val description = res.getAnnotationInfo("rs09.game.ai.general.scriptrepository.ScriptDescription").parameterValues[0].value as Array<String>
|
||||
val identifier = res.getAnnotationInfo("rs09.game.ai.general.scriptrepository.ScriptIdentifier").parameterValues[0].value.toString()
|
||||
val name = res.getAnnotationInfo("rs09.game.ai.general.scriptrepository.ScriptName").parameterValues[0].value.toString()
|
||||
PlayerScripts.identifierMap[identifier] =
|
||||
PlayerScripts.PlayerScript(identifier, description, name, res.loadClass())
|
||||
PlayerScripts.identifierMap[identifier] = PlayerScripts.PlayerScript(identifier, description, name, res.loadClass())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue