summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-07-06 07:57:22 +0200
committerGitHub <noreply@github.com>2024-07-06 07:57:22 +0200
commit34ba8c5fb8304e7b568822f8d3f675a0f133c6da (patch)
tree57ad5d042796e6d2de6bfe52435b1039d8fbee1e /src/main/java/at/hannibal2/skyhanni/features/misc
parent406225e030892acf8a3e35791571af23b3bb8225 (diff)
downloadskyhanni-34ba8c5fb8304e7b568822f8d3f675a0f133c6da.tar.gz
skyhanni-34ba8c5fb8304e7b568822f8d3f675a0f133c6da.tar.bz2
skyhanni-34ba8c5fb8304e7b568822f8d3f675a0f133c6da.zip
Improvement: Estimated Item Value (#2180)
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/EstimatedItemValueCalculator.kt25
1 files changed, 22 insertions, 3 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 1d6b21d2e..54f8f675e 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
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc.items
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.api.ReforgeAPI
+import at.hannibal2.skyhanni.config.features.misc.EstimatedItemValueConfig
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
@@ -17,7 +18,6 @@ import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull
import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull
-import at.hannibal2.skyhanni.utils.NEUItems.getPrice
import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull
import at.hannibal2.skyhanni.utils.NEUItems.getRawCraftCostOrNull
import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
@@ -208,7 +208,8 @@ object EstimatedItemValueCalculator {
private fun String.fixMending() = if (this == "MENDING") "VITALITY" else this
private fun getPriceOrCompositePriceForAttribute(attributeName: String, level: Int): Double? {
- return (1..10).mapNotNull { lowerLevel ->
+ val intRange = if (config.useAttributeComposite) 1..10 else level..level
+ return intRange.mapNotNull { lowerLevel ->
"$attributeName;$lowerLevel".asInternalName().getPriceOrNull()
?.let { it / (1 shl lowerLevel) * (1 shl level).toDouble() }
}.minOrNull()
@@ -585,9 +586,10 @@ object EstimatedItemValueCalculator {
val map = mutableMapOf<String, Double>()
//todo use repo
- val tieredEnchants = listOf("compact", "cultivating", "champion", "expertise", "hecatomb")
+ val tieredEnchants = listOf("compact", "cultivating", "champion", "expertise", "hecatomb", "toxophilite")
val onlyTierOnePrices =
listOf("ultimate_chimera", "ultimate_fatal_tempo", "smoldering", "ultimate_flash", "divine_gift")
+ val onlyTierFivePrices = listOf("ferocious_mana", "hardened_mana", "mana_vampire", "strong_mana")
val internalName = stack.getInternalName()
for ((rawName, rawLevel) in enchantments) {
@@ -614,6 +616,16 @@ object EstimatedItemValueCalculator {
}
level = 1
}
+ if (rawName in onlyTierFivePrices) {
+ when (rawLevel) {
+ 6 -> multiplier = 2
+ 7 -> multiplier = 4
+ 8 -> multiplier = 8
+ 9 -> multiplier = 16
+ 10 -> multiplier = 32
+ }
+ level = 5
+ }
if (internalName.startsWith("ENCHANTED_BOOK_BUNDLE_")) {
multiplier = EstimatedItemValue.bookBundleAmount.getOrDefault(rawName, 5)
}
@@ -743,4 +755,11 @@ object EstimatedItemValueCalculator {
list += priceMap.sortedDesc().keys
return totalPrice
}
+
+ private fun NEUInternalName.getPrice(): Double = getPriceOrNull() ?: -1.0
+
+ private fun NEUInternalName.getPriceOrNull(): Double? {
+ val useSellPrice = config.bazaarPriceSource == EstimatedItemValueConfig.BazaarPriceSource.BUY_ORDER
+ return getPriceOrNull(useSellPrice)
+ }
}