make scroll reobtainable, fix scroll drop dialogue, add a period, fix EW1 slashed book retrieval

This commit is contained in:
aidan 2026-05-01 08:53:53 -05:00
parent 94257a93c2
commit 8903ed619a
2 changed files with 63 additions and 25 deletions

View file

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

View file

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