aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-04-07 11:01:41 +0200
committerGitHub <noreply@github.com>2024-04-07 11:01:41 +0200
commitf31e5aa4218b77e54f9438adc629c1c2bdd3e291 (patch)
tree4f7c6625b0bcc631fa755585ea1739affc143b64 /src/main/java/at/hannibal2/skyhanni/features
parent3cda068bcbb9b98a8e7704f5e14fffa535c079a1 (diff)
downloadskyhanni-f31e5aa4218b77e54f9438adc629c1c2bdd3e291.tar.gz
skyhanni-f31e5aa4218b77e54f9438adc629c1c2bdd3e291.tar.bz2
skyhanni-f31e5aa4218b77e54f9438adc629c1c2bdd3e291.zip
Improvement: Allow receiving inquisitor information from all chat (#1316)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt12
1 files changed, 9 insertions, 3 deletions
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> (?<playerName>.+)§f: §rx: (?<x>[^ ]+),? y: (?<y>[^ ]+),? z: (?<z>[^ ]+)"
+ "(?<party>§9Party §8> )?(?<playerName>.+)§f: §rx: (?<x>[^ ]+),? y: (?<y>[^ ]+),? z: (?<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> (?<playerName>.+)§f: §rA MINOS INQUISITOR has spawned near \\[(?<area>.*)] at Coords (?<x>[^ ]+) (?<y>[^ ]+) (?<z>[^ ]+)"
+ "(?<party>§9Party §8> )?(?<playerName>.+)§f: §rA MINOS INQUISITOR has spawned near \\[(?<area>.*)] at Coords (?<x>[^ ]+) (?<y>[^ ]+) (?<z>[^ ]+)"
)
private val diedPattern by patternGroup.pattern(
"died",
- "§9Party §8> (?<playerName>.*)§f: §rInquisitor dead!"
+ "(?<party>§9Party §8> )?(?<playerName>.*)§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