diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt index 3559743ed..eb6482adf 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt @@ -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) {