diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-27 00:30:50 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-27 00:30:50 +0200 |
commit | f5d0d8118c96a6ed98ae95f15dd49df9bd86dc29 (patch) | |
tree | 97c4f2e1a8173013f436de69a8655dc71d90312b | |
parent | 370cf58f29a5d32040f83ca17465fd493cc88f61 (diff) | |
download | skyhanni-f5d0d8118c96a6ed98ae95f15dd49df9bd86dc29.tar.gz skyhanni-f5d0d8118c96a6ed98ae95f15dd49df9bd86dc29.tar.bz2 skyhanni-f5d0d8118c96a6ed98ae95f15dd49df9bd86dc29.zip |
Added Griffin Pet Warning
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 1 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/Features.java | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/DianaConfig.java (renamed from src/main/java/at/hannibal2/skyhanni/config/features/Diana.java) | 6 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt | 13 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt | 32 |
5 files changed, 52 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 9519e0146..e79f89452 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -360,6 +360,7 @@ class SkyHanniMod { loadModule(RiftBloodEffigies()) loadModule(RiftWiltedBerberisHelper()) loadModule(RiftHorsezookaHider()) + loadModule(GriffinPetWarning()) // diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index 8824c2203..c8bfc3d1f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -93,7 +93,7 @@ public class Features extends Config { @Expose @Category(name = "Diana", desc = "Diana's mythological event.") - public Diana diana = new Diana(); + public DianaConfig diana = new DianaConfig(); @Expose @Category(name = "Commands", desc = "Enable or disable commands.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Diana.java b/src/main/java/at/hannibal2/skyhanni/config/features/DianaConfig.java index 5c1f18105..3d90a4f54 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Diana.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/DianaConfig.java @@ -4,7 +4,7 @@ import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.*; import org.lwjgl.input.Keyboard; -public class Diana { +public class DianaConfig { @Expose @ConfigOption(name = "Soopy Guess", desc = "Uses §eSoopy's Guess Logic §7to find the next burrow. Does not require SoopyV2 or ChatTriggers to be installed.") @@ -60,4 +60,8 @@ public class Diana { public int keyBindShare = Keyboard.KEY_Y; } + @Expose + @ConfigOption(name = "Griffin Pet Warning", desc = "Warn when holding an Ancestral Spade while no Griffin pet is selected.") + @ConfigEditorBoolean + public boolean petWarning = true; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt new file mode 100644 index 000000000..e684cd04d --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt @@ -0,0 +1,13 @@ +package at.hannibal2.skyhanni.features.event.diana + +import at.hannibal2.skyhanni.data.MayorElection +import at.hannibal2.skyhanni.data.ProfileStorageData +import at.hannibal2.skyhanni.utils.InventoryUtils + +object DianaAPI { + fun hasSpadeInHand() = InventoryUtils.itemInHandId == "ANCESTRAL_SPADE" + + fun isRitualActive() = MayorElection.isPerkActive("Diana", "Mythological Ritual") + + fun hasGriffinPet() = ProfileStorageData.profileSpecific?.let { it.currentPet.contains("Griffin") } ?: false +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt new file mode 100644 index 000000000..f979894c4 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt @@ -0,0 +1,32 @@ +package at.hannibal2.skyhanni.features.event.diana + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.TitleUtils +import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import at.hannibal2.skyhanni.utils.SimpleTimeMark +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds + +class GriffinPetWarning { + private var lastWarnTime = SimpleTimeMark.farPast() + + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + if (!event.isMod(20)) return + if (!IslandType.HUB.isInIsland()) return + if (!SkyHanniMod.feature.diana.petWarning) return + if (!DianaAPI.isRitualActive()) return + if (!DianaAPI.hasSpadeInHand()) return + + if (!DianaAPI.hasGriffinPet()) { + if (lastWarnTime.passedSince() > 30.seconds) { + lastWarnTime = SimpleTimeMark.now() + TitleUtils.sendTitle("§cGriffin Pet!", 3_000) + LorenzUtils.chat("§e[SkyHanni] Reminder to use a Griffin pet for Mythological Ritual!") + } + } + } +} |