blob: 873119171ddb3e15783f1f8c181925860e36383c (
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
|
package at.hannibal2.skyhanni.data
import at.hannibal2.skyhanni.events.LorenzActionBarEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object ActionBarStatsData {
private val patterns = mapOf(
"health" to "§[c6](?<health>[\\d,]+)/[\\d,]+❤.*".toPattern(),
"defense" to ".*§a(?<defense>[\\d,]+)§a❈.*".toPattern(),
"mana" to ".*§b(?<mana>[\\d,]+)/[\\d,]+✎.*".toPattern(),
"riftTime" to "§[a7](?<riftTime>[\\dms ]+)ф.*".toPattern(),
)
var groups = mutableMapOf("health" to "", "riftTime" to "", "defense" to "", "mana" to "")
@SubscribeEvent
fun onActionBar(event: LorenzActionBarEvent) {
if (!LorenzUtils.inSkyBlock) return
for ((groupName, pattern) in patterns) {
pattern.matchMatcher(event.message) {
groups[groupName] = group(groupName)
}
}
}
}
|