From 248edea686fb2580a339b2ca0c3668f3f1da0ff7 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 30 Oct 2023 15:16:08 +0100 Subject: Added option to hide chest value while estimated item value display is showing. --- .../skyhanni/config/features/InventoryConfig.java | 6 ++++++ .../skyhanni/features/inventory/ChestValue.kt | 7 ++++++- .../skyhanni/features/misc/items/EstimatedItemValue.kt | 18 ++++++++++++++---- 3 files changed, 26 insertions(+), 5 deletions(-) (limited to 'src/main') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java index 3c6c75056..d1bf61efa 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java @@ -244,6 +244,12 @@ public class InventoryConfig { @FeatureToggle public boolean enableInDungeons = false; + @Expose + @ConfigOption(name = "Enable during Item Value", desc = "Show this display even if the Estimated Item Value is visible.") + @ConfigEditorBoolean + @FeatureToggle + public boolean showDuringEstimatedItemValue = false; + @Expose @ConfigOption(name = "Show Stacks", desc = "Show the item icon before name.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt index 52e6d3b8d..449464952 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt @@ -42,6 +42,11 @@ class ChestValue { if (!isEnabled()) return if (LorenzUtils.inDungeons && !config.enableInDungeons) return if (InventoryUtils.openInventoryName() == "") return + + if (!config.showDuringEstimatedItemValue) { + if (EstimatedItemValue.currentlyShowing) return + } + if (inInventory) { config.position.renderStringsAndItems( display, @@ -239,7 +244,7 @@ class ChestValue { } val inMinion = name.contains("Minion") && !name.contains("Recipe") && - LorenzUtils.skyBlockIsland == IslandType.PRIVATE_ISLAND + LorenzUtils.skyBlockIsland == IslandType.PRIVATE_ISLAND return name == "Chest" || name == "Large Chest" || inMinion || name == "Personal Vault" } 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 b92bc8f0a..5671822cb 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 @@ -78,6 +78,7 @@ object EstimatedItemValue { private val cache = mutableMapOf>>() private var lastToolTipTime = 0L private var gemstoneUnlockCosts = HashMap>>() + var currentlyShowing = false @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { @@ -96,14 +97,23 @@ object EstimatedItemValue { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { - if (!LorenzUtils.inSkyBlock) return - if (!config.enabled) return - if (!config.hotkey.isKeyHeld() && !config.alwaysEnabled) return - if (System.currentTimeMillis() > lastToolTipTime + 200) return + currentlyShowing = checkCurrentlyVisible() + if (!currentlyShowing) return config.itemPriceDataPos.renderStringsAndItems(display, posLabel = "Estimated Item Value") } + private fun checkCurrentlyVisible(): Boolean { + if (!LorenzUtils.inSkyBlock) return false + if (!config.enabled) return false + if (!config.hotkey.isKeyHeld() && !config.alwaysEnabled) return false + if (System.currentTimeMillis() > lastToolTipTime + 200) return false + + if (display.isEmpty()) return false + + return true + } + @SubscribeEvent fun onInventoryClose(event: InventoryCloseEvent) { cache.clear() -- cgit