aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/gui
diff options
context:
space:
mode:
authorJ10a1n15 <45315647+j10a1n15@users.noreply.github.com>2024-03-26 18:04:41 +0100
committerGitHub <noreply@github.com>2024-03-26 18:04:41 +0100
commit077aea0b56cb31c383fdf9668bdcf06611fbd62b (patch)
treea323f9d930ab60cce541b8b287bedbfa38cbe36c /src/main/java/at/hannibal2/skyhanni/features/gui
parent6582eefb98545c6c05430e7205e2c6e6c012169d (diff)
downloadskyhanni-077aea0b56cb31c383fdf9668bdcf06611fbd62b.tar.gz
skyhanni-077aea0b56cb31c383fdf9668bdcf06611fbd62b.tar.bz2
skyhanni-077aea0b56cb31c383fdf9668bdcf06611fbd62b.zip
Fix: Fixed Cookie Time with Effect Widget in Custom Scoreboard (#1261)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/gui')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt30
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt8
3 files changed, 32 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt
index 3c375a522..3a2c7740b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt
@@ -13,6 +13,8 @@
// - color options in the purse etc lines
// - choose the amount of decimal places in shorten nums
// - more anchor points (alignment enums in renderutils)
+// - 24h instead of 12h for skyblock time
+// - only alert for lines that exist longer than 1s
//
package at.hannibal2.skyhanni.features.gui.customscoreboard
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 89e00c16f..3e9c7f434 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
@@ -30,6 +30,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.percentageColor
import at.hannibal2.skyhanni.utils.RenderUtils.HorizontalAlignment
import at.hannibal2.skyhanni.utils.StringUtils
import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.matches
import at.hannibal2.skyhanni.utils.TabListData
import at.hannibal2.skyhanni.utils.TimeUtils.format
@@ -588,16 +589,32 @@ private fun getTuningDisplayPair(): List<Pair<String, HorizontalAlignment>> {
private fun getPowerShowWhen() = !inAnyIsland(IslandType.THE_RIFT)
+private fun getCookieTime(): String? {
+ return CustomScoreboardUtils.getTablistFooter().split("\n")
+ .nextAfter("§d§lCookie Buff")
+ ?: run {
+ for (line in TabListData.getTabList()) {
+ ScoreboardPattern.boosterCookieEffectsWidgetPattern.matchMatcher(line) {
+ return group("time")
+ }
+ }
+ null
+ }
+}
+
private fun getCookieDisplayPair(): List<ScoreboardElementType> {
- val timeLine = CustomScoreboardUtils.getTablistFooter().split("\n")
- .nextAfter("§d§lCookie Buff") ?: "<hidden>"
+ val timeLine: String = getCookieTime()
+ ?: return listOf(
+ "§d§lCookie Buff" to HorizontalAlignment.LEFT,
+ " §7- §cNot active" to HorizontalAlignment.LEFT
+ )
return listOf(
"§d§lCookie Buff" to HorizontalAlignment.LEFT,
- if (timeLine.contains("Not active"))
+ if (ScoreboardPattern.cookieNotActivePattern.matches(timeLine))
" §7- §cNot active" to HorizontalAlignment.LEFT
else
- " §7- §e${timeLine.substringAfter("§d§lCookie Buff").trim()}" to HorizontalAlignment.LEFT
+ " §7- §f${timeLine}" to HorizontalAlignment.LEFT
)
}
@@ -605,10 +622,7 @@ private fun getCookieShowWhen(): Boolean {
if (HypixelData.bingo) return false
return if (informationFilteringConfig.hideEmptyLines) {
- CustomScoreboardUtils.getTablistFooter().split("\n").any {
- CustomScoreboardUtils.getTablistFooter().split("\n").nextAfter("§d§lCookie Buff")?.contains(it)
- ?: false
- }
+ getCookieTime() != null
} else {
true
}
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 222e85733..dd46d2a44 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
@@ -415,4 +415,12 @@ object ScoreboardPattern {
"eventtime",
"^\\s+Ends In: §r§e(?<time>.*)$"
)
+ val boosterCookieEffectsWidgetPattern by tablistGroup.pattern(
+ "boostereffects",
+ "\\s*(?:§.)*Cookie Buff(?:§.)*: (?:§r)*(?<time>.*)"
+ )
+ val cookieNotActivePattern by tablistGroup.pattern(
+ "cookienotactive",
+ "Not active|§c§lINACTIVE"
+ )
}