From 22269f32f9ce0cbf939cd105884e1e4dc81e3588 Mon Sep 17 00:00:00 2001 From: Greg Tseng Date: Thu, 6 Mar 2025 15:15:01 -0500 Subject: [PATCH] both quests now have a bribe option --- .../quest/heroesquest/AchiettiesDialogue.kt | 374 +++++++++++------- .../shieldofarrav/KingRoaldArravDialogue.kt | 4 +- 2 files changed, 236 insertions(+), 142 deletions(-) diff --git a/Server/src/main/content/region/asgarnia/burthorpe/quest/heroesquest/AchiettiesDialogue.kt b/Server/src/main/content/region/asgarnia/burthorpe/quest/heroesquest/AchiettiesDialogue.kt index be02fd7..555a1a9 100644 --- a/Server/src/main/content/region/asgarnia/burthorpe/quest/heroesquest/AchiettiesDialogue.kt +++ b/Server/src/main/content/region/asgarnia/burthorpe/quest/heroesquest/AchiettiesDialogue.kt @@ -10,9 +10,14 @@ import core.game.node.entity.player.Player import core.plugin.Initializable import org.rs09.consts.Items import org.rs09.consts.NPCs +import core.game.node.item.Item @Initializable -class AchiettiesDialogue(player: Player? = null) : DialoguePlugin(player){ +class AchiettiesDialogue(player: Player? = null) : DialoguePlugin(player) { + + companion object { + const val BRIBE_PRICE = 1_000_000 + } override fun handle(interfaceId: Int, buttonId: Int): Boolean { openDialogue(player, AchiettiesDialogueFile(), npc) @@ -32,149 +37,238 @@ class AchiettiesDialogueFile : DialogueBuilderFile() { override fun create(b: DialogueBuilder) { - b.onQuestStages(Quests.HEROES_QUEST, 0,1) - .branch { player -> - return@branch getQuestStage(player, Quests.HEROES_QUEST) - }.let{ branch -> - branch.onValue(0) - .npcl(FacialExpression.FRIENDLY, "Greetings. Welcome to the Heroes' Guild.") - .npcl("Only the greatest heroes of this land may gain entrance to this guild.") - // - If the player's skill levels are lower than the quest requirements. (I think this is after 2009) - // linel("Before starting this quest, be aware that one or more of your skill levels are lower than what is required to fully complete it.") - .options() - .let { optionBuilder -> - optionBuilder.option("I'm a hero, may I apply to join?") - .playerl("I'm a hero. May I apply to join?") - .branch { player -> - return@branch if (HeroesQuest.hasRequirements(player)) { - 1 - } else { - 0 - } - }.let { branch -> - branch.onValue(0) - .npcl("You're a hero? I've never heard of YOU. You are required to possess at least 55 quest points to file an application.") - .npcl("Additionally you must have completed the Shield of Arrav, Lost City, Merlin's Crystal and Dragon Slayer quests.") - .end() - return@let branch - }.onValue(1) - .betweenStage { df, player, _, _ -> - if(getQuestStage(player, Quests.HEROES_QUEST) == 0) { - setQuestStage(player, Quests.HEROES_QUEST, 1) - } - } - .npcl("Well you seem to meet our initial requirements, so you may now begin the tasks to earn membership in the Heroes' Guild.") - .npcl("The three items required for entrance are: An Entranan Firebird feather, a Master Thieves' armband, and a cooked Lava Eel.") - .options() - .let { optionBuilder2 -> - optionBuilder2.option_playerl("Any hints on getting the thieves armband?") - .npcl("I'm sure you have the relevant contacts to find out about that.") - .end() - optionBuilder2.option_playerl("Any hints on getting the feather?") - .npcl("Not really - other than Entranan firebirds tend to live on Entrana.") - .end() - optionBuilder2.option_playerl("Any hints on getting the eel?") - .npcl("Maybe go and find someone who knows a lot about fishing?") - .end() - optionBuilder2.option_playerl("I'll start looking for all those things then.") - .npcl("Good luck with that.") - .end() - } - - optionBuilder.option_playerl("Good for the foremost heroes of the land.") - .npcl("Yes. Yes it is.") - .end() + b.onQuestStages(Quests.HEROES_QUEST, 0, 1) + .branch { player -> + // Return the current quest stage. + getQuestStage(player, Quests.HEROES_QUEST) + } + .let { branch -> + branch.onValue(0) + .npcl(FacialExpression.FRIENDLY, "Greetings. Welcome to the Heroes' Guild.") + .npcl("Only the greatest heroes of this land may gain entrance to this guild.") + .options() + .let { optionBuilder -> + optionBuilder.option("I'm a hero, may I apply to join?") + .playerl("I'm a hero. May I apply to join?") + .branch { player -> + if (HeroesQuest.hasRequirements(player)) 1 else 0 } - branch.onValue(1) - .npcl("Greetings. Welcome to the Heroes' Guild.") - .npcl("How goes thy quest adventurer?") - .playerl("It's tough. I've not done it yet.") - .npcl("Remember, the items you need to enter are:") - .npcl("An Entranan Firebirds' feather, A Master Thieves armband, and a cooked Lava Eel.") - .options() - .let { optionBuilder2 -> - optionBuilder2.option_playerl("Any hints on getting the thieves armband?") - .npcl("I'm sure you have the relevant contacts to find out about that.") - .end() - optionBuilder2.option_playerl("Any hints on getting the feather?") - .npcl("Not really - other than Entranan firebirds tend to live on Entrana.") - .end() - optionBuilder2.option_playerl("Any hints on getting the eel?") - .npcl("Maybe go and find someone who knows a lot about fishing?") - .end() - optionBuilder2.option_playerl("I'll start looking for all those things then.") - .npcl("Good luck with that.") - .end() + .let { branch -> + branch.onValue(0) + .npcl("You're a hero? I've never heard of YOU. You are required to possess at least 55 quest points to file an application.") + .npcl("Additionally you must have completed the Shield of Arrav, Lost City, Merlin's Crystal and Dragon Slayer quests.") + .end() + branch } - } - - b.onQuestStages(Quests.HEROES_QUEST, 2, 3, 4) - .npcl("Greetings. Welcome to the Heroes' Guild.") - .npcl("How goes thy quest adventurer?") - .playerl("It's tough. I've not done it yet.") - .npcl("Remember, the items you need to enter are:") - .npcl("An Entranan Firebirds' feather, A Master Thieves armband, and a cooked Lava Eel.") - .options() - .let { optionBuilder2 -> - optionBuilder2.option_playerl("Any hints on getting the thieves armband?") - .npcl("I'm sure you have the relevant contacts to find out about that.") - .end() - optionBuilder2.option_playerl("Any hints on getting the feather?") - .npcl("Not really - other than Entranan firebirds tend to live on Entrana.") - .end() - optionBuilder2.option_playerl("Any hints on getting the eel?") - .npcl("Maybe go and find someone who knows a lot about fishing?") - .end() - optionBuilder2.option_playerl("I'll start looking for all those things then.") - .npcl("Good luck with that.") - .end() - } - - b.onQuestStages(Quests.HEROES_QUEST, 6) - .npcl("Greetings. Welcome to the Heroes' Guild.") - .npcl("How goes thy quest adventurer?") - .branch { player -> - return@branch if (HeroesQuest.allItemsInInventory(player)) { 1 } else { 0 } - }.let { branch -> - branch.onValue(0) - .playerl("It's tough. I've not done it yet.") - .npcl("Remember, the items you need to enter are:") - .npcl("An Entranan Firebirds' feather, A Master Thieves armband, and a cooked Lava Eel.") - .options() - .let { optionBuilder2 -> - optionBuilder2.option_playerl("Any hints on getting the thieves armband?") - .npcl("I'm sure you have the relevant contacts to find out about that.") - .end() - optionBuilder2.option_playerl("Any hints on getting the feather?") - .npcl("Not really - other than Entranan firebirds tend to live on Entrana.") - .end() - optionBuilder2.option_playerl("Any hints on getting the eel?") - .npcl("Maybe go and find someone who knows a lot about fishing?") - .end() - optionBuilder2.option_playerl("I'll start looking for all those things then.") - .npcl("Good luck with that.") - .end() - } - - branch.onValue(1) - .playerl("I have all the required items.") - .npcl("I see that you have. Well done. Now, to complete the quest, and gain entry to the Heroes' Guild in your final task all that you have to do is...") - .playerl("W-what? What do you mean? There's MORE?") - .npcl("I'm sorry, I was just having a little fun with you. Just a little Heroes' Guild humour there. What I really meant was") - .npcl("Congratulations! You have completed the Heroes' Guild entry requirements! You will find the door now open for you! Enter, Hero! And take this reward!") - .endWith { _, player -> - if (HeroesQuest.allItemsInInventory(player)) { - removeItem(player, Items.FIRE_FEATHER_1583) - removeItem(player, Items.LAVA_EEL_2149) - removeItem(player, Items.THIEVES_ARMBAND_1579) - if (getQuestStage(player, Quests.HEROES_QUEST) == 6) { - finishQuest(player, Quests.HEROES_QUEST) - } + .onValue(1) + .betweenStage { df, player, _, _ -> + if (getQuestStage(player, Quests.HEROES_QUEST) == 0) { + setQuestStage(player, Quests.HEROES_QUEST, 1) } } - } - + .npcl("Well you seem to meet our initial requirements, so you may now begin the tasks to earn membership in the Heroes' Guild.") + .npcl("The three items required for entrance are: An Entranan Firebird feather, a Master Thieves' armband, and a cooked Lava Eel.") + .options() + .let { optionBuilder2 -> + optionBuilder2.option_playerl("Any hints on getting the thieves armband?") + .npcl("I'm sure you have the relevant contacts to find out about that.") + .end() + optionBuilder2.option_playerl("Any hints on getting the feather?") + .npcl("Not really - other than Entranan firebirds tend to live on Entrana.") + .end() + optionBuilder2.option_playerl("Any hints on getting the eel?") + .npcl("Maybe go and find someone who knows a lot about fishing?") + .end() + optionBuilder2.option_playerl("I'll start looking for all those things then.") + .npcl("Good luck with that.") + .end() + optionBuilder2.option_playerl("Or perhaps the guild needs a bit of financing?") + .npcl("Perhaps a small 'Loan' of 1 million coins?") + // Bribery branch + .options() + .let { optionBuilder3 -> + optionBuilder3.option_playerl("That sounds good") + .branch { player -> + if (inInventory(player!!, 995, AchiettiesDialogue.BRIBE_PRICE)) 1 else 0 + } + .let { branch -> + branch.onValue(1) + .playerl(FacialExpression.FRIENDLY, "Here you go!") + .endWith { _, player -> + removeItem(player, Item(995, AchiettiesDialogue.BRIBE_PRICE), Container.INVENTORY) + finishQuest(player, Quests.HEROES_QUEST) + } + branch.onValue(0) + .playerl(FacialExpression.HALF_GUILTY, "Actually, I don't have that much.") + .end() + } + optionBuilder3.option_playerl("1 million coins for this dump? No way") + .end() + } + } + optionBuilder.option_playerl("Good for the foremost heroes of the land.") + .npcl("Yes. Yes it is.") + .end() + } + branch.onValue(1) + .npcl("Greetings. Welcome to the Heroes' Guild.") + .npcl("How goes thy quest adventurer?") + .playerl("It's tough. I've not done it yet.") + .npcl("Remember, the items you need to enter are:") + .npcl("An Entranan Firebird's feather, A Master Thieves' armband, and a cooked Lava Eel.") + .options() + .let { optionBuilder2 -> + optionBuilder2.option_playerl("Any hints on getting the thieves armband?") + .npcl("I'm sure you have the relevant contacts to find out about that.") + .end() + optionBuilder2.option_playerl("Any hints on getting the feather?") + .npcl("Not really - other than Entranan firebirds tend to live on Entrana.") + .end() + optionBuilder2.option_playerl("Any hints on getting the eel?") + .npcl("Maybe go and find someone who knows a lot about fishing?") + .end() + optionBuilder2.option_playerl("I'll start looking for all those things then.") + .npcl("Good luck with that.") + .end() + optionBuilder2.option_playerl("Or perhaps the guild needs a bit of financing?") + .npcl("Perhaps a small 'Loan' of 1 million coins?") + // Bribery branch + .options() + .let { optionBuilder3 -> + optionBuilder3.option_playerl("That sounds good") + .branch { player -> + if (inInventory(player!!, 995, AchiettiesDialogue.BRIBE_PRICE)) 1 else 0 + } + .let { branch -> + branch.onValue(1) + .playerl(FacialExpression.FRIENDLY, "Here you go!") + .endWith { _, player -> + removeItem(player, Item(995, AchiettiesDialogue.BRIBE_PRICE), Container.INVENTORY) + finishQuest(player, Quests.HEROES_QUEST) + } + branch.onValue(0) + .playerl(FacialExpression.HALF_GUILTY, "Actually, I don't have that much.") + .end() + } + optionBuilder3.option_playerl("1 million coins for this dump? No way") + .end() + } + } + } + + b.onQuestStages(Quests.HEROES_QUEST, 2, 3, 4) + .npcl("Greetings. Welcome to the Heroes' Guild.") + .npcl("How goes thy quest adventurer?") + .playerl("It's tough. I've not done it yet.") + .npcl("Remember, the items you need to enter are:") + .npcl("An Entranan Firebird's feather, A Master Thieves' armband, and a cooked Lava Eel.") + .options() + .let { optionBuilder2 -> + optionBuilder2.option_playerl("Any hints on getting the thieves armband?") + .npcl("I'm sure you have the relevant contacts to find out about that.") + .end() + optionBuilder2.option_playerl("Any hints on getting the feather?") + .npcl("Not really - other than Entranan Firebirds tend to live on Entrana.") + .end() + optionBuilder2.option_playerl("Any hints on getting the eel?") + .npcl("Maybe go and find someone who knows a lot about fishing?") + .end() + optionBuilder2.option_playerl("I'll start looking for all those things then.") + .npcl("Good luck with that.") + .end() + optionBuilder2.option_playerl("Or perhaps the guild needs a bit of financing?") + .npcl("Perhaps a small 'Loan' of 1 million coins?") + // Bribery branch + .options() + .let { optionBuilder3 -> + optionBuilder3.option_playerl("That sounds good") + .branch { player -> + if (inInventory(player!!, 995, AchiettiesDialogue.BRIBE_PRICE)) 1 else 0 + } + .let { branch -> + branch.onValue(1) + .playerl(FacialExpression.FRIENDLY, "Here you go!") + .endWith { _, player -> + removeItem(player, Item(995, AchiettiesDialogue.BRIBE_PRICE), Container.INVENTORY) + finishQuest(player, Quests.HEROES_QUEST) + } + branch.onValue(0) + .playerl(FacialExpression.HALF_GUILTY, "Actually, I don't have that much.") + .end() + } + optionBuilder3.option_playerl("1 million coins for this dump? No way") + .end() + } + } + + b.onQuestStages(Quests.HEROES_QUEST, 6) + .npcl("Greetings. Welcome to the Heroes' Guild.") + .npcl("How goes thy quest adventurer?") + .branch { player -> + if (HeroesQuest.allItemsInInventory(player)) 1 else 0 + } + .let { branch -> + branch.onValue(0) + .playerl("It's tough. I've not done it yet.") + .npcl("Remember, the items you need to enter are:") + .npcl("An Entranan Firebird's feather, A Master Thieves' armband, and a cooked Lava Eel.") + .options() + .let { optionBuilder2 -> + optionBuilder2.option_playerl("Any hints on getting the thieves armband?") + .npcl("I'm sure you have the relevant contacts to find out about that.") + .end() + optionBuilder2.option_playerl("Any hints on getting the feather?") + .npcl("Not really - other than Entranan Firebirds tend to live on Entrana.") + .end() + optionBuilder2.option_playerl("Any hints on getting the eel?") + .npcl("Maybe go and find someone who knows a lot about fishing?") + .end() + optionBuilder2.option_playerl("I'll start looking for all those things then.") + .npcl("Good luck with that.") + .end() + optionBuilder2.option_playerl("Or perhaps the guild needs a bit of financing?") + .npcl("Perhaps a small 'Loan' of 1 million coins?") + // Bribery branch + .options() + .let { optionBuilder3 -> + optionBuilder3.option_playerl("That sounds good") + .branch { player -> + if (inInventory(player!!, 995, AchiettiesDialogue.BRIBE_PRICE)) 1 else 0 + } + .let { branch -> + branch.onValue(1) + .playerl(FacialExpression.FRIENDLY, "Here you go!") + .endWith { _, player -> + removeItem(player, Item(995, AchiettiesDialogue.BRIBE_PRICE), Container.INVENTORY) + finishQuest(player, Quests.HEROES_QUEST) + } + branch.onValue(0) + .playerl(FacialExpression.HALF_GUILTY, "Actually, I don't have that much.") + .end() + } + optionBuilder3.option_playerl("1 million coins for this dump? No way") + .end() + } + } + branch.onValue(1) + .playerl("I have all the required items.") + .npcl("I see that you have. Well done. Now, to complete the quest, and gain entry to the Heroes' Guild in your final task all that you have to do is...") + .playerl("W-what? What do you mean? There's MORE?") + .npcl("I'm sorry, I was just having a little fun with you. Just a little Heroes' Guild humour there. What I really meant was") + .npcl("Congratulations! You have completed the Heroes' Guild entry requirements! You will find the door now open for you! Enter, Hero! And take this reward!") + .endWith { _, player -> + if (HeroesQuest.allItemsInInventory(player)) { + removeItem(player, Items.FIRE_FEATHER_1583) + removeItem(player, Items.LAVA_EEL_2149) + removeItem(player, Items.THIEVES_ARMBAND_1579) + if (getQuestStage(player, Quests.HEROES_QUEST) == 6) { + finishQuest(player, Quests.HEROES_QUEST) + } + } + } + } + b.onQuestStages(Quests.HEROES_QUEST, 100) - .npcl("Greetings. Welcome to the Heroes' Guild.") + .npcl("Greetings. Welcome to the Heroes' Guild.") } } \ No newline at end of file diff --git a/Server/src/main/content/region/misthalin/varrock/quest/shieldofarrav/KingRoaldArravDialogue.kt b/Server/src/main/content/region/misthalin/varrock/quest/shieldofarrav/KingRoaldArravDialogue.kt index 6924e63..2fc2def 100644 --- a/Server/src/main/content/region/misthalin/varrock/quest/shieldofarrav/KingRoaldArravDialogue.kt +++ b/Server/src/main/content/region/misthalin/varrock/quest/shieldofarrav/KingRoaldArravDialogue.kt @@ -65,7 +65,7 @@ class KingRoaldArravDialogue() : DialogueFile() { when (stage) { START_DIALOGUE -> player("I would like to contribute to one of", "your Political Action Committees").also{ stage++ } 1 -> npcl("Which one?").also { stage++ } - 2 -> playerl("The Citizens Who Can't Be", "Bothered To Do Shield of Arrav").also { stage++ } + 2 -> playerl("The Citizens Who Can't Be Bothered To Do Shield of Arrav").also { stage++ } 3 -> npcl(FacialExpression.HALF_THINKING, "I see... that will be 6,000 coins").also { stage++ } 4 -> options("Here you go!", "Nevermind.").also { stage++ } 5 -> when (buttonID) { @@ -78,7 +78,7 @@ class KingRoaldArravDialogue() : DialogueFile() { 2 -> playerl(FacialExpression.FRIENDLY, "On second thought, never mind.").also { stage = END_DIALOGUE } } 20 -> { - npcl("Thank you so much, dear donor. The government of Varrock", "now has higher priorities than the Shield of Arrav.") + npcl("Thank you so much, dear donor. The government of Varrock now has higher priorities than the Shield of Arrav.") if (removeItem(player!!, Item(995, BRIBE_PRICE), Container.INVENTORY)) { player!!.questRepository.getQuest(Quests.SHIELD_OF_ARRAV).finish(player) }