diff options
author | Erymanthus | RayDeeUx <51521765+RayDeeUx@users.noreply.github.com> | 2024-03-19 06:40:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-19 11:40:05 +0100 |
commit | 26a014864e5806b3155c24547c3dce32de4bd66a (patch) | |
tree | f44a406b7c067e22cafe3a809342dbfb46e08eb9 /src/main/java/at/hannibal2/skyhanni/features/event | |
parent | 30a6f963fe6a1a9478db26d0db47062f39422eef (diff) | |
download | skyhanni-26a014864e5806b3155c24547c3dce32de4bd66a.tar.gz skyhanni-26a014864e5806b3155c24547c3dce32de4bd66a.tar.bz2 skyhanni-26a014864e5806b3155c24547c3dce32de4bd66a.zip |
Feature: Easter Egg Hunt Waypoints (#1193)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/event')
3 files changed, 194 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEgg.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEgg.kt new file mode 100644 index 000000000..78f18e08b --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEgg.kt @@ -0,0 +1,39 @@ +package at.hannibal2.skyhanni.features.event.lobby.waypoints.easter + +import at.hannibal2.skyhanni.utils.LorenzVec + +enum class EasterEgg(val eggName: String, val waypoint: LorenzVec) { + EASTER_EGG_1("#1", LorenzVec(-47, 94, -3)), + EASTER_EGG_2("#2", LorenzVec(-20, 86, -70)), + EASTER_EGG_3("#3", LorenzVec(24, 62, -38)), + EASTER_EGG_4("#4", LorenzVec(-38, 56, 195)), + EASTER_EGG_5("#5", LorenzVec(-67, 82, 98)), + EASTER_EGG_6("#6", LorenzVec(-91, 61, 140)), + EASTER_EGG_7("#7", LorenzVec(103, 56, 194)), + EASTER_EGG_8("#8", LorenzVec(81, 68, 108)), + EASTER_EGG_9("#9", LorenzVec(10, 65, 58)), + EASTER_EGG_10("#10", LorenzVec(9, 53, 249)), + EASTER_EGG_11("#11", LorenzVec(216, 51, 93)), + EASTER_EGG_12("#12", LorenzVec(113, 45, 161)), + EASTER_EGG_13("#13", LorenzVec(133, 51, -8)), + EASTER_EGG_14("#14", LorenzVec(141, 73, 3)), + EASTER_EGG_15("#15", LorenzVec(107, 68, -9)), + EASTER_EGG_16("#16", LorenzVec(167, 60, -42)), + EASTER_EGG_17("#17", LorenzVec(58, 65, -2)), + EASTER_EGG_18("#18", LorenzVec(118, 51, -85)), // 158, 68, -81 entrance + EASTER_EGG_19("#19", LorenzVec(197, 60, 17)), + EASTER_EGG_20("#20", LorenzVec(-136, 85, -16)), + EASTER_EGG_21("#21", LorenzVec(-161, 57, -97)), + EASTER_EGG_22("#22", LorenzVec(-138, 74, -133)), + EASTER_EGG_23("#23", LorenzVec(-5, 77, -176)), + EASTER_EGG_24("#24", LorenzVec(67, 60, -170)), + EASTER_EGG_25("#25", LorenzVec(-177, 58, 70)), + EASTER_EGG_26("#26", LorenzVec(-141, 102, -15)), + EASTER_EGG_27("#27", LorenzVec(9, 32, 3)), // 11, 62, 0 entrance + EASTER_EGG_28("#28", LorenzVec(150, 28, 19)), + EASTER_EGG_29("#29", LorenzVec(47, 37, 52)), + EASTER_EGG_30("#30 (get your code first!)", LorenzVec(-28, 11, 123)), + ; + + var found = false +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt new file mode 100644 index 000000000..4fc8d40f4 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt @@ -0,0 +1,120 @@ +package at.hannibal2.skyhanni.features.event.lobby.waypoints.easter + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.HypixelData +import at.hannibal2.skyhanni.data.ScoreboardData +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent +import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.LocationUtils.distanceSqToPlayer +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class EasterEggWaypoints { + + private val config get() = SkyHanniMod.feature.event.lobbyWaypoints.easterEgg + private var closest: EasterEgg? = null + private var isEgg: Boolean = false + + @SubscribeEvent + fun onChat(event: LorenzChatEvent) { + if (!config.allWaypoints && !config.allEntranceWaypoints) return + if (!isEgg) return + + if (!isEnabled()) return + + val message = event.message + if (message.startsWith("§a§lYou found an Easter Egg! §r") || message == "§aYou have received the §bsuper reward§a!" || message == "§cYou already found this egg!") { + val egg = EasterEgg.entries.minByOrNull { it.waypoint.distanceSqToPlayer() }!! + egg.found = true + if (closest == egg) { + closest = null + } + } + } + + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + if (!config.allWaypoints && !config.allEntranceWaypoints) return + if (!isEnabled()) return + + if (event.repeatSeconds(1)) { + isEgg = checkScoreboardEasterSpecific() + } + + if (isEgg) { + if (config.onlyClosest) { + if (closest == null) { + val notFoundEggs = EasterEgg.entries.filter { !it.found } + if (notFoundEggs.isEmpty()) return + closest = notFoundEggs.minByOrNull { it.waypoint.distanceSqToPlayer() }!! + } + } + } + } + + @SubscribeEvent + fun onRenderWorld(event: LorenzRenderWorldEvent) { + if (!isEnabled()) return + if (!isEgg) return + + if (config.allWaypoints) { + for (egg in EasterEgg.entries) { + if (!egg.shouldShow()) continue + event.drawWaypointFilled(egg.waypoint, LorenzColor.AQUA.toColor()) + event.drawDynamicText(egg.waypoint, "§3" + egg.eggName, 1.5) + } + } + + if (config.allEntranceWaypoints) { + for (eggEntrance in EggEntrances.entries) { + if (!eggEntrance.easterEgg.any { it.shouldShow() }) continue + event.drawWaypointFilled(eggEntrance.waypoint, LorenzColor.YELLOW.toColor()) + event.drawDynamicText(eggEntrance.waypoint, "§e" + eggEntrance.eggEntranceName, 1.5) + } + return + } + + if (LorenzUtils.skyBlockArea == "?") return + } + + private fun EasterEgg.shouldShow(): Boolean { + if (found) { + return false + } + + return if (config.onlyClosest) closest == this else true + } + + // TODO use regex with the help of knowing the original lore. Will most likely need to wait until next egg event + + /* + Title: + §e§lHYPIXEL + + '§703/14/24 §8L30A' + ' ' + 'Rank: §bMVP§d+§b' + 'Achievements: §e5,370' + 'Hypixel Level: 140' + ' ' + 'Lobby: §a5' + 'Players: §a32,791' + ' ' + '§bEaster 2024' + 'Event Level: §31' + 'Easter Eggs: §a0/§a30' + ' ' + '§ewww.hypixel.net' + */ + private fun checkScoreboardEasterSpecific(): Boolean { + val a = ScoreboardData.sidebarLinesFormatted.any { it.contains("Hypixel Level") } + val b = ScoreboardData.sidebarLinesFormatted.any { it.contains("Easter") } + val c = ScoreboardData.sidebarLinesFormatted.any { it.contains("Easter Eggs") } + return a && b && c + } + private fun isEnabled() = HypixelData.hypixelLive && !LorenzUtils.inSkyBlock +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EggEntrances.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EggEntrances.kt new file mode 100644 index 000000000..a369e405a --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EggEntrances.kt @@ -0,0 +1,35 @@ +package at.hannibal2.skyhanni.features.event.lobby.waypoints.easter + +import at.hannibal2.skyhanni.utils.LorenzVec + +enum class EggEntrances( + val eggEntranceName: String, + val waypoint: LorenzVec, + vararg val easterEgg: EasterEgg, +) { + + EASTER_EGG_ENTER_12_13_1_28_1("#12, #13, #28 (tunnel)", LorenzVec(126, 52, 175), EasterEgg.EASTER_EGG_12, EasterEgg.EASTER_EGG_13, EasterEgg.EASTER_EGG_28), + EASTER_EGG_ENTER_13_2("#13 (keep going, stay on your left [<--])", LorenzVec(144, 30, 19), EasterEgg.EASTER_EGG_13), + EASTER_EGG_ENTER_13_3("#13 (enter here)", LorenzVec(107, 42, -47), EasterEgg.EASTER_EGG_13), + EASTER_EGG_ENTER_13_4("#13 (straight ahead, don't take the stairs)", LorenzVec(105, 49, -34), EasterEgg.EASTER_EGG_13), + EASTER_EGG_ENTER_14_1("#14 (enter here)", LorenzVec(159, 68, -25), EasterEgg.EASTER_EGG_14), + EASTER_EGG_ENTER_14_2("#14 (right turn [-->] here)", LorenzVec(153, 68, -8), EasterEgg.EASTER_EGG_14), + EASTER_EGG_ENTER_14_3("#14 (left turn [<--] here)", LorenzVec(143, 68, -8), EasterEgg.EASTER_EGG_14), + EASTER_EGG_ENTER_18_1("#18 (down this well)", LorenzVec(158, 67, -82), EasterEgg.EASTER_EGG_18), + EASTER_EGG_ENTER_18_2("#18 (through this painting)", LorenzVec(142, 56, -82), EasterEgg.EASTER_EGG_18), + EASTER_EGG_ENTER_21("#21 (through the waterfall)", LorenzVec(-137, 64, -82), EasterEgg.EASTER_EGG_21), + EASTER_EGG_ENTER_28_2("#13, #28 (right turn [-->] here)", LorenzVec(94, 35, 145), EasterEgg.EASTER_EGG_28), + EASTER_EGG_ENTER_28_3("#13, #28 (straight ahead, stay on your right [-->])", LorenzVec(92, 21, 107), EasterEgg.EASTER_EGG_28), + EASTER_EGG_ENTER_29_2("#29 (straight ahead, stay on your right [-->])", LorenzVec(16, 32, 2), EasterEgg.EASTER_EGG_29), + EASTER_EGG_ENTER_29_3("#29 (enter here)", LorenzVec(54, 22, 60), EasterEgg.EASTER_EGG_29), + EASTER_EGG_ENTER_29_4("#29 (up stairs, make left turn [<--])", LorenzVec(25, 25, 51), EasterEgg.EASTER_EGG_29), + EASTER_EGG_ENTER_29_5("#29 (up stairs, make left turn [<--] again)", LorenzVec(17, 32, 66), EasterEgg.EASTER_EGG_29), + EASTER_EGG_ENTER_29_6("#29 (left turn [<--] here)", LorenzVec(35, 37, 66), EasterEgg.EASTER_EGG_29), + EASTER_EGG_ENTER_29_7("#29 (past this door)", LorenzVec(39, 37, 48), EasterEgg.EASTER_EGG_29), + EASTER_EGG_ENTER_30_1("#30 (1st digit, SNEAK + RCLICK)", LorenzVec(143, 65, -30), EasterEgg.EASTER_EGG_30), + EASTER_EGG_ENTER_30_2("#30 (3rd digit, open chest)", LorenzVec(205, 34, -157), EasterEgg.EASTER_EGG_30), + EASTER_EGG_ENTER_27_29_1_30_3("#27, #29, #30 (inside this well)", LorenzVec(10, 63, 0), EasterEgg.EASTER_EGG_27, EasterEgg.EASTER_EGG_29, EasterEgg.EASTER_EGG_30), + EASTER_EGG_ENTER_30_4("#30 (left turn [<--] here)", LorenzVec(-28, 42, 14), EasterEgg.EASTER_EGG_30), + EASTER_EGG_ENTER_30_5("#30 Vault (brute force 2nd digit)", LorenzVec(-35, 25, 63), EasterEgg.EASTER_EGG_30), +} + |