From 5b12fb9bd5c6c4ea221024ab28bc1dc3e25d09ab Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 31 Jan 2024 11:55:22 +0100 Subject: Added options to hide Helmet Skins, Armor Dyes or Runes from Estimated Item Value Calculation. --- .../features/misc/EstimatedItemValueConfig.java | 15 ++++++++++ .../misc/items/EstimatedItemValueCalculator.kt | 34 +++++++++------------- 2 files changed, 29 insertions(+), 20 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/EstimatedItemValueConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/EstimatedItemValueConfig.java index 2513cd66b..4608f1023 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/EstimatedItemValueConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/EstimatedItemValueConfig.java @@ -47,6 +47,21 @@ public class EstimatedItemValueConfig { @FeatureToggle public boolean armor = true; + @Expose + @ConfigOption(name = "Ignore Helmet Skins", desc = "Ignore helmet Skins from the total value.") + @ConfigEditorBoolean + public boolean ignoreHelmetSkins = false; + + @Expose + @ConfigOption(name = "Ignore Armor Dyes", desc = "Ignore Armor Dyes from the total value.") + @ConfigEditorBoolean + public boolean ignoreArmorDyes = false; + + @Expose + @ConfigOption(name = "Ignore Runes", desc = "Ignore Runes from the total value.") + @ConfigEditorBoolean + public boolean ignoreRunes = false; + @Expose public Position itemPriceDataPos = new Position(140, 90, false, true); } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt index 2ff799e77..fbaed21a9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt @@ -4,7 +4,6 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getItemName -import at.hannibal2.skyhanni.utils.ItemUtils.getItemNameOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.isRune @@ -437,28 +436,30 @@ object EstimatedItemValueCalculator { private fun addHelmetSkin(stack: ItemStack, list: MutableList): Double { val internalName = stack.getHelmetSkin() ?: return 0.0 - - val price = internalName.getPrice() - val name = internalName.getNameOrRepoError() - val displayname = name ?: "§c${internalName.asString()}" - list.add("§7Skin: $displayname §7(§6" + NumberUtil.format(price) + "§7)") - if (name == null) { - list.add(" §8(Not yet in NEU Repo)") - } - return price + return addCosmetic(internalName, list, "Skin", config.ignoreHelmetSkins) } private fun addArmorDye(stack: ItemStack, list: MutableList): Double { val internalName = stack.getArmorDye() ?: return 0.0 + return addCosmetic(internalName, list, "Dye", config.ignoreArmorDyes) + } + private fun addCosmetic( + internalName: NEUInternalName, + list: MutableList, + label: String, + shouldIgnorePrice: Boolean + ): Double { val price = internalName.getPrice() val name = internalName.getNameOrRepoError() val displayname = name ?: "§c${internalName.asString()}" - list.add("§7Dye: $displayname §7(§6" + NumberUtil.format(price) + "§7)") + val color = if (shouldIgnorePrice) "§7" else "§6" + list.add("§7$label: $displayname §7($color" + NumberUtil.format(price) + "§7)") if (name == null) { list.add(" §8(Not yet in NEU Repo)") } - return price + + return if (shouldIgnorePrice) 0.0 else price } private fun addEnrichment(stack: ItemStack, list: MutableList): Double { @@ -476,14 +477,7 @@ object EstimatedItemValueCalculator { if (stack.getInternalName().isRune()) return 0.0 val internalName = stack.getRune() ?: return 0.0 - val price = internalName.getPrice() - val name = internalName.getItemNameOrNull() - val displayname = name ?: "§c${internalName.asString()}" - list.add("§7Rune: $displayname §7(§6" + NumberUtil.format(price) + "§7)") - if (name == null) { - list.add(" §8(Not yet in NEU Repo)") - } - return price + return addCosmetic(internalName, list, "Rune", config.ignoreRunes) } private fun NEUInternalName.getNameOrRepoError(): String? { -- cgit