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/main/kotlin/com/ambientaddons/features/display/ThornOverlay.kt | |
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/main/kotlin/com/ambientaddons/features/display/ThornOverlay.kt')
-rw-r--r-- | src/main/kotlin/com/ambientaddons/features/display/ThornOverlay.kt | 6 |
1 files changed, 4 insertions, 2 deletions
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) |