From 605f17d2afb6487822404fc1c8ee44df87877478 Mon Sep 17 00:00:00 2001 From: inglettronald Date: Sun, 2 Apr 2023 15:09:15 -0500 Subject: Dungeon Key Display initial commit --- src/main/kotlin/dulkirmod/events/ChatEvent.kt | 3 +++ .../dulkirmod/features/chat/DungeonKeyDisplay.kt | 26 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/main/kotlin/dulkirmod/features/chat/DungeonKeyDisplay.kt 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 -- cgit