diff options
author | Stella <stellaarnott1@gmail.com> | 2024-10-13 03:43:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-13 12:43:48 +0200 |
commit | 6f52ce2e3e42ac794c28a8a6eb7f0ae04553b1f6 (patch) | |
tree | 5f8736083bc8ab2690d20a184a3190647aba3aef /src/main/java/at/hannibal2/skyhanni | |
parent | 486231d369a8e2e8cf54f079d6105dac99dec6aa (diff) | |
download | skyhanni-6f52ce2e3e42ac794c28a8a6eb7f0ae04553b1f6.tar.gz skyhanni-6f52ce2e3e42ac794c28a8a6eb7f0ae04553b1f6.tar.bz2 skyhanni-6f52ce2e3e42ac794c28a8a6eb7f0ae04553b1f6.zip |
Feature: Terminal Waypoints (#2719)
Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com>
Co-authored-by: Empa <itsempa@users.noreply.github.com>
Co-authored-by: Empa <42304516+ItsEmpa@users.noreply.github.com>
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
5 files changed, 123 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index bd94a1658..c5a28679e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -25,6 +25,7 @@ import at.hannibal2.skyhanni.features.commands.PartyChatCommands import at.hannibal2.skyhanni.features.commands.PartyCommands import at.hannibal2.skyhanni.features.commands.WikiManager import at.hannibal2.skyhanni.features.dungeon.CroesusChestTracker +import at.hannibal2.skyhanni.features.dungeon.floor7.TerminalInfo import at.hannibal2.skyhanni.features.event.diana.AllBurrowsList import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper import at.hannibal2.skyhanni.features.event.diana.DianaProfitTracker @@ -501,6 +502,10 @@ object Commands { "shdebugscoreboard", "Monitors the scoreboard changes: Prints the raw scoreboard lines in the console after each update, with time since last update.", ) { ScoreboardData.toggleMonitor() } + registerCommand( + "shresetterminal", + "Resets terminal highlights in F7.", + ) { TerminalInfo.resetTerminals() } } @Suppress("LongMethod") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java index ec2bc0c4b..0be6c1e85 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java @@ -139,6 +139,12 @@ public class DungeonConfig { public boolean shadowAssassinJumpNotifier = false; @Expose + @ConfigOption(name = "Terminal Waypoints", desc = "Displays Waypoints in the F7/M7 Goldor Phase.") + @ConfigEditorBoolean + @FeatureToggle + public boolean terminalWaypoints = false; + + @Expose @ConfigOption(name = "Dungeon Races Guide", desc = "") @Accordion public DungeonsRaceGuideConfig dungeonsRaceGuide = new DungeonsRaceGuideConfig(); diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossAPI.kt index 5a7d0ff31..d30553a28 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossAPI.kt @@ -29,6 +29,9 @@ object DungeonBossAPI { F7_GOLDOR_5, F7_NECRON, M7_WITHER_KING, + ; + + fun isCurrent(): Boolean = bossPhase == this } private val patternGroup = RepoPattern.group("dungeon.boss.message") @@ -86,7 +89,7 @@ object DungeonBossAPI { * REGEX-TEST: §bmartimavocado§r§a completed a device! (§r§c3§r§a/8) * REGEX-TEST: §bmartimavocado§r§a activated a terminal! (§r§c4§r§a/7) */ - private val goldorTerminalPattern by patternGroup.pattern( + val goldorTerminalPattern by patternGroup.pattern( "f7.goldor.terminalcomplete", "§.(?<playerName>\\w+)§r§a (?:activated|completed) a (?<type>lever|terminal|device)! \\(§r§c(?<currentTerminal>\\d)§r§a/(?<total>\\d)\\)", ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/floor7/TerminalInfo.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/floor7/TerminalInfo.kt new file mode 100644 index 000000000..bd7b8a4ee --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/floor7/TerminalInfo.kt @@ -0,0 +1,52 @@ +package at.hannibal2.skyhanni.features.dungeon.floor7 + +import at.hannibal2.skyhanni.features.dungeon.DungeonBossAPI +import at.hannibal2.skyhanni.utils.LorenzVec + +private typealias BossPhase = DungeonBossAPI.DungeonBossPhase + +enum class TerminalInfo(val location: LorenzVec, val phase: BossPhase, val text: String) { + P1_TERMINAL_1(LorenzVec(111, 113, 73), BossPhase.F7_GOLDOR_1, "Terminal"), + P1_TERMINAL_2(LorenzVec(111, 119, 79), BossPhase.F7_GOLDOR_1, "Terminal"), + P1_TERMINAL_3(LorenzVec(89, 112, 92), BossPhase.F7_GOLDOR_1, "Terminal"), + P1_TERMINAL_4(LorenzVec(89, 122, 101), BossPhase.F7_GOLDOR_1, "Terminal"), + P1_LEVER_1(LorenzVec(106, 124, 113), BossPhase.F7_GOLDOR_1, "Lever"), + P1_LEVER_2(LorenzVec(94, 124, 113), BossPhase.F7_GOLDOR_1, "Lever"), + P1_DEVICE(LorenzVec(110, 119, 93), BossPhase.F7_GOLDOR_1, "Device"), + + P2_TERMINAL_1(LorenzVec(68, 109, 121), BossPhase.F7_GOLDOR_2, "Terminal"), + P2_TERMINAL_2(LorenzVec(59, 120, 122), BossPhase.F7_GOLDOR_2, "Terminal"), + P2_TERMINAL_3(LorenzVec(47, 109, 121), BossPhase.F7_GOLDOR_2, "Terminal"), + P2_TERMINAL_4(LorenzVec(40, 124, 122), BossPhase.F7_GOLDOR_2, "Terminal"), + P2_TERMINAL_5(LorenzVec(39, 108, 143), BossPhase.F7_GOLDOR_2, "Terminal"), + P2_LEVER_1(LorenzVec(23, 132, 138), BossPhase.F7_GOLDOR_2, "Lever"), + P2_LEVER_2(LorenzVec(27, 124, 127), BossPhase.F7_GOLDOR_2, "Lever"), + P2_DEVICE(LorenzVec(60, 131, 142), BossPhase.F7_GOLDOR_2, "Device"), + + P3_TERMINAL_1(LorenzVec(-3, 109, 112), BossPhase.F7_GOLDOR_3, "Terminal"), + P3_TERMINAL_2(LorenzVec(-3, 119, 93), BossPhase.F7_GOLDOR_3, "Terminal"), + P3_TERMINAL_3(LorenzVec(19, 123, 93), BossPhase.F7_GOLDOR_3, "Terminal"), + P3_TERMINAL_4(LorenzVec(-3, 109, 77), BossPhase.F7_GOLDOR_3, "Terminal"), + P3_LEVER_1(LorenzVec(14, 122, 55), BossPhase.F7_GOLDOR_3, "Lever"), + P3_LEVER_2(LorenzVec(2, 122, 55), BossPhase.F7_GOLDOR_3, "Lever"), + P3_DEVICE(LorenzVec(-2, 119, 77), BossPhase.F7_GOLDOR_3, "Device"), + + P4_TERMINAL_1(LorenzVec(41, 109, 29), BossPhase.F7_GOLDOR_4, "Terminal"), + P4_TERMINAL_2(LorenzVec(44, 121, 29), BossPhase.F7_GOLDOR_4, "Terminal"), + P4_TERMINAL_3(LorenzVec(67, 109, 29), BossPhase.F7_GOLDOR_4, "Terminal"), + P4_TERMINAL_4(LorenzVec(72, 115, 48), BossPhase.F7_GOLDOR_4, "Terminal"), + P4_LEVER_1(LorenzVec(84, 121, 34), BossPhase.F7_GOLDOR_4, "Lever"), + P4_LEVER_2(LorenzVec(86, 128, 46), BossPhase.F7_GOLDOR_4, "Lever"), + P4_DEVICE(LorenzVec(63, 126, 35), BossPhase.F7_GOLDOR_4, "Device"), + ; + + var highlight: Boolean = true + + companion object { + fun resetTerminals() = entries.forEach { it.highlight = true } + + fun getClosestTerminal(input: LorenzVec): TerminalInfo? { + return entries.filter { it.highlight }.minByOrNull { it.location.distance(input) } + } + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/floor7/TerminalWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/floor7/TerminalWaypoints.kt new file mode 100644 index 000000000..f8479507a --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/floor7/TerminalWaypoints.kt @@ -0,0 +1,56 @@ +package at.hannibal2.skyhanni.features.dungeon.floor7 + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent +import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.features.dungeon.DungeonAPI +import at.hannibal2.skyhanni.features.dungeon.DungeonBossAPI +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.EntityUtils +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher +import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.getLorenzVec +import net.minecraft.entity.player.EntityPlayerMP +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +@SkyHanniModule +object TerminalWaypoints { + + private val config get() = SkyHanniMod.feature.dungeon + + @SubscribeEvent + fun onRenderWorld(event: LorenzRenderWorldEvent) { + if (!isEnabled()) return + + for (term in TerminalInfo.entries) { + if (!term.highlight || !term.phase.isCurrent()) continue + event.drawWaypointFilled(term.location, LorenzColor.GREEN.toColor(), seeThroughBlocks = true) + event.drawDynamicText(term.location, term.text, 1.0) + } + } + + @SubscribeEvent + fun onWorldChange(event: LorenzWorldChangeEvent) { + TerminalInfo.resetTerminals() + } + + @SubscribeEvent + fun onChat(event: LorenzChatEvent) { + if (!inBoss()) return + + val playerName = DungeonBossAPI.goldorTerminalPattern.matchMatcher(event.message) { + group("playerName") + } ?: return + + val playerEntity = EntityUtils.getEntities<EntityPlayerMP>().find { it.name == playerName } ?: return + val terminal = TerminalInfo.getClosestTerminal(playerEntity.getLorenzVec()) + terminal?.highlight = false + } + + private fun inBoss() = DungeonAPI.inBossRoom && DungeonAPI.isOneOf("F7", "M7") + + private fun isEnabled() = inBoss() && config.terminalWaypoints +} |