From d1f1465b8ef122085dd78ef5794f31ea359b7cb4 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 10 Apr 2023 21:28:29 +0200 Subject: Moved gemstone inner classes from EstimatedItemValue into SkyBlockItemModifierUtils --- .../skyhanni/features/misc/EstimatedItemValue.kt | 33 --------------- .../skyhanni/utils/SkyBlockItemModifierUtils.kt | 48 ++++++++++++++++++---- 2 files changed, 40 insertions(+), 41 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/EstimatedItemValue.kt index f5f6bc2c8..50dd686aa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/EstimatedItemValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/EstimatedItemValue.kt @@ -542,37 +542,4 @@ class EstimatedItemValue { } return totalPrice } - - class GemstoneSlot(val type: GemstoneType, val tier: GemstoneTier) { - fun getInternalName() = "${tier}_${type}_GEM" - } - - enum class GemstoneTier(val displayName: String) { - ROUGH("Rough"), - FLAWED("Flawed"), - FINE("Fine"), - FLAWLESS("Flawless"), - PERFECT("Perfect"), - ; - - companion object { - fun getByName(name: String) = GemstoneTier.values().firstOrNull { it.name == name } - } - } - - enum class GemstoneType(val displayName: String) { - JADE("Jade"), - AMBER("Amber"), - TOPAZ("Topaz"), - SAPPHIRE("Sapphire"), - AMETHYST("Amethyst"), - JASPER("Jasper"), - RUBY("Ruby"), - OPAL("Opal"), - ; - - companion object { - fun getByName(name: String) = values().firstOrNull { it.name == name } - } - } } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt index 1a27d1e4c..15bd4ff0b 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt @@ -1,6 +1,5 @@ package at.hannibal2.skyhanni.utils -import at.hannibal2.skyhanni.features.misc.EstimatedItemValue import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.name import net.minecraft.item.ItemStack @@ -241,8 +240,8 @@ object SkyBlockItemModifierUtils { return map } - fun ItemStack.getGemstones(): List { - val list = mutableListOf() + fun ItemStack.getGemstones(): List { + val list = mutableListOf() for (tags in tagCompound.keySet) { if (tags != "ExtraAttributes") continue val extraAttributes = tagCompound.getCompoundTag(tags) @@ -256,27 +255,60 @@ object SkyBlockItemModifierUtils { if (value == "") continue val rawType = key.split("_")[0] - val type = EstimatedItemValue.GemstoneType.getByName(rawType) + val type = GemstoneType.getByName(rawType) - val tier = EstimatedItemValue.GemstoneTier.getByName(value) + val tier = GemstoneTier.getByName(value) if (tier == null) { LorenzUtils.debug("Gemstone tier is null for item $name: ('$key' = '$value')") continue } if (type != null) { - list.add(EstimatedItemValue.GemstoneSlot(type, tier)) + list.add(GemstoneSlot(type, tier)) } else { val newKey = gemstones.getString(key + "_gem") - val newType = EstimatedItemValue.GemstoneType.getByName(newKey) + val newType = GemstoneType.getByName(newKey) if (newType == null) { LorenzUtils.debug("Gemstone type is null for item $name: ('$newKey' with '$key' = '$value')") continue } - list.add(EstimatedItemValue.GemstoneSlot(newType, tier)) + list.add(GemstoneSlot(newType, tier)) } } } } return list } + + class GemstoneSlot(val type: GemstoneType, val tier: GemstoneTier) { + fun getInternalName() = "${tier}_${type}_GEM" + } + + enum class GemstoneTier(val displayName: String) { + ROUGH("Rough"), + FLAWED("Flawed"), + FINE("Fine"), + FLAWLESS("Flawless"), + PERFECT("Perfect"), + ; + + companion object { + fun getByName(name: String) = GemstoneTier.values().firstOrNull { it.name == name } + } + } + + enum class GemstoneType(val displayName: String) { + JADE("Jade"), + AMBER("Amber"), + TOPAZ("Topaz"), + SAPPHIRE("Sapphire"), + AMETHYST("Amethyst"), + JASPER("Jasper"), + RUBY("Ruby"), + OPAL("Opal"), + ; + + companion object { + fun getByName(name: String) = values().firstOrNull { it.name == name } + } + } } \ No newline at end of file -- cgit