From d5222bad1eb44223afaa649d63f55a40add0e4fa Mon Sep 17 00:00:00 2001 From: Oven Bread Date: Fri, 2 Jun 2023 09:17:29 +0000 Subject: [PATCH] Burthorpe immersion improvements Implemented the roaming Burthorpe soldiers dialogues, including random Latin insults Implemented the other soldiers/sergeants/archers/guards busy messages. All 10 soldiers in the square now face north towards their sergeant --- Server/data/configs/npc_spawns.json | 2 +- .../dialogue/BurthorpeBusySoldierListener.kt | 48 +++++++++++ .../dialogue/BurthorpeSoldierDialogue.java | 69 ---------------- .../dialogue/BurthorpeSoldierDialogue.kt | 81 +++++++++++++++++++ .../handlers/BurthorpeOptionPlugin.java | 41 ---------- 5 files changed, 130 insertions(+), 111 deletions(-) create mode 100644 Server/src/main/content/region/asgarnia/burthorpe/dialogue/BurthorpeBusySoldierListener.kt delete mode 100644 Server/src/main/content/region/asgarnia/burthorpe/dialogue/BurthorpeSoldierDialogue.java create mode 100644 Server/src/main/content/region/asgarnia/burthorpe/dialogue/BurthorpeSoldierDialogue.kt diff --git a/Server/data/configs/npc_spawns.json b/Server/data/configs/npc_spawns.json index d3b2db10a..b8f1c0c5f 100644 --- a/Server/data/configs/npc_spawns.json +++ b/Server/data/configs/npc_spawns.json @@ -2617,7 +2617,7 @@ }, { "npc_id": "1064", - "loc_data": "{2895,3537,0,0,5}-{2894,3537,0,0,5}-{2893,3537,0,0,5}-{2892,3537,0,0,5}-{2891,3537,0,0,3}-{2891,3538,0,0,3}-{2892,3538,0,0,3}-{2893,3538,0,0,3}-{2894,3538,0,0,3}-{2895,3538,0,0,3}" + "loc_data": "{2895,3537,0,0,1}-{2894,3537,0,0,1}-{2893,3537,0,0,1}-{2892,3537,0,0,1}-{2891,3537,0,0,1}-{2891,3538,0,0,1}-{2892,3538,0,0,1}-{2893,3538,0,0,1}-{2894,3538,0,0,1}-{2895,3538,0,0,1}" }, { "npc_id": "1065", diff --git a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/BurthorpeBusySoldierListener.kt b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/BurthorpeBusySoldierListener.kt new file mode 100644 index 000000000..47982972f --- /dev/null +++ b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/BurthorpeBusySoldierListener.kt @@ -0,0 +1,48 @@ +package content.region.asgarnia.burthorpe.dialogue + +import core.api.* +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import org.rs09.consts.NPCs + +/** + * Burthorpe Busy Soldiers Messages + * @author ovenbread + * + * https://www.youtube.com/watch?v=5RfEUmIdH10 for some busy interactions + * Covers the Sergeant/TrainingSoldier/EatingSoldier/Archer/Guard cases. + * These NPCs do not talk to you as they are busy. + */ +class BurthorpeBusySoldierListener: InteractionListener { + override fun defineListeners() { + // For sergeants. + on(intArrayOf(NPCs.SERGEANT_1061, NPCs.SERGEANT_1062), IntType.NPC, "talk-to") { player, npc -> + sendMessage(player, "The Sergeant is busy training the soldiers.") + return@on true + } + + // For soldiers training. + on(intArrayOf(NPCs.SOLDIER_1063, NPCs.SOLDIER_1064), IntType.NPC, "talk-to") { player, npc -> + sendMessage(player, "The soldier is busy training.") + return@on true + } + + // For soldiers sitting around the fire. + on(intArrayOf(NPCs.SOLDIER_1066, NPCs.SOLDIER_1067, NPCs.SOLDIER_1068), IntType.NPC, "talk-to") { player, npc -> + sendMessage(player, "The soldier is busy eating.") + return@on true + } + + // For archers at the castle. + on(intArrayOf(NPCs.ARCHER_1073, NPCs.ARCHER_1074), IntType.NPC, "talk-to") { player, npc -> + sendMessage(player, "The archer won't talk whilst on duty.") + return@on true + } + + // For soldiers at the castle. + on(intArrayOf(NPCs.GUARD_1076, NPCs.GUARD_1077), IntType.NPC, "talk-to") { player, npc -> + sendMessage(player, "The guard won't talk whilst on duty.") + return@on true + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/BurthorpeSoldierDialogue.java b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/BurthorpeSoldierDialogue.java deleted file mode 100644 index b34e156ce..000000000 --- a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/BurthorpeSoldierDialogue.java +++ /dev/null @@ -1,69 +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 burthorpe soldier dialogue plugin. - * @author 'Vexia - * @version 1.0 - */ -@Initializable -public final class BurthorpeSoldierDialogue extends DialoguePlugin { - - /** - * Constructs a new {@code BurthorpeSoldierDialogue} {@code Object}. - */ - public BurthorpeSoldierDialogue() { - /** - * empty. - */ - } - - /** - * Constructs a new {@code BurthorpeSoldierDialogue} {@code Object}. - * @param player the player. - */ - public BurthorpeSoldierDialogue(Player player) { - super(player); - } - - @Override - public DialoguePlugin newInstance(Player player) { - return new BurthorpeSoldierDialogue(player); - } - - @Override - public boolean open(Object... args) { - npc = (NPC) args[0]; - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Hi!"); - stage = 0; - return true; - } - - @Override - public boolean handle(int interfaceId, int buttonId) { - switch (stage) { - case 0: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Vacca foeda."); - stage = 1; - break; - case 1: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Er..."); - stage = 2; - break; - case 2: - end(); - break; - } - return true; - } - - @Override - public int[] getIds() { - return new int[] { 1065 }; - } -} diff --git a/Server/src/main/content/region/asgarnia/burthorpe/dialogue/BurthorpeSoldierDialogue.kt b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/BurthorpeSoldierDialogue.kt new file mode 100644 index 000000000..fde4e6afe --- /dev/null +++ b/Server/src/main/content/region/asgarnia/burthorpe/dialogue/BurthorpeSoldierDialogue.kt @@ -0,0 +1,81 @@ +package content.region.asgarnia.burthorpe.dialogue + +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 + +/** + * Burthorpe Soldier Dialogue + * @author 'Vexia + * @author ovenbread + * + * https://www.youtube.com/watch?v=5RfEUmIdH10 for full interaction + * https://www.youtube.com/watch?v=ew0wTgv-2Kc for insults + */ +@Initializable +class BurthorpeSoldierDialogue(player: Player? = null) : DialoguePlugin(player) { + + companion object { + val latinInsults = arrayOf( + "Mihi ignosce. Cum homine de cane debeo congredi.", + "Errare humanum est.", + "Die dulci freure.", + "Carpe Diem!", + "Te audire non possum. Musa sapientum fixa est in aure.", + "Furnulum pani nolo.", + "Fac ut gaudeam.", + "Utinam barbari spatium proprium tuum invadant!", + "Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?", + "Sona si Latine loqueris.", + "Raptus Regaliter", + "Nemo dat quod non habet.", + "Ne auderis delere orbem rigidum meum!", + "Da mihi sis bubulae frustum assae, solana tuberosa in modo gallico fricta, ac quassum lactatum coagulatum crassum.", + "Cogito ergo sum.", + "Vacca foeda.", + "Di! Ecce hora! Uxor mea me necabit!", + "Latine loqui coactus sum.", + "Cave ne ante ullas catapultas ambules.", + "Fac ut vivas!", + "Noli me vocare, ego te vocabo.", + "Meliora cogito.", + "Braccae tuae aperiuntur.", + "Vescere bracis meis.", + "Corripe cervisiam!", + ); + + val randomStages = arrayOf(10, 20, 30, 40, 50); + } + + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + when (stage) { + START_DIALOGUE -> playerl(FacialExpression.FRIENDLY, "Hello!").also { stage++ } + 1 -> npcl(FacialExpression.ANGRY, latinInsults.random()).also { stage = randomStages.random() } + + 10 -> playerl(FacialExpression.THINKING, "What?!").also { stage = END_DIALOGUE } + + 20 -> playerl(FacialExpression.THINKING, "Huh?!").also { stage = END_DIALOGUE } + + 30 -> playerl(FacialExpression.HALF_GUILTY, "Er...").also { stage = END_DIALOGUE } + + 40 -> playerl(FacialExpression.HALF_GUILTY, "OK...").also { stage = END_DIALOGUE } + + 50 -> playerl(FacialExpression.THINKING, "Are you insulting me in Latin?").also { stage++ } + 51 -> npcl(FacialExpression.FRIENDLY, "Yes!").also { stage++ } + 52 -> playerl(FacialExpression.HALF_GUILTY, "Hmm...").also { stage = END_DIALOGUE } + } + return true + } + + override fun newInstance(player: Player?): DialoguePlugin { + return BurthorpeSoldierDialogue(player) + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.SOLDIER_1065) + } +} \ No newline at end of file diff --git a/Server/src/main/content/region/asgarnia/burthorpe/handlers/BurthorpeOptionPlugin.java b/Server/src/main/content/region/asgarnia/burthorpe/handlers/BurthorpeOptionPlugin.java index 5af1f46d6..d12520947 100644 --- a/Server/src/main/content/region/asgarnia/burthorpe/handlers/BurthorpeOptionPlugin.java +++ b/Server/src/main/content/region/asgarnia/burthorpe/handlers/BurthorpeOptionPlugin.java @@ -34,28 +34,12 @@ public final class BurthorpeOptionPlugin extends OptionHandler { @Override public Plugin newInstance(Object arg) throws Throwable { - NPCDefinition.forId(1063).getHandlers().put("option:talk-to", this);// soldier - NPCDefinition.forId(1061).getHandlers().put("option:talk-to", this);// sergant - NPCDefinition.forId(1066).getHandlers().put("option:talk-to", this);// seated - // soldier - NPCDefinition.forId(1067).getHandlers().put("option:talk-to", this);// seated - // soldier - NPCDefinition.forId(1068).getHandlers().put("option:talk-to", this);// seated - // soldier - NPCDefinition.forId(1064).getHandlers().put("option:talk-to", this);// other - // soldiers - NPCDefinition.forId(1062).getHandlers().put("option:talk-to", this);// other - // sergant SceneryDefinition.forId(7257).getHandlers().put("option:enter", this);// thieving // guide // trapdoor. SceneryDefinition.forId(7258).getHandlers().put("option:enter", this);// thieving // guide // passegeway. - NPCDefinition.forId(1073).getHandlers().put("option:talk-to", this); - NPCDefinition.forId(1074).getHandlers().put("option:talk-to", this); - NPCDefinition.forId(1076).getHandlers().put("option:talk-to", this); - NPCDefinition.forId(1077).getHandlers().put("option:talk-to", this); SceneryDefinition.forId(4624).getHandlers().put("option:climb-down", this); SceneryDefinition.forId(4627).getHandlers().put("option:climb-down", this); return this; @@ -89,31 +73,6 @@ public final class BurthorpeOptionPlugin extends OptionHandler { break; } break; - case "talk-to": - switch (id) { - case 1064: - case 1063:// training soldier. - player.getPacketDispatch().sendMessage("The soldier is busy training."); - break; - case 1062: - case 1061:// sergeant - player.getPacketDispatch().sendMessage("The Sergeant is busy training the soldiers."); - break; - case 1066:// eating soldier. - case 1067:// eating soldier. - case 1068:// eating soldier. - player.getPacketDispatch().sendMessage("The soldier is busy eating."); - break; - case 1073: - case 1074: - player.getPacketDispatch().sendMessage("The archer won't talk whilst on duty."); - break; - case 1076: - case 1077: - player.getPacketDispatch().sendMessage("The soldier won't talk whilst on duty."); - break; - } - break; } return true; }