From 8903ed619aec2a385277379cd369a2b39ce510d8 Mon Sep 17 00:00:00 2001 From: aidan Date: Fri, 1 May 2026 08:53:53 -0500 Subject: [PATCH] make scroll reobtainable, fix scroll drop dialogue, add a period, fix EW1 slashed book retrieval --- .../quest/elementalworkshop/EWListeners.kt | 49 ++++++++++++++----- .../quest/elementalworkshop2/BeatenBook.kt | 39 ++++++++++----- 2 files changed, 63 insertions(+), 25 deletions(-) diff --git a/Server/src/main/content/region/kandarin/seers/quest/elementalworkshop/EWListeners.kt b/Server/src/main/content/region/kandarin/seers/quest/elementalworkshop/EWListeners.kt index 111d6a274..716b4f667 100644 --- a/Server/src/main/content/region/kandarin/seers/quest/elementalworkshop/EWListeners.kt +++ b/Server/src/main/content/region/kandarin/seers/quest/elementalworkshop/EWListeners.kt @@ -17,7 +17,9 @@ import core.game.interaction.InteractionListener import core.game.interaction.IntType import core.tools.Log import content.data.Quests +import content.global.handlers.iface.BookInterface import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2StageVarbit +import core.game.dialogue.DialogueLabeller /** * Listeners for the Elemental Workshop I quest @@ -109,22 +111,45 @@ class EWListeners : InteractionListener { } // --- AFTER QUEST START --- - if (player.inventory.containsItem(slashedBook)) { - sendItemDialogue(player, Item(Items.SLASHED_BOOK_9715), - "There is a book here titled 'The Elemental Shield'. " + - "It can stay here, as you have a copy in your backpack." - ) - if (player.inventory.addIfDoesntHave(batteredKey)) { - sendItemDialogue(player, Item(Items.BATTERED_KEY_2887),"You also find a key.") - } + + // if player doesn't have book and doesn't have key + if (!inInventory(player, slashedBook.id) && !inInventory(player, batteredKey.id)) { + addItemOrDrop(player, batteredKey.id) + addItemOrDrop(player, slashedBook.id) + openDialogue(player, object : DialogueLabeller() { + override fun addConversation() { + item(slashedBook, "You find a book titled 'The Elemental Shield'.") + item(batteredKey,"You also find a key.") + } + }) return@on true } - sendItemDialogue(player, Item(Items.SLASHED_BOOK_9715), "You find a book titled 'The Elemental Shield'.") - addItemOrDrop(player, slashedBook.id) - if (player.inventory.addIfDoesntHave(batteredKey)) { - sendItemDialogue(player, Item(Items.BATTERED_KEY_2887),"You also find a key.") + // if player doesn't have book and does have key + if (!inInventory(player, slashedBook.id) && inInventory(player, batteredKey.id)) { + addItemOrDrop(player, slashedBook.id) + sendItemDialogue(player, slashedBook, "You find a book titled 'The Elemental Shield'.") + return@on true } + + // if player does have book but doesn't have key + if (inInventory(player, slashedBook.id) && !inInventory(player, batteredKey.id)) { + addItemOrDrop(player, batteredKey.id) + openDialogue(player, object : DialogueLabeller() { + override fun addConversation() { + item(slashedBook, "There is a book here titled 'The Elemental Shield'. " + "It can stay here, as you have a copy in your backpack.") + item(batteredKey,"You also find a key.") + } + }) + return@on true + } + + // if player does have book and does have key + if (inInventory(player, slashedBook.id) && inInventory(player, batteredKey.id)) { + sendItemDialogue(player, slashedBook, "There is a book here titled 'The Elemental Shield'. " + "It can stay here, as you have a copy in your backpack.") + return@on true + } + return@on true } diff --git a/Server/src/main/content/region/kandarin/seers/quest/elementalworkshop2/BeatenBook.kt b/Server/src/main/content/region/kandarin/seers/quest/elementalworkshop2/BeatenBook.kt index 139a5d710..335fd222a 100644 --- a/Server/src/main/content/region/kandarin/seers/quest/elementalworkshop2/BeatenBook.kt +++ b/Server/src/main/content/region/kandarin/seers/quest/elementalworkshop2/BeatenBook.kt @@ -5,8 +5,10 @@ import content.global.handlers.iface.* import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2StageVarbit import core.game.interaction.InteractionListener import core.api.* +import core.game.dialogue.DialogueLabeller import core.game.interaction.IntType import core.game.node.entity.player.Player +import core.game.node.item.Item import org.rs09.consts.Items /** @@ -175,7 +177,7 @@ class BeatenBook : InteractionListener { BookLine("referred to his", 61), BookLine("preparation technique as", 62), BookLine("'priming', and he referred", 63), - BookLine("to his apprentice as 'Idiot'", 64), + BookLine("to his apprentice as 'Idiot'.", 64), BookLine("", 65), ), Page( @@ -202,22 +204,33 @@ class BeatenBook : InteractionListener { override fun defineListeners() { on(Items.BEATEN_BOOK_9717, IntType.ITEM, "read") { player, node -> - // the first time you open the book, the scroll will drop. + + // increment quest stage if needed if (getQuestStage(player, Quests.ELEMENTAL_WORKSHOP_II) == 1) { - addItemOrDrop(player, Items.SCROLL_9721) - sendMessage(player, "The book has two parts; an introduction and an instruction section.") - sendMessage(player, "You flip the book open to the introduction and start reading.") - - // todo the dialogue and openbook should run sequentially, but i've messed around with queuescript and can't figure it out. - // this also applies to EW1 listener that gives the slashed book and battered key back in EWListeners.kt - sendItemDialogue(player, Items.SCROLL_9721, "You find a slip of paper that has been used for a bookmark. You put it in your pack to study later.") - BookInterface.openBook(player, BookInterface.FANCY_BOOK_3_49, ::display) - setQuestStage(player, Quests.ELEMENTAL_WORKSHOP_II, 2) setVarbit(player, EW2StageVarbit, 2, true) - storeBookInHouse(player, node) + } + + storeBookInHouse(player, node) + + // if the player doesn't have the scroll, drop it + if (hasAnItem(player, Items.SCROLL_9721).container == null) { + sendMessage(player, "The book has two parts; an introduction and an instruction section.") + sendMessage(player, "You flip the book open to the introduction and start reading.") + addItemOrDrop(player, Items.SCROLL_9721) // scroll needs to be added here because otherwise in the afterClose block it'll give you 3 lmao + openDialogue(player, object : DialogueLabeller() { + override fun addConversation() { + item(Item(Items.SCROLL_9721), "You find a slip of paper that has been used", "for a bookmark. You put it in your pack to", "study later.") + afterClose { player -> + BookInterface.openBook(player, BookInterface.FANCY_BOOK_3_49, ::display) + } + } + }) + + // if player has scroll, open book } else { - storeBookInHouse(player, node) + sendMessage(player, "The book has two parts; an introduction and an instruction section.") + sendMessage(player, "You flip the book open to the introduction and start reading.") BookInterface.openBook(player, BookInterface.FANCY_BOOK_3_49, ::display) } return@on true