diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-05-10 12:22:30 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-05-10 12:22:30 +0200 |
commit | d5d626895b6eb5d9288709ac54832692ed9ff483 (patch) | |
tree | 8eca64564f0611ecf8f474edfd66759498d400db /src/main/java | |
parent | 954578ca269cc71c4751c328c1b6ed51553c1f99 (diff) | |
download | skyhanni-d5d626895b6eb5d9288709ac54832692ed9ff483.tar.gz skyhanni-d5d626895b6eb5d9288709ac54832692ed9ff483.tar.bz2 skyhanni-d5d626895b6eb5d9288709ac54832692ed9ff483.zip |
Added rune support in Estimated Item Value
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/EstimatedItemValue.kt | 21 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt | 8 |
2 files changed, 25 insertions, 4 deletions
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 285b985a8..06becfc12 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/EstimatedItemValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/EstimatedItemValue.kt @@ -25,6 +25,7 @@ import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getManaDisintegrato import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getMasterStars import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPowerScroll import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getReforgeName +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getRune import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getSilexCount import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getTransmissionTunerCount import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.hasArtOfPiece @@ -95,14 +96,16 @@ class EstimatedItemValue { val internalName = stack.getInternalName() if (internalName == "") return listOf() - //FIX neu item list + // FIX neu item list if (internalName.startsWith("ULTIMATE_ULTIMATE_")) return listOf() - // we don't need this feature to work on books at all + // We don't need this feature to work on books at all if (stack.item == Items.enchanted_book) return listOf() - // block catacombs items in mort inventory + // Block catacombs items in mort inventory if (internalName.startsWith("CATACOMBS_PASS_") || internalName.startsWith("MASTER_CATACOMBS_PASS_")) return listOf() - // blocks the dungeon map + // Blocks the dungeon map if (internalName.startsWith("MAP-")) return listOf() + // Hides the rune item + if (internalName.contains("_RUNE;")) return listOf() if (NEUItems.getItemStackOrNull(internalName) == null) { @@ -136,6 +139,7 @@ class EstimatedItemValue { // cosmetic totalPrice += addHelmetSkin(stack, list) totalPrice += addArmorDye(stack, list) + totalPrice += addRune(stack, list) // dynamic totalPrice += addAbilityScrolls(stack, list) @@ -379,6 +383,15 @@ class EstimatedItemValue { return price } + private fun addRune(stack: ItemStack, list: MutableList<String>): Double { + val internalName = stack.getRune() ?: return 0.0 + + val price = NEUItems.getPrice(internalName) + val name = NEUItems.getItemStack(internalName).name + list.add("§7Rune: $name §7(§6" + NumberUtil.format(price) + "§7)") + return price + } + private fun addAbilityScrolls(stack: ItemStack, list: MutableList<String>): Double { val abilityScrolls = stack.getAbilityScrolls() ?: return 0.0 diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt index 60d2d9860..dc59d832a 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt @@ -58,6 +58,14 @@ object SkyBlockItemModifierUtils { fun ItemStack.getArmorDye() = getAttributeString("dye_item") + fun ItemStack.getRune(): String? { + val runesMap = getExtraAttributes()?.getCompoundTag("runes") ?: return null + val runesList = runesMap.keySet.associateWith { runesMap.getInteger(it) }.toList() + if (runesList.isEmpty()) return null + val (name, tier) = runesList.first() + return "${name.uppercase()}_RUNE;$tier" + } + fun ItemStack.getAbilityScrolls() = getExtraAttributes()?.let { val list = mutableListOf<String>() for (attributes in it.keySet) { |