aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt16
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