aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBlockOpen.kt49
2 files changed, 43 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java
index 5d1c63f8d..93d7d6f61 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java
@@ -233,6 +233,12 @@ public class ChocolateFactoryConfig {
public boolean mythicRabbitRequirement = false;
@Expose
+ @ConfigOption(name = "Booster Cookie", desc = "Blocks running /cf without a §6§lBooster Cookie §7active.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean boosterCookieRequirement = false;
+
+ @Expose
@ConfigOption(name = "Stray Tracker", desc = "Track stray rabbits found in the Chocolate Factory menu.")
@ConfigEditorBoolean
@FeatureToggle
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBlockOpen.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBlockOpen.kt
index a797ca2d6..c9ff65273 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBlockOpen.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBlockOpen.kt
@@ -1,12 +1,17 @@
package at.hannibal2.skyhanni.features.inventory.chocolatefactory
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.EntityMovementData
+import at.hannibal2.skyhanni.data.IslandGraphs
+import at.hannibal2.skyhanni.data.IslandType
+import at.hannibal2.skyhanni.data.ProfileStorageData
import at.hannibal2.skyhanni.events.MessageSendToServerEvent
import at.hannibal2.skyhanni.features.event.hoppity.MythicRabbitPetWarning
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
@@ -16,6 +21,7 @@ import kotlin.time.Duration.Companion.seconds
@SkyHanniModule
object ChocolateFactoryBlockOpen {
private val config get() = SkyHanniMod.feature.inventory.chocolateFactory
+ private val profileStorage get() = ProfileStorageData.profileSpecific?.bits
/**
* REGEX-TEST: /cf
@@ -26,27 +32,46 @@ object ChocolateFactoryBlockOpen {
*/
private val commandPattern by RepoPattern.pattern(
"inventory.chocolatefactory.opencommand",
- "\\/(?:cf|(?:chocolate)?factory)(?: .*)?",
+ "/(?:cf|(?:chocolate)?factory)(?: .*)?",
)
private var commandSentTimer = SimpleTimeMark.farPast()
@SubscribeEvent
fun onCommandSend(event: MessageSendToServerEvent) {
- if (!isEnabled()) return
+ if (!LorenzUtils.inSkyBlock) return
if (!commandPattern.matches(event.message)) return
if (commandSentTimer.passedSince() < 5.seconds) return
- if (MythicRabbitPetWarning.correctPet()) return
- commandSentTimer = SimpleTimeMark.now()
- event.cancel()
- ChatUtils.clickToActionOrDisable(
- "§cBlocked opening the Chocolate Factory without a §dMythic Rabbit Pet §cequipped!",
- config::mythicRabbitRequirement,
- actionName = "open pets menu",
- action = { HypixelCommands.pet() },
- )
+ if (config.mythicRabbitRequirement && !MythicRabbitPetWarning.correctPet()) {
+ event.cancelOpen()
+ ChatUtils.clickToActionOrDisable(
+ "§cBlocked opening the Chocolate Factory without a §dMythic Rabbit Pet §cequipped!",
+ config::mythicRabbitRequirement,
+ actionName = "open pets menu",
+ action = { HypixelCommands.pet() },
+ )
+ } else if (config.boosterCookieRequirement) {
+ profileStorage?.boosterCookieExpiryTime?.let {
+ if (it.timeUntil() > 0.seconds) return
+ event.cancelOpen()
+ ChatUtils.clickToActionOrDisable(
+ "§cBlocked opening the Chocolate Factory without a §dBooster Cookie §cactive!",
+ config::boosterCookieRequirement,
+ actionName = "warp to hub",
+ action = {
+ HypixelCommands.warp("hub")
+ EntityMovementData.onNextTeleport(IslandType.HUB) {
+ IslandGraphs.pathFind(LorenzVec(-32.5, 71.0, -76.5), "§aBazaar", condition = { true })
+ }
+ },
+ )
+ }
+ }
}
- private fun isEnabled() = LorenzUtils.inSkyBlock && config.mythicRabbitRequirement
+ private fun MessageSendToServerEvent.cancelOpen() {
+ commandSentTimer = SimpleTimeMark.now()
+ this.cancel()
+ }
}