From d5d626895b6eb5d9288709ac54832692ed9ff483 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 10 May 2023 12:22:30 +0200 Subject: Added rune support in Estimated Item Value --- .../skyhanni/features/misc/EstimatedItemValue.kt | 21 +++++++++++++++++---- .../skyhanni/utils/SkyBlockItemModifierUtils.kt | 8 ++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2') 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): 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): 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() for (attributes in it.keySet) { -- cgit