aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/garden/DicerRngDropTrackerConfig.java7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt48
2 files changed, 44 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/DicerRngDropTrackerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/DicerRngDropTrackerConfig.java
index c8ce586c7..55dab6c74 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/DicerRngDropTrackerConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/DicerRngDropTrackerConfig.java
@@ -6,6 +6,7 @@ import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigLink;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
+import io.github.notenoughupdates.moulconfig.observer.Property;
public class DicerRngDropTrackerConfig {
@Expose
@@ -15,6 +16,12 @@ public class DicerRngDropTrackerConfig {
public boolean display = true;
@Expose
+ @ConfigOption(name = "Compact Format", desc = "Compact the Dicer RNG Drop Tracker Display.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public Property<Boolean> compact = Property.of(false);
+
+ @Expose
@ConfigOption(name = "Hide Chat", desc = "Hide the chat message when dropping a RNG Dicer drop.")
@ConfigEditorBoolean
@FeatureToggle
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 f0d86d8e5..63b3e9615 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
@@ -2,17 +2,19 @@ package at.hannibal2.skyhanni.features.garden.farming
import at.hannibal2.skyhanni.config.ConfigManager
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
+import at.hannibal2.skyhanni.events.ConfigLoadEvent
import at.hannibal2.skyhanni.events.GardenToolChangeEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.features.garden.CropType
import at.hannibal2.skyhanni.features.garden.GardenAPI
-import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut
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.repopatterns.RepoPattern
import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker
import at.hannibal2.skyhanni.utils.tracker.TrackerData
@@ -85,11 +87,11 @@ object DicerRngDropTracker {
itemDrops.add(ItemDrop(CropType.PUMPKIN, DropRarity.PRAY_TO_RNGESUS, pumpkinRngesusDropPattern))
}
- enum class DropRarity(val displayName: String) {
- UNCOMMON("§a§lUNCOMMON DROP"),
- RARE("§9§lRARE DROP"),
- CRAZY_RARE("§d§lCRAZY RARE DROP"),
- PRAY_TO_RNGESUS("§5§lPRAY TO RNGESUS DROP"),
+ enum class DropRarity(val colorCode: Char, val displayName: String) {
+ UNCOMMON('a', "UNCOMMON"),
+ RARE('9', "RARE"),
+ CRAZY_RARE('d', "CRAZY RARE"),
+ PRAY_TO_RNGESUS('5', "PRAY TO RNGESUS"),
}
@SubscribeEvent
@@ -109,13 +111,37 @@ object DicerRngDropTracker {
}
}
- private fun drawDisplay(data: Data) = buildList<List<Any>> {
+ @SubscribeEvent
+ fun onConfigLoad(event: ConfigLoadEvent) {
+ ConditionalUtils.onToggle(config.compact) {
+ tracker.update()
+ }
+ }
+
+ private fun drawDisplay(data: Data) = buildList {
val cropInHand = cropInHand ?: return@buildList
val items = data.drops.getOrPut(cropInHand) { mutableMapOf() }
- addAsSingletonList("§7Dicer RNG Drop Tracker for $toolName§7:")
- for ((rarity, amount) in items.sortedDesc()) {
- val displayName = rarity.displayName
- addAsSingletonList(" §7- §e${amount.addSeparators()}x $displayName")
+ val list = mutableListOf<Renderable>()
+ val topLine = mutableListOf<Renderable>()
+
+ topLine.add(Renderable.itemStack(cropInHand.icon))
+ topLine.add(Renderable.string("§7Dicer Tracker:"))
+ add(listOf(Renderable.horizontalContainer(topLine)))
+ if (config.compact.get()) {
+
+ val compactLine = items.sortedDesc().map { (rarity, amount) ->
+ "§${rarity.colorCode}${amount.addSeparators()}"
+ }.joinToString("§7/")
+ list.add(Renderable.string(compactLine))
+ add(listOf(Renderable.verticalContainer(list)))
+
+ } 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"))
+ }
+ add(listOf(Renderable.verticalContainer(list)))
}
}