From 4c4bb62e334be479567439bde1f9eae4c71b5959 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 27 Feb 2023 21:53:54 +0100 Subject: Used reworked InventoryOpenEvent. --- .../at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/bazaar') diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt index 5ececdff3..f8139e3b9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt @@ -1,6 +1,5 @@ package at.hannibal2.skyhanni.features.bazaar -import at.hannibal2.skyhanni.data.InventoryData import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName @@ -44,12 +43,12 @@ class BazaarApi { @SubscribeEvent fun onInventoryOpen(event: InventoryOpenEvent) { - inBazaarInventory = checkIfInBazaar(event.inventory) + inBazaarInventory = checkIfInBazaar(event) } - private fun checkIfInBazaar(inventory: InventoryData.Inventory): Boolean { - val returnItem = inventory.slotCount - 5 - for ((slot, item) in inventory.items) { + private fun checkIfInBazaar(event: InventoryOpenEvent): Boolean { + val returnItem = event.inventorySize - 5 + for ((slot, item) in event.inventoryItems) { if (slot == returnItem) { if (item.name?.removeColor().let { it == "Go Back" }) { val lore = item.getLore() @@ -60,9 +59,8 @@ class BazaarApi { } } - val title = inventory.title - if (title.startsWith("Bazaar ➜ ")) return true - return when (title) { + if (event.inventoryName.startsWith("Bazaar ➜ ")) return true + return when (event.inventoryName) { "How many do you want?" -> true "How much do you want to pay?" -> true "Confirm Buy Order" -> true -- cgit