From 8c5e53facf75158bd8b0f4875f71133bf6a365e3 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 11 Jan 2024 12:42:13 +0100 Subject: creating function addTotalProfit for item trackers and fixed wrong calculation when zero bosses killed in slayer profit trackers --- .../hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/slayer') diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt index 6ff20129b..d0c374a8b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt @@ -43,7 +43,7 @@ object SlayerProfitTracker { var slayerSpawnCost: Long = 0 @Expose - var slayerCompletedCount = 0 + var slayerCompletedCount = 0L override fun getDescription(timesDropped: Long): List { val percentage = timesDropped.toDouble() / slayerCompletedCount @@ -168,14 +168,7 @@ object SlayerProfitTracker { ) ) - val profitFormat = profit.addSeparators() - val profitPrefix = if (profit < 0) "§c" else "§6" - - val profitPerBoss = profit / itemLog.slayerCompletedCount - val profitPerBossFormat = NumberUtil.format(profitPerBoss) - - val text = "§eTotal Profit: $profitPrefix$profitFormat coins" - addAsSingletonList(Renderable.hoverTips(text, listOf("§7Profit per boss: $profitPrefix$profitPerBossFormat"))) + addAsSingletonList(tracker.addTotalProfit(profit, itemLog.slayerCompletedCount, "boss")) tracker.addPriceFromButton(this) } -- cgit