From c00ff239c153458ee1524ccadb1cdd716f1865d8 Mon Sep 17 00:00:00 2001 From: Ceikry Date: Wed, 10 Mar 2021 09:51:10 -0600 Subject: [PATCH] Redid King Ronald McDonald's file as well as Duke Horacisto --- .../allfiredup/KingRoaldAFUMiniDialogue.kt | 47 ++ .../game/content/dialogue/DialogueFile.kt | 39 +- .../content/dialogue/DialogueInterpreter.java | 7 + .../game/content/dialogue/DialoguePlugin.java | 42 +- .../content/dialogue/DukeHoracioDialogue.kt | 86 +++ .../content/dialogue/KingRoaldDialogue.kt | 86 +++ .../game/content/dialogue/MistagDialogue.kt | 50 +- .../quest/free/dragonslayer/DragonSlayer.java | 1 + .../dragonslayer/DukeHoracioDSDialogue.kt | 98 ++++ .../dragonslayer/DukeHoracioDialogue.java | 552 ------------------ .../runemysteries/DukeHoracioRMDialogue.kt | 67 +++ .../{ => runemysteries}/RuneMysteries.java | 2 +- .../shieldofarrav/KingRoaldArravDialogue.kt | 58 ++ .../free/shieldofarrav/KingRoaldDialogue.java | 516 ---------------- .../free/shieldofarrav/ShieldofArrav.java | 1 + .../allfiredup/KingRoaldAFUDialogue.kt | 115 ++++ .../priestinperil/KingRoaldPIPDialogue.kt | 94 +++ .../{ => priestinperil}/PriestInPeril.java | 2 +- .../thelosttribe/DukeHoracioTLTDialogue.kt | 230 ++++++++ .../members/thelosttribe/MistagLTDialogue.kt | 51 ++ .../java/Server/core/tools/DialogueConst.kt | 7 +- 21 files changed, 1038 insertions(+), 1113 deletions(-) create mode 100644 Server/src/main/java/Server/core/game/content/activity/allfiredup/KingRoaldAFUMiniDialogue.kt create mode 100644 Server/src/main/java/Server/core/game/content/dialogue/DukeHoracioDialogue.kt create mode 100644 Server/src/main/java/Server/core/game/content/dialogue/KingRoaldDialogue.kt create mode 100644 Server/src/main/java/Server/core/game/content/quest/free/dragonslayer/DukeHoracioDSDialogue.kt delete mode 100644 Server/src/main/java/Server/core/game/content/quest/free/dragonslayer/DukeHoracioDialogue.java create mode 100644 Server/src/main/java/Server/core/game/content/quest/free/runemysteries/DukeHoracioRMDialogue.kt rename Server/src/main/java/Server/core/game/content/quest/free/{ => runemysteries}/RuneMysteries.java (99%) create mode 100644 Server/src/main/java/Server/core/game/content/quest/free/shieldofarrav/KingRoaldArravDialogue.kt delete mode 100644 Server/src/main/java/Server/core/game/content/quest/free/shieldofarrav/KingRoaldDialogue.java create mode 100644 Server/src/main/java/Server/core/game/content/quest/members/allfiredup/KingRoaldAFUDialogue.kt create mode 100644 Server/src/main/java/Server/core/game/content/quest/members/priestinperil/KingRoaldPIPDialogue.kt rename Server/src/main/java/Server/core/game/content/quest/members/{ => priestinperil}/PriestInPeril.java (99%) create mode 100644 Server/src/main/java/Server/core/game/content/quest/members/thelosttribe/DukeHoracioTLTDialogue.kt create mode 100644 Server/src/main/java/Server/core/game/content/quest/members/thelosttribe/MistagLTDialogue.kt diff --git a/Server/src/main/java/Server/core/game/content/activity/allfiredup/KingRoaldAFUMiniDialogue.kt b/Server/src/main/java/Server/core/game/content/activity/allfiredup/KingRoaldAFUMiniDialogue.kt new file mode 100644 index 000000000..1214d9cda --- /dev/null +++ b/Server/src/main/java/Server/core/game/content/activity/allfiredup/KingRoaldAFUMiniDialogue.kt @@ -0,0 +1,47 @@ +package core.game.content.activity.allfiredup + +import core.game.content.dialogue.DialogueFile +import core.game.node.item.Item +import core.tools.END_DIALOGUE +import core.tools.Items +import core.tools.START_DIALOGUE + +class KingRoaldAFUMiniDialogue : DialogueFile() { + override fun handle(componentID: Int, buttonID: Int) { + when(stage){ + START_DIALOGUE -> npc("Did what?").also { stage++ } + 1 -> { + if (player!!.getAttribute("afu-mini:adze", false)) { + player("I lit all 14 beacons at once!") + } else if (player!!.getAttribute("afu-mini:gloves", false)) { + player("I lit 10 beacons at once!") + } else if (player!!.getAttribute("afu-mini:ring", false)) { + player("I lit 6 beacons at once!") + } + stage++ + } + + 2 -> { + npc("Oh, wonderful! Here is your reward then.") + if (player!!.getAttribute( + "afu-mini:adze", + false + ) + ) if (player!!.inventory.add(Item(Items.INFERNO_ADZE_13661))) player!!.removeAttribute("afu-mini:adze") + if (player!!.getAttribute( + "afu-mini:gloves", + false + ) + ) if (player!!.inventory.add(Item(Items.FLAME_GLOVES_13660))) player!!.removeAttribute("afu-mini:gloves") + if (player!!.getAttribute( + "afu-mini:ring", + false + ) + ) if (player!!.inventory.add(Item(Items.RING_OF_FIRE_13659))) player!!.removeAttribute("afu-mini:ring") + stage = END_DIALOGUE + } + + END_DIALOGUE -> end() + } + } +} \ No newline at end of file diff --git a/Server/src/main/java/Server/core/game/content/dialogue/DialogueFile.kt b/Server/src/main/java/Server/core/game/content/dialogue/DialogueFile.kt index 10f47b69f..1b7ce1a14 100644 --- a/Server/src/main/java/Server/core/game/content/dialogue/DialogueFile.kt +++ b/Server/src/main/java/Server/core/game/content/dialogue/DialogueFile.kt @@ -1,21 +1,22 @@ package core.game.content.dialogue import core.game.component.Component +import core.game.node.entity.Entity import core.game.node.entity.npc.NPC import core.game.node.entity.player.Player +import core.tools.START_DIALOGUE abstract class DialogueFile { var player: Player? = null var npc: NPC? = null var interpreter: DialogueInterpreter? = null - var stage = 0 + var stage = START_DIALOGUE abstract fun handle(componentID: Int, buttonID: Int) fun load(player: Player, npc: NPC, interpreter: DialogueInterpreter): DialogueFile{ - val newFile = this::class.java.newInstance() - newFile.player = player - newFile.npc = npc - newFile.interpreter = interpreter - return newFile + this.player = player + this.npc = npc + this.interpreter = interpreter + return this } open fun npc(vararg messages: String?): Component? { @@ -53,4 +54,30 @@ abstract class DialogueFile { fun end(){ if(interpreter != null) interpreter!!.close() } + + open fun sendNormalDialogue(entity: Entity?, expression: FacialExpression?, vararg messages: String?) { + interpreter!!.sendDialogues(entity, expression, *messages) + } + + open fun options(vararg options: String?) { + interpreter!!.sendOptions("Select an Option", *options) + } + + /** + * Use in place of setting the stage to END_DIALOGUE when you want to return to the default dialogue plugin at START_DIALOGUE + */ + fun endFile(){ + interpreter!!.dialogue.file = null + + } + + /** + * Use when you've entered a DialogueFile but current state does not match any possible conditionals. + * Sort-of a fail-safe in a sense. + */ + fun abandonFile(){ + interpreter!!.dialogue.file = null + player("Huh. Nevermind.") + } + } \ No newline at end of file diff --git a/Server/src/main/java/Server/core/game/content/dialogue/DialogueInterpreter.java b/Server/src/main/java/Server/core/game/content/dialogue/DialogueInterpreter.java index a6845e282..9dc66c8f9 100644 --- a/Server/src/main/java/Server/core/game/content/dialogue/DialogueInterpreter.java +++ b/Server/src/main/java/Server/core/game/content/dialogue/DialogueInterpreter.java @@ -24,6 +24,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static core.tools.DialogueConstKt.END_DIALOGUE; + /** * Handles the dialogues. * @author Emperor @@ -172,6 +174,11 @@ public final class DialogueInterpreter { return; } player.setAttribute("chatbox-buttonid",buttonId); + if(player.getDialogueInterpreter().getDialogue().stage == END_DIALOGUE){ + dialogue.close(); + close(); + return; + } if(player.getDialogueInterpreter().getDialogue().file != null){ player.getDialogueInterpreter().getDialogue().file.handle(componentId,buttonId - 1); return; diff --git a/Server/src/main/java/Server/core/game/content/dialogue/DialoguePlugin.java b/Server/src/main/java/Server/core/game/content/dialogue/DialoguePlugin.java index be18ac9d7..2754c3e2a 100644 --- a/Server/src/main/java/Server/core/game/content/dialogue/DialoguePlugin.java +++ b/Server/src/main/java/Server/core/game/content/dialogue/DialoguePlugin.java @@ -8,6 +8,11 @@ import core.plugin.Plugin; import core.plugin.PluginManifest; import core.plugin.PluginType; +import java.util.ArrayList; + +import static core.tools.DialogueConstKt.DIALOGUE_INITIAL_OPTIONS_HANDLE; +import static core.tools.DialogueConstKt.START_DIALOGUE; + /** * Represents a dialogue plugin. * @author Emperor @@ -36,6 +41,9 @@ public abstract class DialoguePlugin implements Plugin { protected DialogueInterpreter interpreter; public DialogueFile file; + + protected ArrayList optionNames = new ArrayList(); + protected ArrayList optionFiles = new ArrayList(); /** * Two options interface. @@ -263,9 +271,41 @@ public abstract class DialoguePlugin implements Plugin { this.stage += 1; } + /** + * Loads a DialogueFile and sets its stage to START_DIALOGUE, and diverts all further handling for the conversation to the file. + * @param file the DialogueFile to load. + */ public void loadFile(DialogueFile file){ this.file = file.load(player,npc,interpreter); - stage = 0; + stage = START_DIALOGUE; + } + + /** + * Add an option to the list of possible choices a player can pick from. Helps build the options interface for sendChoices() + * @param name the name of the quest/activity to talk about. Turns into "Talk about $name" on the option interface. + * @param file the DialogueFile that the option loads when selected. + */ + public void addOption(String name, DialogueFile file){ + optionNames.add("Talk about " + name); + optionFiles.add(file); + } + + /** + * Send the player a list of conversation options if there's more than one choice. I.E. multiple quest lines. + * @return true if an options interface was sent, false if not. + */ + public boolean sendChoices(){ + if(optionNames.size() == 1){ + loadFile(optionFiles.get(0)); + return false; + } else if(optionNames.isEmpty()) { + stage = START_DIALOGUE; + return false; + } else { + options(optionNames.toArray(new String[0])); + stage = DIALOGUE_INITIAL_OPTIONS_HANDLE; + return true; + } } } \ No newline at end of file diff --git a/Server/src/main/java/Server/core/game/content/dialogue/DukeHoracioDialogue.kt b/Server/src/main/java/Server/core/game/content/dialogue/DukeHoracioDialogue.kt new file mode 100644 index 000000000..3f9ddbc5f --- /dev/null +++ b/Server/src/main/java/Server/core/game/content/dialogue/DukeHoracioDialogue.kt @@ -0,0 +1,86 @@ +package core.game.content.dialogue + +import core.game.content.dialogue.DialoguePlugin +import core.game.content.quest.free.dragonslayer.DragonSlayer +import core.game.content.quest.free.dragonslayer.DukeHoracioDSDialogue +import core.game.content.quest.members.thelosttribe.DukeHoracioTLTDialogue +import core.game.content.dialogue.FacialExpression +import core.game.node.entity.player.link.diary.DiaryType +import core.game.node.entity.player.link.quest.Quest +import core.game.content.quest.free.runemysteries.DukeHoracioRMDialogue +import core.game.content.dialogue.DukeHoracioDialogue +import core.game.node.entity.npc.NPC +import core.game.node.entity.player.Player +import core.game.node.item.Item +import core.tools.END_DIALOGUE + +/** + * Core dialogue plugin for Duke Horacio, redirects to more specific DialogueFiles. + * @author Ceikry + */ +class DukeHoracioDialogue(player: Player? = null) : DialoguePlugin(player) { + + override fun getIds(): IntArray { + return intArrayOf(741) + } + + override fun open(vararg args: Any): Boolean { + npc = args[0] as NPC + if (player.questRepository.getQuest("Dragon Slayer").getStage(player) == 100 && !player.inventory.containsItem(DragonSlayer.SHIELD) && !player.bank.containsItem(DragonSlayer.SHIELD) || !player.questRepository.getQuest("Dragon Slayer").isStarted(player) && !player.questRepository.getQuest("Dragon Slayer").isCompleted(player)) { + addOption("Dragon Slayer", DukeHoracioDSDialogue(player.questRepository.getStage("Dragon Slayer"))) + } + if (!player.questRepository.isComplete("Lost Tribe") && player.questRepository.getQuest("Lost Tribe").isStarted(player)) { + addOption("Lost Tribe", DukeHoracioTLTDialogue(player.questRepository.getStage("Lost Tribe"))) + } + if (!sendChoices()) { + interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Greetings. Welcome to my castle.") + } + stage = 0 + // Speak to the Duke of Lumbridge + player.achievementDiaryManager.finishTask(player, DiaryType.LUMBRIDGE, 0, 2) + return true + } + + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + val quest = player.questRepository.getQuest("Rune Mysteries") + when (stage) { + 0 -> { + interpreter.sendOptions("Select an Option", "Have you any quests for me?", "Where can I find money?") + stage = 1 + } + 1 -> when (buttonId) { + 1 -> { + interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Have any quests for me?") + stage = 20 + } + 2 -> { + interpreter.sendDialogues( + npc, + FacialExpression.HALF_GUILTY, + "I hear many of the local people earn money by learning a", + "skill. Many people get by in life by becoming accomplished", + "smiths, cooks, miners and woodcutters." + ) + stage = END_DIALOGUE + } + } + 20 -> { + npc("Let me see...") + if (!player.questRepository.isComplete("Rune Mysteries")) { + loadFile(DukeHoracioRMDialogue(player.questRepository.getStage("Rune Mysteries"))) + } else { + stage++ + } + } + 21 -> { + npc("Nope, I've got everything under control", "in the castle at the moment.") + stage = END_DIALOGUE + } + } + return true + } + + override fun newInstance(player: Player): DialoguePlugin { + return DukeHoracioDialogue(player) + } +} \ No newline at end of file diff --git a/Server/src/main/java/Server/core/game/content/dialogue/KingRoaldDialogue.kt b/Server/src/main/java/Server/core/game/content/dialogue/KingRoaldDialogue.kt new file mode 100644 index 000000000..095b6d70e --- /dev/null +++ b/Server/src/main/java/Server/core/game/content/dialogue/KingRoaldDialogue.kt @@ -0,0 +1,86 @@ +package core.game.content.dialogue + +import core.game.content.quest.members.allfiredup.KingRoaldAFUDialogue +import core.game.content.activity.allfiredup.KingRoaldAFUMiniDialogue +import core.game.content.quest.free.shieldofarrav.KingRoaldArravDialogue +import core.game.content.quest.members.priestinperil.KingRoaldPIPDialogue +import core.game.node.entity.npc.NPC +import core.game.node.entity.player.Player +import core.tools.DIALOGUE_INITIAL_OPTIONS_HANDLE +import core.tools.END_DIALOGUE +import core.tools.START_DIALOGUE + +/** + * Central dialogue plugin for King Roald. Reroutes to the more specific DialogueFiles + * @author Ceikry + * @version 1.0 + */ +class KingRoaldDialogue(player: Player? = null) : DialoguePlugin(player) { + + override fun newInstance(player: Player): DialoguePlugin { + return KingRoaldDialogue(player) + } + + override fun open(vararg args: Any): Boolean { + npc = args[0] as NPC + + if (player.getAttribute("afu-mini:ring", false) || player.getAttribute("afu-mini:gloves", false) || player.getAttribute("afu-mini:adze", false)) { + player("Your Majesty! I did it!") + loadFile(KingRoaldAFUMiniDialogue()) + return true + } + + if(player.questRepository.isComplete("Priest in Peril")) { + if (!player.questRepository.hasStarted("All Fired Up") || player.questRepository.getQuest("All Fired Up").getStage(player) == 90) { + addOption("All Fired Up",KingRoaldAFUDialogue(player.questRepository.getStage("All Fired Up"))) + } + } else { + addOption("Priest in Peril",KingRoaldPIPDialogue(player.questRepository.getStage("Priest in Peril"))) + } + + if (player.questRepository.getQuest("Shield of Arrav").isStarted(player) && !player.questRepository.getQuest("Shield of Arrav").isCompleted(player)) { + addOption("Shield of Arrav",KingRoaldArravDialogue()) + } + + if(!sendChoices()){ + player("Greetings, your Majesty.") + } + return true + } + + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + //Default (non-specific) dialogue + when (stage) { + + DIALOGUE_INITIAL_OPTIONS_HANDLE -> { + player("Greetings, your Majesty.") + loadFile(optionFiles[buttonId - 1]) + } + + START_DIALOGUE -> { + interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Do you have anything of importance to say?") + stage = 1 + } + 1 -> { + interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "...Not really.") + stage = 2 + } + 2 -> { + interpreter.sendDialogues( + npc, + FacialExpression.HALF_GUILTY, + "You will have to excuse me, then. I am very busy as I", + "have a kingdom to run!" + ) + stage = END_DIALOGUE + } + + END_DIALOGUE -> end() + } + return true + } + + override fun getIds(): IntArray { + return intArrayOf(648, 2590, 5838) + } +} \ No newline at end of file diff --git a/Server/src/main/java/Server/core/game/content/dialogue/MistagDialogue.kt b/Server/src/main/java/Server/core/game/content/dialogue/MistagDialogue.kt index 950e86cf5..ca9371b68 100644 --- a/Server/src/main/java/Server/core/game/content/dialogue/MistagDialogue.kt +++ b/Server/src/main/java/Server/core/game/content/dialogue/MistagDialogue.kt @@ -5,6 +5,9 @@ import core.game.node.entity.player.Player import core.plugin.Initializable import core.game.content.activity.ActivityManager import core.game.content.quest.members.thelosttribe.GoblinFollower +import core.game.content.quest.members.thelosttribe.MistagLTDialogue +import core.tools.END_DIALOGUE +import core.tools.START_DIALOGUE @Initializable class MistagDialogue (player: Player? = null) : DialoguePlugin(player){ @@ -17,9 +20,11 @@ class MistagDialogue (player: Player? = null) : DialoguePlugin(player){ } override fun open(vararg args: Any?): Boolean { + val ltStage = player.questRepository.getStage("Lost Tribe") + if(args.size > 0 && args[0] == "greeting"){ npc("A human knows ancient greeting?") - stage = 100 + loadFile(MistagLTDialogue(true,ltStage)) return true } if(!player.getAttribute("mistag-greeted",false)){ @@ -27,16 +32,17 @@ class MistagDialogue (player: Player? = null) : DialoguePlugin(player){ stage = -100 return true } - if(player.questRepository.getQuest("Lost Tribe").getStage(player) == 45){ + + if(ltStage == 45){ npc("Greetings, friend. I am sorry I panicked when I saw you.") - stage = 102 + loadFile(MistagLTDialogue(false,ltStage)) return true - } - if(player.questRepository.getQuest("Lost Tribe").getStage(player) == 50){ + } else if(ltStage == 50){ npc("Hello, friend?") - stage = 150 + loadFile(MistagLTDialogue(false,ltStage)) return true } + npc("Hello friend!").also { stage = 0 } return true } @@ -48,39 +54,13 @@ class MistagDialogue (player: Player? = null) : DialoguePlugin(player){ -99 -> end() //Normal Dialogue - 0 -> options("May I mine the rocks here?","Can you show me the way out?").also { stage++ } + START_DIALOGUE -> options("May I mine the rocks here?","Can you show me the way out?").also { stage++ } 1 -> when(buttonId){ 1 -> player("May I mine the rocks here?").also { stage = 10 } 2 -> player("Can you show me the way out of the mine?").also { stage = 20 } } - 10 -> npc("Certainly, friend!").also { stage = 1000 } - 20 -> npc("Certainly!").also { stage++ } - 21 -> end().also { - GoblinFollower.sendToLumbridge(player) - } - - //Greeting dialogue - 100 -> npc("Perhaps you are a friend after all!").also { stage++ } - 101 -> npc("Greetings, friend. I am sorry I panicked when I saw you.").also { stage++ } - 102 -> npc("Our legends tell of the surface as a place of horror and","violence, where the gods forced us to fight in terrible","battles.").also { stage++ } - 103 -> npc("When I saw a surface-dweller appear I was afraid it","was a return to the old days!").also { stage++ } - 104 -> player("Did you break in to the castle cellar?").also { stage++ } - 105 -> npc("It was an accident. We were following a seam of iron","and suddenly we found ourselves in a room!").also { stage++ } - 106 -> npc("We blocked up our tunnel behind us and ran back","here. Then we did what cave goblins always do when","there is a problem: we hid and hoped it would go away.").also { stage++ } - 107 -> npc("We meant no harm! Please tell the ruler of the above","people that we want to make peace.").also { stage = 1000; player.questRepository.getQuest("Lost Tribe").setStage(player,46) } - - //Peace treaty dialogue - 150 -> player("I have a peace treaty from the Duke of Lumbridge.").also { stage++ } - 151 -> npc("A peace treaty? Then you will not invade?").also { stage++ } - 152 -> player("No. As long as you stick to the terms of this treaty","there will be no conflict. The Duke of Lumbridge wants","to meet your ruler to sign it.").also { stage++ } - 153 -> npc("I will summon Ur-tag, our headman, at once.").also { stage++ } - 154 -> { - end() - ActivityManager.start(player,"Lost Tribe Cutscene",false) - } - - 1000 -> end() - + 10 -> npc("Certainly, friend!").also { stage = END_DIALOGUE } + 20 -> npc("Certainly!").also { GoblinFollower.sendToLumbridge(player); stage = END_DIALOGUE } } return true } diff --git a/Server/src/main/java/Server/core/game/content/quest/free/dragonslayer/DragonSlayer.java b/Server/src/main/java/Server/core/game/content/quest/free/dragonslayer/DragonSlayer.java index 2f0979ae7..a4fc61c88 100644 --- a/Server/src/main/java/Server/core/game/content/quest/free/dragonslayer/DragonSlayer.java +++ b/Server/src/main/java/Server/core/game/content/quest/free/dragonslayer/DragonSlayer.java @@ -1,6 +1,7 @@ package core.game.content.quest.free.dragonslayer; import core.game.component.Component; +import core.game.content.dialogue.DukeHoracioDialogue; import core.plugin.Initializable; import core.game.node.entity.skill.Skills; import core.game.node.entity.skill.agility.AgilityHandler; diff --git a/Server/src/main/java/Server/core/game/content/quest/free/dragonslayer/DukeHoracioDSDialogue.kt b/Server/src/main/java/Server/core/game/content/quest/free/dragonslayer/DukeHoracioDSDialogue.kt new file mode 100644 index 000000000..3a1c3e3b7 --- /dev/null +++ b/Server/src/main/java/Server/core/game/content/quest/free/dragonslayer/DukeHoracioDSDialogue.kt @@ -0,0 +1,98 @@ +package core.game.content.quest.free.dragonslayer + +import core.game.content.dialogue.DialogueFile +import core.game.node.entity.player.Player +import core.game.node.entity.player.link.diary.DiaryType +import core.game.node.item.GroundItemManager +import core.tools.END_DIALOGUE +import core.tools.START_DIALOGUE + +class DukeHoracioDSDialogue(val questStage: Int) : DialogueFile() { + override fun handle(componentID: Int, buttonID: Int) { + + if(questStage >= 20 && !hasShield(player!!)){ + + when(stage){ + START_DIALOGUE -> player("I seek a shield that will protect me from dragonbreath.") + 1 -> npc("A knight going on a dragon quest, hmm? What", "dragon do you intend to slay?").also{ stage++ } + 2 -> player("Elvarg, the dragon of Crandor island!").also { stage++ } + 3 -> npc("Elvarg? Are you sure?").also { stage++ } + 4 -> player("Yes!").also { stage++ } + 5 -> npc("Well, you're a braver man than I!").also { stage++ } + 6 -> player("Why is everyone scared of this dragon?").also { stage++ } + 7 -> npc( + "Back in my father's day, Crandor was an important", + "city-state. Politically, it was important as Falador or", + "Varrock and its shipes traded with every port." + ).also { stage++ } + + 8 -> npc( + "But, one day when I was little, all contact was lost. The", + "trading ships and diplomatic envoys just stopped", + "coming." + ).also { stage++ } + + 9 -> npc( + "I remember my father being very scared. He posted", + "lookouts on the roof to warn if the dragon was", + "approaching. All the city rulers worried that", + "Elvarg would devastate the whole continent." + ).also { stage++ } + + 10 -> player("So, are you going to give me the shield or not?").also { stage++ } + 11 -> npc( + "If you really think you're up to it then perhaps you", + "are the one who can kill this dragon." + ).also { stage++ } + + 12 -> { + if (!player!!.inventory.add(DragonSlayer.SHIELD)) { + GroundItemManager.create(DragonSlayer.SHIELD, player) + } + interpreter!!.sendItemMessage(DragonSlayer.SHIELD, "The Duke hands you a heavy orange shield.") + // Obtain an Anti-dragonbreath shield from Duke Horacio + player!!.achievementDiaryManager.finishTask(player, DiaryType.LUMBRIDGE, 2, 5) + stage = END_DIALOGUE + } + } + + } + + else if(questStage == 20) { + + when(stage){ + START_DIALOGUE -> npc("Take care out there. If you kill it...").also { stage++ } + 1 -> npc("If you kill it, for Saradomin's sake make sure it's really","dead!").also { stage = END_DIALOGUE } + } + + } + + else if(questStage == 100 && !hasShield(player!!)){ + + when(stage){ + START_DIALOGUE -> player("I seek a shield that will protect me from dragonbreath.").also { stage++ } + 1 -> npc("A knight going on a dragon quest, hmm? What", "dragon do you intend to slay?").also { stage++ } + 2 -> player("Oh, no dragon in particular. I just feel like killing a", "dragon.").also { stage++ } + 3 -> npc("Of course. Now you've slain Elvarg, you've earned", "the right to call the shield your own!").also { stage++ } + 4 -> { + if (!player!!.inventory.add(DragonSlayer.SHIELD)) { + GroundItemManager.create(DragonSlayer.SHIELD, player) + } + interpreter!!.sendItemMessage(DragonSlayer.SHIELD, "The Duke hands you the shield.") + // Obtain an Anti-dragonbreath shield from Duke Horacio + player!!.achievementDiaryManager.finishTask(player, DiaryType.LUMBRIDGE, 2, 5) + stage = END_DIALOGUE + } + } + + } + + else { + abandonFile() + } + } + + fun hasShield(player: Player): Boolean{ + return player.inventory.containsItem(DragonSlayer.SHIELD) || player.bank.containsItem(DragonSlayer.SHIELD) || player.equipment.containsItem(DragonSlayer.SHIELD) + } +} \ No newline at end of file diff --git a/Server/src/main/java/Server/core/game/content/quest/free/dragonslayer/DukeHoracioDialogue.java b/Server/src/main/java/Server/core/game/content/quest/free/dragonslayer/DukeHoracioDialogue.java deleted file mode 100644 index e196ce9fd..000000000 --- a/Server/src/main/java/Server/core/game/content/quest/free/dragonslayer/DukeHoracioDialogue.java +++ /dev/null @@ -1,552 +0,0 @@ -package core.game.content.quest.free.dragonslayer; - -import core.game.node.entity.player.link.diary.DiaryType; -import core.tools.Items; -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.quest.Quest; -import core.game.node.item.GroundItemManager; -import core.game.node.item.Item; - -/** - * Represents the dialogue plugin used for the duke horacio - * @author 'Vexia - * @version 1.0 - */ -public final class DukeHoracioDialogue extends DialoguePlugin { - - /** - * Represents the air talisman item. - */ - private static final Item TALISMAN = new Item(1438); - - private static final NPC Sigmund = new NPC(2082); - - /** - * Constructs a new {@code DukeHoracioDialogue} {@code Object}. - */ - public DukeHoracioDialogue() { - /** - * empty. - */ - } - - /** - * Constructs a new {@code DukeHoracioDialogue} {@code Object}. - * - * @param player the player. - */ - public DukeHoracioDialogue(Player player) { - super(player); - } - - @Override - public int[] getIds() { - return new int[]{741}; - } - - @Override - public boolean handle(int interfaceId, int buttonId) { - if (player.getQuestRepository().getQuest("Dragon Slayer").getStage(player) >= 20 - && !player.getInventory().containsItem(DragonSlayer.SHIELD) - && !player.getBank().containsItem(DragonSlayer.SHIELD) && !player.getEquipment().containsItem(DragonSlayer.SHIELD)) { - switch (stage) { - case 0: - player("I seek a shield that will protect me from dragonbreath."); - stage = 400; - break; - case 400: - npc("A knight going on a dragon quest, hmm? What", "dragon do you intend to slay?"); - stage = 401; - break; - case 401: - player("Elvarg, the dragon of Crandor island!"); - stage = 402; - break; - case 402: - npc("Elvarg? Are you sure?"); - stage = 403; - break; - case 403: - player("Yes!"); - stage = 404; - break; - case 404: - npc("Well, you're a braver man than I!"); - stage = 405; - break; - case 405: - player("Why is everyone scared of this dragon?"); - stage = 406; - break; - case 406: - npc("Back in my father's day, Crandor was an important", "city-state. Politically, it was important as Falador or", "Varrock and its shipes traded with every port."); - stage = 407; - break; - case 407: - npc("But, one day when I was little, all contact was lost. The", "trading ships and diplomatic envoys just stopped", "coming."); - stage = 408; - break; - case 408: - npc("I remember my father being very scared. He posted", "lookouts on the roof to warn if the dragon was", "approaching. All the city rulers worried that", "Elvarg would devastate the whole continent."); - stage = 409; - break; - case 409: - player("So, are you going to give me the shield or not?"); - stage = 410; - break; - case 410: - npc("If you really think you're up to it then perhaphs you", "are the one who can kill this dragon."); - stage = 411; - break; - case 411: - if (!player.getInventory().add(DragonSlayer.SHIELD)) { - GroundItemManager.create(DragonSlayer.SHIELD, player); - } - interpreter.sendItemMessage(DragonSlayer.SHIELD, "The Duke hands you a heavy orange shield."); - // Obtain an Anti-dragonbreath shield from Duke Horacio - player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 2, 5); - stage = 412; - break; - } - return true; - } - if (player.getQuestRepository().getQuest("Dragon Slayer").getStage(player) == 20) { - switch (stage) { - case 412: - npc("Take care out there. If you kill it..."); - stage = 413; - return true; - case 413: - npc("If you kill it, for Saradomin's sake make sure it's really", "dead!"); - stage = 414; - return true; - case 414: - end(); - return true; - } - } - final Quest quest = player.getQuestRepository().getQuest("Rune Mysteries"); - switch (stage) { - case 0: - if (player.getQuestRepository().getQuest("Dragon Slayer").getStage(player) == 100 && !player.getInventory().containsItem(DragonSlayer.SHIELD) && !player.getBank().containsItem(DragonSlayer.SHIELD)) { - interpreter.sendOptions("Select an Option", "I seek a shield that will protect me from dragonbreath.", "Have you any quests for me?", "Where can I find money?"); - stage = -5; - return true; - } else if(player.getQuestRepository().getQuest("Lost Tribe").getStage(player) == 20){ - interpreter.sendOptions("Select an Option","Have you any quests for me?","Where can I find money?","I know what happened in the cellar."); - stage = -10; - return true; - } else if(player.getQuestRepository().getQuest("Lost Tribe").getStage(player) == 30 && player.getInventory().containsItem(new Item(Items.BROOCH_5008))){ - options("Have you any quests for me?","Where can I find money?","I found something in the rubble."); - stage = -15; - return true; - } else if(player.getQuestRepository().getQuest("Lost Tribe").getStage(player) == 44){ - options("Have you any quests for me?","Where can I find money?","I spoke with the goblin generals."); - stage = -20; - return true; - } else if(player.getQuestRepository().getQuest("Lost Tribe").getStage(player) == 46){ - options("Have you any quests for me?","Where can I find money?","I made contact with the Dorgeshuun."); - stage = -25; - return true; - } else if(player.getQuestRepository().getQuest("Lost Tribe").getStage(player) == 49 && player.getInventory().contains(Items.SILVERWARE_5011,1)){ - options("Have you any quests for me?","Where can I find money?","I found the silverware."); - stage = -30; - return true; - } - - else { - interpreter.sendOptions("Select an Option", "Have you any quests for me?", "Where can I find money?"); - } - stage = 1; - break; - case -5: - switch (buttonId) { - case 1: - stage = 800; - handleShield(buttonId); - break; - case 2: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Have any quests for me?"); - stage = 20; - break; - case 3: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I hear many of the local people earn money by", "learning a skill. Many people get by in life by becoming", "accomplished smiths, cooks, miners and woodcutters."); - stage = 30; - break; - } - break; - case -10: - switch(buttonId){ - case 1: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Have any quests for me?"); - stage = 20; - break; - case 2: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I hear many of the local people earn money by", "learning a skill. Many people get by in life by becoming", "accomplished smiths, cooks, miners and woodcutters."); - stage = 30; - break; - case 3: - NPC witness = new NPC(player.getAttribute("tlt-witness",0)); - player(witness.getName() + " says he saw something in the cellar.","Like a goblin with big eyes."); - stage = 500; - break; - } - break; - case -15: - switch(buttonId){ - case 1: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Have any quests for me?"); - stage = 20; - break; - case 2: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I hear many of the local people earn money by", "learning a skill. Many people get by in life by becoming", "accomplished smiths, cooks, miners and woodcutters."); - stage = 30; - break; - case 3: - player("I dug through the rubble in the cellar and found a","tunnel!"); - stage = 520; - break; - } - break; - case -20: - switch(buttonId){ - case 1: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Have any quests for me?"); - stage = 20; - break; - case 2: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I hear many of the local people earn money by", "learning a skill. Many people get by in life by becoming", "accomplished smiths, cooks, miners and woodcutters."); - stage = 30; - break; - case 3: - player("I spoke to the goblin generals in the goblin village. They","told me about an ancient goblin tribe that went to live","underground."); - stage = 540; - break; - } - break; - case -25: - switch(buttonId){ - case 1: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Have any quests for me?"); - stage = 20; - break; - case 2: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I hear many of the local people earn money by", "learning a skill. Many people get by in life by becoming", "accomplished smiths, cooks, miners and woodcutters."); - stage = 30; - break; - case 3: - player("I've made contact with the cave goblins. They say they","were following a seam and broke into the cellar by","mistake."); - stage = 550; - break; - } - break; - case -30: - switch(buttonId){ - case 1: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Have any quests for me?"); - stage = 20; - break; - case 2: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I hear many of the local people earn money by", "learning a skill. Many people get by in life by becoming", "accomplished smiths, cooks, miners and woodcutters."); - stage = 30; - break; - case 3: - player("I found the missing silverware in the HAM cave!"); - stage = 560; - break; - } - break; - case 1: - switch (buttonId) { - case 1: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Have any quests for me?"); - stage = 20; - break; - case 2: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I hear many of the local people earn money by learning a", "skill. Many people get by in life by becoming accomplished", "smiths, cooks, miners and woodcutters."); - stage = 30; - break; - } - break; - case 10: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "You haven't seem to have slain Elvarg yet!", "Once you have slain Elvarg come back and talk to me."); - stage = 11; - break; - case 20: - if (quest.getStage(player) == 10) { - interpreter.sendDialogues(npc, null, "The only task remotely approaching a quest is the", "delivery of the talisman I gave you to the head wizard", "of the Wizards' Tower,"); - stage = 1000; - break; - } - if (quest.getStage(player) > 10) { - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Nope, I've got everything under control", "in the castle at the moment."); - stage = 69; - return true; - } - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Well, it's not really a quest but I recently discovered", "this strange talisman."); - stage = 21; - break; - case 69: - end(); - break; - case 1000: - interpreter.sendDialogues(npc, null, "south-west of here. I suggest you deliver it to him as", "soon as possible. I have the oddest feeling that is", "important..."); - stage = 1001; - break; - case 1001: - end(); - break; - case 21: - interpreter.sendDialogues(npc, null, "It seems to be mystical and I have never seen anything", "like it before. Would you take it to the head wizard at"); - stage = 22; - break; - case 22: - interpreter.sendDialogues(npc, null, "the Wizards' Tower for me? It's just south-west of here", "and should not take you very long at all. I would be", "awfully grateful."); - stage = 23; - break; - case 23: - interpreter.sendOptions("Select an Option", "Sure, no problem.", "Not right now."); - stage = 24; - break; - case 24: - switch (buttonId) { - case 1: - interpreter.sendDialogues(player, null, "Sure, no problem."); - stage = 100; - break; - case 2: - interpreter.sendDialogues(player, null, "Not right now."); - stage = 26; - break; - } - break; - case 100: - interpreter.sendDialogues(npc, null, "Thank you very much, stranger. I am sure the head", "wizard will reward you for such an interesting find."); - stage = 101; - break; - case 101: - interpreter.sendDialogue("The Duke hands you an " + Quest.BLUE + "air talisman."); - stage = 102; - break; - case 102: - quest.start(player); - player.getQuestRepository().syncronizeTab(player); - if (!player.getInventory().add(TALISMAN)) { - GroundItemManager.create(TALISMAN, player.getLocation(), player); - } - end(); - break; - case 26: - interpreter.sendDialogues(npc, null, "As you wish, stranger, although I have this strange", "feeling that it is important. Unfortunately, I cannot", "leave my castle unattended."); - stage = 27; - break; - case 27: - end(); - break; - case 30: - end(); - break; - case 500: - npc("Yes, he mentioned that to me. But I think he was","imagining things. Goblins live in natural caves but","everyone knows they don't have the wit to make their","own tunnels."); - stage++; - break; - case 501: - sendNormalDialogue(Sigmund,FacialExpression.ANGRY,"Yes your grace, but if there is any possibility that this","is a goblin incursion then we should take that possibility","very seriously!"); - stage++; - break; - case 502: - player("I think we should at least investigate."); - stage++; - break; - case 503: - sendNormalDialogue(Sigmund,FacialExpression.WORRIED,"Your grace, I think you should listen to " + (player.isMale() ? "him" : "her") + "."); - stage++; - break; - case 504: - npc("Hmm, very well. I give you permission to investigate","this mystery. If there is a blocked tunnel then perhaps","you should try to un-block it."); - player.getQuestRepository().getQuest("Lost Tribe").setStage(player,30); - stage++; - break; - case 505: - end(); - break; - case 520: - player("On the ground I found this brooch."); - stage++; - break; - case 521: - npc("I've never seen anything like that before. It doesn't","come from Lumbridge. What do you think, Sigmund?"); - stage++; - break; - case 522: - sendNormalDialogue(Sigmund,FacialExpression.WORRIED,"It is unknown to me, your grace. But the fact it is","there is enough to prove the Cook's story. It must have","been dropped by a goblin as it fled."); - stage++; - break; - case 523: - npc("I've never heard of a goblin wearing something so well-","crafted."); - stage++; - break; - case 524: - sendNormalDialogue(Sigmund,FacialExpression.ANGRY,"Then it must have been stolen!"); - stage++; - break; - case 525: - npc("But it wasn't stolen from us. Where could it be from?"); - stage++; - break; - case 526: - sendNormalDialogue(Sigmund,FacialExpression.ANGRY,"That doesn't matter! You said yourself that goblins","couldn't have made that, so they must have stolen it","from somewhere."); - stage++; - break; - case 527: - sendNormalDialogue(Sigmund,FacialExpression.ANGRY,"Horrible, thieving goblins have broken into our cellar!","We must retaliate immediately!"); - stage++; - break; - case 528: - sendNormalDialogue(Sigmund,FacialExpression.ANGRY,"First we should wipe out the goblins east of the river,","then we can march on the goblin village to the north-","west..."); - stage++; - break; - case 529: - npc("I will not commit troops until I have proof that goblins","are behind this."); - stage++; - break; - case 530: - npc(player.getName() + ", please find out what you can about this","brooch. The librarian in Varrock might be able to help","identify the symbol."); - player.getQuestRepository().getQuest("Lost Tribe").setStage(player,40); - stage++; - break; - case 531: - end(); - break; - case 540: - sendNormalDialogue(Sigmund,FacialExpression.ANGRY,"What more proof do we need? Nasty, smelly goblins","have been living under our feet all this time! We must","crush them at once!"); - stage++; - break; - case 541: - npc("Hmm, perhaps you are right. I will send word to the","army to prepare for an underground assault."); - stage++; - break; - case 542: - npc(player.getName() + ", I would still like you to find out more","about this tribe. It cannot hurt to know one's enemy."); - player.getQuestRepository().getQuest("Lost Tribe").setStage(player,45); - stage++; - break; - case 543: - end(); - break; - case 550: - sendNormalDialogue(Sigmund,FacialExpression.ANGRY,"And I suppose you believe them, goblin lover?"); - stage++; - break; - case 551: - player("Well, they seemed friendlier than most goblins, and","nothing was taken from the cellar."); - stage++; - break; - case 552: - npc("Actually, something was taken. Sigmund has informed","me that some of the castle silverware is missing from","the cellar."); - stage++; - break; - case 553: - npc("Unless it is returned, I am afraid I will have no option","but war."); - player.getQuestRepository().getQuest("Lost Tribe").setStage(player,47); - stage++; - break; - case 554: - end(); - break; - case 560: - npc("Sigmund! Is this your doing?"); - stage++; - break; - case 561: - sendNormalDialogue(Sigmund,FacialExpression.WORRIED,"Of...of course not! The goblins must have, um, dropped","the silverware as they ran away."); - stage++; - break; - case 562: - npc("Don't lie to me! I knew you were a HAM member but","I didn't think you would stoop to this. You are","dismissed from my service."); - stage++; - break; - case 563: - sendNormalDialogue(Sigmund,FacialExpression.THINKING,"But don't you see it was for the best? For goblins to be","living under our feet like this... ugh. It doesn't matter","how civilised they are: all sub-human species must be","wiped out!"); - stage++; - break; - case 564: - npc("That's enough! Get out of my castle now!"); - stage++; - break; - case 565: - npc("I see I was ill-advised. Unless there is an act of","aggression by the cave goblins there is no need for war."); - stage++; - break; - case 566: - interpreter.sendItemMessage(Items.PEACE_TREATY_5012,"The Duke writes a document and signs it."); - stage++; - break; - case 567: - npc("This peace treaty specifies the border between","Lumbridge and the Cave Goblin realm. Please take it to","the cave goblins and tell them I would like to meet with","their leader to sign it."); - player.getInventory().add(new Item(Items.PEACE_TREATY_5012)); - player.getQuestRepository().getQuest("Lost Tribe").setStage(player,50); - player.varpManager.get(465).setVarbit(0,9).send(player); - stage++; - break; - case 568: - end(); - break; - default: - handleShield(buttonId); - break; - } - return true; - } - - @Override - public DialoguePlugin newInstance(Player player) { - return new DukeHoracioDialogue(player); - } - - @Override - public boolean open(Object... args) { - npc = (NPC) args[0]; - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Greetings. Welcome to my castle."); - stage = 0; - // Speak to the Duke of Lumbridge - player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 0, 2); - return true; - } - - public void handleShield(int buttonId) { - switch (stage) { - case 800: - player("I seek a shield that will protect me from dragonbreath."); - stage = 801; - break; - case 801: - npc("A knight going on a dragon quest, hmm? What", "dragon do you intend to slay?"); - stage = 802; - break; - case 802: - player("Oh, no dragon in particular. I just feel like killing a", "dragon."); - stage = 803; - break; - case 803: - npc("Of course. Now you've slain Elvarg, you've earned", "the right to call the shield your own!"); - stage = 804; - break; - case 804: - if (!player.getInventory().add(DragonSlayer.SHIELD)) { - GroundItemManager.create(DragonSlayer.SHIELD, player); - } - interpreter.sendItemMessage(DragonSlayer.SHIELD, "The Duke hands you the shield."); - // Obtain an Anti-dragonbreath shield from Duke Horacio - player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 2, 5); - stage = 805; - break; - case 805: - end(); - break; - } - } -} diff --git a/Server/src/main/java/Server/core/game/content/quest/free/runemysteries/DukeHoracioRMDialogue.kt b/Server/src/main/java/Server/core/game/content/quest/free/runemysteries/DukeHoracioRMDialogue.kt new file mode 100644 index 000000000..15c1229e5 --- /dev/null +++ b/Server/src/main/java/Server/core/game/content/quest/free/runemysteries/DukeHoracioRMDialogue.kt @@ -0,0 +1,67 @@ +package core.game.content.quest.free.runemysteries + +import core.game.content.dialogue.DialogueFile +import core.game.node.entity.player.link.quest.Quest +import core.game.node.item.GroundItemManager +import core.game.node.item.Item +import core.tools.END_DIALOGUE +import core.tools.START_DIALOGUE + +class DukeHoracioRMDialogue(val questStage: Int) : DialogueFile() { + + private val TALISMAN = Item(1438) + + override fun handle(componentID: Int, buttonID: Int) { + + if(questStage == 0){ + + when(stage){ + START_DIALOGUE -> npc("Well, it's not really a quest but I recently discovered", "this strange talisman.").also{ stage++ } + 1 -> npc("It seems to be mystical and I have never seen anything", "like it before. Would you take it to the head wizard at").also { stage++ } + 2 -> npc("the Wizards' Tower for me? It's just south-west of here", "and should not take you very long at all. I would be", "awfully grateful.").also { stage++ } + 3 -> options("Sure, no problem.", "Not right now.").also { stage++ } + 4 -> when(buttonID){ + 1 -> player("Sure, no problem.").also { stage = 10 } + 2 -> player("Not right now.").also { stage = 20 } + } + + //Sure + 10 -> npc("Thank you very much, stranger. I am sure the head", "wizard will reward you for such an interesting find.").also { stage++ } + 11 -> { + interpreter!!.sendDialogue("The Duke hands you an " + Quest.BLUE + "air talisman.").also { stage++ } + player!!.questRepository.getQuest("Rune Mysteries").start(player) + if (!player!!.inventory.add(TALISMAN)) { + GroundItemManager.create(TALISMAN, player!!.location, player) + } + stage = END_DIALOGUE + } + + //No thanks + 20 -> npc("As you wish, stranger, although I have this strange", "feeling that it is important. Unfortunately, I cannot", "leave my castle unattended.").also { stage = END_DIALOGUE } + } + + } + + else if(questStage == 10){ + + when(stage){ + START_DIALOGUE -> npc("The only task remotely approaching a quest is the", "delivery of the talisman I gave you to the head wizard", "of the Wizards' Tower,").also { stage++ } + 2 -> npc("south-west of here. I suggest you deliver it to him as", "soon as possible. I have the oddest feeling that is", "important...").also { stage = END_DIALOGUE } + } + + } + + else if(questStage > 10){ + + when(stage){ + START_DIALOGUE -> npc("Nope, I've got everything under control", "in the castle at the moment.").also { stage = END_DIALOGUE } + } + + } + + else { + abandonFile() + } + + } +} \ No newline at end of file diff --git a/Server/src/main/java/Server/core/game/content/quest/free/RuneMysteries.java b/Server/src/main/java/Server/core/game/content/quest/free/runemysteries/RuneMysteries.java similarity index 99% rename from Server/src/main/java/Server/core/game/content/quest/free/RuneMysteries.java rename to Server/src/main/java/Server/core/game/content/quest/free/runemysteries/RuneMysteries.java index 400e722b7..1e994fa22 100644 --- a/Server/src/main/java/Server/core/game/content/quest/free/RuneMysteries.java +++ b/Server/src/main/java/Server/core/game/content/quest/free/runemysteries/RuneMysteries.java @@ -1,4 +1,4 @@ -package core.game.content.quest.free; +package core.game.content.quest.free.runemysteries; import core.game.node.entity.player.Player; import core.plugin.Initializable; diff --git a/Server/src/main/java/Server/core/game/content/quest/free/shieldofarrav/KingRoaldArravDialogue.kt b/Server/src/main/java/Server/core/game/content/quest/free/shieldofarrav/KingRoaldArravDialogue.kt new file mode 100644 index 000000000..6a27d784e --- /dev/null +++ b/Server/src/main/java/Server/core/game/content/quest/free/shieldofarrav/KingRoaldArravDialogue.kt @@ -0,0 +1,58 @@ +package core.game.content.quest.free.shieldofarrav + +import core.game.content.dialogue.DialogueFile +import core.game.node.item.GroundItemManager +import core.game.node.item.Item +import core.tools.END_DIALOGUE +import core.tools.START_DIALOGUE + +private val CERTIFICATE = Item(769) + + +class KingRoaldArravDialogue() : DialogueFile() { + override fun handle(componentID: Int, buttonID: Int) { + + if (player!!.inventory.containsItem(ShieldofArrav.PHOENIX_SHIELD) || player!!.inventory.containsItem(ShieldofArrav.BLACKARM_SHIELD)) { + when (stage) { + START_DIALOGUE -> player("Your majesty, I have recovered the Shield of Arrav; I", "would like to claim the reward.").also { stage++ } + 1 -> npc("The Shield of Arrav, eh? Yes, I do recall my father,", "King Roald, put a reward out for that.").also { stage++ } + 2 -> npc("Very well.").also { stage++ } + 3 -> npc("If you get the authenticity of the shield verified by the", "curator at the museum and then return here with", "authentication, I will grant your reward.").also { stage = END_DIALOGUE } + END_DIALOGUE -> end() + } + } + + else if(player!!.getInventory().containsItem(ShieldofArrav.BLACKARM_CERTIFICATE) || player!!.getInventory().containsItem(ShieldofArrav.PHOENIX_CERTIFICATE)){ + when(stage) { + START_DIALOGUE -> player("Your majesty, I have come to claim the reward for the", "return of the Shield of Arrav.").also { stage++ } + 1 -> interpreter!!.sendItemMessage(if (player!!.inventory.containsItem(ShieldofArrav.BLACKARM_CERTIFICATE)) ShieldofArrav.BLACKARM_CERTIFICATE.id else ShieldofArrav.PHOENIX_CERTIFICATE.id, "You show the certificate to the king.").also { stage++ } + 2 -> npc("I'm afraid that's only half the reward certificate. You'll", "have to get the other half and join them together if you", "want to cliam the reward.").also { stage = END_DIALOGUE } + END_DIALOGUE -> end() + } + } + + else if(player!!.inventory.containsItem(CERTIFICATE)){ + when(stage){ + START_DIALOGUE -> player("Your majesty, I have come to claim the reward for the", "return of the Shield of Arrav.").also { stage++ } + 1 -> interpreter!!.sendItemMessage(CERTIFICATE.id, "You show the certificate to the king.").also { stage++ } + 2 -> npc("My goodness! This claim is for the reward offered by", "my father many years ago!").also { stage++ } + 3 -> npc("I never thought I would live to see the day when", "someone came forward to claim this reward!").also { stage++ } + 4 -> npc("I heard that you found half the shield, so I will give", "you half of the bounty. That comes to exactly 600 gp!").also { stage++ } + 5 -> interpreter!!.sendItemMessage(CERTIFICATE.id, "You hand over a certificate. The king gives you 600 gp.").also { stage = END_DIALOGUE } + END_DIALOGUE -> { + if (player!!.inventory.remove(CERTIFICATE)) { + if (!player!!.inventory.add(Item(995, 600))) { + GroundItemManager.create(Item(995, 600), player) + } + player!!.questRepository.getQuest("Shield of Arrav").finish(player) + end() + } + } + } + } + + else { + abandonFile() + } + } +} \ No newline at end of file diff --git a/Server/src/main/java/Server/core/game/content/quest/free/shieldofarrav/KingRoaldDialogue.java b/Server/src/main/java/Server/core/game/content/quest/free/shieldofarrav/KingRoaldDialogue.java deleted file mode 100644 index ef38bab69..000000000 --- a/Server/src/main/java/Server/core/game/content/quest/free/shieldofarrav/KingRoaldDialogue.java +++ /dev/null @@ -1,516 +0,0 @@ -package core.game.content.quest.free.shieldofarrav; - -import core.tools.Items; -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.quest.Quest; -import core.game.node.item.GroundItemManager; -import core.game.node.item.Item; -import core.game.node.entity.skill.Skills; - -/** - * Represents the dialogue used to handle king roald NPC. - * @author 'Vexia - * @version 1.0 - */ -public class KingRoaldDialogue extends DialoguePlugin { - - /** - * Represents the certificate item. - */ - private static final Item CERTIFICATE = new Item(769); - - /** - * Constructs a new {@code KingRoaldDialogue} {@code Object}. - */ - public KingRoaldDialogue() { - /** - * empty. - */ - } - - /** - * Constructs a new {@code KingRoaldDialogue} {@code Object}. - * @param player the player. - */ - public KingRoaldDialogue(Player player) { - super(player); - } - - @Override - public DialoguePlugin newInstance(Player player) { - return new KingRoaldDialogue(player); - } - - @Override - public boolean open(Object... args) { - npc = (NPC) args[0]; - if(player.getQuestRepository().getQuest("All Fired Up").getStage(player) == 90){ - player("Greetings, your majesty."); - stage = 600; - return true; - } - if(player.getAttribute("afu-mini:ring",false) || player.getAttribute("afu-mini:gloves",false) || player.getAttribute("afu-mini:adze",false)){ - player("Your Majesty! I did it!"); - stage = 700; - return true; - } - if(player.getQuestRepository().getQuest("Shield of Arrav").isStarted(player) && !player.getQuestRepository().getQuest("Shield of Arrav").isCompleted(player)){ - player("Greetings, your majesty."); - stage = 0; - return true; - } - switch (player.getQuestRepository().getQuest("Priest in Peril").getStage(player)) { - case 0: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Greetings, your majesty."); - stage = 0; - break; - case 100: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Greetings, your majesty."); - if(player.getQuestRepository().getQuest("All Fired Up").isCompleted(player)){ - stage = 200; - } else { - stage = 499; - } - break; - } - return true; - } - - @Override - public boolean handle(int interfaceId, int buttonId) { - if (player.getQuestRepository().getQuest("Shield of Arrav").getStage(player) == 70 && player.getInventory().containsItem(ShieldofArrav.PHOENIX_SHIELD) || player.getInventory().containsItem(ShieldofArrav.BLACKARM_SHIELD)) { - switch (stage) { - case 0: - if (player.getInventory().containsItem(ShieldofArrav.PHOENIX_SHIELD) || player.getInventory().containsItem(ShieldofArrav.BLACKARM_SHIELD)) { - player("Your majesty, I have recovered the Shield of Arrav; I", "would like to claim the reward."); - stage = 1; - } - break; - case 1: - npc("The Shield of Arrav, eh? Yes, I do recall my father,", "King Roald, put a reward out for that."); - stage = 2; - break; - case 2: - npc("Very well."); - stage = 3; - break; - case 3: - npc("If you get the authenticity of the shield verified by the", "curator at the museum and then return here with", "authentication, I will grant your reward."); - stage = 4; - break; - case 4: - end(); - break; - } - return true; - } - if (player.getQuestRepository().getQuest("Shield of Arrav").getStage(player) == 70 && player.getInventory().containsItem(ShieldofArrav.BLACKARM_CERTIFICATE) || player.getInventory().containsItem(ShieldofArrav.PHOENIX_CERTIFICATE)) { - switch (stage) { - case 0: - player("Your majesty, I have come to claim the reward for the", "return of the Shield of Arrav."); - stage = 1; - break; - case 1: - interpreter.sendItemMessage(player.getInventory().containsItem(ShieldofArrav.BLACKARM_CERTIFICATE) ? ShieldofArrav.BLACKARM_CERTIFICATE.getId() : ShieldofArrav.PHOENIX_CERTIFICATE.getId(), "You show the certificate to the king."); - stage = 2; - break; - case 2: - npc("I'm afraid that's only half the reward certificate. You'll", "have to get the other half and join them together if you", "want to cliam the reward."); - stage = 3; - break; - case 3: - end(); - break; - } - return true; - } - if (player.getQuestRepository().getQuest("Shield of Arrav").getStage(player) == 70 && player.getInventory().containsItem(CERTIFICATE)) { - switch (stage) { - case 0: - player("Your majesty, I have come to claim the reward for the", "return of the Shield of Arrav."); - stage = 1; - break; - case 1: - interpreter.sendItemMessage(CERTIFICATE.getId(), "You show the certificate to the king."); - stage = 2; - break; - case 2: - npc("My goodness! This claim is for the reward offered by", "my father many years ago!"); - stage = 3; - break; - case 3: - npc("I never thought I would live to see the day when", "someone came forward to claim this reward!"); - stage = 4; - break; - case 4: - npc("I heard that you found half the shield, so I will give", "you half of the bounty. That comes to exactly 600 gp!"); - stage = 5; - break; - case 5: - interpreter.sendItemMessage(CERTIFICATE.getId(), "You hand over a certificate. The king gives you 600 gp."); - stage = 6; - break; - case 6: - if (player.getInventory().remove(CERTIFICATE)) { - if (!player.getInventory().add(new Item(995, 600))) { - GroundItemManager.create(new Item(995, 600), player); - } - player.getQuestRepository().getQuest("Shield of Arrav").finish(player); - end(); - } - break; - } - return true; - } - Quest quest = player.getQuestRepository().getQuest("Priest in Peril"); - switch (stage) { - case 0: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Well hello there. What do you want?"); - stage = 1; - break; - case 1: - if (quest.getStage(player) == 0) { - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I am looking for a quest!"); - stage = 2; - return true; - } - if (quest.getStage(player) <= 11) { - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "You have news of Drezel for me?"); - stage = 20; - } - if (quest.getStage(player) == 12) { - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "You have news of Drezel for me?"); - stage = 23; - } - if (quest.getStage(player) == 13) { - interpreter.sendDialogues(npc, FacialExpression.FURIOUS, "AND MORE IMPORTANTLY, WHY HAVEN'T", "YOU ENSURED THE BORDER TO", "MORYTANIA IS SECURE YET?"); - stage = 40; - } - if (quest.getStage(player) == 14) { - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I'm looking for a key to unlock drezel!"); - stage = 50; - } - if (quest.getStage(player) == 15 || quest.getStage(player) == 16 || quest.getStage(player) == 17) { - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I'm helping Drezel!"); - stage = 50; - } - if (quest.getStage(player) == 100) { - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Ah, it's you again. Hello there."); - stage = 200; - } - break; - case 200: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Do you have anything of importace to say?"); - stage = 201; - break; - case 201: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "...Not really."); - stage = 202; - break; - case 202: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "You will have to excuse me, then. I am very busy as I", "have a kingdom to run!"); - stage = 203; - break; - case 203: - end(); - break; - case 2: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "A quest you say? Hmm, what an odd request to make", "of the king. It's funny you should mention it though, as", "there is something you can do for me."); - stage = 3; - break; - case 3: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Are you aware of the temple easy of here? It stands on", "the river Salve and guards the entrance to the lands of", "Morytania?"); - stage = 4; - break; - case 4: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "No, I don't think I know it..."); - stage = 5; - break; - case 5: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Hmm, how strange that you don't. Well anyway, it has", "been some days since last I heard from Drezel, the", "priest who lives there."); - stage = 6; - break; - case 6: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Be a sport and go make sure that nothing untoward", "has happend to the silly old codger for me, would you?"); - stage = 7; - break; - case 7: - interpreter.sendOptions("Select an Option", "Sure.", "No, that sounds boring."); - stage = 8; - break; - case 8: - switch (buttonId) { - case 1: - quest.start(player); - player.getQuestRepository().syncronizeTab(player); - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Sure. I don't have anything better to do right now."); - stage = 10; - break; - case 2: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Yes, I dare say it does. I wouldn't even have", "mentioned it had you not seemed to be looking for", "something to do anyway."); - stage = 9; - break; - } - break; - case 9: - end(); - break; - case 10: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Many thanks adventurer! I would have sent one of my", "squires but they wanted payment for it!"); - stage = 11; - break; - case 11: - end(); - break; - case 20: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "No not yet."); - stage = 21; - break; - case 21: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I would wish you would go check on my dear friend."); - stage = 22; - break; - case 22: - end(); - break; - case 23: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Yeah, I spoke to the guys at the temple and they said", "they were being bothered by that dog in the crypt, so I", "went and killed it for them. No problem."); - stage = 24; - break; - case 24: - interpreter.sendDialogues(npc, FacialExpression.FURIOUS, "YOU DID WHAT???"); - stage = 25; - break; - case 25: - interpreter.sendDialogues(npc, FacialExpression.FURIOUS, "Are you mentally deficient??? That guard dog was", "protecting the route to Morytania! Without it we could", "be in severe peril of attack!"); - stage = 26; - break; - case 26: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Did I make a mistake?"); - stage = 27; - break; - case 27: - interpreter.sendDialogues(npc, FacialExpression.FURIOUS, "YES YOU DID!!!!! You need to get there", "and find out what is happening! Before it is too late for", "us all!"); - stage = 28; - break; - case 28: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "B-but Drezel TOLD me to...!"); - stage = 29; - break; - case 29: - interpreter.sendDialogues(npc, FacialExpression.FURIOUS, "No, you absolute cretin! Obviously some fiend has done", "something to Drezel and tricked your feeble intellect", "into helping them kill that guard dog!"); - stage = 30; - break; - case 30: - interpreter.sendDialogues(npc, FacialExpression.FURIOUS, "You get back there and do whatever is necessary to", "safeguard my kingdom from attack, or I will see you", "beheaded for high treason!"); - stage = 31; - break; - case 31: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Y-yes your Highness."); - stage = 32; - break; - case 32: - quest.setStage(player, 13); - end(); - break; - case 40: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Okay, okay, I'm going, I'm going.... There's no need to", "shout..."); - stage = 41; - break; - case 41: - interpreter.sendDialogues(npc, FacialExpression.FURIOUS, "NO NEED TO SHOUT???"); - stage = 42; - break; - case 42: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Listen, and listen well, and see if your puny mind can", "comprehend this; if the border is not protected, then we", "are at the mercy of the evil beings"); - stage = 43; - break; - case 43: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "that live in Morytania. Given the most of the", "inhabitants consider humans to be nothing more than", "over talkative snack foods, I would"); - stage = 44; - break; - case 44: - interpreter.sendDialogues(npc, FacialExpression.FURIOUS, "say that me shouting at you for your incompetence is", "the LEAST of your worries right now NOW GO!"); - stage = 45; - break; - case 45: - end(); - break; - case 50: - end(); - break; - case 499: - npc("Ah, it's you again. Hello there."); - stage = 500; - break; - case 500: - player("Hello, Your Majesty. I am happy to report that the", "situation at the Temple of Paterdomus has been sorted.", "Misthalin's borders should once again be fully protected", "against the threats of Morytania."); - stage++; - break; - case 501: - npc("Ah, thank you! The kingdom is forever in your", "debt."); - stage++; - break; - case 502: - player("In your debt? Does that mean you're going to give me", "fabulous rewards for my efforts?"); - stage++; - break; - case 503: - npc("Of course not; however, if it's rewards you're after, it", "occurs to me that you could be of even more service to", "the kingdom...and this time, there's payment in it for", "you."); - stage++; - break; - case 504: - options("Oh, tell me more!", "Sorry, not interested."); - stage++; - break; - case 505: - switch (buttonId) { - case 1: - player("Oh, tell me more!"); - stage++; - break; - case 2: - player("Sorry, not interested."); - stage = 50; - break; - } - break; - case 506: - npc("Well, you see, because of the mounting threats from", "Morytania and the Wilderness, the southern kingdoms", "have banded together to take action."); - stage++; - break; - case 507: - npc("We have constructed a network of beacons that stretch", "all the way from the source of the River Salve to the", "northwestern-most edge of the Wilderness."); - stage++; - break; - case 508: - npc("Should there be any threat from these uncivilized lands,", "we'll be able to spread the word as fast as the light of", "the flames can travel."); - stage++; - break; - case 509: - player("So how could I be of help?"); - stage++; - break; - case 510: - npc("The task itself should be rather straightforward: I need", "you to help us test the network of beacons to make", "sure everything is in order, in case the worst", "should occur."); - stage++; - break; - case 511: - options("I'd be happy to help.", "I'm a bit busy right now."); - stage++; - break; - case 512: - switch (buttonId) { - case 1: - player("I'd be happy to help."); - stage++; - break; - case 2: - player("I'm a bit busy right now."); - stage = 50; - break; - } - break; - case 513: - if (player.getSkills().getLevel(Skills.FIREMAKING) < 43) { - npc("I'd love for you to help, but you need", "to get better at lighting fires first."); - stage = 50; - } else { - npc("Excellent! The kingdom of Misthalin is eternally", "grateful."); - stage++; - } - break; - case 514: - player("So what do I need to do?"); - stage++; - break; - case 515: - npc("Talk to the head fire tender, Blaze Sharpeye - he'll", "explain everything. He is stationed just south of the", "Temple of Paterdomus, on the cliffs by the River Salve."); - stage++; - break; - case 516: - player("Thank you, Your Majesty. I'll seek out Blaze", "right away."); - stage = 50; - player.getQuestRepository().getQuest("All Fired Up").start(player); - break; - case 600: - player("I'm happy to report that the beacon network seems to", "be working as expected."); - stage++; - break; - case 601: - npc("Excellent! I'm delighted to hear it."); - stage++; - break; - case 602: - player("So, about that reward you promised?"); - stage++; - break; - case 603: - npc("What happened to the days when adventurers felt", "rewarded in full by the knowledge of a job well done?"); - stage++; - break; - case 604: - player("Well before my time, I'm afraid."); - stage++; - break; - case 605: - npc("Hmph. Well, I suppose a king must stick to his word.", "Mind you, let me stress how grateful we are - and how", "grateful we'd be if you could continue helping us test", "the beacons."); - stage++; - break; - case 606: - npc("There is much more to be done and this is but a", "pittance compared to what I'm willing to offer for", "further assistance!"); - stage++; - break; - case 607: - end(); - player.getQuestRepository().getQuest("All Fired Up").finish(player); - break; - case 700: - npc("Did what?"); - stage++; - break; - case 701: - if (player.getAttribute("afu-mini:adze", false)) { - player("I lit all 14 beacons at once!"); - } else if (player.getAttribute("afu-mini:gloves", false)) { - player("I lit 10 beacons at once!"); - } else if (player.getAttribute("afu-mini:ring", false)) { - player("I lit 6 beacons at once!"); - } - stage++; - break; - case 702: - npc("Oh, wonderful! Here is your reward then."); - if (player.getAttribute("afu-mini:adze", false)) - if (player.getInventory().add(new Item(Items.INFERNO_ADZE_13661))) - player.removeAttribute("afu-mini:adze"); - if (player.getAttribute("afu-mini:gloves", false)) - if (player.getInventory().add(new Item(Items.FLAME_GLOVES_13660))) - player.removeAttribute("afu-mini:gloves"); - if (player.getAttribute("afu-mini:ring", false)) - if (player.getInventory().add(new Item(Items.RING_OF_FIRE_13659))) - player.removeAttribute("afu-mini:ring"); - stage++; - break; - case 703: - end(); - break; - } - return true; - } - - @Override - public int[] getIds() { - return new int[] { 648, 2590, 5838 }; - } -} \ No newline at end of file diff --git a/Server/src/main/java/Server/core/game/content/quest/free/shieldofarrav/ShieldofArrav.java b/Server/src/main/java/Server/core/game/content/quest/free/shieldofarrav/ShieldofArrav.java index 283c5bcfc..c283ac4d6 100644 --- a/Server/src/main/java/Server/core/game/content/quest/free/shieldofarrav/ShieldofArrav.java +++ b/Server/src/main/java/Server/core/game/content/quest/free/shieldofarrav/ShieldofArrav.java @@ -1,5 +1,6 @@ package core.game.content.quest.free.shieldofarrav; +import core.game.content.dialogue.KingRoaldDialogue; import core.game.node.entity.player.Player; import core.game.node.entity.player.link.quest.Quest; import core.game.node.item.Item; diff --git a/Server/src/main/java/Server/core/game/content/quest/members/allfiredup/KingRoaldAFUDialogue.kt b/Server/src/main/java/Server/core/game/content/quest/members/allfiredup/KingRoaldAFUDialogue.kt new file mode 100644 index 000000000..ed0b1cea0 --- /dev/null +++ b/Server/src/main/java/Server/core/game/content/quest/members/allfiredup/KingRoaldAFUDialogue.kt @@ -0,0 +1,115 @@ +package core.game.content.quest.members.allfiredup + +import core.game.content.dialogue.DialogueFile +import core.game.node.entity.skill.Skills +import core.tools.END_DIALOGUE +import core.tools.START_DIALOGUE + +class KingRoaldAFUDialogue(val questStage: Int) : DialogueFile() { + override fun handle(componentID: Int, buttonID: Int) { + + if(questStage == 0){ + when(stage){ + 0 -> npc("Ah, it's you again. Hello there.").also { stage++ } + + 1 -> player( + "Hello, Your Majesty. I am happy to report that the", + "situation at the Temple of Paterdomus has been sorted.", + "Misthalin's borders should once again be fully protected", + "against the threats of Morytania." + ).also { stage++ } + + 2 -> npc("Ah, thank you! The kingdom is forever in your", "debt.").also{stage++} + 3 -> player("In your debt? Does that mean you're going to give me", "fabulous rewards for my efforts?").also { stage++ } + 4 -> npc( + "Of course not; however, if it's rewards you're after, it", + "occurs to me that you could be of even more service to", + "the kingdom...and this time, there's payment in it for", + "you." + ).also { stage++ } + + 5 -> options("Oh, tell me more!", "Sorry, not interested.").also { stage++ } + 6 -> when(buttonID){ + 1 -> player("Oh, tell me more!").also { stage++ } + 2 -> player("Sorry, not interested.").also { stage = END_DIALOGUE } + } + + 7 -> npc( + "Well, you see, because of the mounting threats from", + "Morytania and the Wilderness, the southern kingdoms", + "have banded together to take action." + ).also { stage++ } + + 8 -> npc( + "We have constructed a network of beacons that stretch", + "all the way from the source of the River Salve to the", + "northwestern-most edge of the Wilderness." + ).also { stage++ } + + 9 -> npc( + "Should there be any threat from these uncivilized lands,", + "we'll be able to spread the word as fast as the light of", + "the flames can travel." + ).also { stage++ } + + 10 -> player("So how could I be of help?").also { stage++ } + 11 -> npc( + "The task itself should be rather straightforward: I need", + "you to help us test the network of beacons to make", + "sure everything is in order, in case the worst", + "should occur." + ).also { stage++ } + + 12 -> options("I'd be happy to help.", "I'm a bit busy right now.").also { stage++ } + 13 -> when(buttonID){ + 1 -> player("I'd be happy to help.").also { stage++ } + 2 -> player("I'm a bit busy right now.").also { stage = END_DIALOGUE } + } + + 14 -> if (player!!.skills.getLevel(Skills.FIREMAKING) < 43) { + npc("I'd love for you to help, but you need", "to get better at lighting fires first.") + stage = END_DIALOGUE + } else { + npc("Excellent! The kingdom of Misthalin is eternally", "grateful.") + stage++ + } + + 15 -> player("So what do I need to do?").also { stage++ } + 16 -> npc( + "Talk to the head fire tender, Blaze Sharpeye - he'll", + "explain everything. He is stationed just south of the", + "Temple of Paterdomus, on the cliffs by the River Salve." + ).also { stage++ } + + 17 -> { + player("Thank you, Your Majesty. I'll seek out Blaze", "right away.") + stage = END_DIALOGUE + player!!.questRepository.getQuest("All Fired Up").start(player) + } + + END_DIALOGUE -> end() + } + } + + else if(questStage == 90){ + when(stage){ + START_DIALOGUE -> player("I'm happy to report that the beacon network seems to", "be working as expected.").also { stage++ } + 1 -> npc("Excellent! I'm delighted to hear it.").also { stage++ } + 2 -> player("So, about that reward you promised?").also { stage++ } + 4 -> npc("What happened to the days when adventurers felt", "rewarded in full by the knowledge of a job well done?").also { stage++ } + 5 -> player("Well before my time, I'm afraid.") + 6 -> npc("Hmph. Well, I suppose a king must stick to his word.", "Mind you, let me stress how grateful we are - and how", "grateful we'd be if you could continue helping us test", "the beacons.").also { stage++ } + 7 -> npc("There is much more to be done and this is but a", "pittance compared to what I'm willing to offer for", "further assistance!").also { stage = END_DIALOGUE } + END_DIALOGUE -> { + end() + player!!.questRepository.getQuest("All Fired Up").finish(player) + } + } + } + + else { + abandonFile() + } + + } +} \ No newline at end of file diff --git a/Server/src/main/java/Server/core/game/content/quest/members/priestinperil/KingRoaldPIPDialogue.kt b/Server/src/main/java/Server/core/game/content/quest/members/priestinperil/KingRoaldPIPDialogue.kt new file mode 100644 index 000000000..ce2ce2655 --- /dev/null +++ b/Server/src/main/java/Server/core/game/content/quest/members/priestinperil/KingRoaldPIPDialogue.kt @@ -0,0 +1,94 @@ +package core.game.content.quest.members.priestinperil + +import core.game.content.dialogue.DialogueFile +import core.tools.END_DIALOGUE +import core.tools.START_DIALOGUE + +class KingRoaldPIPDialogue(val questStage: Int) : DialogueFile() { + override fun handle(componentID: Int, buttonID: Int) { + + if(stage == START_DIALOGUE){ + npc("Well, hello there. What do you want?").also { stage++ } + return + } + + if(questStage == 0){ + when(stage){ + 1 -> player("I am looking for a quest!").also { stage++ } + 2 -> npc("A quest you say? Hmm, what an odd request to make", "of the king. It's funny you should mention it though, as", "there is something you can do for me.").also { stage++ } + 3 -> npc("Are you aware of the temple easy of here? It stands on", "the river Salve and guards the entrance to the lands of", "Morytania?").also { stage++ } + 4 -> player("No, I don't think I know it...").also { stage++ } + 5 -> npc("Hmm, how strange that you don't. Well anyway, it has", "been some days since last I heard from Drezel, the", "priest who lives there.").also { stage++ } + 6 -> npc("Be a sport and go make sure that nothing untoward", "has happend to the silly old codger for me, would you?").also { stage++ } + 7 -> options("Sure.", "No, that sounds boring.").also { stage++ } + 8 -> when(buttonID){ + 1 -> { + player("Sure. I don't have anything better to do right now.") + player!!.questRepository.getQuest("Priest in Peril").start(player) + stage++ + } + 2 -> { + npc("Yes, I dare say it does. I wouldn't even have", "mentioned it had you not seemed to be looking for", "something to do anyway.") + stage = END_DIALOGUE + } + } + 9 -> npc("Many thanks adventurer! I would have sent one of my", "squires but they wanted payment for it!").also { stage = END_DIALOGUE } + } + } + + else if(questStage <= 11){ + when(stage){ + 1 -> npc("You have news of Drezel for me?").also { stage++ } + 2 -> player("No, not yet.").also { stage++ } + 3 -> npc("I would wish you would go check on my dear friend.").also { stage = END_DIALOGUE } + } + } + + else if(questStage == 12){ + when(stage){ + 1 -> npc("You have news of Drezel for me?").also { stage++ } + 2 -> player("Yeah, I spoke to the guys at the temple and they said", "they were being bothered by that dog in the crypt, so I", "went and killed it for them. No problem.").also { stage++ } + 3 -> npc("YOU DID WHAT??").also { stage++ } + 4 -> npc("Are you mentally deficient??? That guard dog was", "protecting the route to Morytania! Without it we could", "be in severe peril of attack!").also { stage++ } + 5 -> player("Did I make a mistake?").also { stage++ } + 6 -> npc("YES YOU DID!!!!! You need to get there", "and find out what is happening! Before it is too late for", "us all!").also { stage++ } + 7 -> player("B-but Drezel TOLD me to..!").also { stage++ } + 8 -> npc("No, you absolute cretin! Obviously some fiend has done", "something to Drezel and tricked your feeble intellect", "into helping them kill that guard dog!").also { stage++ } + 9 -> npc("You get back there and do whatever is necessary to", "safeguard my kingdom from attack, or I will see you", "beheaded for high treason!").also { stage++ } + 10 -> { + player("Y-yes your Highness.") + player!!.questRepository.getQuest("Priest in Peril").setStage(player,13) + stage = END_DIALOGUE + } + } + } + + else if(questStage == 13){ + when(stage){ + 1 -> npc("AND MORE IMPORTANTLY, WHY HAVEN'T", "YOU ENSURED THE BORDER TO", "MORYTANIA IS SECURE YET?").also { stage++ } + 2 -> player("Okay, okay, I'm going, I'm going.... There's no need to", "shout...").also { stage++ } + 3 -> npc("NO NEED TO SHOUT?!").also { stage++ } + 4 -> npc("Listen, and listen well, and see if your puny mind can", "comprehend this; if the border is not protected, then we", "are at the mercy of the evil beings").also { stage++ } + 5 -> npc("that live in Morytania. Given the most of the", "inhabitants consider humans to be nothing more than", "over talkative snack foods, I would").also { stage++ } + 6 -> npc("say that me shouting at you for your incompetence is", "the LEAST of your worries right now, NOW GO!").also { stage = END_DIALOGUE } + } + } + + else if(questStage == 14){ + when(stage){ + 1 -> player("I'm looking for a key to unlock Drezel!").also { stage = END_DIALOGUE } + } + } + + else if(questStage == 15 || questStage == 16 || questStage == 17){ + when(stage){ + 1 -> player("I'm helping Drezel!").also { stage = END_DIALOGUE } + } + } + + else { + abandonFile() + } + + } +} \ No newline at end of file diff --git a/Server/src/main/java/Server/core/game/content/quest/members/PriestInPeril.java b/Server/src/main/java/Server/core/game/content/quest/members/priestinperil/PriestInPeril.java similarity index 99% rename from Server/src/main/java/Server/core/game/content/quest/members/PriestInPeril.java rename to Server/src/main/java/Server/core/game/content/quest/members/priestinperil/PriestInPeril.java index af84d6df1..36fcb0a30 100644 --- a/Server/src/main/java/Server/core/game/content/quest/members/PriestInPeril.java +++ b/Server/src/main/java/Server/core/game/content/quest/members/priestinperil/PriestInPeril.java @@ -1,4 +1,4 @@ -package core.game.content.quest.members; +package core.game.content.quest.members.priestinperil; import core.plugin.Initializable; import core.game.node.entity.skill.Skills; diff --git a/Server/src/main/java/Server/core/game/content/quest/members/thelosttribe/DukeHoracioTLTDialogue.kt b/Server/src/main/java/Server/core/game/content/quest/members/thelosttribe/DukeHoracioTLTDialogue.kt new file mode 100644 index 000000000..5cae544df --- /dev/null +++ b/Server/src/main/java/Server/core/game/content/quest/members/thelosttribe/DukeHoracioTLTDialogue.kt @@ -0,0 +1,230 @@ +package core.game.content.quest.members.thelosttribe + +import core.game.content.dialogue.DialogueFile +import core.game.content.dialogue.DukeHoracioDialogue +import core.game.content.dialogue.FacialExpression +import core.game.node.entity.npc.NPC +import core.game.node.item.Item +import core.tools.END_DIALOGUE +import core.tools.Items +import core.tools.START_DIALOGUE + +class DukeHoracioTLTDialogue(val questStage: Int) : DialogueFile() { + private val Sigmund = NPC(2082) + + + override fun handle(componentID: Int, buttonID: Int) { + + if(questStage == 20){ + when(stage){ + START_DIALOGUE -> player("I know what happened in the cellar.").also { stage++ } + 1 -> npc("Oh?").also { stage++ } + 2 -> player("The cook says he saw something in the cellar.","Like a goblin with big eyes.").also { stage++ } + 3 -> npc( + "Yes, he mentioned that to me. But I think he was", + "imagining things. Goblins live in natural caves but", + "everyone knows they don't have the wit to make their", + "own tunnels." + ).also { stage++ } + + 4 -> sendNormalDialogue( + Sigmund, + FacialExpression.ANGRY, + "Yes your grace, but if there is any possibility that this", + "is a goblin incursion then we should take that possibility", + "very seriously!" + ).also { stage++ } + + 5 -> player("I think we should at least investigate.").also { stage++ } + 6 -> sendNormalDialogue( + Sigmund, + FacialExpression.WORRIED, + "Your grace, I think you should listen to " + (if (player!!.isMale) "him" else "her") + "." + ).also { stage++ } + + 7 -> { + npc( + "Hmm, very well. I give you permission to investigate", + "this mystery. If there is a blocked tunnel then perhaps", + "you should try to un-block it." + ) + player!!.questRepository.getQuest("Lost Tribe").setStage(player, 30) + stage = END_DIALOGUE + } + } + } + + else if(questStage == 30 && player!!.inventory.containsItem(Item(Items.BROOCH_5008))){ + when(stage){ + START_DIALOGUE -> player("On the ground I found this brooch.").also { stage++ } + 1 -> npc( + "I've never seen anything like that before. It doesn't", + "come from Lumbridge. What do you think, Sigmund?" + ).also { stage++ } + + 2 -> sendNormalDialogue( + Sigmund, + FacialExpression.WORRIED, + "It is unknown to me, your grace. But the fact it is", + "there is enough to prove the Cook's story. It must have", + "been dropped by a goblin as it fled." + ).also { stage++ } + + 3 -> npc("I've never heard of a goblin wearing something so well-", "crafted.").also { stage++ } + 4 -> sendNormalDialogue( + Sigmund, + FacialExpression.ANGRY, + "Then it must have been stolen!" + ).also { stage++ } + + 5 -> npc("But it wasn't stolen from us. Where could it be from?").also { stage++ } + 6 -> sendNormalDialogue( + Sigmund, + FacialExpression.ANGRY, + "That doesn't matter! You said yourself that goblins", + "couldn't have made that, so they must have stolen it", + "from somewhere." + ).also { stage++ } + + 7 -> sendNormalDialogue( + Sigmund, + FacialExpression.ANGRY, + "Horrible, thieving goblins have broken into our cellar!", + "We must retaliate immediately!" + ).also { stage++ } + + 8 -> sendNormalDialogue( + Sigmund, + FacialExpression.ANGRY, + "First we should wipe out the goblins east of the river,", + "then we can march on the goblin village to the north-", + "west..." + ).also { stage++ } + + 9 -> npc("I will not commit troops until I have proof that goblins", "are behind this.").also { stage++ } + 10 -> { + npc( + player!!.name + ", please find out what you can about this", + "brooch. The librarian in Varrock might be able to help", + "identify the symbol." + ) + player!!.questRepository.getQuest("Lost Tribe").setStage(player, 40) + stage = END_DIALOGUE + } + } + } + + else if(stage == 44){ + when(stage){ + START_DIALOGUE -> player( + "I spoke to the goblin generals in the goblin village. They", + "told me about an ancient goblin tribe that went to live", + "underground." + ).also { stage++ } + + 1 -> sendNormalDialogue( + Sigmund, + FacialExpression.ANGRY, + "What more proof do we need? Nasty, smelly goblins", + "have been living under our feet all this time! We must", + "crush them at once!" + ).also { stage++ } + + 2 -> npc( + "Hmm, perhaps you are right. I will send word to the", + "army to prepare for an underground assault." + ).also { stage++ } + + 3 -> { + npc( + player!!.name.capitalize() + ", I would still like you to find out more", + "about this tribe. It cannot hurt to know one's enemy." + ) + player!!.questRepository.getQuest("Lost Tribe").setStage(player, 45) + stage = END_DIALOGUE + } + } + } + + else if(questStage == 46){ + when(stage){ + START_DIALOGUE -> player( + "I've made contact with the cave goblins. They say they", + "were following a seam and broke into the cellar by", + "mistake." + ).also { stage++ } + + 2 -> sendNormalDialogue( + Sigmund, + FacialExpression.ANGRY, + "And I suppose you believe them, goblin lover?" + ).also { stage++ } + + 3 -> player("Well, they seemed friendlier than most goblins, and", "nothing was taken from the cellar.").also { stage++ } + 4 -> npc( + "Actually, something was taken. Sigmund has informed", + "me that some of the castle silverware is missing from", + "the cellar." + ).also { stage++ } + + 5 -> { + npc("Unless it is returned, I am afraid I will have no option", "but war.") + player!!.questRepository.getQuest("Lost Tribe").setStage(player, 47) + stage = END_DIALOGUE + } + } + } + + else if(questStage == 49 && player!!.inventory.contains(Items.SILVERWARE_5011,1)){ + when(stage){ + START_DIALOGUE -> player("I found the missing silverware in the HAM cave!").also { stage++ } + 1 -> npc("Sigmund! Is this your doing?").also { stage++ } + 2 -> sendNormalDialogue( + Sigmund, + FacialExpression.WORRIED, + "Of...of course not! The goblins must have, um, dropped", + "the silverware as they ran away." + ).also { stage++ } + + 3 -> npc( + "Don't lie to me! I knew you were a HAM member but", + "I didn't think you would stoop to this. You are", + "dismissed from my service." + ).also { stage++ } + + 4 -> sendNormalDialogue( + Sigmund, + FacialExpression.THINKING, + "But don't you see it was for the best? For goblins to be", + "living under our feet like this... ugh. It doesn't matter", + "how civilised they are: all sub-human species must be", + "wiped out!" + ).also { stage++ } + + 5 -> npc("That's enough! Get out of my castle now!").also { stage++ } + 6 -> npc( + "I see I was ill-advised. Unless there is an act of", + "aggression by the cave goblins there is no need for war." + ).also { stage++ } + + 7 -> interpreter!!.sendItemMessage(Items.PEACE_TREATY_5012, "The Duke writes a document and signs it.").also { stage++ } + 8 -> { + npc( + "This peace treaty specifies the border between", + "Lumbridge and the Cave Goblin realm. Please take it to", + "the cave goblins and tell them I would like to meet with", + "their leader to sign it." + ) + player!!.inventory.add(Item(Items.PEACE_TREATY_5012)) + player!!.questRepository.getQuest("Lost Tribe").setStage(player, 50) + player!!.varpManager.get(465).setVarbit(0, 9).send(player!!) + stage = END_DIALOGUE + } + } + } + + else { + abandonFile() + } + } +} \ No newline at end of file diff --git a/Server/src/main/java/Server/core/game/content/quest/members/thelosttribe/MistagLTDialogue.kt b/Server/src/main/java/Server/core/game/content/quest/members/thelosttribe/MistagLTDialogue.kt new file mode 100644 index 000000000..ffb1e4391 --- /dev/null +++ b/Server/src/main/java/Server/core/game/content/quest/members/thelosttribe/MistagLTDialogue.kt @@ -0,0 +1,51 @@ +package core.game.content.quest.members.thelosttribe + +import core.game.content.activity.ActivityManager +import core.game.content.dialogue.DialogueFile +import core.tools.END_DIALOGUE +import core.tools.START_DIALOGUE + +class MistagLTDialogue(val isGreeting: Boolean, val questStage: Int) : DialogueFile() { + override fun handle(componentID: Int, buttonID: Int) { + + if(isGreeting){ + when(stage){ + //Greeting dialogue + START_DIALOGUE -> npc("Perhaps you are a friend after all!").also { stage++ } + 1 -> npc("Greetings, friend. I am sorry I panicked when I saw you.").also { stage++ } + 2 -> npc("Our legends tell of the surface as a place of horror and","violence, where the gods forced us to fight in terrible","battles.").also { stage++ } + 3 -> npc("When I saw a surface-dweller appear I was afraid it","was a return to the old days!").also { stage++ } + 4 -> player("Did you break in to the castle cellar?").also { stage++ } + 5 -> npc("It was an accident. We were following a seam of iron","and suddenly we found ourselves in a room!").also { stage++ } + 6 -> npc("We blocked up our tunnel behind us and ran back","here. Then we did what cave goblins always do when","there is a problem: we hid and hoped it would go away.").also { stage++ } + 7 -> npc("We meant no harm! Please tell the ruler of the above","people that we want to make peace.").also { stage = END_DIALOGUE; player!!.questRepository.getQuest("Lost Tribe").setStage(player,46) } + } + } + + else{ + if(questStage == 45){ + when(stage){ + START_DIALOGUE -> npc("Our legends tell of the surface as a place of horror and","violence, where the gods forced us to fight in terrible","battles.").also { stage++ } + 1 -> npc("When I saw a surface-dweller appear I was afraid it","was a return to the old days!").also { stage++ } + 2 -> player("Did you break in to the castle cellar?").also { stage++ } + 3 -> npc("It was an accident. We were following a seam of iron","and suddenly we found ourselves in a room!").also { stage++ } + 4 -> npc("We blocked up our tunnel behind us and ran back","here. Then we did what cave goblins always do when","there is a problem: we hid and hoped it would go away.").also { stage++ } + 5 -> npc("We meant no harm! Please tell the ruler of the above","people that we want to make peace.").also { stage = END_DIALOGUE; player!!.questRepository.getQuest("Lost Tribe").setStage(player,46) } + } + } + + if(questStage == 50){ + when(stage){ + START_DIALOGUE -> player("I have a peace treaty from the Duke of Lumbridge.").also { stage++ } + 1 -> npc("A peace treaty? Then you will not invade?").also { stage++ } + 2 -> player("No. As long as you stick to the terms of this treaty","there will be no conflict. The Duke of Lumbridge wants","to meet your ruler to sign it.").also { stage++ } + 3 -> npc("I will summon Ur-tag, our headman, at once.").also { stage++ } + 4 -> { + end() + ActivityManager.start(player,"Lost Tribe Cutscene",false) + } + } + } + } + } +} \ No newline at end of file diff --git a/Server/src/main/java/Server/core/tools/DialogueConst.kt b/Server/src/main/java/Server/core/tools/DialogueConst.kt index ea1ca3d4f..0e5a605ea 100644 --- a/Server/src/main/java/Server/core/tools/DialogueConst.kt +++ b/Server/src/main/java/Server/core/tools/DialogueConst.kt @@ -1,4 +1,9 @@ package core.tools const val START_DIALOGUE = 0 -const val END_DIALOGUE = 1000000 \ No newline at end of file +const val END_DIALOGUE = 1000000 + +/** + * Stage gets set to this by the sendChoices() method if there's more than one option a player can pick when starting a conversation. I.E. multiple simultaneous quests. + */ +const val DIALOGUE_INITIAL_OPTIONS_HANDLE = 1001 \ No newline at end of file