aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/abilities
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-08-06 13:21:48 +0200
committerLorenz <lo.scherf@gmail.com>2022-08-06 13:21:48 +0200
commit5f2f88ac52502cb5da0a48f2a61a4977e005917c (patch)
tree65cd43650a5f0ad53c5d272915f1e51478346ffd /src/main/java/at/hannibal2/skyhanni/features/abilities
parent0ecc9092a8d98f05d29a1854770eb911edd9e2f6 (diff)
downloadskyhanni-5f2f88ac52502cb5da0a48f2a61a4977e005917c.tar.gz
skyhanni-5f2f88ac52502cb5da0a48f2a61a4977e005917c.tar.bz2
skyhanni-5f2f88ac52502cb5da0a48f2a61a4977e005917c.zip
add ashfang freeze cooldown
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/abilities')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/abilities/AshfangFreezeCooldown.kt43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/abilities/AshfangFreezeCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/abilities/AshfangFreezeCooldown.kt
new file mode 100644
index 000000000..5a5bdac0d
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/abilities/AshfangFreezeCooldown.kt
@@ -0,0 +1,43 @@
+package at.hannibal2.skyhanni.features.abilities
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.utils.GuiRender.renderString
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex
+import net.minecraftforge.client.event.RenderGameOverlayEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.text.DecimalFormat
+
+class AshfangFreezeCooldown {
+
+ var lastHit = 0L
+
+ @SubscribeEvent
+ fun onChatMessage(event: LorenzChatEvent) {
+ if (!isEnabled()) return
+
+ val message = event.message
+ if (message.matchRegex("§cAshfang Follower's Cryogenic Blast hit you for (.*) damage!")) {
+ lastHit = System.currentTimeMillis()
+ }
+ }
+
+ @SubscribeEvent
+ fun renderOverlay(event: RenderGameOverlayEvent.Post) {
+ if (!isEnabled()) return
+ val duration = System.currentTimeMillis() - lastHit
+ val maxDuration = 3_000
+
+ val remainingLong = maxDuration - duration
+ if (remainingLong > 0) {
+ val remaining = (remainingLong.toFloat() / 1000)
+ val format = DecimalFormat("0.0").format(remaining + 0.1)
+ SkyHanniMod.feature.abilities.ashfangFreezeCooldownPos.renderString("§cAshfang Freeze: §a${format}s")
+ }
+ }
+
+ private fun isEnabled(): Boolean {
+ return LorenzUtils.inSkyblock && SkyHanniMod.feature.abilities.ashfangFreezeCooldown
+ }
+} \ No newline at end of file