diff options
Diffstat (limited to 'src/main/kotlin/com/ambientaddons/utils')
-rw-r--r-- | src/main/kotlin/com/ambientaddons/utils/DungeonFloor.kt | 12 | ||||
-rw-r--r-- | src/main/kotlin/com/ambientaddons/utils/SBLocation.kt | 19 |
2 files changed, 26 insertions, 5 deletions
diff --git a/src/main/kotlin/com/ambientaddons/utils/DungeonFloor.kt b/src/main/kotlin/com/ambientaddons/utils/DungeonFloor.kt index ab11d7f..e0e44cb 100644 --- a/src/main/kotlin/com/ambientaddons/utils/DungeonFloor.kt +++ b/src/main/kotlin/com/ambientaddons/utils/DungeonFloor.kt @@ -2,25 +2,27 @@ package com.ambientaddons.utils data class DungeonFloor( val mode: Mode, - val floor: Int + val floor: Int, + var enteredBoss: Boolean ) { override fun toString(): String { - return when { + val floorString = when { floor == 0 -> "E" mode == Mode.Normal -> "F$floor" else -> "M$floor" } + return if (enteredBoss) "$floorString [BOSS]" else floorString } companion object { fun String.toDungeonFloor(): DungeonFloor? { if (this.isEmpty()) return null - if (this == "E") return DungeonFloor(Mode.Normal, 0) + if (this == "E") return DungeonFloor(Mode.Normal, 0, false) val floorInt = this.last().digitToIntOrNull() ?: return null if (floorInt !in 1..7) return null return when (this.first()) { - 'F' -> DungeonFloor(Mode.Normal, floorInt) - 'M' -> DungeonFloor(Mode.Master, floorInt) + 'F' -> DungeonFloor(Mode.Normal, floorInt, false) + 'M' -> DungeonFloor(Mode.Master, floorInt, false) else -> null } } diff --git a/src/main/kotlin/com/ambientaddons/utils/SBLocation.kt b/src/main/kotlin/com/ambientaddons/utils/SBLocation.kt index bfd35eb..f99c5da 100644 --- a/src/main/kotlin/com/ambientaddons/utils/SBLocation.kt +++ b/src/main/kotlin/com/ambientaddons/utils/SBLocation.kt @@ -8,6 +8,7 @@ import com.ambientaddons.utils.Extensions.substringBetween import com.ambientaddons.utils.TabListUtils.fetchTabEntries import net.minecraft.scoreboard.Score import net.minecraft.scoreboard.ScorePlayerTeam +import net.minecraftforge.client.event.ClientChatReceivedEvent import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent @@ -22,6 +23,16 @@ object SBLocation { var dungeonFloor: DungeonFloor? = null var ticks = 0 + private val entryMessages = listOf( + "[BOSS] Bonzo: Gratz for making it this far, but I'm basically unbeatable.", + "[BOSS] Scarf: This is where the journey ends for you, Adventurers.", + "[BOSS] The Professor: I was burdened with terrible news recently...", + "[BOSS] Thorn: Welcome Adventurers! I am Thorn, the Spirit! And host of the Vegan Trials!", + "[BOSS] Livid: Welcome, you arrive right on time. I am Livid, the Master of Shadows.", + "[BOSS] Sadan: So you made it all the way here... Now you wish to defy me? Sadan?!", + "[BOSS] Maxor: WELL WELL WELL LOOK WHO'S HERE!" + ) + @SubscribeEvent fun onWorldUnload(event: WorldEvent.Unload) { inSkyblock = false @@ -29,6 +40,14 @@ object SBLocation { area = null } + @SubscribeEvent(receiveCanceled = true) + fun onChatReceived(event: ClientChatReceivedEvent) { + if (dungeonFloor == null) return + if (entryMessages.any { it == event.message.unformattedText.stripControlCodes() }) { + dungeonFloor?.enteredBoss = true + } + } + @SubscribeEvent fun onConnect(event: FMLNetworkEvent.ClientConnectedToServerEvent) { onHypixel = mc.runCatching { |