diff options
author | jani270 <69345714+jani270@users.noreply.github.com> | 2023-04-10 20:04:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-10 20:04:15 +0200 |
commit | b814edd6e6d8d615e02191ddd3a7085ee81bf38f (patch) | |
tree | a92d9fce6bdb46ab5d5b785e5375d1d0f669619e /src/main | |
parent | 251c36ddee87c7d160f33ad3c01d489d0a0865de (diff) | |
download | skyhanni-b814edd6e6d8d615e02191ddd3a7085ee81bf38f.tar.gz skyhanni-b814edd6e6d8d615e02191ddd3a7085ee81bf38f.tar.bz2 skyhanni-b814edd6e6d8d615e02191ddd3a7085ee81bf38f.zip |
Added Dyes and Skins to the price calc (also removed funny prinLn's (#33)
Co-authored-by: Roman / Linnea Gräf <roman.graef@gmail.com>
Diffstat (limited to 'src/main')
-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> { |