Add missing teapot. Remove obsolete parameters

Fix issue with 2nd More not working
This commit is contained in:
gregf36665 2024-12-22 22:16:53 +00:00 committed by Syndromeramo
parent db43418b1e
commit 0ade1f308c

View file

@ -21,10 +21,10 @@ class ShelfListener : InteractionListener {
}
private fun searchShelf(player : Player, shelfId: Int){
openDialogue(player, ShelfDialogue(shelfId, 0))
openDialogue(player, ShelfDialogue(shelfId))
}
class ShelfDialogue(shelfId: Int, val offset: Int) : DialogueFile() {
class ShelfDialogue(shelfId: Int) : DialogueFile() {
companion object{
@ -53,6 +53,7 @@ class ShelfListener : InteractionListener {
private val oakshelf_2_items = oakshelf_1_items.map { (name, itemId) ->
if (name == "Cup") { "Porcelain cup" to Items.PORCELAIN_CUP_7732 }
else if (name == "Teapot") { "Teapot" to Items.TEAPOT_7714 }
else { name to itemId}
} + listOf( "Pie dish" to Items.PIE_DISH_2313 )
@ -62,6 +63,7 @@ class ShelfListener : InteractionListener {
private val teakshelf_2_items = teakshelf_1_items.map { (name, itemId) ->
if (name == "Porcelain cup") { "Porcelain cup" to Items.PORCELAIN_CUP_7735 }
else if (name == "Teapot") { "Teapot" to Items.TEAPOT_7726 }
else { name to itemId }
} + listOf( "Chef's Hat" to Items.CHEFS_HAT_1949 )
@ -120,13 +122,13 @@ class ShelfListener : InteractionListener {
val topics = createTopics(1, itemsPerPage)
showTopics(*topics.toTypedArray()).also { stage = 1 }
}
in 1..shelfItemsNames.size -> { // Specific stages for each page
val currentPage = stage / (itemsPerPage + 1)
in 1..shelfItemsNames.size -> {
val currentPage = (stage-1) / itemsPerPage
val startIndex = currentPage * itemsPerPage
if (buttonID == itemsPerPage + 1) { // "More" button clicked (but not the last one)
val topics = createTopics(currentPage + 1, itemsPerPage)
showTopics(*topics.toTypedArray()).also { stage = currentPage*4 + 1 }
showTopics(*topics.toTypedArray()).also { stage = currentPage*itemsPerPage + 1 }
} else { // Handle item selection
val itemIndex = startIndex + (buttonID - 1)
if (itemIndex < shelfItemsNames.size) {