aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-16 09:17:05 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-16 09:17:05 +0200
commit98788ec56847cdfca2a1e5f3676844a9ac25acb8 (patch)
treec638e3fe622c3f1916bf4a1ddd7de053be344af2 /src/main/java/at/hannibal2/skyhanni/features/misc
parent87049ddf530ff9da72989620fab1a51c4f4e045a (diff)
downloadskyhanni-98788ec56847cdfca2a1e5f3676844a9ac25acb8.tar.gz
skyhanni-98788ec56847cdfca2a1e5f3676844a9ac25acb8.tar.bz2
skyhanni-98788ec56847cdfca2a1e5f3676844a9ac25acb8.zip
Added Enchantments Cap to EstimatedItemValue.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
index d6886200e..58616196f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.misc.items
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.ConfigLoadEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.RenderItemTooltipEvent
@@ -11,6 +12,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getItemName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
+import at.hannibal2.skyhanni.utils.LorenzUtils.onToggle
import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
@@ -74,6 +76,14 @@ object EstimatedItemValue {
cache.clear()
}
+
+ @SubscribeEvent
+ fun onConfigLoad(event: ConfigLoadEvent) {
+ config.estimatedIemValueEnchantmentsCap.onToggle {
+ cache.clear()
+ }
+ }
+
@SubscribeEvent
fun onRenderItemTooltip(event: RenderItemTooltipEvent) {
if (!LorenzUtils.inSkyBlock) return
@@ -580,13 +590,13 @@ object EstimatedItemValue {
map[" $name §7(§6$format§7)"] = price
}
+ val enchantmentsCap: Int = config.estimatedIemValueEnchantmentsCap.get().toInt()
if (map.isNotEmpty()) {
list.add("§7Enchantments: §6" + NumberUtil.format(totalPrice))
var i = 0
- val size = map.size
for (entry in map.sortedDesc().keys) {
- if (i == 7) {
- val missing = size - i
+ if (i == enchantmentsCap) {
+ val missing = map.size - enchantmentsCap
list.add(" §7§o$missing more enchantments..")
break
}