diff options
Diffstat (limited to 'src/main/java')
3 files changed, 102 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index e91fbb1ae..0ef311323 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -102,6 +102,7 @@ import at.hannibal2.skyhanni.features.event.diana.InquisitorWaypointShare import at.hannibal2.skyhanni.features.event.diana.SoopyGuessBurrow import at.hannibal2.skyhanni.features.event.jerry.HighlightJerries import at.hannibal2.skyhanni.features.event.jerry.frozentreasure.FrozenTreasureTracker +import at.hannibal2.skyhanni.features.event.spook.TheGreatSpook import at.hannibal2.skyhanni.features.fame.AccountUpgradeReminder import at.hannibal2.skyhanni.features.fame.CityProjectFeatures import at.hannibal2.skyhanni.features.fishing.ChumBucketHider @@ -457,6 +458,7 @@ class SkyHanniMod { loadModule(NonGodPotEffectDisplay()) loadModule(SoopyGuessBurrow()) loadModule(HighlightJerries()) + loadModule(TheGreatSpook()) loadModule(GriffinBurrowHelper) loadModule(GriffinBurrowParticleFinder()) loadModule(BurrowWarpHelper()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/EventConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/EventConfig.java index 7b4d0211f..fe7e36440 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/EventConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/EventConfig.java @@ -329,6 +329,48 @@ public class EventConfig { } + @ConfigOption(name = "The Great Spook", desc = "") + @Accordion + @Expose + public GreatSpookConfig spook = new GreatSpookConfig(); + + public static class GreatSpookConfig { + + @Expose + @ConfigOption(name = "Primal Fear Timer", desc = "Shows cooldown timer for next primal fear.") + @ConfigEditorBoolean + @FeatureToggle + public boolean primalFearTimer = false; + + @Expose + @ConfigOption(name = "Primal Fear Notify", desc = "Plays a notification sound when the next primal fear can spawn.") + @ConfigEditorBoolean + @FeatureToggle + public boolean primalFearNotification = false; + + @Expose + public Position positionTimer = new Position(20, 20, false, true); + + @Expose + @ConfigOption(name = "Fear Stat Display", desc = "Shows your current Fear stat value.") + @ConfigEditorBoolean + @FeatureToggle + public boolean fearStatDisplay = false; + + @Expose + public Position positionFear = new Position(30, 30, false, true); + + @Expose + @ConfigOption(name = "IRL Time Left", desc = "Shows the IRL time left before The Great Spook ends.") + @ConfigEditorBoolean + @FeatureToggle + public boolean greatSpookTimeLeft = false; + + @Expose + public Position positionTimeLeft = new Position(40, 40, false, true); + + } + // comment in if the event is needed again // @ConfigOption(name = "300þ Anniversary Celebration", desc = "Features for the 300þ year of SkyBlock") @Accordion diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/spook/TheGreatSpook.kt b/src/main/java/at/hannibal2/skyhanni/features/event/spook/TheGreatSpook.kt new file mode 100644 index 000000000..f0334549e --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/event/spook/TheGreatSpook.kt @@ -0,0 +1,58 @@ +package at.hannibal2.skyhanni.features.event.spook + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.renderString +import at.hannibal2.skyhanni.utils.SoundUtils +import at.hannibal2.skyhanni.utils.TabListData +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class TheGreatSpook { +// §r§cPrimal Fears§r§7: §r§6§lREADY!! + private val config get() = SkyHanniMod.feature.event.spook + private var displayTimer = "" + private var displayFearStat = "" + private var displayTimeLeft = "" + private var notificationSeconds = 0 + + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + if (isAllDisabled()) return + if (!event.repeatSeconds(1)) return + + if (isTimerEnabled() || isNotificationEnabled()) displayTimer = checkTabList(" §r§cPrimal Fears§r§7: ") + if (isFearStatEnabled()) displayFearStat = checkTabList(" §r§5Fear: ") + if (isTimeLeftEnabled()) displayTimeLeft = checkTabList(" §r§dEnds In§r§7: ") + if (isNotificationEnabled()) { + if (displayTimer.endsWith("READY!!")) { + if (notificationSeconds > 0) { + SoundUtils.playBeepSound() + notificationSeconds-- + } + } else if (displayTimer.isNotEmpty()) { + notificationSeconds = 5 + } + } + } + + private fun checkTabList(matchString: String): String { + return (TabListData.getTabList().find { it.contains(matchString) } ?: "").trim() + } + @SubscribeEvent + fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { + if (isTimerEnabled()) config.positionTimer.renderString(displayTimer, posLabel = "Primal Fear Timer") + if (isFearStatEnabled()) config.positionFear.renderString(displayFearStat, posLabel = "Fear Stat Display") + if (isTimeLeftEnabled()) config.positionTimeLeft.renderString(displayTimeLeft, posLabel = "Time Left Display") + } + + private fun isTimerEnabled(): Boolean = LorenzUtils.inSkyBlock && config.primalFearTimer + + private fun isNotificationEnabled(): Boolean = LorenzUtils.inSkyBlock && config.primalFearNotification + private fun isFearStatEnabled(): Boolean = LorenzUtils.inSkyBlock && config.fearStatDisplay + private fun isTimeLeftEnabled(): Boolean = LorenzUtils.inSkyBlock && config.greatSpookTimeLeft + + private fun isAllDisabled(): Boolean = !isTimeLeftEnabled() && !isTimerEnabled() && !isFearStatEnabled() && + !isNotificationEnabled() +} |