aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/bazaar
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-27 21:53:54 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-27 21:53:54 +0100
commit4c4bb62e334be479567439bde1f9eae4c71b5959 (patch)
tree2266c0b51c6e702d5d076668f58860c78f2bff98 /src/main/java/at/hannibal2/skyhanni/features/bazaar
parentbb0d26f682e803b83d7d9252f8863285164cba15 (diff)
downloadskyhanni-4c4bb62e334be479567439bde1f9eae4c71b5959.tar.gz
skyhanni-4c4bb62e334be479567439bde1f9eae4c71b5959.tar.bz2
skyhanni-4c4bb62e334be479567439bde1f9eae4c71b5959.zip
Used reworked InventoryOpenEvent.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/bazaar')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt14
1 files changed, 6 insertions, 8 deletions
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