aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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"
+ )
}