aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/kotlin/dulkirmod/events/ChatEvent.kt3
-rw-r--r--src/main/kotlin/dulkirmod/features/chat/DungeonKeyDisplay.kt26
2 files changed, 29 insertions, 0 deletions
diff --git a/src/main/kotlin/dulkirmod/events/ChatEvent.kt b/src/main/kotlin/dulkirmod/events/ChatEvent.kt
index 8a4065e..b66765b 100644
--- a/src/main/kotlin/dulkirmod/events/ChatEvent.kt
+++ b/src/main/kotlin/dulkirmod/events/ChatEvent.kt
@@ -33,5 +33,8 @@ object ChatEvent {
// Quick vanquisher thing
VanquisherTrigger.handle(unformatted)
+
+ // Key Hud Element
+ DungeonKeyDisplay.handle(unformatted)
}
} \ No newline at end of file
diff --git a/src/main/kotlin/dulkirmod/features/chat/DungeonKeyDisplay.kt b/src/main/kotlin/dulkirmod/features/chat/DungeonKeyDisplay.kt
new file mode 100644
index 0000000..2ba01f0
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/features/chat/DungeonKeyDisplay.kt
@@ -0,0 +1,26 @@
+package dulkirmod.features.chat
+
+import dulkirmod.utils.TabListUtils
+
+object DungeonKeyDisplay {
+
+ private val keyPickupMessage = "^(\\[(.*)] )?([a-zA-Z]+) has obtained (Blood|Wither) Key!".toRegex()
+ private val altPickupMessage = "A Wither Key was picked up!".toRegex()
+ private val openMessage = "([a-zA-Z]+) opened a WITHER door!".toRegex()
+ private val altOpenMessage = "The BLOOD DOOR has been opened!".toRegex()
+ var hasKey = false;
+ fun handle(stringUnformatted: String) {
+ if (!TabListUtils.isInDungeons) {
+ hasKey = false
+ return
+ }
+ if (stringUnformatted matches keyPickupMessage || stringUnformatted matches altPickupMessage) {
+ hasKey = true
+ return
+ }
+ if (stringUnformatted matches openMessage || stringUnformatted matches altOpenMessage) {
+ hasKey = false
+ return
+ }
+ }
+} \ No newline at end of file