From 0eebe1c0f734379e50c641aea87fc03a1930d58e Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Mon, 20 May 2024 12:18:26 +0200 Subject: Fix: Craft Materials (#1840) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../inventory/bazaar/CraftMaterialsFromBazaar.kt | 29 ++++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt index c1b4582c9..a161bab74 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.Companion.isBazaarItem import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.CollectionUtils.addString import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.ItemUtils.itemNameWithoutColor import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -126,18 +127,24 @@ class CraftMaterialsFromBazaar { private fun MutableList.addMultipliers() { for (m in listOf(1, 5, 16, 32, 64, 512)) { - val nameColor = if (m == multiplier) "§amount" else "§e" - val priceColor = if (m == multiplier) "§6" else "§7" + val isThisMultiply = m == multiplier + val nameColor = if (isThisMultiply) "§a" else "§e" + val priceColor = if (isThisMultiply) "§6" else "§7" val price = priceColor + NumberUtil.format(calculateTotalPrice(neededMaterials, m)) - add( - Renderable.clickAndHover( - "${nameColor}Mulitply x$m $price", - listOf("§eClick here to multiply the items needed times $m!"), - onClick = { - multiplier = m - updateBazaarDisplay() - }) - ) + val text = "${nameColor}Mulitply x$m $price" + if (!isThisMultiply) { + add( + Renderable.clickAndHover( + text, + listOf("§eClick here to multiply the items needed times $m!"), + onClick = { + multiplier = m + updateBazaarDisplay() + }) + ) + } else { + addString(text) + } } } -- cgit