From 6eb085f4e2ba69e98934ffa9489c8679ba23d244 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Sun, 23 Jun 2024 20:06:17 +0200 Subject: Feature: Reforge helper (#1437) Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Co-authored-by: hannibal2 <24389977+hannibal002@users.noreply.github.com> Co-authored-by: Cal Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/features/misc/items/EstimatedItemValue.kt | 4 ---- .../features/misc/items/EstimatedItemValueCalculator.kt | 13 +++++++------ 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt index 724583e20..dee0a6749 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt @@ -4,7 +4,6 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.jsonobjects.repo.ItemsJson -import at.hannibal2.skyhanni.data.jsonobjects.repo.neu.NeuReforgeStoneJson import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -45,7 +44,6 @@ object EstimatedItemValue { private val cache = mutableMapOf>>() private var lastToolTipTime = 0L var gemstoneUnlockCosts = HashMap>>() - var reforges = mapOf() var bookBundleAmount = mapOf() private var currentlyShowing = false @@ -55,8 +53,6 @@ object EstimatedItemValue { fun onNeuRepoReload(event: NeuRepositoryReloadEvent) { gemstoneUnlockCosts = event.readConstant>>>("gemstonecosts") - reforges = - event.readConstant>("reforgestones") } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt index e1619ad92..05d53fa65 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.items import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.ReforgeAPI import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName @@ -130,7 +131,7 @@ object EstimatedItemValueCalculator { ) if (price != null) { val name = attributes[0].first.fixMending().allLettersFirstUppercase() - list.add("§7Attribute §9$name ${attributes[0].second}§7: (§6${price.shortFormat()}§7)",) + list.add("§7Attribute §9$name ${attributes[0].second}§7: (§6${price.shortFormat()}§7)") return price } } @@ -214,15 +215,15 @@ object EstimatedItemValueCalculator { private fun addReforgeStone(stack: ItemStack, list: MutableList): Double { val rawReforgeName = stack.getReforgeName() ?: return 0.0 - val reforge = EstimatedItemValue.reforges.values.firstOrNull { - rawReforgeName == it.reforgeName.lowercase() || rawReforgeName == it.internalName.asString().lowercase() + val reforge = ReforgeAPI.onlyPowerStoneReforge.firstOrNull { + rawReforgeName == it.lowercaseName || rawReforgeName == it.reforgeStone?.asString()?.lowercase() } ?: return 0.0 - val internalName = reforge.internalName.asString().asInternalName() + val internalName = reforge.reforgeStone ?: return 0.0 val reforgeStonePrice = internalName.getPrice() val reforgeStoneName = internalName.itemName - val applyCost = getReforgeStoneApplyCost(stack, reforge.reforgeCosts, internalName) ?: return 0.0 + val applyCost = reforge.costs?.let { getReforgeStoneApplyCost(stack, it, internalName) } ?: return 0.0 - list.add("§7Reforge: §9${reforge.reforgeName}") + list.add("§7Reforge: §9${reforge.name}") list.add(" §7Stone $reforgeStoneName §7(§6" + reforgeStonePrice.shortFormat() + "§7)") list.add(" §7Apply cost: (§6" + applyCost.shortFormat() + "§7)") return reforgeStonePrice + applyCost -- cgit