aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt29
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt35
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/GraphEditor.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt39
18 files changed, 147 insertions, 131 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])
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt
index 01d2c1d2e..f8ae6165b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt
@@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
-import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList
+import at.hannibal2.skyhanni.utils.CollectionUtils.addString
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
@@ -77,20 +77,20 @@ object DianaProfitTracker {
}
}
- private fun drawDisplay(data: Data): List<List<Any>> = buildList {
- addAsSingletonList("§e§lDiana Profit Tracker")
+ private fun drawDisplay(data: Data): List<Renderable> = buildList {
+ addString("§e§lDiana Profit Tracker")
val profit = tracker.drawItems(data, { true }, this)
val treasureCoins = data.burrowsDug
- addAsSingletonList(
+ add(
Renderable.hoverTips(
"§7Burrows dug: §e${treasureCoins.addSeparators()}",
listOf("§7You dug out griffin burrows §e${treasureCoins.addSeparators()} §7times."),
),
)
- addAsSingletonList(tracker.addTotalProfit(profit, data.burrowsDug, "burrow"))
+ add(tracker.addTotalProfit(profit, data.burrowsDug, "burrow"))
tracker.addPriceFromButton(this)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt
index 68b70a77a..fc7442faf 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt
@@ -5,14 +5,15 @@ import at.hannibal2.skyhanni.events.ConfigLoadEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
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.CollectionUtils.sumAllValues
import at.hannibal2.skyhanni.utils.ConditionalUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.SimpleTimeMark
+import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker
import at.hannibal2.skyhanni.utils.tracker.TrackerData
@@ -99,8 +100,8 @@ object MythologicalCreatureTracker {
}
}
- private fun drawDisplay(data: Data): List<List<Any>> = buildList {
- addAsSingletonList("§7Mythological Creature Tracker:")
+ private fun drawDisplay(data: Data): List<Renderable> = buildList {
+ addString("§7Mythological Creature Tracker:")
val total = data.count.sumAllValues()
for ((creatureType, amount) in data.count.entries.sortedByDescending { it.value }) {
val percentageSuffix = if (config.showPercentage.get()) {
@@ -108,10 +109,10 @@ object MythologicalCreatureTracker {
" §7$percentage"
} else ""
- addAsSingletonList(" §7- §e${amount.addSeparators()} ${creatureType.displayName}$percentageSuffix")
+ addString(" §7- §e${amount.addSeparators()} ${creatureType.displayName}$percentageSuffix")
}
- addAsSingletonList(" §7- §e${total.addSeparators()} §7Total Mythological Creatures")
- addAsSingletonList(" §7- §e${data.creaturesSinceLastInquisitor.addSeparators()} §7Creatures since last Minos Inquisitor")
+ addString(" §7- §e${total.addSeparators()} §7Total Mythological Creatures")
+ addString(" §7- §e${data.creaturesSinceLastInquisitor.addSeparators()} §7Creatures since last Minos Inquisitor")
}
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt
index 7547f1bc2..4fc5b824b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt
@@ -11,8 +11,8 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.SecondPassedEvent
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.ConfigUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
@@ -20,6 +20,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker
import at.hannibal2.skyhanni.utils.tracker.TrackerData
@@ -104,8 +105,8 @@ object FrozenTreasureTracker {
icePerHour = (icePerSecond.average() * 3600).toInt()
}
- private fun formatDisplay(map: List<List<Any>>): List<List<Any>> {
- val newList = mutableListOf<List<Any>>()
+ private fun formatDisplay(map: List<Renderable>): List<Renderable> {
+ val newList = mutableListOf<Renderable>()
for (index in config.textFormat) {
// TODO, change functionality to use enum rather than ordinals
newList.add(map[index.ordinal])
@@ -136,20 +137,20 @@ object FrozenTreasureTracker {
}
}
- private fun drawDisplay(data: Data) = buildList<List<Any>> {
+ private fun drawDisplay(data: Data) = buildList {
calculateIce(data)
- addAsSingletonList("§e§lFrozen Treasure Tracker")
- addAsSingletonList("§6${formatNumber(data.treasuresMined)} Treasures Mined")
- addAsSingletonList("§3${formatNumber(estimatedIce)} Total Ice")
- addAsSingletonList("§3${formatNumber(icePerHour)} Ice/hr")
- addAsSingletonList("§8${formatNumber(data.compactProcs)} Compact Procs")
- addAsSingletonList("")
+ addString("§e§lFrozen Treasure Tracker")
+ addString("§6${formatNumber(data.treasuresMined)} Treasures Mined")
+ addString("§3${formatNumber(estimatedIce)} Total Ice")
+ addString("§3${formatNumber(icePerHour)} Ice/hr")
+ addString("§8${formatNumber(data.compactProcs)} Compact Procs")
+ addString("")
for (treasure in FrozenTreasure.entries) {
val count = (data.treasureCount[treasure] ?: 0) * if (config.showAsDrops) treasure.defaultAmount else 1
- addAsSingletonList("§b${formatNumber(count)} ${treasure.displayName}")
+ addString("§b${formatNumber(count)} ${treasure.displayName}")
}
- addAsSingletonList("")
+ addString("")
}
fun formatNumber(amount: Number): String {
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 a0590816e..619334a98 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
@@ -13,10 +13,10 @@ import at.hannibal2.skyhanni.features.fishing.FishingAPI
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.ChatUtils
-import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList
+import at.hannibal2.skyhanni.utils.CollectionUtils.addButton
+import at.hannibal2.skyhanni.utils.CollectionUtils.addString
import at.hannibal2.skyhanni.utils.DelayedRun
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.addButton
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
@@ -119,26 +119,26 @@ object FishingProfitTracker {
return map
}
- private fun drawDisplay(data: Data): List<List<Any>> = buildList {
- addAsSingletonList("§e§lFishing Profit Tracker")
+ private fun drawDisplay(data: Data): List<Renderable> = buildList {
+ addString("§e§lFishing Profit Tracker")
val filter: (NEUInternalName) -> Boolean = addCategories(data)
val profit = tracker.drawItems(data, filter, this)
val fishedCount = data.totalCatchAmount
- addAsSingletonList(
+ add(
Renderable.hoverTips(
"§7Times fished: §e${fishedCount.addSeparators()}",
listOf("§7You've reeled in §e${fishedCount.addSeparators()} §7catches."),
),
)
- addAsSingletonList(tracker.addTotalProfit(profit, data.totalCatchAmount, "catch"))
+ add(tracker.addTotalProfit(profit, data.totalCatchAmount, "catch"))
tracker.addPriceFromButton(this)
}
- private fun MutableList<List<Any>>.addCategories(data: Data): (NEUInternalName) -> Boolean {
+ private fun MutableList<Renderable>.addCategories(data: Data): (NEUInternalName) -> Boolean {
val amounts = getCurrentCategories(data)
checkMissingItems(data)
val list = amounts.keys.toList()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt
index d241b6a19..fd41883ef 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt
@@ -9,14 +9,15 @@ import at.hannibal2.skyhanni.features.fishing.FishingAPI
import at.hannibal2.skyhanni.features.fishing.SeaCreatureManager
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.command.ErrorManager
-import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList
+import at.hannibal2.skyhanni.utils.CollectionUtils.addButton
import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut
+import at.hannibal2.skyhanni.utils.CollectionUtils.addString
import at.hannibal2.skyhanni.utils.CollectionUtils.sumAllValues
import at.hannibal2.skyhanni.utils.ConditionalUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.addButton
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.StringUtils.allLettersFirstUppercase
+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
@@ -70,8 +71,8 @@ object SeaCreatureTracker {
return map
}
- private fun drawDisplay(data: Data): List<List<Any>> = buildList {
- addAsSingletonList("§7Sea Creature Tracker:")
+ private fun drawDisplay(data: Data): List<Renderable> = buildList {
+ addString("§7Sea Creature Tracker:")
val filter: (String) -> Boolean = addCategories(data)
val realAmount = data.amount.filter { filter(it.key) }
@@ -93,12 +94,12 @@ object SeaCreatureTracker {
" §7$percentage"
} else ""
- addAsSingletonList(" §7- §e${amount.addSeparators()} $displayName$percentageSuffix")
+ addString(" §7- §e${amount.addSeparators()} $displayName$percentageSuffix")
}
- addAsSingletonList(" §7- §e${total.addSeparators()} §7Total Sea Creatures")
+ addString(" §7- §e${total.addSeparators()} §7Total Sea Creatures")
}
- private fun MutableList<List<Any>>.addCategories(data: Data): (String) -> Boolean {
+ private fun MutableList<Renderable>.addCategories(data: Data): (String) -> Boolean {
val amounts = getCurrentCategories(data)
val list = amounts.keys.toList()
if (currentCategory !in list) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt
index b55ed769d..1e9397d5f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt
@@ -13,13 +13,14 @@ import at.hannibal2.skyhanni.events.SecondPassedEvent
import at.hannibal2.skyhanni.features.garden.CropType
import at.hannibal2.skyhanni.features.garden.GardenAPI
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.CollectionUtils.sortedDesc
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.SimpleTimeMark
+import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker
import at.hannibal2.skyhanni.utils.tracker.TrackerData
@@ -83,11 +84,11 @@ object ArmorDropTracker {
}
}
- private fun drawDisplay(data: Data): List<List<Any>> = buildList {
- addAsSingletonList("§7Armor Drop Tracker:")
+ private fun drawDisplay(data: Data): List<Renderable> = buildList {
+ addString("§7Armor Drop Tracker:")
for ((drop, amount) in data.drops.sortedDesc()) {
val dropName = drop.dropName
- addAsSingletonList(" §7- §e${amount.addSeparators()}x $dropName")
+ addString(" §7- §e${amount.addSeparators()}x $dropName")
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt
index 7d9f2587e..34d3fe53d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt
@@ -120,13 +120,13 @@ object DicerRngDropTracker {
}
}
- private fun drawDisplay(data: Data) = buildList {
+ private fun drawDisplay(data: Data) = buildList<Renderable> {
val cropInHand = cropInHand ?: return@buildList
val topLine = mutableListOf<Renderable>()
topLine.add(Renderable.itemStack(cropInHand.icon))
topLine.add(Renderable.string("§7Dicer Tracker:"))
- add(listOf(Renderable.horizontalContainer(topLine)))
+ add(Renderable.horizontalContainer(topLine))
val items = data.drops[cropInHand] ?: return@buildList
val list = mutableListOf<Renderable>()
@@ -143,7 +143,7 @@ object DicerRngDropTracker {
list.add(Renderable.string(" §7- §e${amount.addSeparators()}x §$colorCode$displayName"))
}
}
- add(listOf(Renderable.verticalContainer(list)))
+ add(Renderable.verticalContainer(list))
}
private var cropInHand: CropType? = null
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt
index 1d2710c7c..7dcd07861 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt
@@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.events.PurseChangeCause
import at.hannibal2.skyhanni.events.PurseChangeEvent
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
-import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList
+import at.hannibal2.skyhanni.utils.CollectionUtils.addString
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
@@ -117,18 +117,18 @@ object PestProfitTracker {
lastPestKillTime = SimpleTimeMark.now()
}
- private fun drawDisplay(data: Data): List<List<Any>> = buildList {
- addAsSingletonList("§e§lPest Profit Tracker")
+ private fun drawDisplay(data: Data): List<Renderable> = buildList {
+ addString("§e§lPest Profit Tracker")
val profit = tracker.drawItems(data, { true }, this)
val pestsKilled = data.totalPestsKills
- addAsSingletonList(
+ add(
Renderable.hoverTips(
"§7Pests killed: §e${pestsKilled.addSeparators()}",
listOf("§7You killed pests §e${pestsKilled.addSeparators()} §7times."),
),
)
- addAsSingletonList(tracker.addTotalProfit(profit, data.totalPestsKills, "kill"))
+ add(tracker.addTotalProfit(profit, data.totalPestsKills, "kill"))
tracker.addPriceFromButton(this)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt
index 89b8355be..abab20400 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt
@@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.features.event.hoppity.HoppityEventSummary
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.DelayedRun
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
@@ -148,18 +149,18 @@ object ChocolateFactoryStrayTracker {
tracker.modify { it.goldenTypesCaught.addOrPut(typeCaught, amount) }
}
- private fun drawDisplay(data: Data): List<List<Any>> = buildList {
+ private fun drawDisplay(data: Data): List<Renderable> = buildList {
val extraChocMs = data.straysExtraChocMs.values.sum().milliseconds
val formattedExtraTime = extraChocMs.let { if (it == 0.milliseconds) "0s" else it.format() }
- addAsSingletonList(
+ add(
Renderable.hoverTips(
"§6§lStray Tracker",
tips = listOf("§a+§b${formattedExtraTime} §afrom strays§7"),
),
)
rarityFormatMap.keys.forEach { rarity ->
- extractHoverableOfRarity(rarity, data)?.let { addAsSingletonList(it) }
+ extractHoverableOfRarity(rarity, data)?.let { add(it) }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt
index ef3b780b7..655b885e0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt
@@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.events.ItemAddEvent
import at.hannibal2.skyhanni.events.mining.FossilExcavationEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
-import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList
+import at.hannibal2.skyhanni.utils.CollectionUtils.addString
import at.hannibal2.skyhanni.utils.ItemUtils.itemName
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
@@ -73,12 +73,12 @@ object ExcavatorProfitTracker {
private val scrapItem get() = FossilExcavatorAPI.scrapItem
- private fun drawDisplay(data: Data): List<List<Any>> = buildList {
- addAsSingletonList("§e§lFossil Excavation Profit Tracker")
+ private fun drawDisplay(data: Data): List<Renderable> = buildList {
+ addString("§e§lFossil Excavation Profit Tracker")
var profit = tracker.drawItems(data, { true }, this)
val timesExcavated = data.timesExcavated
- addAsSingletonList(
+ add(
Renderable.hoverTips(
"§7Times excavated: §e${timesExcavated.addSeparators()}",
listOf("§7You excavated §e${timesExcavated.addSeparators()} §7times."),
@@ -93,12 +93,12 @@ object ExcavatorProfitTracker {
addGlacitePowder(data)
}
- addAsSingletonList(tracker.addTotalProfit(profit, data.timesExcavated, "excavation"))
+ add(tracker.addTotalProfit(profit, data.timesExcavated, "excavation"))
tracker.addPriceFromButton(this)
}
- private fun MutableList<List<Any>>.addFossilDust(
+ private fun MutableList<Renderable>.addFossilDust(
fossilDustGained: Long,
profit: Double,
): Double {
@@ -106,7 +106,7 @@ object ExcavatorProfitTracker {
// TODO use same price source as profit tracker
val pricePer = scrapItem.getPrice() / 500
val fossilDustPrice = pricePer * fossilDustGained
- addAsSingletonList(
+ add(
Renderable.hoverTips(
"§7${fossilDustGained.shortFormat()}x §fFossil Dust§7: §6${fossilDustPrice.shortFormat()}",
listOf(
@@ -121,10 +121,10 @@ object ExcavatorProfitTracker {
return profit + fossilDustPrice
}
- private fun MutableList<List<Any>>.addGlacitePowder(data: Data) {
+ private fun MutableList<Renderable>.addGlacitePowder(data: Data) {
val glacitePowderGained = data.glacitePowderGained
if (glacitePowderGained <= 0) return
- addAsSingletonList(
+ add(
Renderable.hoverTips(
"§bGlacite Powder§7: §e${glacitePowderGained.addSeparators()}",
listOf(
@@ -135,7 +135,7 @@ object ExcavatorProfitTracker {
)
}
- private fun MutableList<List<Any>>.addScrap(
+ private fun MutableList<Renderable>.addScrap(
timesExcavated: Long,
profit: Double,
): Double {
@@ -143,7 +143,7 @@ object ExcavatorProfitTracker {
// TODO use same price source as profit tracker
val scrapPrice = timesExcavated * scrapItem.getPrice()
val name = StringUtils.pluralize(timesExcavated.toInt(), scrapItem.itemName)
- addAsSingletonList(
+ add(
Renderable.hoverTips(
"$name §7price: §c-${scrapPrice.shortFormat()}",
listOf(
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt
index 6edcac0a0..a8c81edab 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt
@@ -16,8 +16,8 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.SecondPassedEvent
import at.hannibal2.skyhanni.events.mining.PowderGainEvent
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.LorenzUtils.isInIsland
@@ -27,6 +27,7 @@ import at.hannibal2.skyhanni.utils.RegexUtils.groupOrNull
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.TimeUtils
+import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker
import at.hannibal2.skyhanni.utils.tracker.TrackerData
@@ -283,10 +284,10 @@ object PowderTracker {
}
}
- private fun formatDisplay(map: List<List<Any>>) = buildList<List<Any>> {
+ private fun formatDisplay(map: List<Renderable>) = buildList<Renderable> {
if (map.isEmpty()) return@buildList
- addAsSingletonList("§b§lPowder Tracker")
+ addString("§b§lPowder Tracker")
for (index in config.textFormat.get()) {
// TODO, change functionality to use enum rather than ordinals
@@ -294,7 +295,7 @@ object PowderTracker {
}
}
- private fun drawDisplay(data: Data): List<List<Any>> = buildList {
+ private fun drawDisplay(data: Data): List<Renderable> = buildList {
calculate(data, gemstoneInfo, PowderChestReward.GEMSTONE_POWDER)
calculate(data, mithrilInfo, PowderChestReward.MITHRIL_POWDER)
calculate(data, diamondEssenceInfo, PowderChestReward.DIAMOND_ESSENCE)
@@ -303,20 +304,20 @@ object PowderTracker {
calculateHardStone(data)
val chestPerHour = format(chestInfo.perHour)
- addAsSingletonList("§d${data.totalChestPicked.addSeparators()} Total Chests Picked §7($chestPerHour/h)")
- addAsSingletonList("§bDouble Powder: ${if (doublePowder) "§aActive! §7($powderTimer)" else "§cInactive!"}")
+ addString("§d${data.totalChestPicked.addSeparators()} Total Chests Picked §7($chestPerHour/h)")
+ addString("§bDouble Powder: ${if (doublePowder) "§aActive! §7($powderTimer)" else "§cInactive!"}")
val entries = PowderChestReward.entries
val rewards = data.rewards
addPerHour(rewards, entries[0], mithrilInfo)
addPerHour(rewards, entries[1], gemstoneInfo)
- addAsSingletonList("")
+ addString("")
addPerHour(rewards, entries[46], diamondEssenceInfo)
addPerHour(rewards, entries[47], goldEssenceInfo)
- addAsSingletonList("")
+ addString("")
val hardStonePerHour = format(hardStoneInfo.perHour)
- addAsSingletonList("§b${data.totalHardStoneCompacted.addSeparators()} §fHard Stone §bCompacted §7($hardStonePerHour/h)")
- addAsSingletonList("")
+ addString("§b${data.totalHardStoneCompacted.addSeparators()} §fHard Stone §bCompacted §7($hardStonePerHour/h)")
+ addString("")
for ((gem, color) in gemstones) {
var totalGemstone = 0L
@@ -333,38 +334,38 @@ object PowderTracker {
}
val (flawless, fine, flawed, rough) = convert(totalGemstone)
- addAsSingletonList("§5${flawless}§7-§9${fine}§7-§a${flawed}§f-${rough} $color$gem Gemstone")
+ addString("§5${flawless}§7-§9${fine}§7-§a${flawed}§f-${rough} $color$gem Gemstone")
}
var totalParts = 0L
for (reward in entries.subList(26, 32)) { // robots part
val count = rewards.getOrDefault(reward, 0)
totalParts += count
- addAsSingletonList("§b${count.addSeparators()} ${reward.displayName}")
+ addString("§b${count.addSeparators()} ${reward.displayName}")
}
- addAsSingletonList("§b${totalParts.addSeparators()} §9Total Robot Parts")
+ addString("§b${totalParts.addSeparators()} §9Total Robot Parts")
val goblinEgg = rewards.getOrDefault(PowderChestReward.GOBLIN_EGG, 0)
val greenEgg = rewards.getOrDefault(PowderChestReward.GREEN_GOBLIN_EGG, 0)
val redEgg = rewards.getOrDefault(PowderChestReward.RED_GOBLIN_EGG, 0)
val yellowEgg = rewards.getOrDefault(PowderChestReward.YELLOW_GOBLIN_EGG, 0)
val blueEgg = rewards.getOrDefault(PowderChestReward.BLUE_GOBLIN_EGG, 0)
- addAsSingletonList("§3$blueEgg§7-§c$redEgg§7-§e$yellowEgg§f-§a$greenEgg§f-§9$goblinEgg §fGoblin Egg")
+ addString("§3$blueEgg§7-§c$redEgg§7-§e$yellowEgg§f-§a$greenEgg§f-§9$goblinEgg §fGoblin Egg")
for (reward in entries.subList(37, 46)) {
val count = rewards.getOrDefault(reward, 0).addSeparators()
- addAsSingletonList("§b$count ${reward.displayName}")
+ addString("§b$count ${reward.displayName}")
}
}
- private fun MutableList<List<Any>>.addPerHour(
+ private fun MutableList<Renderable>.addPerHour(
map: Map<PowderChestReward, Long>,
reward: PowderChestReward,
info: ResourceInfo,
) {
val mithrilCount = map.getOrDefault(reward, 0).addSeparators()
val mithrilPerHour = format(info.perHour)
- addAsSingletonList("§b$mithrilCount ${reward.displayName} §7($mithrilPerHour/h)")
+ addString("§b$mithrilCount ${reward.displayName} §7($mithrilPerHour/h)")
}
private fun format(e: Double): String = if (e < 0) "0" else e.toInt().addSeparators()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt
index 8377e5c76..c8fabc226 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt
@@ -8,8 +8,8 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.SecondPassedEvent
import at.hannibal2.skyhanni.features.rift.RiftAPI
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.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
@@ -18,6 +18,7 @@ import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RegexUtils.matches
+import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker
import at.hannibal2.skyhanni.utils.tracker.TrackerData
@@ -150,11 +151,11 @@ object VerminTracker {
tracker.modify(SkyHanniTracker.DisplayMode.TOTAL) { it.count[vermin] = count }
}
- private fun drawDisplay(data: Data): List<List<Any>> = buildList {
- addAsSingletonList("§7Vermin Tracker:")
+ private fun drawDisplay(data: Data): List<Renderable> = buildList {
+ addString("§7Vermin Tracker:")
for ((vermin, amount) in data.count.entries.sortedBy { it.key.order }) {
val verminName = vermin.vermin
- addAsSingletonList(" §7- §e${amount.addSeparators()} $verminName")
+ addString(" §7- §e${amount.addSeparators()} $verminName")
}
}
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 d2f50358d..ee4192b03 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt
@@ -16,7 +16,7 @@ import at.hannibal2.skyhanni.events.SlayerChangeEvent
import at.hannibal2.skyhanni.events.SlayerQuestCompleteEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
-import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList
+import at.hannibal2.skyhanni.utils.CollectionUtils.addString
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
@@ -171,15 +171,15 @@ object SlayerProfitTracker {
return internalName in allowedList
}
- private fun drawDisplay(data: Data) = buildList<List<Any>> {
+ private fun drawDisplay(data: Data) = buildList {
val tracker = getTracker() ?: return@buildList
- addAsSingletonList("§e§l$itemLogCategory Profit Tracker")
+ addString("§e§l$itemLogCategory Profit Tracker")
var profit = tracker.drawItems(data, { true }, this)
val slayerSpawnCost = data.slayerSpawnCost
if (slayerSpawnCost != 0L) {
val slayerSpawnCostFormat = slayerSpawnCost.shortFormat()
- addAsSingletonList(
+ add(
Renderable.hoverTips(
" §7Slayer Spawn Costs: §c$slayerSpawnCostFormat",
listOf("§7You paid §c$slayerSpawnCostFormat §7in total", "§7for starting the slayer quests."),
@@ -189,14 +189,14 @@ object SlayerProfitTracker {
}
val slayerCompletedCount = data.slayerCompletedCount
- addAsSingletonList(
+ add(
Renderable.hoverTips(
"§7Bosses killed: §e${slayerCompletedCount.addSeparators()}",
listOf("§7You killed the $itemLogCategory boss", "§e${slayerCompletedCount.addSeparators()} §7times."),
),
)
- addAsSingletonList(tracker.addTotalProfit(profit, data.slayerCompletedCount, "boss"))
+ add(tracker.addTotalProfit(profit, data.slayerCompletedCount, "boss"))
tracker.addPriceFromButton(this)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/GraphEditor.kt b/src/main/java/at/hannibal2/skyhanni/test/GraphEditor.kt
index 8757f19bf..4564b9b72 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/GraphEditor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/GraphEditor.kt
@@ -79,6 +79,7 @@ object GraphEditor {
activeNode?.name?.let {
textBox.textBox = it
}
+
textBox.makeActive()
} else {
textBox.clear()
@@ -88,6 +89,7 @@ object GraphEditor {
private var inTutorialMode = false
+
private val textBox = TextInput()
private val nodeColor = LorenzColor.BLUE.addOpacity(200)
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt
index 56bdcfabd..d91078d71 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt
@@ -176,6 +176,7 @@ object CollectionUtils {
add(Collections.singletonList(text))
}
+ // TODO move to RenderableUtils
fun MutableList<List<Renderable>>.addSingleString(text: String) {
add(Collections.singletonList(Renderable.string(text)))
}
@@ -296,6 +297,7 @@ object CollectionUtils {
addItemStack(internalName.getItemStack())
}
+ // TODO move to RenderableUtils
inline fun <reified T : Enum<T>> MutableList<Renderable>.addSelector(
prefix: String,
getName: (T) -> String,
@@ -305,6 +307,7 @@ object CollectionUtils {
add(Renderable.horizontalContainer(buildSelector<T>(prefix, getName, isCurrent, onChange)))
}
+ // TODO move to RenderableUtils
inline fun <reified T : Enum<T>> buildSelector(
prefix: String,
getName: (T) -> String,
@@ -329,6 +332,7 @@ object CollectionUtils {
}
}
+ // TODO move to RenderableUtils
inline fun MutableList<Renderable>.addButton(
prefix: String,
getName: String,
@@ -358,6 +362,7 @@ object CollectionUtils {
)
}
+ // TODO move to RenderableUtils
fun Collection<Collection<Renderable>>.tableStretchXPadding(xSpace: Int): Int {
if (this.isEmpty()) return xSpace
val off = RenderableUtils.calculateTableXOffsets(this as List<List<Renderable?>>, 0)
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 e7af81cea..8806f3bdb 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
@@ -5,14 +5,13 @@ import at.hannibal2.skyhanni.config.storage.ProfileSpecificStorage
import at.hannibal2.skyhanni.data.SlayerAPI
import at.hannibal2.skyhanni.data.TrackerManager
import at.hannibal2.skyhanni.utils.ChatUtils
-import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList
+import at.hannibal2.skyhanni.utils.CollectionUtils.addSelector
import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc
import at.hannibal2.skyhanni.utils.ItemPriceSource
import at.hannibal2.skyhanni.utils.ItemUtils.itemName
import at.hannibal2.skyhanni.utils.ItemUtils.readableInternalName
import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
@@ -24,7 +23,7 @@ class SkyHanniItemTracker<Data : ItemTrackerData>(
name: String,
createNewSession: () -> Data,
getStorage: (ProfileSpecificStorage) -> Data,
- drawDisplay: (Data) -> List<List<Any>>,
+ drawDisplay: (Data) -> List<Renderable>,
) : SkyHanniTracker<Data>(name, createNewSession, getStorage, drawDisplay) {
companion object {
@@ -61,7 +60,7 @@ class SkyHanniItemTracker<Data : ItemTrackerData>(
}
}
- fun addPriceFromButton(lists: MutableList<List<Any>>) {
+ fun addPriceFromButton(lists: MutableList<Renderable>) {
if (isInventoryOpen()) {
lists.addSelector<ItemPriceSource>(
"",
@@ -78,7 +77,7 @@ class SkyHanniItemTracker<Data : ItemTrackerData>(
fun drawItems(
data: Data,
filter: (NEUInternalName) -> Boolean,
- lists: MutableList<List<Any>>,
+ lists: MutableList<Renderable>,
): Double {
var profit = 0.0
val items = mutableMapOf<NEUInternalName, Long>()
@@ -86,8 +85,7 @@ class SkyHanniItemTracker<Data : ItemTrackerData>(
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
@@ -151,11 +149,11 @@ class SkyHanniItemTracker<Data : ItemTrackerData>(
},
) else Renderable.string(displayName)
- lists.addAsSingletonList(renderable)
+ lists.add(renderable)
}
if (hiddenItemTexts.size > 0) {
val text = Renderable.hoverTips(" §7${hiddenItemTexts.size} cheap items are hidden.", hiddenItemTexts)
- lists.addAsSingletonList(text)
+ lists.add(text)
}
return profit
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt
index 345767b05..9d77d4668 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt
@@ -7,11 +7,10 @@ import at.hannibal2.skyhanni.data.ProfileStorageData
import at.hannibal2.skyhanni.data.TrackerManager
import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue
import at.hannibal2.skyhanni.utils.ChatUtils
-import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList
-import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.CollectionUtils
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NEUItems.getPrice
-import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
+import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.renderables.Renderable
import net.minecraft.client.Minecraft
@@ -24,13 +23,13 @@ open class SkyHanniTracker<Data : TrackerData>(
private val createNewSession: () -> Data,
private val getStorage: (ProfileSpecificStorage) -> Data,
// TODO change to renderable
- private val drawDisplay: (Data) -> List<List<Any>>,
+ private val drawDisplay: (Data) -> List<Renderable>,
) {
private var inventoryOpen = false
private var displayMode: DisplayMode? = null
private val currentSessions = mutableMapOf<ProfileSpecificStorage, Data>()
- private var display = emptyList<List<Any>>()
+ private var display = emptyList<Renderable>()
private var sessionResetTime = SimpleTimeMark.farPast()
private var dirty = false
@@ -84,25 +83,27 @@ open class SkyHanniTracker<Data : TrackerData>(
if (dirty || TrackerManager.dirty) {
display = getSharedTracker()?.let {
- buildFinalDisplay(drawDisplay(it.get(getDisplayMode())))
+ val get = it.get(getDisplayMode())
+ val rawList = drawDisplay(get)
+ buildFinalDisplay(rawList)
} ?: emptyList()
dirty = false
}
- position.renderStringsAndItems(display, posLabel = name)
+ position.renderRenderables(display, posLabel = name)
}
fun update() {
dirty = true
}
- private fun buildFinalDisplay(rawList: List<List<Any>>) = rawList.toMutableList().also {
+ private fun buildFinalDisplay(rawList: List<Renderable>) = rawList.toMutableList().also {
if (it.isEmpty()) return@also
if (inventoryOpen) {
it.add(1, buildDisplayModeView())
}
if (inventoryOpen && getDisplayMode() == DisplayMode.SESSION) {
- it.addAsSingletonList(buildSessionResetButton())
+ it.add(buildSessionResetButton())
}
}
@@ -121,15 +122,17 @@ open class SkyHanniTracker<Data : TrackerData>(
},
)
- private fun buildDisplayModeView() = LorenzUtils.buildSelector<DisplayMode>(
- "§7Display Mode: ",
- getName = { type -> type.displayName },
- isCurrent = { it == getDisplayMode() },
- onChange = {
- displayMode = it
- storedTrackers[name] = it
- update()
- },
+ private fun buildDisplayModeView() = Renderable.horizontalContainer(
+ CollectionUtils.buildSelector<DisplayMode>(
+ "§7Display Mode: ",
+ getName = { type -> type.displayName },
+ isCurrent = { it == getDisplayMode() },
+ onChange = {
+ displayMode = it
+ storedTrackers[name] = it
+ update()
+ },
+ ),
)
protected fun getSharedTracker() = ProfileStorageData.profileSpecific?.let {