diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-05-13 21:37:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-13 21:37:35 +0200 |
commit | ba7ce87f38a73a30704aa9b5fcf17467713a7540 (patch) | |
tree | cee72b734b97821b12bac42f19372c6aa50a5d29 /src/main/java/at/hannibal2/skyhanni | |
parent | f54fd3a5865546873228e6857c1336282e19c067 (diff) | |
download | skyhanni-ba7ce87f38a73a30704aa9b5fcf17467713a7540.tar.gz skyhanni-ba7ce87f38a73a30704aa9b5fcf17467713a7540.tar.bz2 skyhanni-ba7ce87f38a73a30704aa9b5fcf17467713a7540.zip |
Improvement: 3 egg warn (#1747)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java | 6 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt | 36 |
2 files changed, 41 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java index 31fed5074..564e9876a 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java @@ -44,6 +44,12 @@ public class HoppityEggsConfig { public boolean showClaimedEggs = false; @Expose + @ConfigOption(name = "Warn When Unclaimed", desc = "Warn when all three eggs are ready for finding.") + @ConfigEditorBoolean + @FeatureToggle + public boolean warnUnclaimedEggs = false; + + @Expose @ConfigOption(name = "Show during Contest", desc = "Show during a farming contest.") @ConfigEditorBoolean @FeatureToggle diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt index c382e227e..8f5d9ecca 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt @@ -14,9 +14,12 @@ import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings +import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.asTimeMark import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.fromNow +import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.now import at.hannibal2.skyhanni.utils.SkyBlockTime +import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeUtils.format @@ -57,6 +60,10 @@ object HoppityEggsManager { private var lastMeal: HoppityEggType? = null private var lastNote: String? = null + // has claimed all eggs at least once + private var warningActive = false + private var lastWarnTime = SimpleTimeMark.farPast() + @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { lastMeal = null @@ -145,7 +152,7 @@ object HoppityEggsManager { fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock) return if (!config.showClaimedEggs) return - if (ReminderUtils.isBusy(config.showDuringContest)) return + if (isBuzy()) return if (!ChocolateFactoryAPI.isHoppityEvent()) return val displayList = HoppityEggType.entries @@ -160,8 +167,35 @@ object HoppityEggsManager { @SubscribeEvent fun onSecondPassed(event: SecondPassedEvent) { HoppityEggType.checkClaimed() + checkWarn() } + private fun checkWarn() { + if (!warningActive) { + warningActive = HoppityEggType.entries.all { it.isClaimed() } + } + + if (warningActive) { + if (HoppityEggType.entries.all { !it.isClaimed() }) { + warn() + } + } + } + + private fun warn() { + if (!config.warnUnclaimedEggs) return + if (isBuzy()) return + if (lastWarnTime.passedSince() < 30.seconds) return + + lastWarnTime = now() + val amount = HoppityEggType.entries.size + ChatUtils.chat("All $amount Hoppity Eggs are ready for finding!") + LorenzUtils.sendTitle("§e$amount Hoppity Eggs!", 5.seconds) + SoundUtils.playPlingSound() + } + + private fun isBuzy() = ReminderUtils.isBusy(config.showDuringContest) + @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move( |