aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/com/dulkirfabric/Registrations.kt1
-rw-r--r--src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt13
-rw-r--r--src/main/kotlin/com/dulkirfabric/events/AreaChangeEvent.kt5
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/VisitorAlert.kt45
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/slayer/BossTimer.kt2
-rw-r--r--src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt6
6 files changed, 71 insertions, 1 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/Registrations.kt b/src/main/kotlin/com/dulkirfabric/Registrations.kt
index 3dee251..e859c6a 100644
--- a/src/main/kotlin/com/dulkirfabric/Registrations.kt
+++ b/src/main/kotlin/com/dulkirfabric/Registrations.kt
@@ -95,6 +95,7 @@ object Registrations {
EVENT_BUS.subscribe(BossTimer)
EVENT_BUS.subscribe(DamageNumbers)
EVENT_BUS.subscribe(Garden)
+ EVENT_BUS.subscribe(VisitorAlert)
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 b7f7ca0..a2a7d66 100644
--- a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt
+++ b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt
@@ -285,6 +285,10 @@ class DulkirConfig {
entryBuilder.mkToggle(Text.literal("MiniBoss Announcement Alert"), configOptions::announceMinis)
)
slayer.addEntry(
+ entryBuilder.mkToggle(Text.literal("Show Kill Time on Slayer Completion"), configOptions::slayerKillTime,
+ Text.literal("Shows up in chat!"))
+ )
+ slayer.addEntry(
entryBuilder.mkToggle(Text.literal("Blaze Slayer Attunement Display"), configOptions::attunementDisplay,
Text.literal("Shows a wireframe in the correct color for the slayer."))
)
@@ -299,6 +303,12 @@ class DulkirConfig {
garden.addEntry(
entryBuilder.mkToggle(Text.literal("Show Composter Info in HUD"), configOptions::showComposterInfo)
)
+ garden.addEntry(
+ entryBuilder.mkToggle(Text.literal("Show Title alert when max visitors"), configOptions::visitorAlert)
+ )
+ garden.addEntry(
+ entryBuilder.mkToggle(Text.literal("Persistent Visitor alert (dependent on previous)"), configOptions::persistentVisitorAlert)
+ )
builder.transparentBackground()
screen = builder.build()
@@ -350,6 +360,9 @@ class DulkirConfig {
var hideCrits: Boolean = false,
var visitorHud: Boolean = false,
var showComposterInfo: Boolean = false,
+ var slayerKillTime: Boolean = false,
+ var visitorAlert: Boolean = false,
+ var persistentVisitorAlert: Boolean = false,
)
@Serializable
diff --git a/src/main/kotlin/com/dulkirfabric/events/AreaChangeEvent.kt b/src/main/kotlin/com/dulkirfabric/events/AreaChangeEvent.kt
new file mode 100644
index 0000000..e3e8c2a
--- /dev/null
+++ b/src/main/kotlin/com/dulkirfabric/events/AreaChangeEvent.kt
@@ -0,0 +1,5 @@
+package com.dulkirfabric.events
+
+import com.dulkirfabric.events.base.Event
+
+data class AreaChangeEvent(val newArea: String, val prevArea: String): Event() \ No newline at end of file
diff --git a/src/main/kotlin/com/dulkirfabric/features/VisitorAlert.kt b/src/main/kotlin/com/dulkirfabric/features/VisitorAlert.kt
new file mode 100644
index 0000000..9f75d83
--- /dev/null
+++ b/src/main/kotlin/com/dulkirfabric/features/VisitorAlert.kt
@@ -0,0 +1,45 @@
+package com.dulkirfabric.features
+
+import com.dulkirfabric.config.DulkirConfig
+import com.dulkirfabric.events.AreaChangeEvent
+import com.dulkirfabric.events.HudRenderEvent
+import com.dulkirfabric.events.LongUpdateEvent
+import com.dulkirfabric.util.TablistUtils
+import com.dulkirfabric.util.render.HudRenderUtil
+import meteordevelopment.orbit.EventHandler
+import net.minecraft.text.Style
+import net.minecraft.text.Text
+import net.minecraft.util.Formatting
+import java.time.Duration
+
+object VisitorAlert {
+
+ private var canAlert = true
+ private var prevVisitorState = ""
+
+ @EventHandler
+ private fun onAreaChange(event: AreaChangeEvent) {
+ canAlert = true
+ }
+
+ @EventHandler
+ private fun onLong(event: LongUpdateEvent) {
+ if (TablistUtils.persistentInfo.area != "Garden") return
+ if (TablistUtils.persistentInfo.nextVisitorTime == "Queue Full!") {
+ if (DulkirConfig.configOptions.persistentVisitorAlert) {
+ HudRenderUtil.drawTitle(
+ Text.literal("Max Visitors").setStyle(Style.EMPTY.withColor(Formatting.GOLD)),
+ Duration.ofSeconds(5)
+ )
+ } else if (canAlert) {
+ HudRenderUtil.drawTitle(
+ Text.literal("Max Visitors").setStyle(Style.EMPTY.withColor(Formatting.GOLD)),
+ Duration.ofSeconds(5)
+ )
+ canAlert = false
+ }
+ }
+
+ prevVisitorState = TablistUtils.persistentInfo.nextVisitorTime
+ }
+} \ No newline at end of file
diff --git a/src/main/kotlin/com/dulkirfabric/features/slayer/BossTimer.kt b/src/main/kotlin/com/dulkirfabric/features/slayer/BossTimer.kt
index c08ed97..563a660 100644
--- a/src/main/kotlin/com/dulkirfabric/features/slayer/BossTimer.kt
+++ b/src/main/kotlin/com/dulkirfabric/features/slayer/BossTimer.kt
@@ -1,5 +1,6 @@
package com.dulkirfabric.features.slayer
+import com.dulkirfabric.config.DulkirConfig
import com.dulkirfabric.events.SlayerBossEvents
import com.dulkirfabric.util.TextUtils
import meteordevelopment.orbit.EventHandler
@@ -17,6 +18,7 @@ object BossTimer {
@EventHandler
fun onSlayerKill(event: SlayerBossEvents.Kill) {
+ if (!DulkirConfig.configOptions.slayerKillTime) return
if (lastType != event.type) return
val bossTime: Float = (event.timestamp - lastSpawnTime) / 1000f
TextUtils.info("ยง6Slayer Boss took ${"%.2f".format(bossTime)}s to kill.")
diff --git a/src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt b/src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt
index 881b3b9..b69f0b4 100644
--- a/src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt
+++ b/src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt
@@ -1,6 +1,7 @@
package com.dulkirfabric.util
import com.dulkirfabric.DulkirModFabric.mc
+import com.dulkirfabric.events.AreaChangeEvent
import com.dulkirfabric.events.LongUpdateEvent
import meteordevelopment.orbit.EventHandler
import net.minecraft.client.network.PlayerListEntry
@@ -35,7 +36,10 @@ object TablistUtils {
tablist!!.forEach {
val str = it.displayName?.string?.trim() ?: return@forEach
areaPattern.find(str)?.let { result ->
- persistentInfo.area = result.groupValues[1]
+ if (persistentInfo.area != result.groupValues[1]) {
+ AreaChangeEvent(result.groupValues[1], persistentInfo.area).post()
+ persistentInfo.area = result.groupValues[1]
+ }
return@forEach
}