diff options
author | Appability <appable@icloud.com> | 2022-11-13 16:54:28 -0800 |
---|---|---|
committer | Appability <appable@icloud.com> | 2022-11-13 16:54:28 -0800 |
commit | 012690fe591b7de4cb248a632a48371432be7610 (patch) | |
tree | 97e5f0c668651e904275fd4c212bab2413c1df6b /src | |
parent | 766ce61c5655935a232c5d87c1e334c6fba3d73b (diff) | |
download | AmbientAddons-012690fe591b7de4cb248a632a48371432be7610.tar.gz AmbientAddons-012690fe591b7de4cb248a632a48371432be7610.tar.bz2 AmbientAddons-012690fe591b7de4cb248a632a48371432be7610.zip |
fix inaccessible color setting + fix thorn timer
Diffstat (limited to 'src')
5 files changed, 58 insertions, 33 deletions
diff --git a/src/main/kotlin/com/ambientaddons/config/Config.kt b/src/main/kotlin/com/ambientaddons/config/Config.kt index ccf4909..406a880 100644 --- a/src/main/kotlin/com/ambientaddons/config/Config.kt +++ b/src/main/kotlin/com/ambientaddons/config/Config.kt @@ -128,60 +128,62 @@ object Config : Vigilant( category("Highlights") { subcategory("Bat highlight") { + color( + ::batColor, + name = "Bat highlight color", + description = "Color of bat secrets", + ) selector( ::batHighlight, name = "Bat highlight", description = "Show bat secrets", options = listOf("Off", "Highlight", "ESP") ) - color( - ::batColor, - name = "Bat highlight color", - description = "Color of bat secrets", - ) + } subcategory("Shadow assassin highlight") { + color( + ::saColor, + name = "Shadow assassin highlight color", + description = "Color of shadow assassins", + ) selector( ::saHighlight, name = "Shadow assassin highlight", description = "Show shadow assassins (without this, they will not be highlighted even when starred.)", options = listOf("Off", "Highlight", "ESP") ) - color( - ::saColor, - name = "Shadow assassin highlight color", - description = "Color of shadow assassins", - ) + } subcategory("Starred mob highlight") { + color( + ::starredColor, + name = "Starred mob highlight color", + description = "Color of starred mobs", + ) selector( ::starredHighlight, name = "Starred mob highlight", description = "Show bat secrets", options = listOf("Off", "Highlight", "ESP") ) - color( - ::starredColor, - name = "Starred mob highlight color", - description = "Color of starred mobs", - ) + } subcategory("Bestiary highlight") { + color( + ::bestiaryColor, + name = "Bestiary highlight color", + description = "Color of bestiary mobs.", + ) selector( ::bestiaryHighlight, name = "Bestiary highlight", description = "Show cave spiders and snipers. Disabled automatically when idkmansry is nearby.", options = listOf("Off", "Highlight", "ESP") ) - color( - ::bestiaryColor, - name = "Bestiary highlight color", - description = "Color of bestiary mobs.", - ) } } - category("Pre/Post Dungeon") { subcategory("Chest QOL") { switch( diff --git a/src/main/kotlin/com/ambientaddons/features/display/ThornOverlay.kt b/src/main/kotlin/com/ambientaddons/features/display/ThornOverlay.kt index 70a5d2e..f7e9070 100644 --- a/src/main/kotlin/com/ambientaddons/features/display/ThornOverlay.kt +++ b/src/main/kotlin/com/ambientaddons/features/display/ThornOverlay.kt @@ -21,10 +21,13 @@ object ThornOverlay { private var lastPickedUpBow: Long = -1 private const val bowPickedUpString = "You picked up the Spirit Bow! Use it to attack Thorn!" + private val timeUntilBreak: Double + get() = 20.0 - ((System.currentTimeMillis() - lastPickedUpBow) / 1000.0) + @SubscribeEvent fun onChat(event: ClientChatReceivedEvent) { if (SBLocation.dungeonFloor?.floor != 4) return - if (event.message.unformattedText.stripControlCodes() == bowPickedUpString && lastPickedUpBow < 0) { + if (event.message.unformattedText.stripControlCodes() == bowPickedUpString && timeUntilBreak < 0) { lastPickedUpBow = System.currentTimeMillis() } } @@ -44,7 +47,6 @@ object ThornOverlay { fun onRenderOverlay(event: RenderGameOverlayEvent) { if (event.type != RenderGameOverlayEvent.ElementType.TEXT) return val textStyle = TextStyle.fromInt(config.spiritBowTimer - 1) ?: TextStyle.Outline - val timeUntilBreak = 20.0 - ((System.currentTimeMillis() - lastPickedUpBow) / 1000.0) if (config.spiritBowTimer != 0 && SBLocation.dungeonFloor?.floor == 4) { if (timeUntilBreak > 0) { val timeString = "${colorizeTime(timeUntilBreak)}%.2f".format(timeUntilBreak) diff --git a/src/main/kotlin/com/ambientaddons/features/dungeon/DungeonHighlights.kt b/src/main/kotlin/com/ambientaddons/features/dungeon/DungeonHighlights.kt index 5019151..aedd2e7 100644 --- a/src/main/kotlin/com/ambientaddons/features/dungeon/DungeonHighlights.kt +++ b/src/main/kotlin/com/ambientaddons/features/dungeon/DungeonHighlights.kt @@ -4,6 +4,7 @@ import AmbientAddons.Companion.config import AmbientAddons.Companion.mc import com.ambientaddons.utils.Area import com.ambientaddons.utils.Extensions.skyblockID +import com.ambientaddons.utils.Extensions.stripControlCodes import com.ambientaddons.utils.SBLocation import com.ambientaddons.utils.render.EntityUtils import net.minecraft.entity.Entity @@ -15,6 +16,7 @@ import net.minecraft.entity.monster.EntitySkeleton import net.minecraft.entity.passive.EntityBat import net.minecraft.entity.player.EntityPlayer import net.minecraft.item.ItemArmor +import net.minecraftforge.client.event.ClientChatReceivedEvent import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -37,7 +39,7 @@ object DungeonHighlights { @SubscribeEvent fun onRenderWorld(event: RenderWorldLastEvent) { - if (SBLocation.area != Area.Dungeon) return + if (SBLocation.area != Area.Dungeon || SBLocation.dungeonFloor?.enteredBoss == true) return mc.theWorld.loadedEntityList.forEach { entity -> if (entity is EntityArmorStand && entity.customNameTag.contains("✯") && !markedArmorStands.contains(entity)) { if (config.starredHighlight == 0) return@forEach @@ -48,10 +50,8 @@ object DungeonHighlights { }.forEach { starredMobs.add(it) } - } else if (entity is EntityPlayer) { - if (entity.uniqueID == idkmansry) { - nearIdkmansry = true - } + } else if (entity is EntityPlayer && mc.thePlayer.uniqueID != idkmansry && entity.uniqueID == idkmansry) { + nearIdkmansry = true } } mc.theWorld.loadedEntityList.forEach { 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 { |