From 39797310d19ae83be9d4b9180ba38e8961177187 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Fri, 31 May 2024 02:44:55 +0200 Subject: Improvement: Fewer diana yellow chat moments (#1954) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/features/event/diana/DianaFixChat.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaFixChat.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaFixChat.kt index ebdb83bcf..e2e323933 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaFixChat.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaFixChat.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ClickType import at.hannibal2.skyhanni.events.BurrowGuessEvent import at.hannibal2.skyhanni.events.ItemClickEvent +import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.features.event.diana.DianaAPI.isDianaSpade import at.hannibal2.skyhanni.test.command.ErrorManager @@ -23,6 +24,7 @@ class DianaFixChat { private var lastParticleQualityPrompt = SimpleTimeMark.farPast() private var lastToggleMusicPrompt = SimpleTimeMark.farPast() private var errorCounter = 0 + private var successfulCounter = 0 private var lastSpadeUse = SimpleTimeMark.farPast() private var lastErrorTime = SimpleTimeMark.farPast() @@ -51,7 +53,9 @@ class DianaFixChat { private fun noGuessFound() { errorCounter++ if (errorCounter == 1) { - ChatUtils.chat("Could not find Diana Guess using sound and particles, please try again. (Was this a funny sound easter egg?)") + if (successfulCounter < 5) { + ChatUtils.chat("Could not find Diana Guess using sound and particles, please try again. (Was this a funny sound easter egg?)") + } return } @@ -86,7 +90,8 @@ class DianaFixChat { ErrorManager.logErrorStateWithData( "Could not find diana guess point", "diana guess point failed to load after /pq and /togglemusic", - "errorCounter" to errorCounter + "errorCounter" to errorCounter, + "successfulCounter" to successfulCounter, ) } } @@ -118,6 +123,12 @@ class DianaFixChat { hasSetParticleQuality = false hasSetToggleMusic = false errorCounter = 0 + successfulCounter++ + } + + @SubscribeEvent + fun onWorldChange(event: LorenzWorldChangeEvent) { + successfulCounter = 0 } private fun isEnabled() = DianaAPI.isDoingDiana() && config.burrowsSoopyGuess -- cgit