you must close the book before you can open it again

This commit is contained in:
aidan 2026-05-28 11:40:39 -05:00
parent a21577191c
commit dd001312f1

View file

@ -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
}
}