diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-09-09 15:26:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-09 15:26:16 +0200 |
commit | 18da4a7c13d215fb6cd7969654986d9072dd24fa (patch) | |
tree | 493b5f4aed0e6511cac67cfdd7815d4eb7852b31 /src/main/java/at/hannibal2/skyhanni/features/fishing | |
parent | e17e70b6933982ca417577f441928f77cbbf9ef1 (diff) | |
download | skyhanni-18da4a7c13d215fb6cd7969654986d9072dd24fa.tar.gz skyhanni-18da4a7c13d215fb6cd7969654986d9072dd24fa.tar.bz2 skyhanni-18da4a7c13d215fb6cd7969654986d9072dd24fa.zip |
Improvement: SH Tracker Search (#2477)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/fishing')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt | 14 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt | 16 |
2 files changed, 16 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt index 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) { |