aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/features/chat/DungeonKeyDisplay.kt
blob: d31de5672291a9203ca10f9f8b374065e4b16195 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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.area != "Dungeon") {
            hasKey = false
            return
        }
        if (stringUnformatted matches keyPickupMessage || stringUnformatted matches altPickupMessage) {
            hasKey = true
            return
        }
        if (stringUnformatted matches openMessage || stringUnformatted matches altOpenMessage) {
            hasKey = false
            return
        }
    }
}