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 335fd222a..11f167232 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 @@ -205,34 +205,38 @@ class BeatenBook : InteractionListener { override fun defineListeners() { on(Items.BEATEN_BOOK_9717, IntType.ITEM, "read") { player, node -> - // increment quest stage if needed - if (getQuestStage(player, Quests.ELEMENTAL_WORKSHOP_II) == 1) { - setQuestStage(player, Quests.ELEMENTAL_WORKSHOP_II, 2) - setVarbit(player, EW2StageVarbit, 2, true) - } + // check the player is not already reading the book + if (!player.interfaceManager.isOpened) { + // increment quest stage if needed + if (getQuestStage(player, Quests.ELEMENTAL_WORKSHOP_II) == 1) { + 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 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 { + 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) + } + } else sendMessage(player, "Please finish what you're doing first.") // this is the same message/logic used for clue scrolls - // if player has scroll, open book - } else { - 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 } }