diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/EstimatedItemValue.kt | 28 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt | 19 |
2 files changed, 33 insertions, 14 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 b98587dec..f5f6bc2c8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/EstimatedItemValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/EstimatedItemValue.kt @@ -13,10 +13,12 @@ import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAbilityScrolls +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getArmorDye import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getDrillUpgrades import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEnchantments import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getFarmingForDummiesCount import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getGemstones +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getHelmetSkin import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getHotPotatoCount import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getManaDisintegrators import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getMasterStars @@ -131,6 +133,10 @@ class EstimatedItemValue { totalPrice += addTransmissionTuners(stack, list) totalPrice += addManaDisintegrators(stack, list) + // cosmetic + totalPrice += addHelmetSkin(stack, list) + totalPrice += addArmorDye(stack, list) + // dynamic totalPrice += addAbilityScrolls(stack, list) totalPrice += addDrillUpgrades(stack, list) @@ -372,6 +378,24 @@ class EstimatedItemValue { return price } + private fun addHelmetSkin(stack: ItemStack, list: MutableList<String>): Double { + val internalName = stack.getHelmetSkin() ?: return 0.0 + + val price = NEUItems.getPrice(internalName) + val name = NEUItems.getItemStack(internalName).name + list.add("§7Skin: $name §7(§6" + NumberUtil.format(price) + "§7)") + return price + } + + private fun addArmorDye(stack: ItemStack, list: MutableList<String>): Double { + val internalName = stack.getArmorDye() ?: return 0.0 + + val price = NEUItems.getPrice(internalName) + val name = NEUItems.getItemStack(internalName).name + list.add("§7Dye: $name §7(§6" + NumberUtil.format(price) + "§7)") + return price + } + private fun addAbilityScrolls(stack: ItemStack, list: MutableList<String>): Double { var totalPrice = 0.0 val map = mutableMapOf<String, Double>() @@ -442,10 +466,6 @@ class EstimatedItemValue { 5 -> multiplier = 16 } level = 1 - println("") - println("rawName: $rawName") - println("rawLevel: $rawLevel") - println("multiplier: $multiplier") } if (internalName.startsWith("ENCHANTED_BOOK_BUNDLE_")) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt index 4229a80df..1a27d1e4c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt @@ -108,17 +108,16 @@ object SkyBlockItemModifierUtils { } fun ItemStack.getPowerScroll(): String? { - for (tags in tagCompound.keySet) { - if (tags != "ExtraAttributes") continue - val extraAttributes = tagCompound.getCompoundTag(tags) - for (attributes in extraAttributes.keySet) { - if (attributes == "power_ability_scroll") { - return extraAttributes.getString(attributes) - } - } - } + return tagCompound?.getCompoundTag("ExtraAttributes")?.getString("power_ability_scroll") + ?.takeUnless { it.isBlank() } + } - return null + fun ItemStack.getHelmetSkin(): String? { + return tagCompound?.getCompoundTag("ExtraAttributes")?.getString("skin")?.takeUnless { it.isBlank() } + } + + fun ItemStack.getArmorDye(): String? { + return tagCompound?.getCompoundTag("ExtraAttributes")?.getString("dye_item")?.takeUnless { it.isBlank() } } fun ItemStack.getAbilityScrolls(): List<String> { |