summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt5
3 files changed, 10 insertions, 13 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
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
index b3eb82c95..7a9966cc7 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
@@ -36,7 +36,7 @@ class GardenVisitorFeatures {
inVisitorInventory = false
if (!isEnabled()) return
- val npcItem = event.inventory.items[13] ?: return
+ val npcItem = event.inventoryItems[13] ?: return
val lore = npcItem.getLore()
var isVisitor = false
if (lore.size == 4) {
@@ -47,7 +47,7 @@ class GardenVisitorFeatures {
}
if (!isVisitor) return
- val offerItem = event.inventory.items[29] ?: return
+ val offerItem = event.inventoryItems[29] ?: return
if (offerItem.name != "§aAccept Offer") return
inVisitorInventory = true
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt
index d28d9abe4..06498031a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt
@@ -30,13 +30,12 @@ class SkyMartBestProfit {
fun onInventoryOpen(event: InventoryOpenEvent) {
if (!isEnabled()) return
- val inventory = event.inventory
- if (inventory.title != "SkyMart") return
+ if (event.inventoryName != "SkyMart") return
val priceMap = mutableMapOf<Pair<String, String>, Double>()
val iconMap = mutableMapOf<String, ItemStack>()
- for (stack in inventory.items.values) {
+ for (stack in event.inventoryItems.values) {
for (line in stack.getLore()) {
val matcher = pattern.matcher(line)
if (!matcher.matches()) continue