Skip to content

Commit

Permalink
fixed profit per mineshaft corpse
Browse files Browse the repository at this point in the history
  • Loading branch information
hannibal002 committed Sep 10, 2024
1 parent 2f6121b commit 9acb6e8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object CorpseTracker {
"Corpse Tracker",
{ BucketData() },
{ it.mining.mineshaft.corpseProfitTracker },
{ drawDisplay(it) }
{ drawDisplay(it) },
)

class BucketData : BucketedItemTrackerData<CorpseType>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 9acb6e8

Please sign in to comment.