aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-09-10 21:54:18 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-09-10 21:54:18 +0200
commit9acb6e88fb868ce9d591fb98cfa80730681653f6 (patch)
tree06a3a8cc28fed97d1063aa5ea19b0a74255573f9
parent2f6121bc209fb28e1d9f12fe2d10bfacfb12836d (diff)
downloadskyhanni-9acb6e88fb868ce9d591fb98cfa80730681653f6.tar.gz
skyhanni-9acb6e88fb868ce9d591fb98cfa80730681653f6.tar.bz2
skyhanni-9acb6e88fb868ce9d591fb98cfa80730681653f6.zip
fixed profit per mineshaft corpse
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/ProfitPerMineshaftCorpse.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/MineshaftCorpseProfitPer.kt)19
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniBucketedItemTracker.kt3
3 files changed, 11 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt
index 77aabc1bd..c54315d7e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt
@@ -34,7 +34,7 @@ object CorpseTracker {
"Corpse Tracker",
{ BucketData() },
{ it.mining.mineshaft.corpseProfitTracker },
- { drawDisplay(it) }
+ { drawDisplay(it) },
)
class BucketData : BucketedItemTrackerData<CorpseType>() {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/MineshaftCorpseProfitPer.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/ProfitPerMineshaftCorpse.kt
index eed5f2b9d..7eebeeaab 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/MineshaftCorpseProfitPer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/ProfitPerMineshaftCorpse.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.mining.CorpseLootedEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc
+import at.hannibal2.skyhanni.utils.ItemPriceUtils.getPriceOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.itemName
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NEUItems.getPrice
@@ -13,7 +14,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@SkyHanniModule
-object MineshaftCorpseProfitPer {
+object ProfitPerMineshaftCorpse {
private val config get() = SkyHanniMod.feature.mining.mineshaft
@SubscribeEvent
@@ -25,14 +26,12 @@ object MineshaftCorpseProfitPer {
val map = mutableMapOf<String, Double>()
for ((name, amount) in loot) {
if (name == "§bGlacite Powder") continue
- NEUInternalName.fromItemNameOrNull(name)?.let {
- val pricePer = it.getPrice()
- if (pricePer == -1.0) continue
- val profit = amount * pricePer
- val text = "§eFound $name §8${amount.addSeparators()}x §7(§6${profit.shortFormat()}§7)"
- map[text] = profit
- totalProfit += profit
- }
+ val internalName = NEUInternalName.fromItemNameOrNull(name) ?: continue
+ val pricePer = internalName.getPriceOrNull() ?: continue
+ val profit = amount * pricePer
+ val text = "§eFound $name §8${amount.addSeparators()}x §7(§6${profit.shortFormat()}§7)"
+ map[text] = profit
+ totalProfit += profit
}
val corpseType = event.corpseType
@@ -42,7 +41,7 @@ object MineshaftCorpseProfitPer {
val keyName = it.itemName
val price = it.getPrice()
- map["$keyName: §c-${price.shortFormat()}"] = -price
+ map["§cCost: $keyName §7(§c-${price.shortFormat()}§7)"] = -price
totalProfit -= price
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniBucketedItemTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniBucketedItemTracker.kt
index dcbab2b1b..2975d57e2 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniBucketedItemTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniBucketedItemTracker.kt
@@ -98,8 +98,7 @@ class SkyHanniBucketedItemTracker<E : Enum<E>, BucketedData : BucketedItemTracke
if (!filter(internalName)) continue
val amount = itemProfit.totalAmount
- val pricePer =
- if (internalName == SKYBLOCK_COIN) 1.0 else data.getCustomPricePer(internalName)
+ val pricePer = if (internalName == SKYBLOCK_COIN) 1.0 else data.getCustomPricePer(internalName)
val price = (pricePer * amount).toLong()
val hidden = itemProfit.hidden