summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorJordan <77755681+Jordyrat@users.noreply.github.com>2024-09-08 08:21:14 +0100
committerGitHub <noreply@github.com>2024-09-08 09:21:14 +0200
commit9352ace3e97c92645b176f88b6cef6e638121b95 (patch)
tree803cbb085fc1b9e4877a8e16c6db697d10e6d90b /src/main/java/at/hannibal2/skyhanni/features
parent5ac091a11d558717eb42106bcad35d23653dab5d (diff)
downloadskyhanni-9352ace3e97c92645b176f88b6cef6e638121b95.tar.gz
skyhanni-9352ace3e97c92645b176f88b6cef6e638121b95.tar.bz2
skyhanni-9352ace3e97c92645b176f88b6cef6e638121b95.zip
Improvement: Powder Tracker revamped (#2394)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt25
2 files changed, 22 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
index a58a7efc4..369fca62e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
@@ -731,7 +731,7 @@ private fun getQuiverShowWhen(): Boolean {
}
private fun getPowderDisplayPair() = buildList {
- val powderTypes = HotmAPI.Powder.values()
+ val powderTypes = HotmAPI.PowderType.values()
if (informationFilteringConfig.hideEmptyLines && powderTypes.all { it.getTotal() == 0L }) {
return listOf("<hidden>" to HorizontalAlignment.LEFT)
}
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 69e93489f..6edcac0a0 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,6 +1,8 @@
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
@@ -12,8 +14,10 @@ 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.addAsSingletonList
+import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut
import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange
import at.hannibal2.skyhanni.utils.ConfigUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
@@ -32,6 +36,7 @@ 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 {
@@ -192,13 +197,11 @@ 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
- var amount = groupOrNull("amount")?.formatLong() ?: 1
- if ((reward == PowderChestReward.MITHRIL_POWDER || reward == PowderChestReward.GEMSTONE_POWDER) && doublePowder) {
- amount *= 2
- }
+ val amount = groupOrNull("amount")?.formatLong() ?: 1
it.rewards[reward] = count + amount
}
}
@@ -206,6 +209,20 @@ 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 {