From f31e5aa4218b77e54f9438adc629c1c2bdd3e291 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Sun, 7 Apr 2024 11:01:41 +0200 Subject: Improvement: Allow receiving inquisitor information from all chat (#1316) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/features/event/diana/InquisitorWaypointShare.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt index 31de087cd..42a4c8850 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt @@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.hasGroup import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SoundUtils @@ -34,12 +35,13 @@ object InquisitorWaypointShare { private val config get() = SkyHanniMod.feature.event.diana.inquisitorSharing private val patternGroup = RepoPattern.group("diana.waypoints") + /** * REGEX-TEST: §9Party §8> User Name§f: §rx: 2.3, y: 4.5, z: 6.7 */ private val partyOnlyCoordsPattern by patternGroup.pattern( "party.onlycoords", - "§9Party §8> (?.+)§f: §rx: (?[^ ]+),? y: (?[^ ]+),? z: (?[^ ]+)" + "(?§9Party §8> )?(?.+)§f: §rx: (?[^ ]+),? y: (?[^ ]+),? z: (?[^ ]+)" ) //Support for https://www.chattriggers.com/modules/v/inquisitorchecker @@ -48,11 +50,11 @@ object InquisitorWaypointShare { */ private val partyInquisitorCheckerPattern by patternGroup.pattern( "party.inquisitorchecker", - "§9Party §8> (?.+)§f: §rA MINOS INQUISITOR has spawned near \\[(?.*)] at Coords (?[^ ]+) (?[^ ]+) (?[^ ]+)" + "(?§9Party §8> )?(?.+)§f: §rA MINOS INQUISITOR has spawned near \\[(?.*)] at Coords (?[^ ]+) (?[^ ]+) (?[^ ]+)" ) private val diedPattern by patternGroup.pattern( "died", - "§9Party §8> (?.*)§f: §rInquisitor dead!" + "(?§9Party §8> )?(?.*)§f: §rInquisitor dead!" ) private var time = 0L @@ -258,6 +260,7 @@ object InquisitorWaypointShare { } } diedPattern.matchMatcher(message) { + if (block()) return val rawName = group("playerName") val name = rawName.cleanPlayerName() val displayName = rawName.cleanPlayerName(displayName = true) @@ -267,7 +270,10 @@ object InquisitorWaypointShare { } } + private fun Matcher.block(): Boolean = !hasGroup("party") && !config.globalChat + private fun Matcher.detectFromChat(): Boolean { + if (block()) return false val rawName = group("playerName") val x = group("x").trim().toDoubleOrNull() ?: return false val y = group("y").trim().toDoubleOrNull() ?: return false -- cgit