aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/dulkirfabric/features/slayer/BossTimer.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric/features/slayer/BossTimer.kt')
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/slayer/BossTimer.kt24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/features/slayer/BossTimer.kt b/src/main/kotlin/com/dulkirfabric/features/slayer/BossTimer.kt
new file mode 100644
index 0000000..c08ed97
--- /dev/null
+++ b/src/main/kotlin/com/dulkirfabric/features/slayer/BossTimer.kt
@@ -0,0 +1,24 @@
+package com.dulkirfabric.features.slayer
+
+import com.dulkirfabric.events.SlayerBossEvents
+import com.dulkirfabric.util.TextUtils
+import meteordevelopment.orbit.EventHandler
+
+object BossTimer {
+
+ private var lastSpawnTime: Long = 0
+ private var lastType = ""
+
+ @EventHandler
+ fun onSlayerStart(event: SlayerBossEvents.Spawn) {
+ lastType = event.type
+ lastSpawnTime = event.timestamp
+ }
+
+ @EventHandler
+ fun onSlayerKill(event: SlayerBossEvents.Kill) {
+ if (lastType != event.type) return
+ val bossTime: Float = (event.timestamp - lastSpawnTime) / 1000f
+ TextUtils.info("ยง6Slayer Boss took ${"%.2f".format(bossTime)}s to kill.")
+ }
+} \ No newline at end of file