aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoringlettronald <inglettronald@gmail.com>2023-04-02 15:09:15 -0500
committeringlettronald <inglettronald@gmail.com>2023-04-02 15:09:15 -0500
commit605f17d2afb6487822404fc1c8ee44df87877478 (patch)
treeff332ee488c995eb73155f201e14e4b881e40a9d
parent2f6a1525e0b87fba9b144476b2fcaa54e4433596 (diff)
downloadDulkirMod-605f17d2afb6487822404fc1c8ee44df87877478.tar.gz
DulkirMod-605f17d2afb6487822404fc1c8ee44df87877478.tar.bz2
DulkirMod-605f17d2afb6487822404fc1c8ee44df87877478.zip
Dungeon Key Display initial commit
-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