diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
3 files changed, 48 insertions, 18 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 666b2a80b..31accaddb 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 @@ -90,6 +90,11 @@ enum class ScoreboardElement( ::getHeatShowWhen, "Heat: §c♨ 0" ), + COLD( + ::getColdDisplayPair, + ::getColdShowWhen, + "Cold: §b❄ 0" + ), NORTH_STARS( ::getNorthStarsDisplayPair, ::getNorthStarsShowWhen, @@ -377,6 +382,21 @@ private fun getHeatDisplayPair(): List<ScoreboardElementType> { private fun getHeatShowWhen() = inAnyIsland(IslandType.CRYSTAL_HOLLOWS) && ScoreboardData.sidebarLinesFormatted.any { ScoreboardPattern.heatPattern.matches(it) } +private fun getColdDisplayPair(): List<ScoreboardElementType> { + val cold = getGroupFromPattern(ScoreboardData.sidebarLinesFormatted, ScoreboardPattern.coldPattern, "cold") + + return listOf( + when { + informationFilteringConfig.hideEmptyLines && cold == "0" -> "<hidden>" + displayConfig.displayNumbersFirst -> "§b❄ $cold Cold" + else -> "Cold: §b❄ $cold" + } to HorizontalAlignment.LEFT + ) +} + +private fun getColdShowWhen() = inAnyIsland(IslandType.DWARVEN_MINES, IslandType.MINESHAFT) + && ScoreboardData.sidebarLinesFormatted.any { ScoreboardPattern.coldPattern.matches(it) } + private fun getNorthStarsDisplayPair(): List<ScoreboardElementType> { val northStars = getGroupFromPattern(ScoreboardData.sidebarLinesFormatted, ScoreboardPattern.northstarsPattern, "northstars") @@ -597,32 +617,33 @@ private fun getQuiverShowWhen(): Boolean { } private fun getPowderDisplayPair() = buildList { - val mithrilPowder = - getGroupFromPattern( + val powderTypes = listOf( + "§2Mithril" to getGroupFromPattern( TabListData.getTabList(), ScoreboardPattern.mithrilPowderPattern, "mithrilpowder" - ) - .formatNum() - val gemstonePowder = - getGroupFromPattern( + ).formatNum(), + "§dGemstone" to getGroupFromPattern( TabListData.getTabList(), ScoreboardPattern.gemstonePowderPattern, "gemstonepowder" - ) - .formatNum() + ).formatNum(), + "§bGlacite" to getGroupFromPattern( + TabListData.getTabList(), + ScoreboardPattern.glacitePowderPattern, + "glacitepowder" + ).formatNum(), + ) - if (informationFilteringConfig.hideEmptyLines && mithrilPowder == "0" && gemstonePowder == "0") { + if (informationFilteringConfig.hideEmptyLines && powderTypes.all { it.second == "0" }) { add("<hidden>" to HorizontalAlignment.LEFT) } else { add("§9§lPowder" to HorizontalAlignment.LEFT) - if (displayConfig.displayNumbersFirst) { - add(" §7- §2$mithrilPowder Mithril" to HorizontalAlignment.LEFT) - add(" §7- §d$gemstonePowder Gemstone" to HorizontalAlignment.LEFT) - } else { - add(" §7- §fMithril: §2$mithrilPowder" to HorizontalAlignment.LEFT) - add(" §7- §fGemstone: §d$gemstonePowder" to HorizontalAlignment.LEFT) + for ((type, value) in powderTypes) { + if (value != "0") { + add(" §7- §f$type: $value" 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 cc9717ab3..916b5cc8f 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 @@ -18,6 +18,10 @@ object ScoreboardPattern { "heat", "^Heat: (?<heat>.*)$" ) // this line is weird (either text or number), ill leave it as is; it even has different colors? + val coldPattern by mainSb.pattern( + "cold", + "^Cold: §.❄ (?<cold>-?\\d+)$" + ) val copperPattern by mainSb.pattern( "copper", "^(§.)*Copper: (§.)*(?<copper>[\\d,]+).*$" @@ -167,7 +171,7 @@ object ScoreboardPattern { private val miningSb = scoreboardGroup.group("mining") val powderPattern by miningSb.pattern( "powder", - "(§.)*᠅ §f(Gemstone|Mithril)( Powder)?(§.)*:?.*$" + "(§.)*᠅ §.(Gemstone|Mithril|Glacite)( Powder)?(§.)*:?.*$" ) val windCompassPattern by miningSb.pattern( "windcompass", @@ -279,7 +283,7 @@ object ScoreboardPattern { private val miscSb = scoreboardGroup.group("misc") val essencePattern by miscSb.pattern( "essence", - "^\\s*(.*)?Essence: §.(?<essence>-?\\d+(:?,\\d{3})*(?:\\.\\d+)?)$" + "^\\s*.*Essence: §.(?<essence>-?\\d+(:?,\\d{3})*(?:\\.\\d+)?)$" ) val brokenRedstonePattern by miscSb.pattern( "brokenredstone", @@ -399,6 +403,10 @@ object ScoreboardPattern { "gemstonepowder", "^\\s*Gemstone Powder: (?:§.)+(?<gemstonepowder>[\\d,\\.]+)$" ) + val glacitePowderPattern by tablistGroup.pattern( + "glacitepowder", + "^\\s*Glacite Powder: (?:§.)+(?<glacitepowder>[\\d,\\.]+)$" + ) val eventNamePattern by tablistGroup.pattern( "event", "^\\s*§e§lEvent: §r(?<name>§.*)$" diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index ed0af59eb..0c267e6c0 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -366,7 +366,8 @@ object LorenzUtils { @Deprecated("moved", ReplaceWith("ChatUtils.sendMessageToServer(message)")) fun sendMessageToServer(message: String) = ChatUtils.sendMessageToServer(message) - fun inAdvancedMiningIsland() = IslandType.DWARVEN_MINES.isInIsland() || IslandType.CRYSTAL_HOLLOWS.isInIsland() + fun inAdvancedMiningIsland() = + IslandType.DWARVEN_MINES.isInIsland() || IslandType.CRYSTAL_HOLLOWS.isInIsland() || IslandType.MINESHAFT.isInIsland() fun inMiningIsland() = IslandType.GOLD_MINES.isInIsland() || IslandType.DEEP_CAVERNS.isInIsland() || inAdvancedMiningIsland() |