aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJ10a1n15 <45315647+j10a1n15@users.noreply.github.com>2024-07-21 10:46:02 +0200
committerGitHub <noreply@github.com>2024-07-21 10:46:02 +0200
commit56da75a2b9dbeaeeab3f5a89d485b6be48affec8 (patch)
tree95a0236251333b5d52d3296a06ae81b840d2db59 /src
parent66ff8dafcfb82111437f50d9951532910a6d3c91 (diff)
downloadskyhanni-56da75a2b9dbeaeeab3f5a89d485b6be48affec8.tar.gz
skyhanni-56da75a2b9dbeaeeab3f5a89d485b6be48affec8.tar.bz2
skyhanni-56da75a2b9dbeaeeab3f5a89d485b6be48affec8.zip
Fix: Kuudra Errors (#2236)
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt19
3 files changed, 29 insertions, 20 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
index a3b3652b2..6562edaf3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
@@ -632,17 +632,21 @@ private fun getCookieShowWhen(): Boolean {
}
private fun getObjectiveDisplayPair() = buildList {
- val objective =
- ScoreboardData.sidebarLinesFormatted.first { ScoreboardPattern.objectivePattern.matches(it) }
+ val formattedLines = ScoreboardData.sidebarLinesFormatted
+ val objective = formattedLines.firstOrNull { ScoreboardPattern.objectivePattern.matches(it) }
+ if (objective != null) {
+ add(objective to HorizontalAlignment.LEFT)
- add(objective to HorizontalAlignment.LEFT)
- add((ScoreboardData.sidebarLinesFormatted.nextAfter(objective) ?: "<hidden>") to HorizontalAlignment.LEFT)
+ val secondLine = formattedLines.nextAfter(objective) ?: "<hidden>"
+ add(secondLine to HorizontalAlignment.LEFT)
- if (ScoreboardData.sidebarLinesFormatted.any { ScoreboardPattern.thirdObjectiveLinePattern.matches(it) }) {
- add(
- (ScoreboardData.sidebarLinesFormatted.nextAfter(objective, 2)
- ?: "Second objective here") to HorizontalAlignment.LEFT,
- )
+ formattedLines.nextAfter(objective, 2)?.let {
+ if (ScoreboardPattern.thirdObjectiveLinePattern.matches(it)) add(it to HorizontalAlignment.LEFT)
+ }
+
+ formattedLines.nextAfter(objective, 3)?.let {
+ if (ScoreboardPattern.thirdObjectiveLinePattern.matches(it)) add(it to HorizontalAlignment.LEFT)
+ }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt
index 62b282b37..d9126ef44 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt
@@ -153,10 +153,11 @@ object ScoreboardPattern {
/**
* REGEX-TEST: Submerges In: §e01m 00s
+ * REGEX-TEST: Submerges In: §e???
*/
val submergesPattern by kuudraSb.pattern(
"submerges",
- "(?:§.)*Submerges In: (?:§.)*[\\w\\s]+",
+ "(?:§.)*Submerges In: (?:§.)*[\\w\\s?]+",
)
// farming
@@ -392,7 +393,10 @@ object ScoreboardPattern {
"§d\\d+(?:st|nd|rd|th) Anniversary§f (?:\\d|:)+",
)
- // this thirdObjectiveLinePattern includes all those weird objective lines that go into a third scoreboard line
+ // this thirdObjectiveLinePattern includes all those weird objective lines that go into a third (and fourth) scoreboard line
+ /**
+ * REGEX-TEST: §eProtect Elle §7(§a98%§7)
+ */
val thirdObjectiveLinePattern by miscSb.pattern(
"thirdobjectiveline",
"(\\s*§.\\(§.\\w+§./§.\\w+§.\\)|§f Mages.*|§f Barbarians.*|§edefeat Kuudra|§eand stun him)",
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt
index a38b52d78..bbae099d6 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt
@@ -142,16 +142,17 @@ object UnknownLinesHandler {
}
/**
- * remove known text
+ * Remove Known Text
**/
- // remove objectives
- val objectiveLine = sidebarLines.firstOrNull { SbPattern.objectivePattern.matches(it) }
- ?: "Objective"
- unknownLines = unknownLines.filter { sidebarLines.nextAfter(objectiveLine) != it }
- // TODO create function
- unknownLines = unknownLines.filter {
- sidebarLines.nextAfter(objectiveLine, 2) != it &&
- !SbPattern.thirdObjectiveLinePattern.matches(it)
+ // Remove objectives
+ val objectiveLine = sidebarLines.firstOrNull { SbPattern.objectivePattern.matches(it) } ?: "Objective"
+
+ unknownLines = unknownLines.filter { line ->
+ val nextLine = sidebarLines.nextAfter(objectiveLine)
+ val secondNextLine = sidebarLines.nextAfter(objectiveLine, 2)
+ val thirdNextLine = sidebarLines.nextAfter(objectiveLine, 3)
+
+ line != nextLine && line != secondNextLine && line != thirdNextLine && !SbPattern.thirdObjectiveLinePattern.matches(line)
}
// Remove jacobs contest