diff options
author | J10a1n15 <45315647+j10a1n15@users.noreply.github.com> | 2024-06-08 22:38:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-08 22:38:26 +0200 |
commit | 7e1dc04af29539cc6183a3a92d116272ff79b750 (patch) | |
tree | f20028980478879e3d31ec91bb1e488f226135cc /src/main/java/at | |
parent | d5667f8915e2a48b11f165a48a5c0b1acace92ff (diff) | |
download | skyhanni-7e1dc04af29539cc6183a3a92d116272ff79b750.tar.gz skyhanni-7e1dc04af29539cc6183a3a92d116272ff79b750.tar.bz2 skyhanni-7e1dc04af29539cc6183a3a92d116272ff79b750.zip |
Feature: Add Reminder to open Calendar for Temp Mayor (#2009)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java | 6 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt | 34 |
2 files changed, 37 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java index bd96bb425..536ac1e52 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java @@ -266,6 +266,12 @@ public class MiscConfig { @FeatureToggle public boolean replaceRomanNumerals = false; + @Expose + @ConfigOption(name = "Unknown Perkpocalypse Mayor Warning", desc = "Show a warning when the Unknown Perkpocalypse Mayor is unknown.") + @ConfigEditorBoolean + @FeatureToggle + public boolean unknownPerkpocalypseMayorWarning = true; + @ConfigOption(name = "Hide Far Entities", desc = "") @Accordion @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt index b61739c29..ebb23536d 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.SecondPassedEvent +import at.hannibal2.skyhanni.features.fame.ReminderUtils import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.APIUtil import at.hannibal2.skyhanni.utils.ChatUtils @@ -44,23 +45,40 @@ import kotlin.time.Duration.Companion.minutes object MayorAPI { private val group = RepoPattern.group("mayorapi") + + // TODO: Add Regex-test val foxyExtraEventPattern by group.pattern( "foxy.extraevent", "Schedules an extra §.(?<event>.*) §.event during the year\\." ) + + /** + * REGEX-TEST: The election room is now closed. Clerk Seraphine is doing a final count of the votes... + */ private val electionOverPattern by group.pattern( "election.over", "§eThe election room is now closed\\. Clerk Seraphine is doing a final count of the votes\\.\\.\\." ) + + /** + * REGEX-TEST: Calendar and Events + */ private val calendarGuiPattern by group.pattern( "calendar.gui", "Calendar and Events" ) + + /** + * REGEX-TEST: §dMayor Jerry + */ private val jerryHeadPattern by group.pattern( "jerry.head", "§dMayor Jerry" ) - // TODO add regex tests + + /** + * REGEX-TEST: §9Perkpocalypse Perks: + */ private val perkpocalypsePerksPattern by group.pattern( "perkpocalypse", "§9Perkpocalypse Perks:" @@ -68,9 +86,10 @@ object MayorAPI { var currentMayor: Mayor? = null private set + private var lastMayor: Mayor? = null var jerryExtraMayor: Pair<Mayor?, SimpleTimeMark> = null to SimpleTimeMark.farPast() private set - private var lastMayor: Mayor? = null + var lastJerryExtraMayorReminder = SimpleTimeMark.farPast() private var lastUpdate = SimpleTimeMark.farPast() private var dispatcher = Dispatchers.IO @@ -108,7 +127,16 @@ object MayorAPI { if (jerryExtraMayor.first != null && jerryExtraMayor.second.isInPast() && Mayor.JERRY.isActive()) { jerryExtraMayor = null to SimpleTimeMark.farPast() ChatUtils.clickableChat( - "The Perkpocalypse Mayor has expired! Click here to update to the new temporary Mayor.", + "The Perkpocalypse Mayor has expired! Click here to update the new temporary Mayor.", + onClick = { HypixelCommands.calendar() } + ) + } + if (Mayor.JERRY.isActive() && jerryExtraMayor.first == null && SkyHanniMod.feature.misc.unknownPerkpocalypseMayorWarning) { + if (lastJerryExtraMayorReminder.passedSince() < 5.minutes) return + if (ReminderUtils.isBusy()) return + lastJerryExtraMayorReminder = SimpleTimeMark.now() + ChatUtils.clickableChat( + "The Perkpocalypse Mayor is not known! Click here to update the temporary Mayor.", onClick = { HypixelCommands.calendar() } ) } |