mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
King Bolren now gives back lost gnome amulets
This commit is contained in:
parent
1a67932351
commit
9054e36288
4 changed files with 43 additions and 12 deletions
|
|
@ -87,9 +87,9 @@ class SCThormacDialogue(val questStage: Int) : DialogueFile() {
|
|||
|
||||
|
||||
WAITING_FOR_SCORPIONS -> {
|
||||
if (!hasAnItem(player!!, Items.SCORPION_CAGE_456, Items.SCORPION_CAGE_457, Items.SCORPION_CAGE_458,
|
||||
if (!hasAnItem(player!!, arrayOf(Items.SCORPION_CAGE_456, Items.SCORPION_CAGE_457, Items.SCORPION_CAGE_458,
|
||||
Items.SCORPION_CAGE_459, Items.SCORPION_CAGE_460, Items.SCORPION_CAGE_461,
|
||||
Items.SCORPION_CAGE_462).exists()){
|
||||
Items.SCORPION_CAGE_462), false).exists()){
|
||||
playerl(FacialExpression.SAD, "I've lost my cage.").also { stage = GIVE_ANOTHER_CAGE }
|
||||
}
|
||||
else{
|
||||
|
|
|
|||
|
|
@ -187,10 +187,15 @@ class KingBolrenDialogue : DialogueFile() {
|
|||
}
|
||||
isQuestComplete(player!!, questName) -> {
|
||||
when(stage) {
|
||||
0 -> playerl("Hello Bolren.").also { stage++ }
|
||||
1 -> npcl("Thank you for your help traveler.").also { stage = END_DIALOGUE }
|
||||
0 -> playerl("Hello again Bolren.").also { stage++ }
|
||||
1 -> npcl("Well hello, it's good to see you again.").also { stage = if (hasAnItem(player!!, Items.GNOME_AMULET_589).container != null) END_DIALOGUE else 2 }
|
||||
2 -> playerl("I've lost my amulet.").also { stage++ }
|
||||
3 -> npcl("Oh dear. Here, take another. We are truly indebted to you.").also {
|
||||
addItemOrDrop(player!!, Items.GNOME_AMULET_589)
|
||||
stage = END_DIALOGUE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class DimintheisDialogue(player: Player? = null): core.game.dialogue.DialoguePlu
|
|||
return true
|
||||
}
|
||||
|
||||
val hasGauntlets = hasAnItem(player, Items.COOKING_GAUNTLETS_775, Items.GOLDSMITH_GAUNTLETS_776, Items.CHAOS_GAUNTLETS_777, Items.FAMILY_GAUNTLETS_778).container != null
|
||||
val hasGauntlets = hasAnItem(player, arrayOf(Items.COOKING_GAUNTLETS_775, Items.GOLDSMITH_GAUNTLETS_776, Items.CHAOS_GAUNTLETS_777, Items.FAMILY_GAUNTLETS_778), true).container != null
|
||||
|
||||
if (questComplete && hasGauntlets) {
|
||||
npc("Thank you for saving our family honour, ",
|
||||
|
|
|
|||
|
|
@ -247,14 +247,40 @@ class ContainerisedItem(val container: core.game.container.Container?, val itemI
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if player has any of the specified item IDs equipped, in inventory, or in banks
|
||||
* Returns a ContainerisedItem containing the container and the item ID if found, otherwise ContainerisedItem(null, -1) if not found
|
||||
* Check if player has the specified item ID equipped, in inventory, or in their bank
|
||||
* @param id The item ID to check
|
||||
* @return A ContainerisedItem containing the container and the item ID if found, otherwise ContainerisedItem(null, -1) if not found
|
||||
*/
|
||||
fun hasAnItem(player: Player, vararg ids: Int): ContainerisedItem {
|
||||
for (searchSpace in arrayOf(player.inventory, player.equipment, player.bankPrimary, player.bankSecondary)) {
|
||||
fun hasAnItem(player: Player, id: Int): ContainerisedItem {
|
||||
return hasAnItem(player, arrayOf(id), false)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if player has the specified item ID equipped, in inventory, or in their bank
|
||||
* @param id The item ID to check
|
||||
* @param checkSecondBank Whether to check the player's second bank.
|
||||
* @return A ContainerisedItem containing the container and the item ID if found, otherwise ContainerisedItem(null, -1) if not found
|
||||
*/
|
||||
fun hasAnItem(player: Player, id: Int, checkSecondBank: Boolean): ContainerisedItem {
|
||||
return hasAnItem(player, arrayOf(id), checkSecondBank)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if player has any of the specified item IDs equipped, in inventory, or in their bank
|
||||
* @param ids An array of item IDs to check
|
||||
* @param checkSecondBank Whether to check the player's second bank.
|
||||
* @return A ContainerisedItem containing the container and the item ID if found, otherwise ContainerisedItem(null, -1) if not found
|
||||
*/
|
||||
fun hasAnItem(player: Player, ids: Array<Int>, checkSecondBank: Boolean): ContainerisedItem {
|
||||
val searchSpace = if (checkSecondBank) {
|
||||
arrayOf(player.inventory, player.equipment, player.bankPrimary, player.bankSecondary)
|
||||
} else {
|
||||
arrayOf(player.inventory, player.equipment, player.bankPrimary)
|
||||
}
|
||||
for (container in searchSpace) {
|
||||
for (id in ids) {
|
||||
if (searchSpace.containItems(id)) {
|
||||
return ContainerisedItem(searchSpace, id)
|
||||
if (container.containItems(id)) {
|
||||
return ContainerisedItem(container, id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue