diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-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 |
2 files changed, 45 insertions, 0 deletions
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!") + } + } + } +} |