Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: Added Display Options to Powder in Custom Scoreboard #1442

Merged
merged 41 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
40af948
input some data
Thunderblade73 Dec 29, 2023
b4991e4
working
Thunderblade73 Feb 24, 2024
ed8846a
added full storage support, copy tree, powder and tokens
Thunderblade73 Feb 25, 2024
2ed9de7
test
Thunderblade73 Feb 25, 2024
03b008d
improved the rewardFun
Thunderblade73 Feb 25, 2024
94f7801
rename of file
Thunderblade73 Feb 25, 2024
11a7b19
Merge branch 'beta' into hotm-API
Thunderblade73 Feb 25, 2024
f63774c
made feature separate
Thunderblade73 Feb 25, 2024
8950236
fix
Thunderblade73 Feb 25, 2024
bcbdab0
fix
Thunderblade73 Feb 25, 2024
243a4c2
Revert "test"
Thunderblade73 Feb 25, 2024
ed0f783
max level hide
Thunderblade73 Feb 25, 2024
f5136a8
fixed missing new line
Thunderblade73 Feb 25, 2024
c4e431b
updated format
Thunderblade73 Feb 25, 2024
d954a74
.
Thunderblade73 Feb 25, 2024
35158f2
Merge branch 'beta' into hotm-API
Thunderblade73 Mar 16, 2024
8d45844
Merge branch 'beta' into hotm-API
Thunderblade73 Mar 17, 2024
8b70d6c
Merge branch 'beta' into hotm-API
Thunderblade73 Mar 28, 2024
6c46d32
Merge branch 'beta' into hotm-API
Thunderblade73 Apr 3, 2024
b003bc9
Merge branch 'beta' into hotm-API
Thunderblade73 Apr 7, 2024
2089acd
Mining V3
Thunderblade73 Apr 13, 2024
ab77fa2
Merge branch 'beta' into hotm-API
Thunderblade73 Apr 13, 2024
9f8bf3f
Merge branch 'beta' into hotm-API
Thunderblade73 Apr 13, 2024
f4f8467
fix
Thunderblade73 Apr 13, 2024
801a2e9
Merge pull request #19 from Thunderblade73/hotm-API
j10a1n15 Apr 13, 2024
c974232
improved
j10a1n15 Apr 14, 2024
4aa6cb5
Removed tablist pattern
j10a1n15 Apr 15, 2024
511742d
Merge branch 'hannibal002:beta' into powder
j10a1n15 Apr 16, 2024
85b30d9
Merge branch 'beta' into powder
j10a1n15 Apr 28, 2024
1404ee8
Merge branch 'hannibal002:beta' into powder
j10a1n15 May 12, 2024
7c2de0c
Merge branch 'hannibal002:beta' into powder
j10a1n15 May 20, 2024
a8b323b
Merge branch 'beta' into powder
j10a1n15 May 30, 2024
053800c
fix
j10a1n15 May 30, 2024
4ad06df
fixc
j10a1n15 Jun 1, 2024
d4d1703
Merge branch 'hannibal002:beta' into powder
j10a1n15 Jun 5, 2024
a595ac8
cleanup
j10a1n15 Jun 11, 2024
7021460
Merge branch 'beta' into powder
j10a1n15 Jun 13, 2024
49ba740
Merge branch 'hannibal002:beta' into powder
j10a1n15 Jun 13, 2024
81b521d
removed triples and pairs
hannibal002 Jun 13, 2024
e862075
small code cleanup
hannibal002 Jun 13, 2024
772f482
big reformat
hannibal002 Jun 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
j10a1n15 marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,29 @@ public class DisplayConfig {
@ConfigEditorBoolean
public boolean showMaxIslandPlayers = true;

@Expose
@ConfigOption(name = "Powder Display", desc = "Select how the powder display should be formatted.")
@ConfigEditorDropdown
public PowderDisplay powderDisplay = PowderDisplay.AVAILABLE;

public enum PowderDisplay {
AVAILABLE("Available"),
TOTAL("Total"),
BOTH("Available / All")
;

private final String str;

PowderDisplay(String str) {
this.str = str;
}

@Override
public String toString() {
return str;
}
}

@Expose
@ConfigOption(name = "Number Format", desc = "")
@ConfigEditorDropdown
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package at.hannibal2.skyhanni.features.gui.customscoreboard

import at.hannibal2.skyhanni.api.HotmAPI
import at.hannibal2.skyhanni.config.features.gui.customscoreboard.ArrowConfig.ArrowAmountDisplay
import at.hannibal2.skyhanni.config.features.gui.customscoreboard.DisplayConfig.PowderDisplay
import at.hannibal2.skyhanni.data.BitsAPI
import at.hannibal2.skyhanni.data.HypixelData
import at.hannibal2.skyhanni.data.HypixelData.Companion.getMaxPlayersForCurrentServer
Expand Down Expand Up @@ -688,47 +690,52 @@ private fun getQuiverShowWhen(): Boolean {
}

private fun getPowderDisplayPair() = buildList {
val powderTypes: List<Triple<String, String, String>> = listOf(
val powderTypes = listOf(
Triple(
"Mithril", "§2", getGroupFromPattern(
TabListData.getTabList(),
ScoreboardPattern.mithrilPowderPattern,
"mithrilpowder"
).formatNum()
"Mithril",
"§2",
Pair(HotmAPI.Powder.MITHRIL.getCurrent().formatNum(), HotmAPI.Powder.MITHRIL.getTotal().formatNum())
),
Triple(
"Gemstone", "§d", getGroupFromPattern(
TabListData.getTabList(),
ScoreboardPattern.gemstonePowderPattern,
"gemstonepowder"
).formatNum()
"Gemstone",
"§d",
Pair(HotmAPI.Powder.GEMSTONE.getCurrent().formatNum(), HotmAPI.Powder.GEMSTONE.getTotal().formatNum())
),
Triple(
"Glacite", "§b", getGroupFromPattern(
TabListData.getTabList(),
ScoreboardPattern.glacitePowderPattern,
"glacitepowder"
).formatNum()
"Glacite",
"§b",
Pair(HotmAPI.Powder.GLACITE.getCurrent().formatNum(), HotmAPI.Powder.GLACITE.getTotal().formatNum())
)
)

if (informationFilteringConfig.hideEmptyLines && powderTypes.all { it.third == "0" }) {
add("<hidden>" to HorizontalAlignment.LEFT)
} else {
add("§9§lPowder" to HorizontalAlignment.LEFT)
if (informationFilteringConfig.hideEmptyLines && powderTypes.all { it.third.first == "0" && it.third.second == "0" }) {
return listOf("<hidden>" to HorizontalAlignment.LEFT)
}

if (displayConfig.displayNumbersFirst) {
for ((type, color, value) in powderTypes) {
if (value != "0") {
add(" §7- $color$value $type" to HorizontalAlignment.LEFT)
add("§9§lPowder" to HorizontalAlignment.LEFT)

val displayNumbersFirst = displayConfig.displayNumbersFirst

for ((type, color, value) in powderTypes) {
val (current, total) = value

when (displayConfig.powderDisplay) {
PowderDisplay.AVAILABLE -> {
if (current != "0") {
add(" §7- ${if (displayNumbersFirst) "$color$current $type" else "§f$type: $color$current"}" to HorizontalAlignment.LEFT)
}
}
} else {
for ((type, color, value) in powderTypes) {
if (value != "0") {
add(" §7- §f$type: $color$value" to HorizontalAlignment.LEFT)
PowderDisplay.TOTAL -> {
if (total != "0") {
add(" §7- ${if (displayNumbersFirst) "$color$total $type" else "§f$type: $color$total"}" to HorizontalAlignment.LEFT)
}
}
PowderDisplay.BOTH -> {
if (current != "0" && total != "0") {
add(" §7- ${if (displayNumbersFirst) "$color$current/$total $type" else "§f$type: $color$current/$total"}" to HorizontalAlignment.LEFT)
}
}
null -> {}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,18 +443,6 @@ object ScoreboardPattern {
"bank",
"^\\s*Bank: §6(?<bank>[\\w.,]+(?:§7 \\/ §6(?<coop>[\\w.,]+))?)$"
)
val mithrilPowderPattern by tablistGroup.pattern(
"mithrilpowder",
"^\\s*Mithril(?: Powder)?: (?:§.)+(?<mithrilpowder>[\\d,\\.]+)$"
)
val gemstonePowderPattern by tablistGroup.pattern(
"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>§.*)$"
Expand Down
Loading