diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java | 21 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt | 16 |
2 files changed, 25 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 588a52345..630ef9e70 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -2,15 +2,7 @@ package at.hannibal2.skyhanni.config.features; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; -import io.github.moulberry.moulconfig.annotations.Accordion; -import io.github.moulberry.moulconfig.annotations.ConfigAccordionId; -import io.github.moulberry.moulconfig.annotations.ConfigEditorAccordion; -import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; -import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; -import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; -import io.github.moulberry.moulconfig.annotations.ConfigEditorKeybind; -import io.github.moulberry.moulconfig.annotations.ConfigEditorText; -import io.github.moulberry.moulconfig.annotations.ConfigOption; +import io.github.moulberry.moulconfig.annotations.*; import io.github.moulberry.moulconfig.observer.Property; import org.lwjgl.input.Keyboard; @@ -267,6 +259,17 @@ public class MiscConfig { public boolean estimatedIemValueAlwaysEnabled = true; @Expose + @ConfigOption(name = "Enchantments Cap", desc = "Only show the top # most expensive enchantments.") + @ConfigEditorSlider( + minValue = 1, + maxValue = 30, + minStep = 1 + ) + @ConfigAccordionId(id = 11) + public Property<Integer> estimatedIemValueEnchantmentsCap = Property.of(7); + + + @Expose @ConfigOption(name = "Show Exact Price", desc = "Show the exact total price instead of the compact number.") @ConfigEditorBoolean @ConfigAccordionId(id = 11) 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 } |