aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-11 12:42:13 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-11 12:42:13 +0100
commit8c5e53facf75158bd8b0f4875f71133bf6a365e3 (patch)
tree999e48fcd0d449c26339ac9ad60abb33839ab016 /src/main/java/at/hannibal2/skyhanni/utils
parente92fdc4d5e06fd70566f4ec844ecc2625f720a8a (diff)
downloadskyhanni-8c5e53facf75158bd8b0f4875f71133bf6a365e3.tar.gz
skyhanni-8c5e53facf75158bd8b0f4875f71133bf6a365e3.tar.bz2
skyhanni-8c5e53facf75158bd8b0f4875f71133bf6a365e3.zip
creating function addTotalProfit for item trackers and fixed wrong calculation when zero bosses killed in slayer profit trackers
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
index 8dab120fa..b831ade3f 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
@@ -172,4 +172,18 @@ class SkyHanniItemTracker<Data : ItemTrackerData>(
}
}
+ fun addTotalProfit(profit: Double, totalAmount: Long, action: String): Renderable {
+ val profitFormat = profit.addSeparators()
+ val profitPrefix = if (profit < 0) "§c" else "§6"
+
+ val tips = if (totalAmount > 0) {
+ val profitPerCatch = profit / totalAmount
+ val profitPerCatchFormat = NumberUtil.format(profitPerCatch)
+ listOf("§7Profit per $action: $profitPrefix$profitPerCatchFormat")
+ } else emptyList()
+
+ val text = "§eTotal Profit: $profitPrefix$profitFormat coins"
+ return Renderable.hoverTips(text, tips)
+ }
+
}