diff options
| author | Jordan <77755681+Jordyrat@users.noreply.github.com> | 2024-09-08 08:21:14 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-08 09:21:14 +0200 |
| commit | 9352ace3e97c92645b176f88b6cef6e638121b95 (patch) | |
| tree | 803cbb085fc1b9e4877a8e16c6db697d10e6d90b /src/main/java/at/hannibal2/skyhanni/features/mining | |
| parent | 5ac091a11d558717eb42106bcad35d23653dab5d (diff) | |
| download | skyhanni-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/mining')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt | 25 |
1 files changed, 21 insertions, 4 deletions
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 { |
