diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-16 01:06:39 +0200 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-16 01:06:39 +0200 |
| commit | b5358ebd5ec8df4854a3f816b8b263db33ceedef (patch) | |
| tree | ea898868a3c361d7a59fca4aec642fae18494320 | |
| parent | ca80b7530acd3b984f638a7f6a48e3377f690aba (diff) | |
| download | SkyHanni-b5358ebd5ec8df4854a3f816b8b263db33ceedef.tar.gz SkyHanni-b5358ebd5ec8df4854a3f816b8b263db33ceedef.tar.bz2 SkyHanni-b5358ebd5ec8df4854a3f816b8b263db33ceedef.zip | |
Fixed gemstone detection in estimated item value for gemstones with unique ids
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt index 14a691fa8..25cae741c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt @@ -104,19 +104,23 @@ object SkyBlockItemModifierUtils { for (key in gemstones.keySet) { if (key.endsWith("_gem")) continue if (key == "unlocked_slots") continue - val value = gemstones.getString(key) - if (value == "") continue + var value = gemstones.getString(key) + if (value == "") { + val tag = gemstones.getCompoundTag(key) + value = tag.getString("quality") + if (value == "") continue + } val rawType = key.split("_")[0] val type = GemstoneType.getByName(rawType) - val tier = GemstoneTier.getByName(value) - if (tier == null) { - LorenzUtils.debug("Gemstone tier is null for item $name: ('$key' = '$value')") + val quality = GemstoneQuality.getByName(value) + if (quality == null) { + LorenzUtils.debug("Gemstone quality is null for item $name: ('$key' = '$value')") continue } if (type != null) { - list.add(GemstoneSlot(type, tier)) + list.add(GemstoneSlot(type, quality)) } else { val newKey = gemstones.getString(key + "_gem") val newType = GemstoneType.getByName(newKey) @@ -124,7 +128,7 @@ object SkyBlockItemModifierUtils { LorenzUtils.debug("Gemstone type is null for item $name: ('$newKey' with '$key' = '$value')") continue } - list.add(GemstoneSlot(newType, tier)) + list.add(GemstoneSlot(newType, quality)) } } } @@ -143,11 +147,11 @@ object SkyBlockItemModifierUtils { private fun ItemStack.getExtraAttributes() = tagCompound?.getCompoundTag("ExtraAttributes") - class GemstoneSlot(val type: GemstoneType, val tier: GemstoneTier) { - fun getInternalName() = "${tier}_${type}_GEM" + class GemstoneSlot(val type: GemstoneType, val quality: GemstoneQuality) { + fun getInternalName() = "${quality}_${type}_GEM" } - enum class GemstoneTier(val displayName: String) { + enum class GemstoneQuality(val displayName: String) { ROUGH("Rough"), FLAWED("Flawed"), FINE("Fine"), @@ -156,7 +160,7 @@ object SkyBlockItemModifierUtils { ; companion object { - fun getByName(name: String) = GemstoneTier.values().firstOrNull { it.name == name } + fun getByName(name: String) = GemstoneQuality.values().firstOrNull { it.name == name } } } |
