diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-10 21:28:29 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-10 21:28:29 +0200 |
commit | d1f1465b8ef122085dd78ef5794f31ea359b7cb4 (patch) | |
tree | 0c38841a0383678b3752a190d4d9bb0e541ce7af /src/main/java/at/hannibal2/skyhanni/utils | |
parent | 4acc02e6a6959fef1ac202ee4db88258d4b7b32c (diff) | |
download | skyhanni-d1f1465b8ef122085dd78ef5794f31ea359b7cb4.tar.gz skyhanni-d1f1465b8ef122085dd78ef5794f31ea359b7cb4.tar.bz2 skyhanni-d1f1465b8ef122085dd78ef5794f31ea359b7cb4.zip |
Moved gemstone inner classes from EstimatedItemValue into SkyBlockItemModifierUtils
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt | 48 |
1 files changed, 40 insertions, 8 deletions
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<EstimatedItemValue.GemstoneSlot> { - val list = mutableListOf<EstimatedItemValue.GemstoneSlot>() + fun ItemStack.getGemstones(): List<GemstoneSlot> { + val list = mutableListOf<GemstoneSlot>() 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 |