aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt
blob: 60fd79f6d5770fe87197c64aa2690de42bef90ef (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package at.hannibal2.skyhanni.features.dungeon

import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

class DungeonBossMessages {

    @SubscribeEvent
    fun onChatMessage(event: LorenzChatEvent) {
        if (!LorenzUtils.inDungeons) return
        if (!isBoss(event.message)) return

        DungeonData.handleBossMessage(event.message)

        if (SkyHanniMod.feature.chat.dungeonBossMessages) {
            event.blockedReason = "dungeon_boss"
        }
    }

    private fun isBoss(message: String): Boolean {
        when {
            message.matchRegex("§([cd4])\\[BOSS] (.*)") -> {
                when {
                    message.contains(" The Watcher§r§f: ") ->
                        message != "§c[BOSS] The Watcher§r§f: You have proven yourself. You may pass."

                    message.contains(" Bonzo§r§f: ") -> return true
                    message.contains(" Scarf§r§f:") -> return true
                    message.contains("Professor§r§f") -> return true
                    message.contains(" Livid§r§f: ") || message.contains(" Enderman§r§f: ") -> return true
                    message.contains(" Thorn§r§f: ") -> return true
                    message.contains(" Sadan§r§f: ") -> return true
                    message.contains(" Maxor§r§c: ") -> return true
                    message.contains(" Storm§r§c: ") -> return true
                    message.contains(" Goldor§r§c: ") -> return true
                    message.contains(" Necron§r§c: ") -> return true
                    message.contains(" §r§4§kWither King§r§c:") -> return true

                    message.endsWith(" Necron§r§c: That is enough, fool!") -> return true
                    message.endsWith(" Necron§r§c: Adventurers! Be careful of who you are messing with..") -> return true
                    message.endsWith(" Necron§r§c: Before I have to deal with you myself.") -> return true
                }
            }

            //M7 – Dragons
            message == "§cThe Crystal withers your soul as you hold it in your hands!" -> return true
            message == "§cIt doesn't seem like that is supposed to go there." -> return true
        }
        return false
    }
}