From 38ad085118f6d0403c8d59345a250dd182191a20 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Thu, 13 Jun 2024 19:39:40 +0200 Subject: Feature: Added Rabbit pet warning (#2087) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../config/features/event/HoppityEggsConfig.java | 10 ++++++++ .../features/event/hoppity/HoppityEggLocator.kt | 7 +++--- .../event/hoppity/MythicRabbitPetWarning.kt | 28 ++++++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/event/hoppity/MythicRabbitPetWarning.kt diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java index 816471e16..96911d97d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java @@ -141,4 +141,14 @@ public class HoppityEggsConfig { @ConfigEditorBoolean @FeatureToggle public boolean compactChat = false; + + @Expose + @ConfigOption( + name = "Rabbit Pet Warning", + desc = "Warn when using the Egglocator without having a §d§lMythic Rabbit Pet §7selected. " + + "§eOnly enable this setting when you own a mythic Rabbit pet." + ) + @ConfigEditorBoolean + @FeatureToggle + public boolean petWarning = false; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt index a5ab1a7c6..4e5d96f2a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt @@ -215,6 +215,7 @@ object HoppityEggLocator { if (event.clickType == ClickType.RIGHT_CLICK && item.isLocatorItem) { lastClick = SimpleTimeMark.now() + MythicRabbitPetWarning.check() } } @@ -238,7 +239,7 @@ object HoppityEggLocator { secondPos = LorenzVec( secondPoint.x + xDiff * 1000, secondPoint.y + yDiff * 1000, - secondPoint.z + zDiff * 1000 + secondPoint.z + zDiff * 1000, ) val sortedEggs = islandEggsLocations.map { @@ -277,8 +278,8 @@ object HoppityEggLocator { private fun ReceiveParticleEvent.isEnchantmentParticle() = type == EnumParticleTypes.ENCHANTMENT_TABLE && speed == -2.0f && count == 10 - fun isEnabled() = LorenzUtils.inSkyBlock && config.waypoints && !GardenAPI.inGarden() - && !ReminderUtils.isBusy(true) && ChocolateFactoryAPI.isHoppityEvent() + fun isEnabled() = LorenzUtils.inSkyBlock && config.waypoints && !GardenAPI.inGarden() && + !ReminderUtils.isBusy(true) && ChocolateFactoryAPI.isHoppityEvent() private val ItemStack.isLocatorItem get() = getInternalName() == locatorItem diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/MythicRabbitPetWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/MythicRabbitPetWarning.kt new file mode 100644 index 000000000..59e951d21 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/MythicRabbitPetWarning.kt @@ -0,0 +1,28 @@ +package at.hannibal2.skyhanni.features.event.hoppity + +import at.hannibal2.skyhanni.data.PetAPI +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.SimpleTimeMark +import kotlin.time.Duration.Companion.seconds + +object MythicRabbitPetWarning { + val mythicRabbit = "§dRabbit" + var lastCheck = SimpleTimeMark.farPast() + + fun check() { + if (!HoppityEggsManager.config.petWarning) return + + if (lastCheck.passedSince() < 30.seconds) return + + if (!PetAPI.isCurrentPet(mythicRabbit)) { + lastCheck = SimpleTimeMark.now() + warn() + } + } + + private fun warn() { + ChatUtils.chat("Use a mythic Rabbit pet for more chocolate!") + LorenzUtils.sendTitle("§cNo Rabbit Pet!", 3.seconds) + } +} -- cgit