made Shield of Arrav completable with bribery to King Roald

This commit is contained in:
Greg Tseng 2025-03-06 12:18:15 -05:00
parent d6add6cc4e
commit 5895b1e90a
3 changed files with 32 additions and 62 deletions

View File

@ -6,7 +6,6 @@ import core.game.dialogue.FacialExpression
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import content.region.misthalin.varrock.quest.shieldofarrav.KingRoaldArravDialogue import content.region.misthalin.varrock.quest.shieldofarrav.KingRoaldArravDialogue
import content.region.misthalin.varrock.quest.shieldofarrav.KingRoaldBribe
import content.region.misthalin.varrock.quest.allfiredup.KingRoaldAFUDialogue import content.region.misthalin.varrock.quest.allfiredup.KingRoaldAFUDialogue
import content.region.misthalin.quest.priestinperil.KingRoaldPIPDialogue import content.region.misthalin.quest.priestinperil.KingRoaldPIPDialogue
import core.tools.DIALOGUE_INITIAL_OPTIONS_HANDLE import core.tools.DIALOGUE_INITIAL_OPTIONS_HANDLE
@ -42,12 +41,8 @@ class KingRoaldDialogue(player: Player? = null) : DialoguePlugin(player) {
addOption("Priest in Peril", KingRoaldPIPDialogue(player.questRepository.getStage(Quests.PRIEST_IN_PERIL))) addOption("Priest in Peril", KingRoaldPIPDialogue(player.questRepository.getStage(Quests.PRIEST_IN_PERIL)))
} }
if (player.questRepository.getQuest(Quests.SHIELD_OF_ARRAV).isStarted(player) && !player.questRepository.getQuest(Quests.SHIELD_OF_ARRAV).isCompleted(player)) {
addOption("Shield of Arrav", KingRoaldArravDialogue())
}
if (!player.questRepository.getQuest(Quests.SHIELD_OF_ARRAV).isCompleted(player)) { if (!player.questRepository.getQuest(Quests.SHIELD_OF_ARRAV).isCompleted(player)) {
addOption("Bribe for Shield of Arrav", KingRoaldBribe()) addOption("Shield of Arrav", KingRoaldArravDialogue())
} }
if(!sendChoices()){ if(!sendChoices()){

View File

@ -6,12 +6,20 @@ import core.game.dialogue.DialogueFile
import core.tools.END_DIALOGUE import core.tools.END_DIALOGUE
import core.tools.START_DIALOGUE import core.tools.START_DIALOGUE
import content.data.Quests import content.data.Quests
import core.game.dialogue.FacialExpression
import core.api.Container
import core.api.inInventory
import core.api.removeItem
import core.game.dialogue.DialoguePlugin
private val CERTIFICATE = Item(769) private val CERTIFICATE = Item(769)
class KingRoaldArravDialogue() : DialogueFile() { class KingRoaldArravDialogue() : DialogueFile() {
companion object {
const val BRIBE_PRICE = 6000
}
override fun handle(componentID: Int, buttonID: Int) { override fun handle(componentID: Int, buttonID: Int) {
if (player!!.inventory.containsItem(ShieldofArrav.PHOENIX_SHIELD) || player!!.inventory.containsItem(ShieldofArrav.BLACKARM_SHIELD)) { if (player!!.inventory.containsItem(ShieldofArrav.PHOENIX_SHIELD) || player!!.inventory.containsItem(ShieldofArrav.BLACKARM_SHIELD)) {
@ -54,7 +62,29 @@ class KingRoaldArravDialogue() : DialogueFile() {
} }
else { else {
abandonFile() 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++ }
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) {
1 -> {
if (inInventory(player!!, 995, BRIBE_PRICE))
playerl(FacialExpression.FRIENDLY, "Here you go!").also { stage = 20 }
else
playerl(FacialExpression.HALF_GUILTY, "Actually, I don't have that much.").also { stage = END_DIALOGUE }
}
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.")
if (removeItem(player!!, Item(995, BRIBE_PRICE), Container.INVENTORY)) {
player!!.questRepository.getQuest(Quests.SHIELD_OF_ARRAV).finish(player)
}
stage = END_DIALOGUE
}
}
} }
} }
} }

View File

@ -1,55 +0,0 @@
package content.region.misthalin.varrock.quest.shieldofarrav
import core.game.node.item.GroundItemManager
import core.game.node.item.Item
import core.game.dialogue.DialogueFile
import core.tools.START_DIALOGUE
import content.data.Quests
import core.api.Container
import core.api.inInventory
import core.api.removeItem
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.FacialExpression
import core.game.node.entity.player.Player
import core.plugin.Initializable
import core.tools.END_DIALOGUE
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import java.text.SimpleDateFormat
import java.time.temporal.ChronoUnit
import java.util.*
class KingRoaldBribe() : DialogueFile() {
companion object {
const val BRIBE_PRICE = 6000
}
override fun handle(interfaceId: Int, buttonId: Int) {
when (stage) {
START_DIALOGUE -> {
player("I would like to contribute to one of", "your Political Action Committees")
stage = 0
}
0 -> npcl("Which one?").also { stage++ }
1 -> playerl("The Citizens Who Can't Be Bothered To Do Shield of Arrav").also { stage++ }
2 -> npcl(FacialExpression.HALF_THINKING, "I see... that will be 6,000 coins").also { stage++ }
3 -> options("Here you go!", "Nevermind.").also { stage++ }
12 -> when (buttonId) {
1 -> {
if (inInventory(player!!, 995, BRIBE_PRICE))
playerl(FacialExpression.FRIENDLY, "Here you go!").also { stage = 20 }
else
playerl(FacialExpression.HALF_GUILTY, "Actually, I don't have that much.").also { stage = END_DIALOGUE }
}
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 cares much less about the Shield of Arrav.")
if (removeItem(player!!, Item(995, BRIBE_PRICE), Container.INVENTORY)) {
player!!.questRepository.getQuest(Quests.SHIELD_OF_ARRAV).finish(player)
}
stage = END_DIALOGUE
}
}
}
}