aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-06-23 20:06:17 +0200
committerGitHub <noreply@github.com>2024-06-23 20:06:17 +0200
commit6eb085f4e2ba69e98934ffa9489c8679ba23d244 (patch)
tree6f3f4abe26118a5c14ed84ce48408b17665be79f /src/main/java/at/hannibal2/skyhanni/features/misc
parent78f5f7b94bdc48c3395ef17f30022b8cd653a776 (diff)
downloadskyhanni-6eb085f4e2ba69e98934ffa9489c8679ba23d244.tar.gz
skyhanni-6eb085f4e2ba69e98934ffa9489c8679ba23d244.tar.bz2
skyhanni-6eb085f4e2ba69e98934ffa9489c8679ba23d244.zip
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 <cwolfson58@gmail.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt13
2 files changed, 7 insertions, 10 deletions
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<ItemStack, List<List<Any>>>()
private var lastToolTipTime = 0L
var gemstoneUnlockCosts = HashMap<NEUInternalName, HashMap<String, List<String>>>()
- var reforges = mapOf<NEUInternalName, NeuReforgeStoneJson>()
var bookBundleAmount = mapOf<String, Int>()
private var currentlyShowing = false
@@ -55,8 +53,6 @@ object EstimatedItemValue {
fun onNeuRepoReload(event: NeuRepositoryReloadEvent) {
gemstoneUnlockCosts =
event.readConstant<HashMap<NEUInternalName, HashMap<String, List<String>>>>("gemstonecosts")
- reforges =
- event.readConstant<Map<NEUInternalName, NeuReforgeStoneJson>>("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<String>): 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