aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-25 03:26:09 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-25 03:26:09 +0100
commitf92544ee261b3470a35dbc52dca4079e6be4878b (patch)
treeba88354a3333fbb1f9b1b311bec84c54e80403f9 /src/main/java/at
parentea84c154f07a805e61bab93ca3883bb727ce2080 (diff)
downloadskyhanni-f92544ee261b3470a35dbc52dca4079e6be4878b.tar.gz
skyhanni-f92544ee261b3470a35dbc52dca4079e6be4878b.tar.bz2
skyhanni-f92544ee261b3470a35dbc52dca4079e6be4878b.zip
reformat
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt47
1 files changed, 26 insertions, 21 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 5f01183d6..27bcad12a 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
@@ -98,27 +98,7 @@ object FishingProfitTracker {
private fun drawDisplay(data: Data): List<List<Any>> = buildList {
addAsSingletonList("§e§lFishing Profit Tracker")
- val amounts = getCurrentCategories(data)
- val list = amounts.keys.toList()
- if (currentCategory !in list) {
- currentCategory = nameAll
- }
- addButton(
- prefix = "§7Category: ",
- getName = currentCategory + " §7(" + amounts[currentCategory] + ")",
- onChange = {
- val id = list.indexOf(currentCategory)
- currentCategory = list[(id + 1) % list.size]
- tracker.update()
- }
- )
-
- val filter: (NEUInternalName) -> Boolean = if (currentCategory == nameAll) {
- { true }
- } else {
- val items = itemCategories[currentCategory]!!
- { it in items }
- }
+ val filter: (NEUInternalName) -> Boolean = addCategories(data)
val profit = tracker.drawItems(data, filter, this)
@@ -142,6 +122,31 @@ object FishingProfitTracker {
tracker.addPriceFromButton(this)
}
+ private fun MutableList<List<Any>>.addCategories(data: Data): (NEUInternalName) -> Boolean {
+ val amounts = getCurrentCategories(data)
+ val list = amounts.keys.toList()
+ if (currentCategory !in list) {
+ currentCategory = nameAll
+ }
+ addButton(
+ prefix = "§7Category: ",
+ getName = currentCategory + " §7(" + amounts[currentCategory] + ")",
+ onChange = {
+ val id = list.indexOf(currentCategory)
+ currentCategory = list[(id + 1) % list.size]
+ tracker.update()
+ }
+ )
+
+ val filter: (NEUInternalName) -> Boolean = if (currentCategory == nameAll) {
+ { true }
+ } else {
+ val items = itemCategories[currentCategory]!!
+ { it in items }
+ }
+ return filter
+ }
+
@SubscribeEvent
fun onItemAdd(event: ItemAddEvent) {
if (!isEnabled()) return