diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt | 8 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt | 12 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt index 298717720..84ca5b235 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt @@ -57,9 +57,9 @@ class AnitaMedalProfit { inInventory = true val table = mutableListOf<DisplayTableEntry>() - for ((_, item) in event.inventoryItems) { + for ((slot, item) in event.inventoryItems) { try { - readItem(item, table) + readItem(slot, item, table) } catch (e: Throwable) { ErrorManager.logErrorWithData( e, "Error in AnitaMedalProfit while reading item '${item.itemName}'", @@ -76,7 +76,7 @@ class AnitaMedalProfit { display = newList } - private fun readItem(item: ItemStack, table: MutableList<DisplayTableEntry>) { + private fun readItem(slot: Int, item: ItemStack, table: MutableList<DisplayTableEntry>) { val itemName = getItemName(item) ?: return if (itemName == " ") return if (itemName == "§cClose") return @@ -108,7 +108,7 @@ class AnitaMedalProfit { "§7Material cost: §6${NumberUtil.format(fullCost)} ", "§7Final profit: §6${profitFormat} ", ) - table.add(DisplayTableEntry(itemName, "$color$profitFormat", profit, internalName, hover)) + table.add(DisplayTableEntry(itemName, "$color$profitFormat", profit, internalName, hover, highlightsOnHoverSlots = listOf(slot))) } private fun getItemName(item: ItemStack): String? { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt index 69c551d74..9e5ec780c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt @@ -64,23 +64,23 @@ class SkyMartCopperPrice { inInventory = true val table = mutableListOf<DisplayTableEntry>() - for (stack in event.inventoryItems.values) { - val lore = stack.getLore() - val otherItemsPrice = stack.loreCosts().sumOf { it.getPrice() }.takeIf { it != -1.0 } + for ((slot, item) in event.inventoryItems) { + val lore = item.getLore() + val otherItemsPrice = item.loreCosts().sumOf { it.getPrice() }.takeIf { it != -1.0 } for (line in lore) { val copper = copperPattern.matchMatcher(line) { group("amount").formatInt() } ?: continue - val internalName = stack.getInternalName() + val internalName = item.getInternalName() val lowestBin = internalName.getPriceOrNull() ?: continue val profit = lowestBin - (otherItemsPrice ?: 0.0) val factor = profit / copper val perFormat = NumberUtil.format(factor) - val itemName = stack.itemName + val itemName = item.itemName val hover = buildList { add(itemName) add("") @@ -93,7 +93,7 @@ class SkyMartCopperPrice { add("§7Copper amount: §c${copper.addSeparators()} ") add("§7Profit per copper: §6${perFormat} ") } - table.add(DisplayTableEntry("$itemName§f:", "§6§l$perFormat", factor, internalName, hover)) + table.add(DisplayTableEntry("$itemName§f:", "§6§l$perFormat", factor, internalName, hover, highlightsOnHoverSlots = listOf(slot))) } } |