aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/misc/TrackerConfig.java24
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt37
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt3
5 files changed, 82 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index a5e0487c5..3cd9830d8 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -41,6 +41,7 @@ import at.hannibal2.skyhanni.data.SlayerAPI
import at.hannibal2.skyhanni.data.TitleData
import at.hannibal2.skyhanni.data.TitleManager
import at.hannibal2.skyhanni.data.ToolTipData
+import at.hannibal2.skyhanni.data.TrackerManager
import at.hannibal2.skyhanni.data.jsonobjects.local.FriendsJson
import at.hannibal2.skyhanni.data.jsonobjects.local.JacobContestsJson
import at.hannibal2.skyhanni.data.jsonobjects.local.KnownFeaturesJson
@@ -415,6 +416,7 @@ class SkyHanniMod {
loadModule(AdvancedPlayerList)
loadModule(ItemAddManager())
loadModule(BingoCardReader())
+ loadModule(TrackerManager)
// APIs
loadModule(BazaarApi())
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/TrackerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/TrackerConfig.java
index 307395a7a..643ce637b 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/TrackerConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/TrackerConfig.java
@@ -96,4 +96,28 @@ public class TrackerConfig {
@ConfigEditorSlider(minValue = 1, maxValue = 50_000_000, minStep = 1)
public int minimumTitle = 5_000_000;
}
+
+ @Expose
+ @ConfigOption(name = "Hide Cheap Items", desc = "Hide cheap items.")
+ @Accordion
+ public HideCheapItemsConfig hideCheapItems = new HideCheapItemsConfig();
+
+ public static class HideCheapItemsConfig {
+
+ @Expose
+ @ConfigOption(name = "Enabled", desc = "Limit how many items should be shown.")
+ @ConfigEditorBoolean
+ public Property<Boolean> enabled = Property.of(true);
+
+ @Expose
+ @ConfigOption(name = "Show Expensive #", desc = "Always show the # most expensive items.")
+ @ConfigEditorSlider(minValue = 1, maxValue = 40, minStep = 1)
+ public Property<Integer> alwaysShowBest = Property.of(8);
+
+ @Expose
+ @ConfigOption(name = "Still Show Above", desc = "Always show items above this §6price in 1k §7even when not in the top # of items.")
+ @ConfigEditorSlider(minValue = 5, maxValue = 500, minStep = 5)
+ public Property<Integer> minPrice = Property.of(100);
+
+ }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt b/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt
new file mode 100644
index 000000000..de9caa02e
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt
@@ -0,0 +1,37 @@
+package at.hannibal2.skyhanni.data
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.ConfigLoadEvent
+import at.hannibal2.skyhanni.events.GuiRenderEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraftforge.fml.common.eventhandler.EventPriority
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+object TrackerManager {
+
+ private var hasChanged = false
+ var dirty = false
+
+ @SubscribeEvent
+ fun onConfigLoad(event: ConfigLoadEvent) {
+ val config = SkyHanniMod.feature.misc.tracker.hideCheapItems
+ LorenzUtils.onToggle(config.alwaysShowBest, config.minPrice, config.enabled) {
+ hasChanged = true
+ }
+ }
+
+ @SubscribeEvent(priority = EventPriority.HIGHEST)
+ fun onRenderOverlayFirst(event: GuiRenderEvent) {
+ if (hasChanged) {
+ dirty = true
+ }
+ }
+
+ @SubscribeEvent(priority = EventPriority.LOWEST)
+ fun onRenderOverlayLast(event: GuiRenderEvent) {
+ if (hasChanged) {
+ dirty = false
+ hasChanged = false
+ }
+ }
+}
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 60d094dbe..9183dad62 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
@@ -125,9 +125,25 @@ class SkyHanniItemTracker<Data : ItemTrackerData>(
}
}
- for (text in items.sortedDesc().keys) {
+ val limitList = config.hideCheapItems
+ var pos = 0
+ var hiddenItems = 0
+ for ((text, pricePer) in items.sortedDesc()) {
+ pos++
+ if (limitList.enabled.get()) {
+ if (pos > limitList.alwaysShowBest.get()) {
+ if (pricePer < limitList.minPrice.get() * 1000) {
+ hiddenItems++
+ continue
+ }
+ }
+ }
lists.addAsSingletonList(text)
}
+ if (hiddenItems > 0) {
+ lists.addAsSingletonList(" §7$hiddenItems cheap items are hidden.")
+ }
+
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 ad3418ace..234902c10 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt
@@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.config.Storage
import at.hannibal2.skyhanni.config.core.config.Position
import at.hannibal2.skyhanni.config.features.misc.TrackerConfig.PriceFromEntry
import at.hannibal2.skyhanni.data.ProfileStorageData
+import at.hannibal2.skyhanni.data.TrackerManager
import at.hannibal2.skyhanni.features.bazaar.BazaarApi.Companion.getBazaarData
import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue
import at.hannibal2.skyhanni.utils.ConfigUtils
@@ -87,7 +88,7 @@ open class SkyHanniTracker<Data : TrackerData>(
update()
}
- if (dirty) {
+ if (dirty || TrackerManager.dirty) {
display = getSharedTracker()?.let {
buildFinalDisplay(drawDisplay(it.get(getDisplayMode())))
} ?: emptyList()