diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt | 67 |
1 files changed, 33 insertions, 34 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 c7a70f12c..601413065 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 @@ -56,48 +56,47 @@ import java.util.Locale object EstimatedItemValueCalculator { private val config get() = SkyHanniMod.feature.misc.estimatedItemValues - - fun calculate(stack: ItemStack, list: MutableList<String>): Pair<Double, Double> { - var totalPrice = 0.0 - val basePrice = addBaseItem(stack, list) - totalPrice += basePrice - - totalPrice += addAttributeCost(stack, list) - - totalPrice += addReforgeStone(stack, list) + private val additionalCostFunctions = listOf( + ::addAttributeCost, + ::addReforgeStone, // once - totalPrice += addRecomb(stack, list) - totalPrice += addArtOfWar(stack, list) - totalPrice += addArtOfPeace(stack, list) - totalPrice += addEtherwarp(stack, list) - totalPrice += addPowerScrolls(stack, list) - totalPrice += addWoodSingularity(stack, list) - totalPrice += addJalapenoBook(stack, list) - totalPrice += addStatsBook(stack, list) - totalPrice += addEnrichment(stack, list) + ::addRecomb, + ::addArtOfWar, + ::addArtOfPeace, + ::addEtherwarp, + ::addPowerScrolls, + ::addWoodSingularity, + ::addJalapenoBook, + ::addStatsBook, + ::addEnrichment, // counted - totalPrice += addMasterStars(stack, list) - totalPrice += addHotPotatoBooks(stack, list) - totalPrice += addFarmingForDummies(stack, list) - totalPrice += addSilex(stack, list) - totalPrice += addTransmissionTuners(stack, list) - totalPrice += addManaDisintegrators(stack, list) - totalPrice += addPolarvoidBook(stack, list) - totalPrice += addBookwormBook(stack, list) + ::addMasterStars, + ::addHotPotatoBooks, + ::addFarmingForDummies, + ::addSilex, + ::addTransmissionTuners, + ::addManaDisintegrators, + ::addPolarvoidBook, + ::addBookwormBook, // cosmetic - totalPrice += addHelmetSkin(stack, list) - totalPrice += addArmorDye(stack, list) - totalPrice += addRune(stack, list) + ::addHelmetSkin, + ::addArmorDye, + ::addRune, // dynamic - totalPrice += addAbilityScrolls(stack, list) - totalPrice += addDrillUpgrades(stack, list) - totalPrice += addGemstoneSlotUnlockCost(stack, list) - totalPrice += addGemstones(stack, list) - totalPrice += addEnchantments(stack, list) + ::addAbilityScrolls, + ::addDrillUpgrades, + ::addGemstoneSlotUnlockCost, + ::addGemstones, + ::addEnchantments + ) + + fun calculate(stack: ItemStack, list: MutableList<String>): Pair<Double, Double> { + val basePrice = addBaseItem(stack, list) + val totalPrice = additionalCostFunctions.fold(basePrice) { total, function -> total + function(stack, list) } return Pair(totalPrice, basePrice) } |