diff options
author | Luna <luna@alexia.lol> | 2024-06-13 17:38:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-13 17:38:06 +0200 |
commit | 760052709058d4f2c92d4caf3233f5bb0d6773ea (patch) | |
tree | 314a3d51ff51ea4ad3db12cce1f7481ff23331f7 /src | |
parent | 578895eb80ca1c98e7b26bf2257cc0986db09421 (diff) | |
download | skyhanni-760052709058d4f2c92d4caf3233f5bb0d6773ea.tar.gz skyhanni-760052709058d4f2c92d4caf3233f5bb0d6773ea.tar.bz2 skyhanni-760052709058d4f2c92d4caf3233f5bb0d6773ea.zip |
Fix: Prefixes being incorrectly stripped from non-Kuudra armor items (#2057)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt | 16 |
1 files changed, 10 insertions, 6 deletions
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 c18408a0f..2cb5835e6 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 @@ -103,13 +103,15 @@ object EstimatedItemValueCalculator { return Pair(totalPrice, basePrice) } + private fun isKuudraSet(internalName: String) = + (kuudraSets.any { internalName.contains(it) } && + listOf("CHESTPLATE", "LEGGINGS", "HELMET", "BOOTS").any { internalName.endsWith(it) }) + private fun addAttributeCost(stack: ItemStack, list: MutableList<String>): Double { val attributes = stack.getAttributes() ?: return 0.0 - var internalName = stack.getInternalName().asString().removePrefix("VANQUISHED_") + var internalName = removeKuudraArmorPrefix(stack.getInternalName().asString().removePrefix("VANQUISHED_")) var genericName = internalName - if (kuudraSets.any { internalName.contains(it) } - && listOf("CHESTPLATE", "LEGGINGS", "HELMET", "BOOTS").any { internalName.endsWith(it) }) { - internalName = removeCrimsonArmorPrefix(internalName) + if (isKuudraSet(internalName)) { genericName = kuudraSets.fold(internalName) { acc, part -> acc.replace(part, "GENERIC_KUUDRA") } } if (internalName == "ATTRIBUTE_SHARD" && attributes.size == 1) { @@ -168,7 +170,9 @@ object EstimatedItemValueCalculator { return subTotal + 0.1 } - private fun removeCrimsonArmorPrefix(original: String): String { + private fun removeKuudraArmorPrefix(original: String): String { + if (!isKuudraSet(original)) return original + var internalName = original for (prefix in listOf("HOT_", "BURNING_", "FIERY_", "INFERNAL_")) { internalName = internalName.removePrefix(prefix) @@ -530,7 +534,7 @@ object EstimatedItemValueCalculator { } private fun addBaseItem(stack: ItemStack, list: MutableList<String>): Double { - val internalName = removeCrimsonArmorPrefix(stack.getInternalName().asString()).asInternalName() + val internalName = removeKuudraArmorPrefix(stack.getInternalName().asString()).asInternalName() var price = internalName.getPrice() if (price == -1.0) { price = 0.0 |