aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishDisplay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt34
2 files changed, 25 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishDisplay.kt
index d54f7cf48..ce6352c0d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishDisplay.kt
@@ -218,7 +218,7 @@ object TrophyFishDisplay {
private fun getItemName(rawName: String): String {
val name = getInternalName(rawName).itemName
- return name.split(" ").dropLast(1).joinToString(" ").replace("§k", "")
+ return name.split(" ").dropLast(1).joinToString(" ")
}
private fun getInternalName(name: String): NEUInternalName {
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 25fa85c03..27a345a98 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
@@ -4,6 +4,7 @@ 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.getAttributeFromShard
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
@@ -128,16 +129,8 @@ object EstimatedItemValueCalculator {
if (isKuudraSet(internalName)) {
genericName = kuudraSets.fold(internalName) { acc, part -> acc.replace(part, "GENERIC_KUUDRA") }
}
- if (internalName == "ATTRIBUTE_SHARD" && attributes.size == 1) {
- val price = getPriceOrCompositePriceForAttribute(
- "ATTRIBUTE_SHARD+ATTRIBUTE_" + attributes[0].first,
- attributes[0].second,
- )
- if (price != null) {
- val name = attributes[0].first.fixMending().allLettersFirstUppercase()
- list.add("§7Attribute §9$name ${attributes[0].second}§7: (§6${price.shortFormat()}§7)")
- return price
- }
+ stack.getAttributeFromShard()?.let {
+ return 0.0
}
if (attributes.size != 2) return 0.0
val basePrice = internalName.asInternalName().getPriceOrNull() ?: 0.0
@@ -546,6 +539,16 @@ object EstimatedItemValueCalculator {
private fun addBaseItem(stack: ItemStack, list: MutableList<String>): Double {
val internalName = removeKuudraArmorPrefix(stack.getInternalName().asString()).asInternalName()
+
+ stack.getAttributeFromShard()?.let {
+ val price = it.getAttributePrice()
+ if (price != null) {
+ val name = it.getAttributeName()
+ list.add("§7Base item: $name §7(§6" + price.shortFormat() + "§7)")
+ return price
+ }
+ }
+
var price = internalName.getPrice()
if (price == -1.0) {
price = 0.0
@@ -771,4 +774,15 @@ object EstimatedItemValueCalculator {
private fun NEUInternalName.getPriceOrNull(): Double? {
return getPriceOrNull(config.priceSource.get())
}
+
+ fun Pair<String, Int>.getAttributeName(): String {
+ val name = first.fixMending().allLettersFirstUppercase()
+ return "§9$name ${second}"
+ }
+
+ fun Pair<String, Int>.getAttributePrice(): Double? =
+ EstimatedItemValueCalculator.getPriceOrCompositePriceForAttribute(
+ "ATTRIBUTE_SHARD+ATTRIBUTE_" + first,
+ second,
+ )
}