aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorronald <inglettronald@gmail.com>2023-07-29 12:30:06 -0500
committerronald <inglettronald@gmail.com>2023-07-29 12:30:06 -0500
commit130377f112ac4c64c138e15b2541d95381964c6a (patch)
tree9549c677b45a94db40fe43d721b28a3c513efca2 /src
parent7705c7606298a5c67c64f1e088c4ef93ee042e95 (diff)
downloadDulkirMod-Fabric-130377f112ac4c64c138e15b2541d95381964c6a.tar.gz
DulkirMod-Fabric-130377f112ac4c64c138e15b2541d95381964c6a.tar.bz2
DulkirMod-Fabric-130377f112ac4c64c138e15b2541d95381964c6a.zip
Slayer Boss Timer and clean Blaze boss impl
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/com/dulkirfabric/Registrations.kt3
-rw-r--r--src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt8
-rw-r--r--src/main/kotlin/com/dulkirfabric/events/SlayerBossEvents.kt5
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/slayer/BossTimer.kt24
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/slayer/Demonlord.kt30
-rw-r--r--src/main/kotlin/com/dulkirfabric/util/Utils.kt9
6 files changed, 73 insertions, 6 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/Registrations.kt b/src/main/kotlin/com/dulkirfabric/Registrations.kt
index 0a87c0d..fa86fc8 100644
--- a/src/main/kotlin/com/dulkirfabric/Registrations.kt
+++ b/src/main/kotlin/com/dulkirfabric/Registrations.kt
@@ -12,6 +12,7 @@ import com.dulkirfabric.features.chat.BridgeBotFormatter
import com.dulkirfabric.features.chat.ChatStacking
import com.dulkirfabric.features.filters.CullExplosionParticles
import com.dulkirfabric.features.filters.Lightning
+import com.dulkirfabric.features.slayer.BossTimer
import com.dulkirfabric.features.slayer.Demonlord
import com.dulkirfabric.features.slayer.MiniBossHighlight
import com.dulkirfabric.hud.ActionBarHudReplacements
@@ -83,7 +84,6 @@ object Registrations {
EVENT_BUS.subscribe(SpeedOverlay)
EVENT_BUS.subscribe(ActionBarUtil)
EVENT_BUS.subscribe(ActionBarHudReplacements)
- EVENT_BUS.subscribe(ChatStacking)
EVENT_BUS.subscribe(AotvHighlight)
EVENT_BUS.subscribe(MiniBossHighlight)
EVENT_BUS.subscribe(ScoreBoardUtils)
@@ -91,6 +91,7 @@ object Registrations {
EVENT_BUS.subscribe(Demonlord)
EVENT_BUS.subscribe(Lightning)
EVENT_BUS.subscribe(Utils)
+ EVENT_BUS.subscribe(BossTimer)
if (FabricLoader.getInstance().isDevelopmentEnvironment)
EVENT_BUS.subscribe(RenderTest)
diff --git a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt
index 246912a..8dbca32 100644
--- a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt
+++ b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt
@@ -280,7 +280,9 @@ class DulkirConfig {
entryBuilder.mkToggle(Text.literal("Blaze Slayer Attunement Display"), configOptions::attunementDisplay,
Text.literal("Shows a wireframe in the correct color for the slayer."))
)
-
+ slayer.addEntry(
+ entryBuilder.mkToggle(Text.literal("Disable ALL particles during Blaze slayer boss"), configOptions::cleanBlaze)
+ )
builder.transparentBackground()
screen = builder.build()
}
@@ -323,7 +325,9 @@ class DulkirConfig {
var boxMinis: Boolean = false,
var attunementDisplay: Boolean = false,
var hideFireOverlay: Boolean = false,
- var hideLightning: Boolean = false
+ var hideLightning: Boolean = false,
+ var cleanBlaze: Boolean= false,
+ var timeSlayerBoss: Boolean = false,
)
@Serializable
diff --git a/src/main/kotlin/com/dulkirfabric/events/SlayerBossEvents.kt b/src/main/kotlin/com/dulkirfabric/events/SlayerBossEvents.kt
index d16c854..7097ccb 100644
--- a/src/main/kotlin/com/dulkirfabric/events/SlayerBossEvents.kt
+++ b/src/main/kotlin/com/dulkirfabric/events/SlayerBossEvents.kt
@@ -12,4 +12,9 @@ class SlayerBossEvents {
val type: String,
var timestamp: Long = System.currentTimeMillis()
): Event()
+
+ data class Fail(
+ val type: String,
+ var timestamp: Long = System.currentTimeMillis()
+ ): Event()
}
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
diff --git a/src/main/kotlin/com/dulkirfabric/features/slayer/Demonlord.kt b/src/main/kotlin/com/dulkirfabric/features/slayer/Demonlord.kt
index 434c866..b9d03d1 100644
--- a/src/main/kotlin/com/dulkirfabric/features/slayer/Demonlord.kt
+++ b/src/main/kotlin/com/dulkirfabric/features/slayer/Demonlord.kt
@@ -1,7 +1,10 @@
package com.dulkirfabric.features.slayer
import com.dulkirfabric.DulkirModFabric.mc
+import com.dulkirfabric.config.DulkirConfig
+import com.dulkirfabric.events.AddParticleEvent
import com.dulkirfabric.events.PlaySoundEvent
+import com.dulkirfabric.events.SlayerBossEvents
import com.dulkirfabric.events.WorldRenderLastEvent
import com.dulkirfabric.util.TablistUtils
import com.dulkirfabric.util.TextUtils
@@ -21,6 +24,8 @@ object Demonlord {
"SPIRIT ♨" to Color(255, 255, 255, 255)
)
private val box = Box(-.5, -.4, -.5, .5, -1.9, .5)
+ private var inBoss: Boolean = false
+ private var lastSpawnTime: Long = 0
@EventHandler
fun attunementHighlight(event: WorldRenderLastEvent) {
@@ -40,4 +45,29 @@ object Demonlord {
}
}
}
+
+ @EventHandler
+ fun onSlayerStart(event: SlayerBossEvents.Spawn) {
+ if (event.type.contains("Demonlord")) {
+ inBoss = true
+ lastSpawnTime = event.timestamp
+ }
+ }
+
+ @EventHandler
+ fun onSlayerKill(event: SlayerBossEvents.Kill) {
+ inBoss = false
+ }
+
+ @EventHandler
+ fun onSlayerFail(event: SlayerBossEvents.Fail) {
+ inBoss = false
+ }
+
+ @EventHandler
+ fun onParticle(event: AddParticleEvent) {
+ if (!DulkirConfig.configOptions.cleanBlaze) return
+ if (!inBoss) return
+ event.cancel()
+ }
} \ No newline at end of file
diff --git a/src/main/kotlin/com/dulkirfabric/util/Utils.kt b/src/main/kotlin/com/dulkirfabric/util/Utils.kt
index 1f781d3..c2d65c3 100644
--- a/src/main/kotlin/com/dulkirfabric/util/Utils.kt
+++ b/src/main/kotlin/com/dulkirfabric/util/Utils.kt
@@ -35,8 +35,11 @@ object Utils {
}
@EventHandler
- fun detectSlayerKill(event: ChatEvents.AllowChat) {
- if (event.message.string.trim() != "SLAYER QUEST COMPLETE!") return
- SlayerBossEvents.Kill(ScoreBoardUtils.slayerType?: return ScoreBoardUtils.err()).post()
+ fun detectSlayerEvents(event: ChatEvents.AllowChat) {
+ if (event.message.string.trim() == "SLAYER QUEST COMPLETE!") {
+ SlayerBossEvents.Kill(ScoreBoardUtils.slayerType ?: return ScoreBoardUtils.err()).post()
+ } else if (event.message.string.trim() == "SLAYER QUEST FAILED!") {
+ SlayerBossEvents.Fail(ScoreBoardUtils.slayerType ?: return ScoreBoardUtils.err()).post()
+ }
}
} \ No newline at end of file