aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/combat
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-09-08 13:36:19 +0200
committerGitHub <noreply@github.com>2024-09-08 13:36:19 +0200
commit796ef7ca4139669f15e323c112378125760b5292 (patch)
treef389143acf59ee7a8fd095503c49ddfd16205443 /src/main/java/at/hannibal2/skyhanni/features/combat
parent7519ef5249502f9aa14e350e5e5b8b83eab0e1eb (diff)
downloadskyhanni-796ef7ca4139669f15e323c112378125760b5292.tar.gz
skyhanni-796ef7ca4139669f15e323c112378125760b5292.tar.bz2
skyhanni-796ef7ca4139669f15e323c112378125760b5292.zip
Backend: No List<Any> in Trackers (#2474)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: Cal <cwolfson58@gmail.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/combat')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt
index 12bd69658..931f3b622 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt
@@ -12,8 +12,8 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent
import at.hannibal2.skyhanni.events.SackChangeEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
-import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut
+import at.hannibal2.skyhanni.utils.CollectionUtils.addString
import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange
import at.hannibal2.skyhanni.utils.ConfigUtils
import at.hannibal2.skyhanni.utils.InventoryUtils
@@ -26,6 +26,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
+import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker
import at.hannibal2.skyhanni.utils.tracker.TrackerData
import com.google.gson.annotations.Expose
@@ -211,36 +212,36 @@ object EnderNodeTracker {
else -> null
}
- private fun drawDisplay(data: Data) = buildList<List<Any>> {
+ private fun drawDisplay(data: Data) = buildList<Renderable> {
val lootProfit = getLootProfit(data)
- addAsSingletonList("§5§lEnder Node Tracker")
- addAsSingletonList("§d${data.totalNodesMined.addSeparators()} Ender Nodes mined")
- addAsSingletonList("§6${lootProfit.values.sum().shortFormat()} Coins made")
- addAsSingletonList(" ")
- addAsSingletonList("§b${data.totalEndermiteNests.addSeparators()} §cEndermite Nest")
+ addString("§5§lEnder Node Tracker")
+ addString("§d${data.totalNodesMined.addSeparators()} Ender Nodes mined")
+ addString("§6${lootProfit.values.sum().shortFormat()} Coins made")
+ addString(" ")
+ addString("§b${data.totalEndermiteNests.addSeparators()} §cEndermite Nest")
for (item in EnderNode.entries.subList(0, 11)) {
val count = (data.lootCount[item] ?: 0).addSeparators()
val profit = (lootProfit[item] ?: 0.0).shortFormat()
- addAsSingletonList("§b$count ${item.displayName} §7(§6$profit§7)")
+ addString("§b$count ${item.displayName} §7(§6$profit§7)")
}
- addAsSingletonList(" ")
+ addString(" ")
val totalEnderArmor = calculateEnderArmor(data)
- addAsSingletonList(
+ addString(
"§b${totalEnderArmor.addSeparators()} §5Ender Armor " +
"§7(§6${(totalEnderArmor * 10_000).shortFormat()}§7)"
)
for (item in EnderNode.entries.subList(11, 16)) {
val count = (data.lootCount[item] ?: 0).addSeparators()
val profit = (lootProfit[item] ?: 0.0).shortFormat()
- addAsSingletonList("§b$count ${item.displayName} §7(§6$profit§7)")
+ addString("§b$count ${item.displayName} §7(§6$profit§7)")
}
// enderman pet rarities
val (c, u, r, e, l) = EnderNode.entries.subList(16, 21).map { (data.lootCount[it] ?: 0).addSeparators() }
val profit = EnderNode.entries.subList(16, 21).sumOf { lootProfit[it] ?: 0.0 }.shortFormat()
- addAsSingletonList("§f$c§7-§a$u§7-§9$r§7-§5$e§7-§6$l §fEnderman Pet §7(§6$profit§7)")
+ addString("§f$c§7-§a$u§7-§9$r§7-§5$e§7-§6$l §fEnderman Pet §7(§6$profit§7)")
}
private fun calculateEnderArmor(storage: Data) =
@@ -248,10 +249,10 @@ object EnderNodeTracker {
.map { it.value }
.sum()
- private fun formatDisplay(map: List<List<Any>>): List<List<Any>> {
+ private fun formatDisplay(map: List<Renderable>): List<Renderable> {
if (!ProfileStorageData.loaded) return emptyList()
- val newList = mutableListOf<List<Any>>()
+ val newList = mutableListOf<Renderable>()
for (index in config.textFormat.get()) {
// TODO, change functionality to use enum rather than ordinals
newList.add(map[index.ordinal])