diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-25 03:21:38 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-25 03:21:38 +0100 |
commit | e47a2877bbb0550a1852889e0398f45bc20c0881 (patch) | |
tree | b191552e878d9f00274c4ac987abc7a2696a72c0 /src/main/java/at/hannibal2/skyhanni/features | |
parent | f142d7f2483247f541a24625af3f5789f3ee1ae6 (diff) | |
download | skyhanni-e47a2877bbb0550a1852889e0398f45bc20c0881.tar.gz skyhanni-e47a2877bbb0550a1852889e0398f45bc20c0881.tar.bz2 skyhanni-e47a2877bbb0550a1852889e0398f45bc20c0881.zip |
moved item draw logic from item tracker data to SkyHanni item tracker
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt | 14 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt | 21 |
2 files changed, 8 insertions, 27 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt index 674269c8d..a6e8c2477 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt @@ -10,7 +10,6 @@ import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addButton -import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil @@ -121,18 +120,7 @@ object FishingProfitTracker { { it in items } } - var profit = 0.0 - val map = mutableMapOf<Renderable, Long>() - for ((internalName, itemProfit) in data.items) { - if (!filter(internalName)) continue - - val price = data.drawItem(tracker, itemProfit, internalName, map) - profit += price - } - - for (text in map.sortedDesc().keys) { - addAsSingletonList(text) - } + val profit = tracker.drawItems(data, filter, this) val fishedCount = data.totalCatchAmount addAsSingletonList( 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 d71172eb3..938441d95 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt @@ -14,7 +14,6 @@ import at.hannibal2.skyhanni.events.SlayerQuestCompleteEvent import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -170,25 +169,19 @@ object SlayerProfitTracker { val tracker = getTracker() ?: return@buildList addAsSingletonList("§e§l$itemLogCategory Profit Tracker") - var profit = 0.0 - val map = mutableMapOf<Renderable, Long>() - for ((internalName, itemProfit) in itemLog.items) { - profit += itemLog.drawItem(tracker, itemProfit, internalName, map) - } + var profit = tracker.drawItems(itemLog, { true }, this) val slayerSpawnCost = itemLog.slayerSpawnCost if (slayerSpawnCost != 0L) { val mobKillCoinsFormat = NumberUtil.format(slayerSpawnCost) - map[Renderable.hoverTips( - " §7Slayer Spawn Costs: §c$mobKillCoinsFormat", - listOf("§7You paid §c$mobKillCoinsFormat §7in total", "§7for starting the slayer quests.") - )] = slayerSpawnCost + addAsSingletonList( + Renderable.hoverTips( + " §7Slayer Spawn Costs: §c$mobKillCoinsFormat", + listOf("§7You paid §c$mobKillCoinsFormat §7in total", "§7for starting the slayer quests.") + ) + ) profit += slayerSpawnCost } - for (text in map.sortedDesc().keys) { - addAsSingletonList(text) - } - val slayerCompletedCount = itemLog.slayerCompletedCount addAsSingletonList( Renderable.hoverTips( |