diff options
Diffstat (limited to 'src/main/java')
5 files changed, 29 insertions, 7 deletions
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 1319cc3af..9ed976764 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 @@ -43,6 +43,7 @@ object HoppityEggLocator { var sharedEggLocation: LorenzVec? = null var possibleEggLocations = listOf<LorenzVec>() var currentEggType: HoppityEggType? = null + var currentEggNote: String? = null var eggLocations: Map<IslandType, List<LorenzVec>> = mapOf() @@ -60,6 +61,7 @@ object HoppityEggLocator { drawLocations = false sharedEggLocation = null currentEggType = null + currentEggNote = null lastParticlePosition = null } @@ -241,6 +243,7 @@ object HoppityEggLocator { add("Draw Locations: $drawLocations") add("Shared Egg Location: ${sharedEggLocation ?: "None"}") add("Current Egg Type: ${currentEggType ?: "None"}") + add("Current Egg Note: ${currentEggNote ?: "None"}") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggType.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggType.kt index 83d335cb1..d36006d7b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggType.kt @@ -52,6 +52,7 @@ enum class HoppityEggType( eggType.lastResetDay = currentSbDay if (HoppityEggLocator.currentEggType == eggType) { HoppityEggLocator.currentEggType = null + HoppityEggLocator.currentEggNote = null HoppityEggLocator.sharedEggLocation = null } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt index 5ebe075bc..759c675b1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt @@ -27,9 +27,14 @@ object HoppityEggsManager { val config get() = SkyHanniMod.feature.event.hoppityEggs + /** + * REGEX-TEST: §d§lHOPPITY'S HUNT §r§dYou found a §r§9Chocolate Lunch Egg §r§don a ledge next to the stairs up§r§d! + * REGEX-TEST: §d§lHOPPITY'S HUNT §r§dYou found a §r§aChocolate Dinner Egg §r§dbehind Emissary Sisko§r§d! + * REGEX-TEST: §d§lHOPPITY'S HUNT §r§dYou found a §r§9Chocolate Lunch Egg §r§dnear the Diamond Essence Shop§r§d! + */ private val eggFoundPattern by ChocolateFactoryAPI.patternGroup.pattern( "egg.found", - "§d§lHOPPITY'S HUNT §r§dYou found a §r§.Chocolate (?<meal>\\w+) Egg.*" + "§d§lHOPPITY'S HUNT §r§dYou found a §r§.Chocolate (?<meal>\\w+) Egg §r§d(?<note>.*)§r§d!" ) private val noEggsLeftPattern by ChocolateFactoryAPI.patternGroup.pattern( "egg.noneleft", @@ -49,10 +54,12 @@ object HoppityEggsManager { ) private var lastMeal: HoppityEggType? = null + private var lastNote: String? = null @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { lastMeal = null + lastNote = null } @SubscribeEvent @@ -62,8 +69,10 @@ object HoppityEggsManager { eggFoundPattern.matchMatcher(event.message) { HoppityEggLocator.eggFound() val meal = getEggType(event) + val note = group("note") meal.markClaimed() lastMeal = meal + lastNote = note return } @@ -116,13 +125,15 @@ object HoppityEggsManager { fun shareWaypointPrompt() { if (!config.sharedWaypoints) return val meal = lastMeal ?: return + val note = lastNote ?: return lastMeal = null + lastNote = null val currentLocation = LocationUtils.playerLocation() DelayedRun.runNextTick { ChatUtils.clickableChat( "Click here to share the location of this chocolate egg with the server!", - onClick = { HoppityEggsShared.shareNearbyEggLocation(currentLocation, meal) }, + onClick = { HoppityEggsShared.shareNearbyEggLocation(currentLocation, meal, note) }, expireAt = 30.seconds.fromNow() ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsShared.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsShared.kt index 5577db3fd..67aaf2008 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsShared.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsShared.kt @@ -3,8 +3,9 @@ package at.hannibal2.skyhanni.features.event.hoppity import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggsManager.getEggType import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI -import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.groupOrNull import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -17,10 +18,11 @@ object HoppityEggsShared { /** * REGEX-TEST: CalMWolfs: [SkyHanni] Breakfast Chocolate Egg located at x: 142, y: 71, z: -453 + * REGEX-TEST: CalMWolfs: [SkyHanni] Breakfast Chocolate Egg located at x: 142, y: 71, z: -453 (hidden note) */ private val sharedEggPattern by ChocolateFactoryAPI.patternGroup.pattern( "egg.shared", - ".*\\[SkyHanni] (?<meal>\\w+) Chocolate Egg located at x: (?<x>-?\\d+), y: (?<y>-?\\d+), z: (?<z>-?\\d+)" + ".*\\[SkyHanni] (?<meal>\\w+) Chocolate Egg located at x: (?<x>-?\\d+), y: (?<y>-?\\d+), z: (?<z>-?\\d+)(?: \\((?<note>.*)\\))?" ) @SubscribeEvent @@ -32,16 +34,18 @@ object HoppityEggsShared { val eggLocation = LorenzVec(x, y, z) val meal = getEggType(event) + val note = groupOrNull("note")?.removeColor() if (meal.isClaimed()) return if (!HoppityEggLocator.isValidEggLocation(eggLocation)) return HoppityEggLocator.sharedEggLocation = eggLocation HoppityEggLocator.currentEggType = meal + HoppityEggLocator.currentEggNote = note } } - fun shareNearbyEggLocation(playerLocation: LorenzVec, meal: HoppityEggType) { + fun shareNearbyEggLocation(playerLocation: LorenzVec, meal: HoppityEggType, note: String) { if (!isEnabled()) return val islandEggsLocations = HoppityEggLocator.getCurrentIslandEggLocations() ?: return val closestEgg = islandEggsLocations.minByOrNull { it.distance(playerLocation) } ?: return @@ -50,8 +54,7 @@ object HoppityEggsShared { val y = closestEgg.y.toInt() val z = closestEgg.z.toInt() - val message = "[SkyHanni] ${meal.mealName} Chocolate Egg located at x: $x, y: $y, z: $z" - ChatUtils.sendCommandToServer("ac $message") + HypixelCommands.allChat("[SkyHanni] ${meal.mealName} Chocolate Egg located at x: $x, y: $y, z: $z ($note)") } fun isEnabled() = LorenzUtils.inSkyBlock && config.waypoints && config.sharedWaypoints diff --git a/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt b/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt index 1af1a70b8..c09c77395 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt @@ -58,6 +58,10 @@ object HypixelCommands { send("party settings allinvite") } + fun allChat(message: String) { + send("ac $message") + } + private fun send(command: String) { @Suppress("DEPRECATION") // TODO rename function |