diff --git a/Server/data/configs/item_configs.json b/Server/data/configs/item_configs.json index 009f97dfa..9e77e8647 100644 --- a/Server/data/configs/item_configs.json +++ b/Server/data/configs/item_configs.json @@ -19920,7 +19920,7 @@ }, { "ge_buy_limit": "100", - "examine": "Common bucket: It's a bucket of water.2008 Easter event: It's a bucket of water from the Easter Bunny's warren. Regular bucket filled from Braindeath Island: It's a bucket of... water?", + "examine": "It's a bucket of water.", "grand_exchange_price": "72", "durability": null, "name": "Bucket of water", @@ -49283,7 +49283,7 @@ "id": "5517" }, { - "examine": "When empty:", + "examine": "This contains mystical teleport information...", "durability": null, "name": "Scrying orb", "weight": "1", @@ -49291,7 +49291,7 @@ "id": "5518" }, { - "examine": "When empty:", + "examine": "This orb apparently contains a cypher spell.", "durability": null, "name": "Scrying orb", "weight": "1", diff --git a/Server/data/configs/npc_configs.json b/Server/data/configs/npc_configs.json index 9f1ab584b..37d38e80a 100644 --- a/Server/data/configs/npc_configs.json +++ b/Server/data/configs/npc_configs.json @@ -72515,5 +72515,15 @@ "combat_audio": "12,3295,3287", "id": "6744", "defence_animation": "7559" + }, + { + "examine": "Distinctly heroic.", + "name": "Achietties", + "id": "796" + }, + { + "examine": "The hat is a dead give away.", + "name": "Wizard Cromperty", + "id": "2328" } ] \ No newline at end of file diff --git a/Server/data/configs/npc_spawns.json b/Server/data/configs/npc_spawns.json index e0ba93b0b..78c2b1400 100644 --- a/Server/data/configs/npc_spawns.json +++ b/Server/data/configs/npc_spawns.json @@ -2171,6 +2171,10 @@ "npc_id": "794", "loc_data": "{2793,3191,0,1,3}" }, + { + "npc_id": "796", + "loc_data": "{2903,3511,0,1,3}" + }, { "npc_id": "797", "loc_data": "{2900,3511,1,1,6}" diff --git a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/AchiettiesDialogue.kt b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/AchiettiesDialogue.kt index 50dedafc4..a4585b87e 100644 --- a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/AchiettiesDialogue.kt +++ b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/AchiettiesDialogue.kt @@ -1,29 +1,22 @@ -package content.region.asgarnia.burthorpe.dialogue - +import core.api.openDialogue +import core.game.dialogue.DialogueBuilder +import core.game.dialogue.DialogueBuilderFile import core.game.dialogue.DialoguePlugin import core.game.dialogue.FacialExpression -import core.game.node.entity.npc.NPC import core.game.node.entity.player.Player import core.plugin.Initializable +import org.rs09.consts.NPCs /** * @author qmqz + * @author Trident101 */ @Initializable class AchiettiesDialogue(player: Player? = null) : DialoguePlugin(player){ - override fun open(vararg args: Any?): Boolean { - npc = args[0] as NPC - npc(FacialExpression.FRIENDLY,"Greetings. Welcome to the Heroes' Guild.") - stage = 99 - return true - } - override fun handle(interfaceId: Int, buttonId: Int): Boolean { - when(stage){ - 99 -> end() - } + openDialogue(player, AchiettiesDialogueFile(), npc) return true } @@ -32,6 +25,15 @@ class AchiettiesDialogue(player: Player? = null) : DialoguePlugin(player){ } override fun getIds(): IntArray { - return intArrayOf(796) + return intArrayOf(NPCs.ACHIETTIES_796) + } +} + +class AchiettiesDialogueFile : DialogueBuilderFile() { + + override fun create(b: DialogueBuilder) { + b.defaultDialogue().npcl(FacialExpression.FRIENDLY, + "Greetings. Welcome to the Heroes' Guild." + ) } } \ No newline at end of file diff --git a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/AntonDialogue.java b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/AntonDialogue.java deleted file mode 100644 index 9ef0cf071..000000000 --- a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/AntonDialogue.java +++ /dev/null @@ -1,69 +0,0 @@ -package content.region.asgarnia.burthorpe.dialogue; - -import core.game.dialogue.DialoguePlugin; -import core.game.node.entity.npc.NPC; -import core.plugin.Initializable; -import core.game.node.entity.player.Player; - -/** - * Represents the dialogue plugin used to handle the anton npc. - * @author 'Vexia - * @version 1.0 - */ -@Initializable -public final class AntonDialogue extends DialoguePlugin { - - /** - * Constructs a new {@code AntonDialogue} {@code Object}. - */ - public AntonDialogue() { - /** - * empty. - */ - } - - /** - * Constructs a new {@code AntonDialogue} {@code Object}. - * @param player the player. - */ - public AntonDialogue(Player player) { - super(player); - } - - @Override - public DialoguePlugin newInstance(Player player) { - return new AntonDialogue(player); - } - - @Override - public boolean open(Object... args) { - npc = (NPC) args[0]; - npc("Ahhh, hello there. How can I help?"); - stage = 0; - return true; - } - - @Override - public boolean handle(int interfaceId, int buttonId) { - switch (stage) { - case 0: - player("Looks like you have a good", "selection of weapons around here..."); - stage = 1; - break; - case 1: - npc("Indeed so, specially imported from the finest smiths", "around the lands, take a look at my wares."); - stage = 2; - break; - case 2: - end(); - npc.openShop(player); - break; - } - return true; - } - - @Override - public int[] getIds() { - return new int[] { 4295 }; - } -} diff --git a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/AntonDialogue.kt b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/AntonDialogue.kt new file mode 100644 index 000000000..f777ba082 --- /dev/null +++ b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/AntonDialogue.kt @@ -0,0 +1,45 @@ +package content.region.asgarnia.burthorpe.dialogue + +import core.api.openDialogue +import core.api.openNpcShop +import core.game.dialogue.DialogueBuilder +import core.game.dialogue.DialogueBuilderFile +import core.game.dialogue.DialoguePlugin +import core.game.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.plugin.Initializable +import org.rs09.consts.NPCs + +@Initializable +class AntonDialogue(player: Player? = null) : DialoguePlugin(player) { + + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + openDialogue(player, AntonDialogueFile(), npc) + return true + } + + override fun newInstance(player: Player?): DialoguePlugin { + return AntonDialogue(player) + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.ANTON_4295) + } +} + +class AntonDialogueFile : DialogueBuilderFile() { + + override fun create(b: DialogueBuilder) { + b.defaultDialogue().npcl( + FacialExpression.ASKING, + "Ahhh, hello there. How can I help?") + .playerl(FacialExpression.NEUTRAL, + "Looks like you have a good selection of weapons around here...") + .npcl(FacialExpression.FRIENDLY, + "Indeed so, specially imported from the finest smiths around the lands, take a look at my wares.") + .endWith { _, player -> + openNpcShop(player, NPCs.ANTON_4295) + end() + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/LidioDialogue.java b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/LidioDialogue.java deleted file mode 100644 index 6124dbf0c..000000000 --- a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/LidioDialogue.java +++ /dev/null @@ -1,66 +0,0 @@ -package content.region.asgarnia.burthorpe.dialogue; - -import core.game.dialogue.DialoguePlugin; -import core.game.dialogue.FacialExpression; -import core.game.node.entity.npc.NPC; -import core.plugin.Initializable; -import core.game.node.entity.player.Player; - -/** - * Represents the dialogue plugin used for the lidio npc. - * @author 'Vexia - * @version 1.0 - */ -@Initializable -public final class LidioDialogue extends DialoguePlugin { - - /** - * Constructs a new {@code LidioDialogue} {@code Object}. - */ - public LidioDialogue() { - /** - * empty. - */ - } - - /** - * Constructs a new {@code LidioDialogue} {@code Object}. - * @param player the player. - */ - public LidioDialogue(Player player) { - super(player); - } - - @Override - public DialoguePlugin newInstance(Player player) { - return new LidioDialogue(player); - } - - @Override - public boolean open(Object... args) { - npc = (NPC) args[0]; - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Greetings, warrior, how can I fill your stomach today?"); - stage = 0; - return true; - } - - @Override - public boolean handle(int interfaceId, int buttonId) { - switch (stage) { - case 0: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "With food preferrable."); - stage = 1; - break; - case 1: - end(); - npc.openShop(player); - break; - } - return true; - } - - @Override - public int[] getIds() { - return new int[] { 4293 }; - } -} diff --git a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/LidioDialogue.kt b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/LidioDialogue.kt new file mode 100644 index 000000000..c6c76e0f8 --- /dev/null +++ b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/LidioDialogue.kt @@ -0,0 +1,42 @@ +package content.region.asgarnia.burthorpe.dialogue + +import core.api.openDialogue +import core.api.openNpcShop +import core.game.dialogue.DialogueBuilder +import core.game.dialogue.DialogueBuilderFile +import core.game.dialogue.DialoguePlugin +import core.game.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.plugin.Initializable +import org.rs09.consts.NPCs + +@Initializable +class LidioDialogue(player: Player? = null) : DialoguePlugin(player) { + + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + openDialogue(player, LidioDialogueFile(), npc) + return true + } + + override fun newInstance(player: Player?): DialoguePlugin { + return LidioDialogue(player) + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.LIDIO_4293) + } +} + +class LidioDialogueFile : DialogueBuilderFile() { + + override fun create(b: DialogueBuilder) { + b.defaultDialogue().npcl(FacialExpression.ASKING, + "Greetings, warrior, how can I fill your stomach today?" + ).playerl(FacialExpression.NEUTRAL, + "With food preferrable." + ).endWith { _, player -> + openNpcShop(player, NPCs.LIDIO_4293) + end() + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/ServantDialogue.kt b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/ServantDialogue.kt index 205f31c41..cc3ac53e3 100644 --- a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/ServantDialogue.kt +++ b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/ServantDialogue.kt @@ -1,27 +1,25 @@ package content.region.asgarnia.burthorpe.dialogue +import core.api.openDialogue +import core.game.dialogue.DialogueBuilder +import core.game.dialogue.DialogueBuilderFile import core.game.dialogue.DialoguePlugin import core.game.dialogue.FacialExpression import core.game.node.entity.player.Player import core.plugin.Initializable -import core.tools.END_DIALOGUE -import core.tools.START_DIALOGUE import org.rs09.consts.NPCs /** * Servant Dialogue * @author 'Vexia * @author ovenbread + * @author Trident101 */ @Initializable class ServantDialogue(player: Player? = null) : DialoguePlugin(player) { + override fun handle(interfaceId: Int, buttonId: Int): Boolean { - when (stage) { - START_DIALOGUE -> playerl(FacialExpression.FRIENDLY, "Hi!").also { stage++ } - 1 -> npcl(FacialExpression.HALF_GUILTY, "Hi").also { stage++ } - 2 -> npcl(FacialExpression.HALF_GUILTY, "Look, I'd better not talk. I'll get in trouble.").also { stage++ } - 3 -> npcl(FacialExpression.HALF_GUILTY, "If you want someone to show you round the castle ask Eohric, the Head Servant.").also { stage = END_DIALOGUE } - } + openDialogue(player, ServantDialogueFile(), npc) return true } @@ -33,3 +31,22 @@ class ServantDialogue(player: Player? = null) : DialoguePlugin(player) { return intArrayOf(NPCs.SERVANT_1081) } } + +class ServantDialogueFile : DialogueBuilderFile() { + + override fun create(b: DialogueBuilder) { + b.defaultDialogue().playerl( + FacialExpression.HALF_GUILTY, + "Hi!" + ).npcl( + FacialExpression.HALF_GUILTY, + "Hi." + ).npcl( + FacialExpression.HALF_GUILTY, + "Look, I'd better not talk. I'll get in trouble." + ).npcl( + FacialExpression.HALF_GUILTY, + "If you want someone to show you round the castle ask Eohric, the Head Servant." + ) + } +} diff --git a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/UnferthDialogue.kt b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/UnferthDialogue.kt index 58252f0cd..84b26124e 100644 --- a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/UnferthDialogue.kt +++ b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/UnferthDialogue.kt @@ -1,5 +1,9 @@ package content.region.asgarnia.burthorpe.dialogue +import core.api.isQuestComplete +import core.api.openDialogue +import core.game.dialogue.DialogueBuilder +import core.game.dialogue.DialogueBuilderFile import core.game.dialogue.DialoguePlugin import core.game.dialogue.FacialExpression import core.game.node.entity.player.Player @@ -11,23 +15,13 @@ import org.rs09.consts.NPCs /** * Unferth Dialogue * @author ovenbread + * @author Trident101 */ @Initializable class UnferthDialogue(player: Player? = null) : DialoguePlugin(player) { + override fun handle(interfaceId: Int, buttonId: Int): Boolean { -// when (stage) { -// START_DIALOGUE -> playerl(FacialExpression.FRIENDLY, "Hi Unferth. How are you doing?").also { stage++ } -// 1 -> npcl(FacialExpression.FRIENDLY, "It's just not the same without Bob around.").also { stage++ } -// 2 -> playerl(FacialExpression.FRIENDLY, "I'm so sorry Unferth.").also { stage++ } -// 3 -> npcl(FacialExpression.FRIENDLY, "Gertrude asked me if I'd like one of her new kittens. I don't think I'm ready for that yet.").also { stage++ } -// 4 -> playerl(FacialExpression.FRIENDLY, "Give it time. Things will get better, I promise.").also { stage++ } -// 5 -> npcl(FacialExpression.FRIENDLY, "Thanks, ${player.username}.").also { stage = END_DIALOGUE } -// } - when (stage) { - START_DIALOGUE -> npcl(FacialExpression.GUILTY, "Hello.").also { stage++ } - 1 -> playerl(FacialExpression.FRIENDLY, "What's wrong?").also { stage++ } - 2 -> npcl(FacialExpression.GUILTY, "It's fine. Nothing for you to worry about.").also { stage = END_DIALOGUE } - } + openDialogue(player, UnferthDialogueFile(), npc) return true } @@ -39,3 +33,34 @@ class UnferthDialogue(player: Player? = null) : DialoguePlugin(player) { return intArrayOf(NPCs.UNFERTH_2655) } } + +class UnferthDialogueFile : DialogueBuilderFile() { + + override fun create(b: DialogueBuilder) { + b.onPredicate { player -> isQuestComplete(player, "A Tail of Two Cats") }.playerl( + FacialExpression.FRIENDLY, "Hi Unferth. How are you doing?" + ).npcl( + FacialExpression.GUILTY, "It's just not the same without Bob around." + ).playerl( + FacialExpression.HALF_GUILTY, "I'm so sorry Unferth." + ).npcl( + FacialExpression.HALF_GUILTY, + "Gertrude asked me if I'd like one of her new kittens. I don't think I'm ready for that yet." + ).playerl( + FacialExpression.FRIENDLY, "Give it time. Things will get better, I promise." + ).npcl( + FacialExpression.HALF_GUILTY, "Thanks, @name." + ).end() + + b.defaultDialogue().npcl( + FacialExpression.GUILTY, + "Hello." + ).playerl( + FacialExpression.FRIENDLY, + "What's wrong?" + ).npcl( + FacialExpression.GUILTY, + "It's fine. Nothing for you to worry about." + ).end() + } +} \ No newline at end of file diff --git a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/WistanDialogue.kt b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/WistanDialogue.kt index 97b3f2730..66fde48af 100644 --- a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/WistanDialogue.kt +++ b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/WistanDialogue.kt @@ -1,33 +1,26 @@ package content.region.asgarnia.burthorpe.dialogue +import core.api.openDialogue +import core.api.openNpcShop +import core.game.dialogue.DialogueBuilder +import core.game.dialogue.DialogueBuilderFile import core.game.dialogue.DialoguePlugin import core.game.dialogue.FacialExpression import core.game.node.entity.player.Player import core.plugin.Initializable -import core.tools.END_DIALOGUE -import core.tools.START_DIALOGUE import org.rs09.consts.NPCs /** * Represents the Wistan dialogue plugin. * @author 'Vexia * @author ovenbread + * @author Trident101 */ @Initializable class WistanDialogue(player: Player? = null) : DialoguePlugin(player) { override fun handle(interfaceId: Int, buttonId: Int): Boolean { - when (stage) { - START_DIALOGUE -> playerl(FacialExpression.FRIENDLY, "Hi!").also { stage++ } - 1 -> npcl(FacialExpression.FRIENDLY, "Welcome to Burthorpe Supplies. Your last shop before heading north into the mountains!").also { stage++ } - 2 -> npcl(FacialExpression.FRIENDLY, "Would you like to buy something?").also { stage++ } - 3 -> options("Yes, please.", "No, thanks.").also { stage++ } - 4 -> when (buttonId) { - 1 -> playerl(FacialExpression.FRIENDLY, "Yes, please.").also { stage = 5 } - 2 -> playerl(FacialExpression.FRIENDLY, "No, thanks.").also { stage = END_DIALOGUE } - } - 5 -> npc.openShop(player).also { stage = END_DIALOGUE } - } + openDialogue(player, WistanDialogueFile(), npc) return true } @@ -39,3 +32,24 @@ class WistanDialogue(player: Player? = null) : DialoguePlugin(player) { return intArrayOf(NPCs.WISTAN_1083) } } + +class WistanDialogueFile : DialogueBuilderFile() { + + override fun create(b: DialogueBuilder) { + b.defaultDialogue().playerl( + FacialExpression.FRIENDLY, "Hi!" + ).npcl( + FacialExpression.FRIENDLY, + "Welcome to Burthorpe Supplies. Your last shop before heading north into the mountains!" + ).npcl( + FacialExpression.FRIENDLY, "Would you like to buy something?" + ).options().let { optionsBuilder -> + optionsBuilder.option("Yes, please.").playerl( + FacialExpression.FRIENDLY, "Yes, Please" + ).endWith { _, player -> openNpcShop(player, NPCs.WISTAN_1083) } + optionsBuilder.option("No, thanks.").playerl( + FacialExpression.FRIENDLY, "No, thanks." + ).end() + } + } +} \ No newline at end of file diff --git a/Server/src/main/core/game/dialogue/DialogueBuilder.kt b/Server/src/main/core/game/dialogue/DialogueBuilder.kt index f99c1bd8e..f1051e45a 100644 --- a/Server/src/main/core/game/dialogue/DialogueBuilder.kt +++ b/Server/src/main/core/game/dialogue/DialogueBuilder.kt @@ -300,6 +300,9 @@ class DialogueBuilder(var target: DialogueBuilderFile, var clauseIndex: Int = -1 clauseIndex = target.data.size - 1 return this } + fun defaultDialogue(): DialogueBuilder { + return onPredicate({ _ -> return@onPredicate true}) + } fun onQuestStages(name: String, vararg stages: Int): DialogueBuilder { return onPredicate() { player -> val questStage = player.questRepository.getStage(name)