diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
15 files changed, 156 insertions, 157 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 931f3b622..51deea2b8 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 @@ -13,7 +13,7 @@ import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent import at.hannibal2.skyhanni.events.SackChangeEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut -import at.hannibal2.skyhanni.utils.CollectionUtils.addString +import at.hannibal2.skyhanni.utils.CollectionUtils.addSearchString import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.InventoryUtils @@ -26,7 +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.renderables.Searchable import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker import at.hannibal2.skyhanni.utils.tracker.TrackerData import com.google.gson.annotations.Expose @@ -212,36 +212,35 @@ object EnderNodeTracker { else -> null } - private fun drawDisplay(data: Data) = buildList<Renderable> { + private fun drawDisplay(data: Data) = buildList<Searchable> { val lootProfit = getLootProfit(data) - 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") + addSearchString("§5§lEnder Node Tracker") + addSearchString("§d${data.totalNodesMined.addSeparators()} Ender Nodes mined") + addSearchString("§6${lootProfit.values.sum().shortFormat()} Coins made") + addSearchString(" ") + addSearchString("§b${data.totalEndermiteNests.addSeparators()} §cEndermite Nest", "Endermite Nest") for (item in EnderNode.entries.subList(0, 11)) { val count = (data.lootCount[item] ?: 0).addSeparators() val profit = (lootProfit[item] ?: 0.0).shortFormat() - addString("§b$count ${item.displayName} §7(§6$profit§7)") + addSearchString("§b$count ${item.displayName} §7(§6$profit§7)", item.displayName) } - addString(" ") + addSearchString(" ") val totalEnderArmor = calculateEnderArmor(data) - addString( - "§b${totalEnderArmor.addSeparators()} §5Ender Armor " + - "§7(§6${(totalEnderArmor * 10_000).shortFormat()}§7)" + addSearchString( + "§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() - addString("§b$count ${item.displayName} §7(§6$profit§7)") + addSearchString("§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() - addString("§f$c§7-§a$u§7-§9$r§7-§5$e§7-§6$l §fEnderman Pet §7(§6$profit§7)") + addSearchString("§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) = @@ -249,10 +248,10 @@ object EnderNodeTracker { .map { it.value } .sum() - private fun formatDisplay(map: List<Renderable>): List<Renderable> { + private fun formatDisplay(map: List<Searchable>): List<Searchable> { if (!ProfileStorageData.loaded) return emptyList() - val newList = mutableListOf<Renderable>() + val newList = mutableListOf<Searchable>() 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 f8ae6165b..ade5966ea 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.addString +import at.hannibal2.skyhanni.utils.CollectionUtils.addSearchString import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -19,6 +19,8 @@ import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher 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.renderables.Searchable +import at.hannibal2.skyhanni.utils.renderables.toSearchable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import at.hannibal2.skyhanni.utils.tracker.ItemTrackerData import at.hannibal2.skyhanni.utils.tracker.SkyHanniItemTracker @@ -77,8 +79,8 @@ object DianaProfitTracker { } } - private fun drawDisplay(data: Data): List<Renderable> = buildList { - addString("§e§lDiana Profit Tracker") + private fun drawDisplay(data: Data): List<Searchable> = buildList { + addSearchString("§e§lDiana Profit Tracker") val profit = tracker.drawItems(data, { true }, this) @@ -87,7 +89,7 @@ object DianaProfitTracker { Renderable.hoverTips( "§7Burrows dug: §e${treasureCoins.addSeparators()}", listOf("§7You dug out griffin burrows §e${treasureCoins.addSeparators()} §7times."), - ), + ).toSearchable(), ) add(tracker.addTotalProfit(profit, data.burrowsDug, "burrow")) 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 fc7442faf..ec882d6ec 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 @@ -6,14 +6,14 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut -import at.hannibal2.skyhanni.utils.CollectionUtils.addString +import at.hannibal2.skyhanni.utils.CollectionUtils.addSearchString 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.renderables.Searchable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker import at.hannibal2.skyhanni.utils.tracker.TrackerData @@ -30,32 +30,31 @@ object MythologicalCreatureTracker { private val patternGroup = RepoPattern.group("event.diana.mythological.tracker") private val minotaurPattern by patternGroup.pattern( "minotaur", - ".* §r§eYou dug out a §r§2Minotaur§r§e!" + ".* §r§eYou dug out a §r§2Minotaur§r§e!", ) private val gaiaConstructPattern by patternGroup.pattern( "gaiaconstruct", - ".* §r§eYou dug out a §r§2Gaia Construct§r§e!" + ".* §r§eYou dug out a §r§2Gaia Construct§r§e!", ) private val minosChampionPattern by patternGroup.pattern( "minoschampion", - ".* §r§eYou dug out a §r§2Minos Champion§r§e!" + ".* §r§eYou dug out a §r§2Minos Champion§r§e!", ) private val siameseLynxesPattern by patternGroup.pattern( "siameselynxes", - ".* §r§eYou dug out §r§2Siamese Lynxes§r§e!" + ".* §r§eYou dug out §r§2Siamese Lynxes§r§e!", ) private val minosHunterPattern by patternGroup.pattern( "minoshunter", - ".* §r§eYou dug out a §r§2Minos Hunter§r§e!" + ".* §r§eYou dug out a §r§2Minos Hunter§r§e!", ) private val minosInquisitorPattern by patternGroup.pattern( "minosinquisitor", - ".* §r§eYou dug out a §r§2Minos Inquisitor§r§e!" + ".* §r§eYou dug out a §r§2Minos Inquisitor§r§e!", ) private val tracker = - SkyHanniTracker("Mythological Creature Tracker", { Data() }, { it.diana.mythologicalMobTracker }) - { drawDisplay(it) } + SkyHanniTracker("Mythological Creature Tracker", { Data() }, { it.diana.mythologicalMobTracker }) { drawDisplay(it) } class Data : TrackerData() { @@ -90,8 +89,7 @@ object MythologicalCreatureTracker { // TODO migrate to abstract feature in the future if (creatureType == MythologicalCreatureType.MINOS_INQUISITOR) { - event.chatComponent = - ChatComponentText(event.message + " §e(${it.creaturesSinceLastInquisitor})") + event.chatComponent = ChatComponentText(event.message + " §e(${it.creaturesSinceLastInquisitor})") it.creaturesSinceLastInquisitor = 0 } else it.creaturesSinceLastInquisitor++ } @@ -100,8 +98,8 @@ object MythologicalCreatureTracker { } } - private fun drawDisplay(data: Data): List<Renderable> = buildList { - addString("§7Mythological Creature Tracker:") + private fun drawDisplay(data: Data): List<Searchable> = buildList { + addSearchString("§7Mythological Creature Tracker:") val total = data.count.sumAllValues() for ((creatureType, amount) in data.count.entries.sortedByDescending { it.value }) { val percentageSuffix = if (config.showPercentage.get()) { @@ -109,10 +107,13 @@ object MythologicalCreatureTracker { " §7$percentage" } else "" - addString(" §7- §e${amount.addSeparators()} ${creatureType.displayName}$percentageSuffix") + addSearchString( + " §7- §e${amount.addSeparators()} ${creatureType.displayName}$percentageSuffix", + searchText = creatureType.displayName, + ) } - addString(" §7- §e${total.addSeparators()} §7Total Mythological Creatures") - addString(" §7- §e${data.creaturesSinceLastInquisitor.addSeparators()} §7Creatures since last Minos Inquisitor") + addSearchString(" §7- §e${total.addSeparators()} §7Total Mythological Creatures") + addSearchString(" §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 4fc5b824b..80812c4c5 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 @@ -12,7 +12,7 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut -import at.hannibal2.skyhanni.utils.CollectionUtils.addString +import at.hannibal2.skyhanni.utils.CollectionUtils.addSearchString import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -20,7 +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.renderables.Searchable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker import at.hannibal2.skyhanni.utils.tracker.TrackerData @@ -105,8 +105,8 @@ object FrozenTreasureTracker { icePerHour = (icePerSecond.average() * 3600).toInt() } - private fun formatDisplay(map: List<Renderable>): List<Renderable> { - val newList = mutableListOf<Renderable>() + private fun formatDisplay(map: List<Searchable>): List<Searchable> { + val newList = mutableListOf<Searchable>() for (index in config.textFormat) { // TODO, change functionality to use enum rather than ordinals newList.add(map[index.ordinal]) @@ -137,20 +137,20 @@ object FrozenTreasureTracker { } } - private fun drawDisplay(data: Data) = buildList { + private fun drawDisplay(data: Data) = buildList<Searchable> { calculateIce(data) - 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("") + addSearchString("§e§lFrozen Treasure Tracker") + addSearchString("§6${formatNumber(data.treasuresMined)} Treasures Mined") + addSearchString("§3${formatNumber(estimatedIce)} Total Ice") + addSearchString("§3${formatNumber(icePerHour)} Ice/hr") + addSearchString("§8${formatNumber(data.compactProcs)} Compact Procs") + addSearchString("") for (treasure in FrozenTreasure.entries) { val count = (data.treasureCount[treasure] ?: 0) * if (config.showAsDrops) treasure.defaultAmount else 1 - addString("§b${formatNumber(count)} ${treasure.displayName}") + addSearchString("§b${formatNumber(count)} ${treasure.displayName}", treasure.displayName) } - addString("") + addSearchString("") } 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 619334a98..12f3accd1 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,8 +13,7 @@ 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.addButton -import at.hannibal2.skyhanni.utils.CollectionUtils.addString +import at.hannibal2.skyhanni.utils.CollectionUtils.addSearchString import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName @@ -26,6 +25,9 @@ import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils import at.hannibal2.skyhanni.utils.renderables.Renderable +import at.hannibal2.skyhanni.utils.renderables.RenderableUtils.addButton +import at.hannibal2.skyhanni.utils.renderables.Searchable +import at.hannibal2.skyhanni.utils.renderables.toSearchable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import at.hannibal2.skyhanni.utils.tracker.ItemTrackerData import at.hannibal2.skyhanni.utils.tracker.SkyHanniItemTracker @@ -119,8 +121,8 @@ object FishingProfitTracker { return map } - private fun drawDisplay(data: Data): List<Renderable> = buildList { - addString("§e§lFishing Profit Tracker") + private fun drawDisplay(data: Data): List<Searchable> = buildList { + addSearchString("§e§lFishing Profit Tracker") val filter: (NEUInternalName) -> Boolean = addCategories(data) val profit = tracker.drawItems(data, filter, this) @@ -130,7 +132,7 @@ object FishingProfitTracker { Renderable.hoverTips( "§7Times fished: §e${fishedCount.addSeparators()}", listOf("§7You've reeled in §e${fishedCount.addSeparators()} §7catches."), - ), + ).toSearchable(), ) add(tracker.addTotalProfit(profit, data.totalCatchAmount, "catch")) @@ -138,7 +140,7 @@ object FishingProfitTracker { tracker.addPriceFromButton(this) } - private fun MutableList<Renderable>.addCategories(data: Data): (NEUInternalName) -> Boolean { + private fun MutableList<Searchable>.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 fd41883ef..b293c2736 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,15 +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.addButton import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut -import at.hannibal2.skyhanni.utils.CollectionUtils.addString +import at.hannibal2.skyhanni.utils.CollectionUtils.addSearchString 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.StringUtils.allLettersFirstUppercase -import at.hannibal2.skyhanni.utils.renderables.Renderable +import at.hannibal2.skyhanni.utils.renderables.RenderableUtils.addButton +import at.hannibal2.skyhanni.utils.renderables.Searchable import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker import at.hannibal2.skyhanni.utils.tracker.TrackerData import com.google.gson.annotations.Expose @@ -71,8 +71,8 @@ object SeaCreatureTracker { return map } - private fun drawDisplay(data: Data): List<Renderable> = buildList { - addString("§7Sea Creature Tracker:") + private fun drawDisplay(data: Data): List<Searchable> = buildList { + addSearchString("§7Sea Creature Tracker:") val filter: (String) -> Boolean = addCategories(data) val realAmount = data.amount.filter { filter(it.key) } @@ -94,12 +94,12 @@ object SeaCreatureTracker { " §7$percentage" } else "" - addString(" §7- §e${amount.addSeparators()} $displayName$percentageSuffix") + addSearchString(" §7- §e${amount.addSeparators()} $displayName$percentageSuffix", displayName) } - addString(" §7- §e${total.addSeparators()} §7Total Sea Creatures") + addSearchString(" §7- §e${total.addSeparators()} §7Total Sea Creatures") } - private fun MutableList<Renderable>.addCategories(data: Data): (String) -> Boolean { + private fun MutableList<Searchable>.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 1e9397d5f..90c68a046 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 @@ -14,13 +14,13 @@ 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.addOrPut -import at.hannibal2.skyhanni.utils.CollectionUtils.addString +import at.hannibal2.skyhanni.utils.CollectionUtils.addSearchString 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.renderables.Searchable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker import at.hannibal2.skyhanni.utils.tracker.TrackerData @@ -84,11 +84,11 @@ object ArmorDropTracker { } } - private fun drawDisplay(data: Data): List<Renderable> = buildList { - addString("§7Armor Drop Tracker:") + private fun drawDisplay(data: Data): List<Searchable> = buildList { + addSearchString("§7Armor Drop Tracker:") for ((drop, amount) in data.drops.sortedDesc()) { val dropName = drop.dropName - addString(" §7- §e${amount.addSeparators()}x $dropName") + addSearchString(" §7- §e${amount.addSeparators()}x $dropName", 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 34d3fe53d..8cc8c55cb 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 @@ -10,12 +10,15 @@ 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.addOrPut +import at.hannibal2.skyhanni.utils.CollectionUtils.addSearchString import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.renderables.Renderable +import at.hannibal2.skyhanni.utils.renderables.Searchable +import at.hannibal2.skyhanni.utils.renderables.toSearchable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker import at.hannibal2.skyhanni.utils.tracker.TrackerData @@ -120,30 +123,28 @@ object DicerRngDropTracker { } } - private fun drawDisplay(data: Data) = buildList<Renderable> { + private fun drawDisplay(data: Data) = buildList<Searchable> { val cropInHand = cropInHand ?: return@buildList val topLine = mutableListOf<Renderable>() topLine.add(Renderable.itemStack(cropInHand.icon)) topLine.add(Renderable.string("§7Dicer Tracker:")) - add(Renderable.horizontalContainer(topLine)) + add(Renderable.horizontalContainer(topLine).toSearchable()) val items = data.drops[cropInHand] ?: return@buildList - val list = mutableListOf<Renderable>() if (config.compact.get()) { val compactLine = items.sortedDesc().map { (rarity, amount) -> "§${rarity.colorCode}${amount.addSeparators()}" }.joinToString("§7/") - list.add(Renderable.string(compactLine)) + addSearchString(compactLine) } else { for ((rarity, amount) in items.sortedDesc()) { val colorCode = rarity.colorCode val displayName = rarity.displayName - list.add(Renderable.string(" §7- §e${amount.addSeparators()}x §$colorCode$displayName")) + addSearchString(" §7- §e${amount.addSeparators()}x §$colorCode$displayName", displayName) } } - 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 7dcd07861..19506109e 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.addString +import at.hannibal2.skyhanni.utils.CollectionUtils.addSearchString import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -19,6 +19,8 @@ import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.renderables.Renderable +import at.hannibal2.skyhanni.utils.renderables.Searchable +import at.hannibal2.skyhanni.utils.renderables.toSearchable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import at.hannibal2.skyhanni.utils.tracker.ItemTrackerData import at.hannibal2.skyhanni.utils.tracker.SkyHanniItemTracker @@ -117,8 +119,8 @@ object PestProfitTracker { lastPestKillTime = SimpleTimeMark.now() } - private fun drawDisplay(data: Data): List<Renderable> = buildList { - addString("§e§lPest Profit Tracker") + private fun drawDisplay(data: Data): List<Searchable> = buildList { + addSearchString("§e§lPest Profit Tracker") val profit = tracker.drawItems(data, { true }, this) val pestsKilled = data.totalPestsKills @@ -126,7 +128,7 @@ object PestProfitTracker { Renderable.hoverTips( "§7Pests killed: §e${pestsKilled.addSeparators()}", listOf("§7You killed pests §e${pestsKilled.addSeparators()} §7times."), - ), + ).toSearchable(), ) add(tracker.addTotalProfit(profit, data.totalPestsKills, "kill")) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt index 697947e3f..eb15f6165 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt @@ -27,6 +27,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.RenderUtils.highlight import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables import at.hannibal2.skyhanni.utils.renderables.Renderable +import at.hannibal2.skyhanni.utils.renderables.buildSearchableTable import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule @@ -82,7 +83,7 @@ object SackDisplay { val sortedPairs = sort(sackItems) val amountShowing = if (config.itemToShow > sortedPairs.size) sortedPairs.size else config.itemToShow list.addString("§7Items in Sacks: §o(Rendering $amountShowing of ${sortedPairs.size} items)") - val table = mutableListOf<List<Renderable>>() + val table = mutableMapOf<List<Renderable>, String?>() for ((itemName, item) in sortedPairs) { val (internalName, colorCode, total, magmaFish) = item val stored = item.stored @@ -92,7 +93,7 @@ object SackDisplay { totalPrice += price if (rendered >= config.itemToShow) continue if (stored == 0 && !config.showEmpty) continue - table.add(buildList { + table[buildList { addString(" §7- ") addItemStack(internalName) // TODO move replace into itemName @@ -156,10 +157,10 @@ object SackDisplay { addItemStack("MAGMA_FISH".asInternalName()) } if (config.showPrice && price != 0L) addAlignedNumber("§6${format(price)}") - }) + }] = itemName rendered++ } - list.add(Renderable.table(table)) + list.add(table.buildSearchableTable()) if (SackAPI.isTrophySack) list.addString("§cTotal Magmafish: §6${totalMagmaFish.addSeparators()}") return totalPrice @@ -230,10 +231,10 @@ object SackDisplay { private fun drawRunesDisplay(list: MutableList<Renderable>) { if (SackAPI.runeItem.isEmpty()) return list.addString("§7Runes:") - val table = mutableListOf<List<Renderable>>() + val table = mutableMapOf<List<Renderable>, String?>() for ((name, rune) in sort(SackAPI.runeItem.toList())) { val (stack, lv1, lv2, lv3) = rune - table.add(buildList { + table[buildList { addString(" §7- ") stack?.let { addItemStack(it) } add( @@ -246,19 +247,19 @@ object SackDisplay { addAlignedNumber("§e$lv1") addAlignedNumber("§e$lv2") addAlignedNumber("§e$lv3") - }) + }] = name } - list.add(Renderable.table(table)) + list.add(table.buildSearchableTable()) } private fun drawGemstoneDisplay(list: MutableList<Renderable>): Long { if (SackAPI.gemstoneItem.isEmpty()) return 0L list.addString("§7Gemstones:") var totalPrice = 0L - val table = mutableListOf<List<Renderable>>() + val table = mutableMapOf<List<Renderable>, String?>() for ((name, gem) in sort(SackAPI.gemstoneItem.toList())) { val (internalName, rough, flawed, fine, roughprice, flawedprice, fineprice) = gem - table.add(buildList { + table[buildList { addString(" §7- ") addItemStack(internalName) add(Renderable.optionalLink( @@ -274,9 +275,10 @@ object SackDisplay { val price = roughprice + flawedprice + fineprice totalPrice += price if (config.showPrice && price != 0L) addAlignedNumber("§7(§6${format(price)}§7)") - }) + }] = name } - list.add(Renderable.table(table)) + + list.add(table.buildSearchableTable()) return totalPrice } 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 abab20400..5c964c639 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 @@ -7,9 +7,7 @@ import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.features.event.hoppity.HoppityAPI 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 @@ -24,6 +22,8 @@ import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeResets import at.hannibal2.skyhanni.utils.TimeUtils.format import at.hannibal2.skyhanni.utils.renderables.Renderable +import at.hannibal2.skyhanni.utils.renderables.Searchable +import at.hannibal2.skyhanni.utils.renderables.toSearchable import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker import at.hannibal2.skyhanni.utils.tracker.TrackerData import com.google.gson.annotations.Expose @@ -149,7 +149,7 @@ object ChocolateFactoryStrayTracker { tracker.modify { it.goldenTypesCaught.addOrPut(typeCaught, amount) } } - private fun drawDisplay(data: Data): List<Renderable> = buildList { + private fun drawDisplay(data: Data): List<Searchable> = buildList { val extraChocMs = data.straysExtraChocMs.values.sum().milliseconds val formattedExtraTime = extraChocMs.let { if (it == 0.milliseconds) "0s" else it.format() } @@ -157,14 +157,14 @@ object ChocolateFactoryStrayTracker { Renderable.hoverTips( "§6§lStray Tracker", tips = listOf("§a+§b${formattedExtraTime} §afrom strays§7"), - ), + ).toSearchable(), ) rarityFormatMap.keys.forEach { rarity -> extractHoverableOfRarity(rarity, data)?.let { add(it) } } } - private fun extractHoverableOfRarity(rarity: String, data: Data): Renderable? { + private fun extractHoverableOfRarity(rarity: String, data: Data): Searchable? { val caughtOfRarity = data.straysCaught[rarity] val caughtString = caughtOfRarity?.toString() ?: return null @@ -175,11 +175,12 @@ object ChocolateFactoryStrayTracker { val lineHeader = "$colorCode${rarity.substring(0, 1).uppercase()}${rarity.substring(1)}§7: §r$colorCode" val lineFormat = "${lineHeader}${caughtString}" - return rarityExtraChocMs?.let { + val renderable = rarityExtraChocMs?.let { val tip = "§a+§b$extraChocFormat §afrom $colorCode$rarity strays§7${if (rarity == "legendary") extractGoldenTypesCaught(data) else ""}" Renderable.hoverTips(Renderable.string(lineFormat), tips = tip.split("\n")) } ?: Renderable.string(lineFormat) + return renderable.toSearchable(rarity) } private fun extractGoldenTypesCaught(data: Data): String { 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 655b885e0..ef3f922fb 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.addString +import at.hannibal2.skyhanni.utils.CollectionUtils.addSearchString import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland @@ -19,6 +19,8 @@ import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.StringUtils import at.hannibal2.skyhanni.utils.renderables.Renderable +import at.hannibal2.skyhanni.utils.renderables.Searchable +import at.hannibal2.skyhanni.utils.renderables.toSearchable import at.hannibal2.skyhanni.utils.tracker.ItemTrackerData import at.hannibal2.skyhanni.utils.tracker.SkyHanniItemTracker import com.google.gson.annotations.Expose @@ -73,8 +75,8 @@ object ExcavatorProfitTracker { private val scrapItem get() = FossilExcavatorAPI.scrapItem - private fun drawDisplay(data: Data): List<Renderable> = buildList { - addString("§e§lFossil Excavation Profit Tracker") + private fun drawDisplay(data: Data): List<Searchable> = buildList { + addSearchString("§e§lFossil Excavation Profit Tracker") var profit = tracker.drawItems(data, { true }, this) val timesExcavated = data.timesExcavated @@ -82,7 +84,7 @@ object ExcavatorProfitTracker { Renderable.hoverTips( "§7Times excavated: §e${timesExcavated.addSeparators()}", listOf("§7You excavated §e${timesExcavated.addSeparators()} §7times."), - ), + ).toSearchable(), ) profit = addScrap(timesExcavated, profit) @@ -98,7 +100,7 @@ object ExcavatorProfitTracker { tracker.addPriceFromButton(this) } - private fun MutableList<Renderable>.addFossilDust( + private fun MutableList<Searchable>.addFossilDust( fossilDustGained: Long, profit: Double, ): Double { @@ -116,12 +118,12 @@ object ExcavatorProfitTracker { "", "§7Price Per Fossil Dust: §6${pricePer.shortFormat()}", ), - ), + ).toSearchable("Fossil Dust"), ) return profit + fossilDustPrice } - private fun MutableList<Renderable>.addGlacitePowder(data: Data) { + private fun MutableList<Searchable>.addGlacitePowder(data: Data) { val glacitePowderGained = data.glacitePowderGained if (glacitePowderGained <= 0) return add( @@ -131,11 +133,11 @@ object ExcavatorProfitTracker { "§7No real profit,", "§7but still nice to see! Right?", ), - ), + ).toSearchable("Glacite Powder"), ) } - private fun MutableList<Renderable>.addScrap( + private fun MutableList<Searchable>.addScrap( timesExcavated: Long, profit: Double, ): Double { @@ -151,7 +153,7 @@ object ExcavatorProfitTracker { "§7for all §e$timesExcavated $name", "§7you have used.", ), - ), + ).toSearchable("Scrap"), ) return profit - scrapPrice } 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 a8c81edab..a90b980d9 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 @@ -1,8 +1,6 @@ package at.hannibal2.skyhanni.features.mining.powdertracker import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.api.HotmAPI -import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry import at.hannibal2.skyhanni.data.BossbarData @@ -14,10 +12,8 @@ import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent 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.addOrPut -import at.hannibal2.skyhanni.utils.CollectionUtils.addString +import at.hannibal2.skyhanni.utils.CollectionUtils.addSearchString import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland @@ -27,7 +23,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.renderables.Searchable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker import at.hannibal2.skyhanni.utils.tracker.TrackerData @@ -37,7 +33,6 @@ import com.google.gson.annotations.Expose import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration import kotlin.time.Duration.Companion.minutes -import kotlin.time.Duration.Companion.seconds @SkyHanniModule object PowderTracker { @@ -198,11 +193,13 @@ object PowderTracker { } for (reward in PowderChestReward.entries) { - if (reward == PowderChestReward.MITHRIL_POWDER || reward == PowderChestReward.GEMSTONE_POWDER) return reward.chatPattern.matchMatcher(msg) { tracker.modify { val count = it.rewards[reward] ?: 0 - val amount = groupOrNull("amount")?.formatLong() ?: 1 + var amount = groupOrNull("amount")?.formatLong() ?: 1 + if ((reward == PowderChestReward.MITHRIL_POWDER || reward == PowderChestReward.GEMSTONE_POWDER) && doublePowder) { + amount *= 2 + } it.rewards[reward] = count + amount } } @@ -210,20 +207,6 @@ object PowderTracker { tracker.update() } - @HandleEvent(onlyOnIsland = IslandType.CRYSTAL_HOLLOWS) - fun onPowderGain(event: PowderGainEvent) { - if (lastChestPicked.passedSince() > 5.seconds) return - tracker.modify { - val reward = when (event.powder) { - HotmAPI.PowderType.GEMSTONE -> PowderChestReward.GEMSTONE_POWDER - HotmAPI.PowderType.MITHRIL -> PowderChestReward.MITHRIL_POWDER - else -> return@modify - } - it.rewards.addOrPut(reward, event.amount) - } - tracker.update() - } - @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { config.textFormat.afterChange { @@ -284,10 +267,10 @@ object PowderTracker { } } - private fun formatDisplay(map: List<Renderable>) = buildList<Renderable> { + private fun formatDisplay(map: List<Searchable>) = buildList<Searchable> { if (map.isEmpty()) return@buildList - addString("§b§lPowder Tracker") + addSearchString("§b§lPowder Tracker") for (index in config.textFormat.get()) { // TODO, change functionality to use enum rather than ordinals @@ -295,7 +278,7 @@ object PowderTracker { } } - private fun drawDisplay(data: Data): List<Renderable> = buildList { + private fun drawDisplay(data: Data): List<Searchable> = buildList { calculate(data, gemstoneInfo, PowderChestReward.GEMSTONE_POWDER) calculate(data, mithrilInfo, PowderChestReward.MITHRIL_POWDER) calculate(data, diamondEssenceInfo, PowderChestReward.DIAMOND_ESSENCE) @@ -304,20 +287,20 @@ object PowderTracker { calculateHardStone(data) val chestPerHour = format(chestInfo.perHour) - addString("§d${data.totalChestPicked.addSeparators()} Total Chests Picked §7($chestPerHour/h)") - addString("§bDouble Powder: ${if (doublePowder) "§aActive! §7($powderTimer)" else "§cInactive!"}") + addSearchString("§d${data.totalChestPicked.addSeparators()} Total Chests Picked §7($chestPerHour/h)") + addSearchString("§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) - addString("") + addSearchString("") addPerHour(rewards, entries[46], diamondEssenceInfo) addPerHour(rewards, entries[47], goldEssenceInfo) - addString("") + addSearchString("") val hardStonePerHour = format(hardStoneInfo.perHour) - addString("§b${data.totalHardStoneCompacted.addSeparators()} §fHard Stone §bCompacted §7($hardStonePerHour/h)") - addString("") + addSearchString("§b${data.totalHardStoneCompacted.addSeparators()} §fHard Stone §bCompacted §7($hardStonePerHour/h)", "Hard Stone") + addSearchString("") for ((gem, color) in gemstones) { var totalGemstone = 0L @@ -334,38 +317,40 @@ object PowderTracker { } val (flawless, fine, flawed, rough) = convert(totalGemstone) - addString("§5${flawless}§7-§9${fine}§7-§a${flawed}§f-${rough} $color$gem Gemstone") + addSearchString("§5${flawless}§7-§9${fine}§7-§a${flawed}§f-${rough} $color$gem Gemstone", "Gemstone") } var totalParts = 0L for (reward in entries.subList(26, 32)) { // robots part val count = rewards.getOrDefault(reward, 0) totalParts += count - addString("§b${count.addSeparators()} ${reward.displayName}") + val name = reward.displayName + addSearchString("§b${count.addSeparators()} $name", name) } - addString("§b${totalParts.addSeparators()} §9Total Robot Parts") + addSearchString("§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) - addString("§3$blueEgg§7-§c$redEgg§7-§e$yellowEgg§f-§a$greenEgg§f-§9$goblinEgg §fGoblin Egg") + addSearchString("§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() - addString("§b$count ${reward.displayName}") + val name = reward.displayName + addSearchString("§b$count $name", name) } } - private fun MutableList<Renderable>.addPerHour( + private fun MutableList<Searchable>.addPerHour( map: Map<PowderChestReward, Long>, reward: PowderChestReward, info: ResourceInfo, ) { val mithrilCount = map.getOrDefault(reward, 0).addSeparators() val mithrilPerHour = format(info.perHour) - addString("§b$mithrilCount ${reward.displayName} §7($mithrilPerHour/h)") + addSearchString("§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 c8fabc226..e47fe8002 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 @@ -9,7 +9,7 @@ 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.addOrPut -import at.hannibal2.skyhanni.utils.CollectionUtils.addString +import at.hannibal2.skyhanni.utils.CollectionUtils.addSearchString import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -18,7 +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.renderables.Searchable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker import at.hannibal2.skyhanni.utils.tracker.TrackerData @@ -151,11 +151,11 @@ object VerminTracker { tracker.modify(SkyHanniTracker.DisplayMode.TOTAL) { it.count[vermin] = count } } - private fun drawDisplay(data: Data): List<Renderable> = buildList { - addString("§7Vermin Tracker:") + private fun drawDisplay(data: Data): List<Searchable> = buildList { + addSearchString("§7Vermin Tracker:") for ((vermin, amount) in data.count.entries.sortedBy { it.key.order }) { val verminName = vermin.vermin - addString(" §7- §e${amount.addSeparators()} $verminName") + addSearchString(" §7- §e${amount.addSeparators()} $verminName", 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 ee4192b03..acd37e9d5 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.addString +import at.hannibal2.skyhanni.utils.CollectionUtils.addSearchString import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -25,6 +25,8 @@ import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.renderables.Renderable +import at.hannibal2.skyhanni.utils.renderables.Searchable +import at.hannibal2.skyhanni.utils.renderables.toSearchable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import at.hannibal2.skyhanni.utils.tracker.ItemTrackerData import at.hannibal2.skyhanni.utils.tracker.SkyHanniItemTracker @@ -171,9 +173,9 @@ object SlayerProfitTracker { return internalName in allowedList } - private fun drawDisplay(data: Data) = buildList { + private fun drawDisplay(data: Data) = buildList<Searchable> { val tracker = getTracker() ?: return@buildList - addString("§e§l$itemLogCategory Profit Tracker") + addSearchString("§e§l$itemLogCategory Profit Tracker") var profit = tracker.drawItems(data, { true }, this) val slayerSpawnCost = data.slayerSpawnCost @@ -183,7 +185,7 @@ object SlayerProfitTracker { Renderable.hoverTips( " §7Slayer Spawn Costs: §c$slayerSpawnCostFormat", listOf("§7You paid §c$slayerSpawnCostFormat §7in total", "§7for starting the slayer quests."), - ), + ).toSearchable(), ) profit += slayerSpawnCost } @@ -193,7 +195,7 @@ object SlayerProfitTracker { Renderable.hoverTips( "§7Bosses killed: §e${slayerCompletedCount.addSeparators()}", listOf("§7You killed the $itemLogCategory boss", "§e${slayerCompletedCount.addSeparators()} §7times."), - ), + ).toSearchable(), ) add(tracker.addTotalProfit(profit, data.slayerCompletedCount, "boss")) |