aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-31 11:55:22 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-31 11:55:22 +0100
commit5b12fb9bd5c6c4ea221024ab28bc1dc3e25d09ab (patch)
tree3699cff75a317b1f8ce41df9d10cdbc9e55704bd /src/main/java/at/hannibal2
parent6798b03f592c3ed7bc5395f8f537ca7b7c3a16bf (diff)
downloadskyhanni-5b12fb9bd5c6c4ea221024ab28bc1dc3e25d09ab.tar.gz
skyhanni-5b12fb9bd5c6c4ea221024ab28bc1dc3e25d09ab.tar.bz2
skyhanni-5b12fb9bd5c6c4ea221024ab28bc1dc3e25d09ab.zip
Added options to hide Helmet Skins, Armor Dyes or Runes from Estimated Item Value Calculation.
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/misc/EstimatedItemValueConfig.java15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt34
2 files changed, 29 insertions, 20 deletions
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
@@ -48,5 +48,20 @@ public class EstimatedItemValueConfig {
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<String>): 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<String>): Double {
val internalName = stack.getArmorDye() ?: return 0.0
+ return addCosmetic(internalName, list, "Dye", config.ignoreArmorDyes)
+ }
+ private fun addCosmetic(
+ internalName: NEUInternalName,
+ list: MutableList<String>,
+ 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<String>): 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? {