From 663f454319c31d952d249d9a526620e5a53f70a1 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Tue, 17 Oct 2023 22:10:20 +0200 Subject: [PATCH 01/44] Added the ground structure --- .../java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 + .../skyhanni/config/features/MiscConfig.java | 52 ++++++++++++ .../features/misc/CustomScoreboard.kt | 84 +++++++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 897b3dc0fda8..bba08b175bfd 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -203,6 +203,7 @@ import at.hannibal2.skyhanni.features.misc.SuperpairsClicksAlert import at.hannibal2.skyhanni.features.misc.ThunderSparksHighlight import at.hannibal2.skyhanni.features.misc.TimeFeatures import at.hannibal2.skyhanni.features.misc.TpsCounter +import at.hannibal2.skyhanni.features.misc.CustomScoreboard import at.hannibal2.skyhanni.features.misc.compacttablist.AdvancedPlayerList import at.hannibal2.skyhanni.features.misc.compacttablist.TabListReader import at.hannibal2.skyhanni.features.misc.compacttablist.TabListRenderer @@ -609,6 +610,7 @@ class SkyHanniMod { loadModule(PartyMemberOutlines()) loadModule(ShiftClickEquipment()) loadModule(LockMouseLook) + loadModule(CustomScoreboard()) init() diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 23dcd5429faf..50c2ba3f44f1 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -780,4 +780,56 @@ public static class KickDurationConfig { @Expose public Position inventoryLoadPos = new Position(394, 124, false, true); + + @Expose + @ConfigOption(name = "Custom Scoreboard", desc = "") + @Accordion + public MiscConfig.CustomScoreboard customScoreboard = new MiscConfig.CustomScoreboard(); + + public static class CustomScoreboard { + + @Expose + @ConfigOption( + name = "Enabled", + desc = "Show a custom scoreboard instead of the default one." //TODO: MAKE COOLER + ) + @ConfigEditorBoolean + @FeatureToggle + public boolean enabled = false; + + @Expose + @ConfigOption( + name = "Text Format", + desc = "Drag text to change the appearance of the overlay." + ) + @ConfigEditorDraggableList( + exampleText = { + "§6§lSKYBLOCK", + "§7Profile", + "§ePurse", + "§eBank", + "§bBits", + "§cCopper", + "§aGems", + "§7Location", + "§7Ingame Time", + "§7Current Server", + "§2Mithril §r/ §dGemstone §7Powder", + "§cSlayer", + "§7Next Event", + "§7Current Event", + "§3Soulflow", + "§cHeat", + "§9Party:\n- hannibal2\n- Moulberry\n- Vahvl\n- J10a1n15", + "§7Pet", + "§7Quiver (approximation)", + "§7Maxwell Power" + } + ) + public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 14, 15, 16, 17, 18, 19)); + + + @Expose + public Position position = new Position(10, 80, false, true); + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt new file mode 100644 index 000000000000..e8d79ec6bf95 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -0,0 +1,84 @@ +// https://discord.com/channels/997079228510117908/1162844830360146080 + + +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.HypixelData +import at.hannibal2.skyhanni.data.PartyAPI +import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems +import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent + +class CustomScoreboard { + private val config get() = SkyHanniMod.feature.misc.customScoreboard + private var display = emptyList>() + @SubscribeEvent + fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { + if (!config.enabled) return + if (!LorenzUtils.inSkyBlock) return + config.position.renderStringsAndItems(display, posLabel = "Custom Scoreboard") + } + + @SubscribeEvent + fun onTick(event: TickEvent) { + update() + } + + private fun formatDisplay(map: List>): List> { + val newList = mutableListOf>() + for (index in config.textFormat) { + newList.add(map[index]) + } + return newList + } + + private fun update() { + display = formatDisplay(drawScoreboard()) + } + + private fun drawScoreboard() = buildList> { + addAsSingletonList("§6§lSKYBLOCK") + addAsSingletonList("${getProfileTypeAsSymbol()} ${HypixelData.profileName.firstLetterUppercase()}") + addAsSingletonList("§ePurse") + addAsSingletonList("§eBank") + addAsSingletonList("§bBits") + addAsSingletonList("§cCopper") + addAsSingletonList("§aGems") + addAsSingletonList("§7Location") + addAsSingletonList("§7Ingame Time") + addAsSingletonList("§7Current Server") + addAsSingletonList("§2Mithril §r/§2Gemstone §7Powder") + addAsSingletonList("§cSlayer") + addAsSingletonList("§7Next Event") + addAsSingletonList("§7Current Event") + addAsSingletonList("§2Soulflow") + addAsSingletonList("§cHeat") + + addAsSingletonList("§9Party") + for (member in PartyAPI.partyMembers){ + addAsSingletonList(" §7- §7$member") + } + + addAsSingletonList("§7Pet") + addAsSingletonList("§7Quiver (approximation)") + addAsSingletonList("§7Maxwell Power") + } + + private fun getProfileTypeAsSymbol() : String{ + if (HypixelData.ironman){ + return "§7♲" + } + if (HypixelData.stranded){ + return "§a☀" + } + if (HypixelData.bingo){ + return "§cⒷ" //TODO GET FUNNY BINGO SYMBOL, ALSO COLORS LOL + } + return "§e" + } +} \ No newline at end of file From 4b7f52a0b5032db9f6f71b6cc3b44b1c873e7bff Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:03:08 +0200 Subject: [PATCH 02/44] New way of drawing scoreboard --- .../skyhanni/config/features/MiscConfig.java | 3 +- .../features/misc/CustomScoreboard.kt | 85 ++++++++++++------- 2 files changed, 54 insertions(+), 34 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 50c2ba3f44f1..2f678b5cb53e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -813,6 +813,7 @@ public static class CustomScoreboard { "§aGems", "§7Location", "§7Ingame Time", + "§7IRL Time", "§7Current Server", "§2Mithril §r/ §dGemstone §7Powder", "§cSlayer", @@ -826,7 +827,7 @@ public static class CustomScoreboard { "§7Maxwell Power" } ) - public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 14, 15, 16, 17, 18, 19)); + public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20)); @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index e8d79ec6bf95..01058674cea8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -1,4 +1,7 @@ -// https://discord.com/channels/997079228510117908/1162844830360146080 +// +// Requested by alpaka8123 (https://discord.com/channels/997079228510117908/1162844830360146080) +// Done by J10a1n15, with lots of help from hanni, and snippets from item tracker features <3 +// package at.hannibal2.skyhanni.features.misc @@ -7,12 +10,15 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.PartyAPI import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.features.garden.farming.GardenCropMilestoneDisplay import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent +import java.util.* +import kotlin.collections.HashMap class CustomScoreboard { private val config get() = SkyHanniMod.feature.misc.customScoreboard @@ -26,58 +32,71 @@ class CustomScoreboard { @SubscribeEvent fun onTick(event: TickEvent) { - update() + display = drawScoreboard() } - private fun formatDisplay(map: List>): List> { + private fun formatDisplay(lineMap: HashMap>): MutableList> { val newList = mutableListOf>() for (index in config.textFormat) { - newList.add(map[index]) + lineMap[index]?.let { + newList.add(it) + } } - return newList - } - private fun update() { - display = formatDisplay(drawScoreboard()) + return newList } private fun drawScoreboard() = buildList> { - addAsSingletonList("§6§lSKYBLOCK") - addAsSingletonList("${getProfileTypeAsSymbol()} ${HypixelData.profileName.firstLetterUppercase()}") - addAsSingletonList("§ePurse") - addAsSingletonList("§eBank") - addAsSingletonList("§bBits") - addAsSingletonList("§cCopper") - addAsSingletonList("§aGems") - addAsSingletonList("§7Location") - addAsSingletonList("§7Ingame Time") - addAsSingletonList("§7Current Server") - addAsSingletonList("§2Mithril §r/§2Gemstone §7Powder") - addAsSingletonList("§cSlayer") - addAsSingletonList("§7Next Event") - addAsSingletonList("§7Current Event") - addAsSingletonList("§2Soulflow") - addAsSingletonList("§cHeat") - - addAsSingletonList("§9Party") + val lineMap = HashMap>() + lineMap[0] = Collections.singletonList("§6§lSKYBLOCK") + lineMap[1] = Collections.singletonList("${getProfileTypeAsSymbol()}${HypixelData.profileName.firstLetterUppercase()}") + lineMap[2] = Collections.singletonList("§ePurse") + lineMap[3] = Collections.singletonList("§eBank") + lineMap[4] = Collections.singletonList("§bBits") + lineMap[5] = Collections.singletonList("§cCopper") + lineMap[6] = Collections.singletonList("§aGems") + lineMap[7] = Collections.singletonList("§7Location") + lineMap[8] = Collections.singletonList("§7Ingame Time") + lineMap[9] = Collections.singletonList("§7IRL Time") + lineMap[10] = Collections.singletonList("§7Current Server") + lineMap[11] = Collections.singletonList("§2Mithril §r/§2Gemstone §7Powder") //could be multiline, need to decide + + val slayerList = mutableListOf() + slayerList.add("§7Slayer") //get slayer stuff + lineMap[12] = slayerList + + lineMap[13] = Collections.singletonList("§7Next Event") + + val eventList = mutableListOf() + eventList.add("§cCurrent Event") //get event stuff + lineMap[14] = eventList + + lineMap[15] = Collections.singletonList("§7Soulflow") + lineMap[16] = Collections.singletonList("§cHeat") + + val partyList = mutableListOf() + partyList.add("§9Party") for (member in PartyAPI.partyMembers){ - addAsSingletonList(" §7- §7$member") + partyList.add(" §7- §7$member") //TODO: add max member amount, default 4 ig (since the player doenst count to the list) } + lineMap[17] = partyList + + lineMap[18] = Collections.singletonList("§7Pet") + lineMap[19] = Collections.singletonList("§7Quiver") + lineMap[20] = Collections.singletonList("§7Maxwell Power") - addAsSingletonList("§7Pet") - addAsSingletonList("§7Quiver (approximation)") - addAsSingletonList("§7Maxwell Power") + return formatDisplay(lineMap) } private fun getProfileTypeAsSymbol() : String{ if (HypixelData.ironman){ - return "§7♲" + return "§7♲ " } if (HypixelData.stranded){ - return "§a☀" + return "§a☀ " } if (HypixelData.bingo){ - return "§cⒷ" //TODO GET FUNNY BINGO SYMBOL, ALSO COLORS LOL + return "§cⒷ " //TODO COLORS LOL, maybe bingoAPI? idk } return "§e" } From 622b5d3e6829a0db7628269ee14517b29641eaa9 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:25:11 +0200 Subject: [PATCH 03/44] Added max party list --- .../skyhanni/config/features/MiscConfig.java | 8 ++++++++ .../skyhanni/features/misc/CustomScoreboard.kt | 18 +++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 2f678b5cb53e..49efd7357a66 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -829,6 +829,14 @@ public static class CustomScoreboard { ) public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20)); + @Expose + @ConfigOption(name = "Max Party List", desc = "Max number of party members to show in the party list. (You are not included)") + @ConfigEditorSlider( + minValue = 1, + maxValue = 25, // why do I even set it so high + minStep = 1 + ) + public Property maxPartyList = Property.of(4); @Expose public Position position = new Position(10, 80, false, true); diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 01058674cea8..8187f7308876 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -19,6 +19,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent import java.util.* import kotlin.collections.HashMap +import kotlin.time.Duration.Companion.seconds class CustomScoreboard { private val config get() = SkyHanniMod.feature.misc.customScoreboard @@ -39,6 +40,18 @@ class CustomScoreboard { val newList = mutableListOf>() for (index in config.textFormat) { lineMap[index]?.let { + + //Multiline for Party Members (breaks nothing) + if (it[0] == "§9Party"){ + newList.add(listOf(it[0])) + for (item in it){ + if (item != it[0]){ + newList.add(listOf(item)) + } + } + continue + } + newList.add(it) } } @@ -75,9 +88,12 @@ class CustomScoreboard { lineMap[16] = Collections.singletonList("§cHeat") val partyList = mutableListOf() + var partyCount = 0 partyList.add("§9Party") for (member in PartyAPI.partyMembers){ - partyList.add(" §7- §7$member") //TODO: add max member amount, default 4 ig (since the player doenst count to the list) + if (partyCount == config.maxPartyList.get()) break + partyList.add(" §7- §7$member") + partyCount++ } lineMap[17] = partyList From 47a89970a78b38fa4d4f5d798b011b0f540f9ba9 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:25:45 +0200 Subject: [PATCH 04/44] Removed useless imports --- .../at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 8187f7308876..bff42fca19c2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -10,16 +10,13 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.PartyAPI import at.hannibal2.skyhanni.events.GuiRenderEvent -import at.hannibal2.skyhanni.features.garden.farming.GardenCropMilestoneDisplay import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent import java.util.* import kotlin.collections.HashMap -import kotlin.time.Duration.Companion.seconds class CustomScoreboard { private val config get() = SkyHanniMod.feature.misc.customScoreboard From 57dfa4e35242d730ce9018899083ac9ec88d8a7a Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 19 Oct 2023 15:38:27 +0200 Subject: [PATCH 05/44] Added more elements --- .../skyhanni/config/features/MiscConfig.java | 10 +++++--- .../features/misc/CustomScoreboard.kt | 23 +++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 49efd7357a66..fa6b46bcc2cc 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -819,15 +819,19 @@ public static class CustomScoreboard { "§cSlayer", "§7Next Event", "§7Current Event", - "§3Soulflow", "§cHeat", "§9Party:\n- hannibal2\n- Moulberry\n- Vahvl\n- J10a1n15", "§7Pet", "§7Quiver (approximation)", - "§7Maxwell Power" + "§7Maxwell Power", + "§ewww.hypixel.net", + " ", + " ", + " ", + " " } ) - public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20)); + public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24)); @Expose @ConfigOption(name = "Max Party List", desc = "Max number of party members to show in the party list. (You are not included)") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index bff42fca19c2..79dabc629861 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -49,6 +49,11 @@ class CustomScoreboard { continue } + if(it[0] == ""){ + newList.add(listOf("")) + continue + } + newList.add(it) } } @@ -81,8 +86,7 @@ class CustomScoreboard { eventList.add("§cCurrent Event") //get event stuff lineMap[14] = eventList - lineMap[15] = Collections.singletonList("§7Soulflow") - lineMap[16] = Collections.singletonList("§cHeat") + lineMap[15] = Collections.singletonList("§cHeat") val partyList = mutableListOf() var partyCount = 0 @@ -92,11 +96,16 @@ class CustomScoreboard { partyList.add(" §7- §7$member") partyCount++ } - lineMap[17] = partyList - - lineMap[18] = Collections.singletonList("§7Pet") - lineMap[19] = Collections.singletonList("§7Quiver") - lineMap[20] = Collections.singletonList("§7Maxwell Power") + lineMap[16] = partyList + + lineMap[17] = Collections.singletonList("§7Pet") + lineMap[18] = Collections.singletonList("§7Quiver") + lineMap[19] = Collections.singletonList("§7Maxwell Power") + lineMap[20] = Collections.singletonList("§ewww.hypixel.net") + lineMap[21] = Collections.singletonList("") + lineMap[22] = Collections.singletonList("") + lineMap[23] = Collections.singletonList("") + lineMap[24] = Collections.singletonList("") return formatDisplay(lineMap) } From 3a4e4851fd844db1bd27aaa81cb69b0c532834d7 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 19 Oct 2023 16:54:45 +0200 Subject: [PATCH 06/44] Fixed issues with new elements --- .../skyhanni/config/features/MiscConfig.java | 9 ++--- .../features/misc/CustomScoreboard.kt | 37 +++++++++---------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index fa6b46bcc2cc..6035c3ab84b5 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -811,27 +811,26 @@ public static class CustomScoreboard { "§bBits", "§cCopper", "§aGems", + "", "§7Location", "§7Ingame Time", "§7IRL Time", "§7Current Server", "§2Mithril §r/ §dGemstone §7Powder", + "", "§cSlayer", "§7Next Event", "§7Current Event", + "", "§cHeat", "§9Party:\n- hannibal2\n- Moulberry\n- Vahvl\n- J10a1n15", "§7Pet", "§7Quiver (approximation)", "§7Maxwell Power", "§ewww.hypixel.net", - " ", - " ", - " ", - " " } ) - public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24)); + public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)); @Expose @ConfigOption(name = "Max Party List", desc = "Max number of party members to show in the party list. (You are not included)") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 79dabc629861..2adce5d31a4a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -70,23 +70,26 @@ class CustomScoreboard { lineMap[4] = Collections.singletonList("§bBits") lineMap[5] = Collections.singletonList("§cCopper") lineMap[6] = Collections.singletonList("§aGems") - lineMap[7] = Collections.singletonList("§7Location") - lineMap[8] = Collections.singletonList("§7Ingame Time") - lineMap[9] = Collections.singletonList("§7IRL Time") - lineMap[10] = Collections.singletonList("§7Current Server") - lineMap[11] = Collections.singletonList("§2Mithril §r/§2Gemstone §7Powder") //could be multiline, need to decide + lineMap[7] = Collections.singletonList("") + lineMap[8] = Collections.singletonList("§7Location") + lineMap[9] = Collections.singletonList("§7Ingame Time") + lineMap[10] = Collections.singletonList("§7IRL Time") + lineMap[11] = Collections.singletonList("§7Current Server") + lineMap[12] = Collections.singletonList("§2Mithril §r/§2Gemstone §7Powder") //could be multiline, need to decide + lineMap[13] = Collections.singletonList("") val slayerList = mutableListOf() slayerList.add("§7Slayer") //get slayer stuff - lineMap[12] = slayerList + lineMap[14] = slayerList - lineMap[13] = Collections.singletonList("§7Next Event") + lineMap[15] = Collections.singletonList("§7Next Event") val eventList = mutableListOf() eventList.add("§cCurrent Event") //get event stuff - lineMap[14] = eventList + lineMap[16] = eventList + lineMap[17] = Collections.singletonList("") - lineMap[15] = Collections.singletonList("§cHeat") + lineMap[18] = Collections.singletonList("§cHeat") val partyList = mutableListOf() var partyCount = 0 @@ -96,16 +99,12 @@ class CustomScoreboard { partyList.add(" §7- §7$member") partyCount++ } - lineMap[16] = partyList - - lineMap[17] = Collections.singletonList("§7Pet") - lineMap[18] = Collections.singletonList("§7Quiver") - lineMap[19] = Collections.singletonList("§7Maxwell Power") - lineMap[20] = Collections.singletonList("§ewww.hypixel.net") - lineMap[21] = Collections.singletonList("") - lineMap[22] = Collections.singletonList("") - lineMap[23] = Collections.singletonList("") - lineMap[24] = Collections.singletonList("") + lineMap[19] = partyList + + lineMap[20] = Collections.singletonList("§7Pet") + lineMap[21] = Collections.singletonList("§7Quiver") + lineMap[22] = Collections.singletonList("§7Maxwell Power") + lineMap[23] = Collections.singletonList("§ewww.hypixel.net") return formatDisplay(lineMap) } From d24d833111cb3b2db2e830fe64ed63ced2a4e4e9 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 19 Oct 2023 18:10:00 +0200 Subject: [PATCH 07/44] Made PurseAPI public --- src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt index d41e5ad7af0e..76d1f6fbb16c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt @@ -11,9 +11,12 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class PurseAPI { private val pattern = "(Piggy|Purse): §6(?[\\d,]*).*".toPattern() - private var currentPurse = 0.0 private var inventoryCloseTime = 0L + companion object { + var currentPurse = 0.0 + } + @SubscribeEvent fun onInventoryClose(event: InventoryCloseEvent) { inventoryCloseTime = System.currentTimeMillis() From 18f6a897a3f503f441d9c3bbbb9f270bcf849ddf Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 19 Oct 2023 20:11:19 +0200 Subject: [PATCH 08/44] added purse, bank, bits, copper & gems --- .../features/misc/CustomScoreboard.kt | 51 ++++++++++++++++--- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 2adce5d31a4a..59b11512b6e0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -9,18 +9,27 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.PartyAPI +import at.hannibal2.skyhanni.data.PurseAPI +import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase +import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.TabListData import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent import java.util.* -import kotlin.collections.HashMap class CustomScoreboard { private val config get() = SkyHanniMod.feature.misc.customScoreboard private var display = emptyList>() + private var purse = "0" + private var bank = "0" + private var bits = "0" + private var copper = "0" + private var gems = "0" + @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!config.enabled) return @@ -31,6 +40,18 @@ class CustomScoreboard { @SubscribeEvent fun onTick(event: TickEvent) { display = drawScoreboard() + + for (line in TabListData.getTabList()){ + if (line.startsWith(" Gems: §r§a")){ + gems = line.removePrefix(" Gems: §r§a") + } + if (line.startsWith(" Bank: §r§6")){ + bank = line.removePrefix(" Bank: §r§6") + } + } + bits = getBits() + purse = LorenzUtils.formatInteger(PurseAPI.currentPurse.toInt()) + copper = getCopper() } private fun formatDisplay(lineMap: HashMap>): MutableList> { @@ -65,11 +86,11 @@ class CustomScoreboard { val lineMap = HashMap>() lineMap[0] = Collections.singletonList("§6§lSKYBLOCK") lineMap[1] = Collections.singletonList("${getProfileTypeAsSymbol()}${HypixelData.profileName.firstLetterUppercase()}") - lineMap[2] = Collections.singletonList("§ePurse") - lineMap[3] = Collections.singletonList("§eBank") - lineMap[4] = Collections.singletonList("§bBits") - lineMap[5] = Collections.singletonList("§cCopper") - lineMap[6] = Collections.singletonList("§aGems") + lineMap[2] = Collections.singletonList("Purse: §6$purse") + lineMap[3] = Collections.singletonList("Bank: §6$bank") + lineMap[4] = Collections.singletonList("Bits: §b$bits") + lineMap[5] = Collections.singletonList("Copper: §c$copper") + lineMap[6] = Collections.singletonList("Gems: §a$gems") lineMap[7] = Collections.singletonList("") lineMap[8] = Collections.singletonList("§7Location") lineMap[9] = Collections.singletonList("§7Ingame Time") @@ -109,6 +130,24 @@ class CustomScoreboard { return formatDisplay(lineMap) } + private fun getBits() : String { + val bitsRegex = Regex("""Bits: ([\d|,]+)[\d|.]*""") + val scoreboard = ScoreboardData.sidebarLinesFormatted + val bits = scoreboard.firstOrNull { bitsRegex.matches(it.removeColor()) }?.let { + bitsRegex.find(it.removeColor())?.groupValues?.get(1) + } + return bits ?: "0" + } + + private fun getCopper() : String { + val copperRegex = Regex("""Copper: ([\d|,]+)[\d|.]*""") + val scoreboard = ScoreboardData.sidebarLinesFormatted + val copper = scoreboard.firstOrNull { copperRegex.matches(it.removeColor()) }?.let { + copperRegex.find(it.removeColor())?.groupValues?.get(1) + } + return copper ?: "0" + } + private fun getProfileTypeAsSymbol() : String{ if (HypixelData.ironman){ return "§7♲ " From 9dd5237bec50c17533f00f63f76e28f69fb7d2d1 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 19 Oct 2023 20:58:23 +0200 Subject: [PATCH 09/44] Added option to hide lines with no info --- .../skyhanni/config/features/MiscConfig.java | 6 +++++ .../features/misc/CustomScoreboard.kt | 23 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 6035c3ab84b5..0c474b063f07 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -841,6 +841,12 @@ public static class CustomScoreboard { ) public Property maxPartyList = Property.of(4); + @Expose + @ConfigOption(name = "Hide lines with no info", desc = "Hide lines that have no info to display, like hiding the party when not being in one.") + @ConfigEditorBoolean + @FeatureToggle + public boolean hideEmptyLines = true; + @Expose public Position position = new Position(10, 80, false, true); } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 59b11512b6e0..a985f1776e27 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -39,8 +39,10 @@ class CustomScoreboard { @SubscribeEvent fun onTick(event: TickEvent) { + // Draws the custom scoreboard display = drawScoreboard() + // Gets some values for the scoreboard for (line in TabListData.getTabList()){ if (line.startsWith(" Gems: §r§a")){ gems = line.removePrefix(" Gems: §r§a") @@ -59,7 +61,7 @@ class CustomScoreboard { for (index in config.textFormat) { lineMap[index]?.let { - //Multiline for Party Members (breaks nothing) + // Multiline for Party Members if (it[0] == "§9Party"){ newList.add(listOf(it[0])) for (item in it){ @@ -70,11 +72,17 @@ class CustomScoreboard { continue } + // Adds empty lines if(it[0] == ""){ newList.add(listOf("")) continue } + // Does not display this line + if(it[0] == ""){ + continue + } + newList.add(it) } } @@ -127,6 +135,19 @@ class CustomScoreboard { lineMap[22] = Collections.singletonList("§7Maxwell Power") lineMap[23] = Collections.singletonList("§ewww.hypixel.net") + // Hide empty lines + if (config.hideEmptyLines){ + lineMap[2] = Collections.singletonList(if(purse == "0") "" else "Purse: §6$purse") + lineMap[3] = Collections.singletonList(if(bank == "0") "" else "Bank: §6$bank") + lineMap[4] = Collections.singletonList(if(bits == "0") "" else "Bits: §b$bits") + lineMap[5] = Collections.singletonList(if(copper == "0") "" else "Copper: §c$copper") + lineMap[6] = Collections.singletonList(if(gems == "0") "" else "Gems: §a$gems") + + if (partyList.size == 1){ + lineMap[19] = Collections.singletonList("") + } + } + return formatDisplay(lineMap) } From 4be6f5c3342ba4e034379e71e5a44ce873f7d8a9 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 19 Oct 2023 21:06:36 +0200 Subject: [PATCH 10/44] Fixed white screen issue with max party list count (hopefully) --- .../at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index a985f1776e27..a2f4c5bb6fdf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -124,7 +124,7 @@ class CustomScoreboard { var partyCount = 0 partyList.add("§9Party") for (member in PartyAPI.partyMembers){ - if (partyCount == config.maxPartyList.get()) break + if (partyCount >= config.maxPartyList.get()) break partyList.add(" §7- §7$member") partyCount++ } From d669b64b4919acabcee87257c2ab04c094340167 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 19 Oct 2023 22:26:13 +0200 Subject: [PATCH 11/44] Added ingame time --- .../at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 6 ++++-- src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index a2f4c5bb6fdf..70e5360cd747 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -17,6 +17,8 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TabListData +import at.hannibal2.skyhanni.utils.TimeUtils.formatted +import io.github.moulberry.notenoughupdates.util.SkyBlockTime import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent import java.util.* @@ -100,8 +102,8 @@ class CustomScoreboard { lineMap[5] = Collections.singletonList("Copper: §c$copper") lineMap[6] = Collections.singletonList("Gems: §a$gems") lineMap[7] = Collections.singletonList("") - lineMap[8] = Collections.singletonList("§7Location") - lineMap[9] = Collections.singletonList("§7Ingame Time") + lineMap[8] = Collections.singletonList("§7⏣ ") + lineMap[9] = Collections.singletonList(SkyBlockTime.now().formatted(false)) lineMap[10] = Collections.singletonList("§7IRL Time") lineMap[11] = Collections.singletonList("§7Current Server") lineMap[12] = Collections.singletonList("§2Mithril §r/§2Gemstone §7Powder") //could be multiline, need to decide diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt index 33a9bbe83aa7..92859717cdb8 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt @@ -119,7 +119,7 @@ object TimeUtils { }.toLong() } - fun SkyBlockTime.formatted(): String { + fun SkyBlockTime.formatted(hoursAndMinutes : Boolean = true): String { val hour = if (this.hour > 12) this.hour - 12 else this.hour val timeOfDay = if (this.hour > 11) "pm" else "am" // hooray for 12-hour clocks var minute = this.minute.toString() @@ -131,6 +131,9 @@ object TimeUtils { val day = this.day val daySuffix = SkyBlockTime.daySuffix(day) val year = this.year + + if (!hoursAndMinutes) return "$month $day$daySuffix, Year $year" // Early Winter 1st Year 300 + return "$month $day$daySuffix, Year $year $hour:${minute}$timeOfDay" // Early Winter 1st Year 300, 12:03pm } } From ad0739bcae81d73cc306d0922a5023623076aba0 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 19 Oct 2023 23:17:33 +0200 Subject: [PATCH 12/44] Added Skyblock location --- .../skyhanni/features/misc/CustomScoreboard.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 70e5360cd747..1c9ab7361f77 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -31,6 +31,7 @@ class CustomScoreboard { private var bits = "0" private var copper = "0" private var gems = "0" + private var location = "None" @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { @@ -53,6 +54,13 @@ class CustomScoreboard { bank = line.removePrefix(" Bank: §r§6") } } + + //todo add copper etc to this + for (line in ScoreboardData.sidebarLinesFormatted){ + if (line.startsWith(" §7⏣ ")){ + location = line.removePrefix(" §7⏣ ") + } + } bits = getBits() purse = LorenzUtils.formatInteger(PurseAPI.currentPurse.toInt()) copper = getCopper() @@ -102,7 +110,7 @@ class CustomScoreboard { lineMap[5] = Collections.singletonList("Copper: §c$copper") lineMap[6] = Collections.singletonList("Gems: §a$gems") lineMap[7] = Collections.singletonList("") - lineMap[8] = Collections.singletonList("§7⏣ ") + lineMap[8] = Collections.singletonList("§7⏣$location") lineMap[9] = Collections.singletonList(SkyBlockTime.now().formatted(false)) lineMap[10] = Collections.singletonList("§7IRL Time") lineMap[11] = Collections.singletonList("§7Current Server") From 456a6eb9357de31cbdc7a379553e16b03cb3075f Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 19 Oct 2023 23:18:36 +0200 Subject: [PATCH 13/44] Made comments a lot better --- .../hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 1c9ab7361f77..6a1dc5c051a7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -114,17 +114,17 @@ class CustomScoreboard { lineMap[9] = Collections.singletonList(SkyBlockTime.now().formatted(false)) lineMap[10] = Collections.singletonList("§7IRL Time") lineMap[11] = Collections.singletonList("§7Current Server") - lineMap[12] = Collections.singletonList("§2Mithril §r/§2Gemstone §7Powder") //could be multiline, need to decide + lineMap[12] = Collections.singletonList("§2Mithril §r/§2Gemstone §7Powder") //todo: could be multiline, need to decide lineMap[13] = Collections.singletonList("") val slayerList = mutableListOf() - slayerList.add("§7Slayer") //get slayer stuff + slayerList.add("§7Slayer") //todo: get slayer stuff lineMap[14] = slayerList lineMap[15] = Collections.singletonList("§7Next Event") val eventList = mutableListOf() - eventList.add("§cCurrent Event") //get event stuff + eventList.add("§cCurrent Event") //todo: get event stuff lineMap[16] = eventList lineMap[17] = Collections.singletonList("") @@ -187,7 +187,7 @@ class CustomScoreboard { return "§a☀ " } if (HypixelData.bingo){ - return "§cⒷ " //TODO COLORS LOL, maybe bingoAPI? idk + return "§cⒷ " //TODO COLORS, maybe bingoAPI? idk } return "§e" } From a1e3a0a8613132dcc7f79132ccea33b907d9823e Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Fri, 20 Oct 2023 19:34:32 +0200 Subject: [PATCH 14/44] Added rift to location & changed some formatting --- .../at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 6a1dc5c051a7..0b90ed779277 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -57,8 +57,8 @@ class CustomScoreboard { //todo add copper etc to this for (line in ScoreboardData.sidebarLinesFormatted){ - if (line.startsWith(" §7⏣ ")){ - location = line.removePrefix(" §7⏣ ") + if (line.startsWith(" §7⏣ ") || line.startsWith(" §5ф ")){ + location = line } } bits = getBits() @@ -110,7 +110,7 @@ class CustomScoreboard { lineMap[5] = Collections.singletonList("Copper: §c$copper") lineMap[6] = Collections.singletonList("Gems: §a$gems") lineMap[7] = Collections.singletonList("") - lineMap[8] = Collections.singletonList("§7⏣$location") + lineMap[8] = Collections.singletonList(location) lineMap[9] = Collections.singletonList(SkyBlockTime.now().formatted(false)) lineMap[10] = Collections.singletonList("§7IRL Time") lineMap[11] = Collections.singletonList("§7Current Server") From 9a1c40c6b54bbe670b644b264ebf0540adc48b3a Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Fri, 20 Oct 2023 22:10:27 +0200 Subject: [PATCH 15/44] Added motes (which auto hides purse, bank, bits & copper) --- .../skyhanni/features/misc/CustomScoreboard.kt | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 0b90ed779277..af064b6df66b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -7,12 +7,10 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.HypixelData -import at.hannibal2.skyhanni.data.PartyAPI -import at.hannibal2.skyhanni.data.PurseAPI -import at.hannibal2.skyhanni.data.ScoreboardData +import at.hannibal2.skyhanni.data.* import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -27,6 +25,7 @@ class CustomScoreboard { private val config get() = SkyHanniMod.feature.misc.customScoreboard private var display = emptyList>() private var purse = "0" + private var motes = "0" private var bank = "0" private var bits = "0" private var copper = "0" @@ -53,6 +52,9 @@ class CustomScoreboard { if (line.startsWith(" Bank: §r§6")){ bank = line.removePrefix(" Bank: §r§6") } + if (line.startsWith("Motes: §d")){ + motes = line.removePrefix("Motes: §d") + } } //todo add copper etc to this @@ -158,6 +160,14 @@ class CustomScoreboard { } } + // Rift + if(IslandType.THE_RIFT.isInIsland()){ + lineMap[2] = Collections.singletonList("Motes: §d$motes") + lineMap[3] = Collections.singletonList("") + lineMap[4] = Collections.singletonList("") + lineMap[5] = Collections.singletonList("") + } + return formatDisplay(lineMap) } From a283bdd4c66088cc14bb2e483ca3ee691b323683 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sat, 21 Oct 2023 14:05:01 +0200 Subject: [PATCH 16/44] Added real time --- .../at/hannibal2/skyhanni/config/features/MiscConfig.java | 8 +++++++- .../hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 0c474b063f07..30b7671d5772 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -814,7 +814,7 @@ public static class CustomScoreboard { "", "§7Location", "§7Ingame Time", - "§7IRL Time", + "§Real Time", "§7Current Server", "§2Mithril §r/ §dGemstone §7Powder", "", @@ -847,6 +847,12 @@ public static class CustomScoreboard { @FeatureToggle public boolean hideEmptyLines = true; + @Expose + @ConfigOption(name = "24h format", desc = "Use 24h format for the IRL time.") + @ConfigEditorBoolean + @FeatureToggle + public boolean use24hFormat = false; + @Expose public Position position = new Position(10, 80, false, true); } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index af064b6df66b..aa0b7ac7b027 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -19,11 +19,14 @@ import at.hannibal2.skyhanni.utils.TimeUtils.formatted import io.github.moulberry.notenoughupdates.util.SkyBlockTime import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent +import java.text.SimpleDateFormat import java.util.* class CustomScoreboard { private val config get() = SkyHanniMod.feature.misc.customScoreboard private var display = emptyList>() + private val timeFormat24h = SimpleDateFormat("HH:mm:ss") + private val timeFormat12h = SimpleDateFormat("hh:mm:ss a") private var purse = "0" private var motes = "0" private var bank = "0" @@ -114,7 +117,7 @@ class CustomScoreboard { lineMap[7] = Collections.singletonList("") lineMap[8] = Collections.singletonList(location) lineMap[9] = Collections.singletonList(SkyBlockTime.now().formatted(false)) - lineMap[10] = Collections.singletonList("§7IRL Time") + lineMap[10] = Collections.singletonList((if (config.use24hFormat) timeFormat24h else timeFormat12h).format(System.currentTimeMillis())) lineMap[11] = Collections.singletonList("§7Current Server") lineMap[12] = Collections.singletonList("§2Mithril §r/§2Gemstone §7Powder") //todo: could be multiline, need to decide lineMap[13] = Collections.singletonList("") From 125d34a71b0bb1864dd1ef114073ff273049fe3e Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sat, 21 Oct 2023 15:56:06 +0200 Subject: [PATCH 17/44] Added lobby code --- .../skyhanni/features/misc/CustomScoreboard.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index aa0b7ac7b027..e896aae24a65 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -34,6 +34,7 @@ class CustomScoreboard { private var copper = "0" private var gems = "0" private var location = "None" + private var lobbyCode = "None" @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { @@ -65,6 +66,9 @@ class CustomScoreboard { if (line.startsWith(" §7⏣ ") || line.startsWith(" §5ф ")){ location = line } + if (extractLobbyCode(line) is String ){ + lobbyCode = extractLobbyCode(line)!! + } } bits = getBits() purse = LorenzUtils.formatInteger(PurseAPI.currentPurse.toInt()) @@ -118,7 +122,7 @@ class CustomScoreboard { lineMap[8] = Collections.singletonList(location) lineMap[9] = Collections.singletonList(SkyBlockTime.now().formatted(false)) lineMap[10] = Collections.singletonList((if (config.use24hFormat) timeFormat24h else timeFormat12h).format(System.currentTimeMillis())) - lineMap[11] = Collections.singletonList("§7Current Server") + lineMap[11] = Collections.singletonList("§8$lobbyCode") lineMap[12] = Collections.singletonList("§2Mithril §r/§2Gemstone §7Powder") //todo: could be multiline, need to decide lineMap[13] = Collections.singletonList("") @@ -157,6 +161,8 @@ class CustomScoreboard { lineMap[4] = Collections.singletonList(if(bits == "0") "" else "Bits: §b$bits") lineMap[5] = Collections.singletonList(if(copper == "0") "" else "Copper: §c$copper") lineMap[6] = Collections.singletonList(if(gems == "0") "" else "Gems: §a$gems") + lineMap[8] = Collections.singletonList(if(location == "None") "" else location) + lineMap[11] = Collections.singletonList(if(lobbyCode == "None") "" else "§8$lobbyCode") if (partyList.size == 1){ lineMap[19] = Collections.singletonList("") @@ -174,6 +180,12 @@ class CustomScoreboard { return formatDisplay(lineMap) } + private fun extractLobbyCode(input: String): String? { + val regex = Regex("§(\\d{3}/\\d{2}/\\d{2}) §([A-Za-z0-9]+)$") + val matchResult = regex.find(input) + return matchResult?.groupValues?.lastOrNull() + } + private fun getBits() : String { val bitsRegex = Regex("""Bits: ([\d|,]+)[\d|.]*""") val scoreboard = ScoreboardData.sidebarLinesFormatted From 130fdb49b23088e11b52f22f02792a56de01481c Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sat, 21 Oct 2023 16:04:34 +0200 Subject: [PATCH 18/44] Fixed issue with lobby code extraction --- .../at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index e896aae24a65..16fcf8e9b3fe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -67,7 +67,7 @@ class CustomScoreboard { location = line } if (extractLobbyCode(line) is String ){ - lobbyCode = extractLobbyCode(line)!! + lobbyCode = extractLobbyCode(line)!!.substring(1) //removes first char (number of colorcode) } } bits = getBits() From 016993931d0849da0d7204e86ac385d3123442d3 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sat, 21 Oct 2023 20:40:38 +0200 Subject: [PATCH 19/44] Fixed motes detection --- .../at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 16fcf8e9b3fe..5f28f6cca249 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -56,9 +56,6 @@ class CustomScoreboard { if (line.startsWith(" Bank: §r§6")){ bank = line.removePrefix(" Bank: §r§6") } - if (line.startsWith("Motes: §d")){ - motes = line.removePrefix("Motes: §d") - } } //todo add copper etc to this @@ -66,6 +63,9 @@ class CustomScoreboard { if (line.startsWith(" §7⏣ ") || line.startsWith(" §5ф ")){ location = line } + if (line.startsWith("Motes: §d")){ + motes = line.removePrefix("Motes: §d") + } if (extractLobbyCode(line) is String ){ lobbyCode = extractLobbyCode(line)!!.substring(1) //removes first char (number of colorcode) } From dee45098329ee1ed74c924e97a17f128e168cb3e Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sat, 21 Oct 2023 21:47:52 +0200 Subject: [PATCH 20/44] Added Heat --- .../at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 5f28f6cca249..c2f7bcd2eb0a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -35,6 +35,7 @@ class CustomScoreboard { private var gems = "0" private var location = "None" private var lobbyCode = "None" + private var heat = "0" @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { @@ -69,6 +70,9 @@ class CustomScoreboard { if (extractLobbyCode(line) is String ){ lobbyCode = extractLobbyCode(line)!!.substring(1) //removes first char (number of colorcode) } + if (line.startsWith("Heat: §c♨")){ + heat = line.removePrefix("Heat: §c♨") + } } bits = getBits() purse = LorenzUtils.formatInteger(PurseAPI.currentPurse.toInt()) @@ -137,7 +141,7 @@ class CustomScoreboard { lineMap[16] = eventList lineMap[17] = Collections.singletonList("") - lineMap[18] = Collections.singletonList("§cHeat") + lineMap[18] = Collections.singletonList("Heat: §c$heat") val partyList = mutableListOf() var partyCount = 0 From 5226e5abb2f761e9d1aa3f29dfa2132502a9191f Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sat, 21 Oct 2023 21:50:01 +0200 Subject: [PATCH 21/44] Added current mayor option --- .../skyhanni/config/features/MiscConfig.java | 3 ++- .../skyhanni/features/misc/CustomScoreboard.kt | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 30b7671d5772..88cf607b06d0 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -821,6 +821,7 @@ public static class CustomScoreboard { "§cSlayer", "§7Next Event", "§7Current Event", + "§7Current Mayor", "", "§cHeat", "§9Party:\n- hannibal2\n- Moulberry\n- Vahvl\n- J10a1n15", @@ -830,7 +831,7 @@ public static class CustomScoreboard { "§ewww.hypixel.net", } ) - public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)); + public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24)); @Expose @ConfigOption(name = "Max Party List", desc = "Max number of party members to show in the party list. (You are not included)") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index c2f7bcd2eb0a..ff56d30eba92 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -139,9 +139,10 @@ class CustomScoreboard { val eventList = mutableListOf() eventList.add("§cCurrent Event") //todo: get event stuff lineMap[16] = eventList - lineMap[17] = Collections.singletonList("") - lineMap[18] = Collections.singletonList("Heat: §c$heat") + lineMap[17] = Collections.singletonList("§7Current Mayor") + lineMap[18] = Collections.singletonList("") + lineMap[19] = Collections.singletonList("Heat: §c$heat") val partyList = mutableListOf() var partyCount = 0 @@ -151,12 +152,12 @@ class CustomScoreboard { partyList.add(" §7- §7$member") partyCount++ } - lineMap[19] = partyList + lineMap[20] = partyList - lineMap[20] = Collections.singletonList("§7Pet") - lineMap[21] = Collections.singletonList("§7Quiver") - lineMap[22] = Collections.singletonList("§7Maxwell Power") - lineMap[23] = Collections.singletonList("§ewww.hypixel.net") + lineMap[21] = Collections.singletonList("§7Pet") + lineMap[22] = Collections.singletonList("§7Quiver") + lineMap[23] = Collections.singletonList("§7Maxwell Power") + lineMap[24] = Collections.singletonList("§ewww.hypixel.net") // Hide empty lines if (config.hideEmptyLines){ From c58ff465e005ec0d2002879eefab317940bdf562 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sat, 21 Oct 2023 22:02:32 +0200 Subject: [PATCH 22/44] Added Pets, fixed heat --- .../at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index ff56d30eba92..e39f45406f27 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -142,7 +142,7 @@ class CustomScoreboard { lineMap[17] = Collections.singletonList("§7Current Mayor") lineMap[18] = Collections.singletonList("") - lineMap[19] = Collections.singletonList("Heat: §c$heat") + lineMap[19] = Collections.singletonList("Heat: §c♨$heat") val partyList = mutableListOf() var partyCount = 0 @@ -154,7 +154,7 @@ class CustomScoreboard { } lineMap[20] = partyList - lineMap[21] = Collections.singletonList("§7Pet") + lineMap[21] = Collections.singletonList(ProfileStorageData.profileSpecific?.currentPet ?: "") lineMap[22] = Collections.singletonList("§7Quiver") lineMap[23] = Collections.singletonList("§7Maxwell Power") lineMap[24] = Collections.singletonList("§ewww.hypixel.net") @@ -170,7 +170,7 @@ class CustomScoreboard { lineMap[11] = Collections.singletonList(if(lobbyCode == "None") "" else "§8$lobbyCode") if (partyList.size == 1){ - lineMap[19] = Collections.singletonList("") + lineMap[20] = Collections.singletonList("") } } From af2f0a4b681a1d2f959a026115cf86eb53a75375 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sat, 21 Oct 2023 22:28:55 +0200 Subject: [PATCH 23/44] =?UTF-8?q?Added=20mayor=20stuff=20&=20=20fixed=20so?= =?UTF-8?q?me=20stuff=F0=9F=94=A5=F0=9F=94=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../skyhanni/config/features/MiscConfig.java | 6 +++++ .../hannibal2/skyhanni/data/MayorElection.kt | 2 +- .../features/misc/CustomScoreboard.kt | 24 ++++++++++++++----- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 88cf607b06d0..14a086bbe8d9 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -854,6 +854,12 @@ public static class CustomScoreboard { @FeatureToggle public boolean use24hFormat = false; + @Expose + @ConfigOption(name = "Show Mayor Perks", desc = "Show the perks of the current mayor.") + @ConfigEditorBoolean + @FeatureToggle + public boolean showMayorPerks = true; + @Expose public Position position = new Position(10, 80, false, true); } diff --git a/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt b/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt index 2508391d985b..b9b2f7dc3b58 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt @@ -19,7 +19,7 @@ class MayorElection { companion object { var rawMayorData: MayorJson? = null var candidates = mapOf() - var currentCandidate: MayorJson.Candidate? = null + var currentCandidate: MayorJson.Candidate? = null //todo: should it not be called currentMayor? fun isPerkActive(mayor: String, perk: String) = currentCandidate?.let { currentCandidate -> currentCandidate.name == mayor && currentCandidate.perks.any { it.name == perk } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index e39f45406f27..5e3714d0219d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -68,7 +68,7 @@ class CustomScoreboard { motes = line.removePrefix("Motes: §d") } if (extractLobbyCode(line) is String ){ - lobbyCode = extractLobbyCode(line)!!.substring(1) //removes first char (number of colorcode) + lobbyCode = extractLobbyCode(line)!!.substring(1) //removes first char (number of color code) } if (line.startsWith("Heat: §c♨")){ heat = line.removePrefix("Heat: §c♨") @@ -86,11 +86,16 @@ class CustomScoreboard { // Multiline for Party Members if (it[0] == "§9Party"){ - newList.add(listOf(it[0])) for (item in it){ - if (item != it[0]){ - newList.add(listOf(item)) - } + newList.add(listOf(item)) + } + continue + } + + // Multiline for Mayor + if (it[0] == MayorElection.currentCandidate?.name){ + for (item in it){ + newList.add(listOf(item)) } continue } @@ -140,7 +145,13 @@ class CustomScoreboard { eventList.add("§cCurrent Event") //todo: get event stuff lineMap[16] = eventList - lineMap[17] = Collections.singletonList("§7Current Mayor") + val mayorList = mutableListOf() + mayorList.add(MayorElection.currentCandidate?.name ?: "") + for (perk in MayorElection.currentCandidate?.perks ?: emptyList()){ + mayorList.add(" §7- §e${perk.name}") + } + lineMap[17] = mayorList + lineMap[18] = Collections.singletonList("") lineMap[19] = Collections.singletonList("Heat: §c♨$heat") @@ -168,6 +179,7 @@ class CustomScoreboard { lineMap[6] = Collections.singletonList(if(gems == "0") "" else "Gems: §a$gems") lineMap[8] = Collections.singletonList(if(location == "None") "" else location) lineMap[11] = Collections.singletonList(if(lobbyCode == "None") "" else "§8$lobbyCode") + lineMap[19] = Collections.singletonList(if(heat == "0") "" else "Heat: §c♨$heat") if (partyList.size == 1){ lineMap[20] = Collections.singletonList("") From 1c066bdb58a5986dc7b420a79e85d05594da97a1 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sun, 22 Oct 2023 10:59:59 +0200 Subject: [PATCH 24/44] Added an option to hide irrelevant lines --- .../skyhanni/config/features/MiscConfig.java | 7 ++++ .../features/misc/CustomScoreboard.kt | 42 +++++++++++++++++-- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 14a086bbe8d9..2a394e4049db 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -848,6 +848,13 @@ public static class CustomScoreboard { @FeatureToggle public boolean hideEmptyLines = true; + @Expose + @ConfigOption(name = "Hide Info not relevant to location", desc = "Hide lines that are not relevant to the current location, like hiding copper while not in garden") + @ConfigEditorBoolean + @FeatureToggle + public boolean hideIrrelevantLines = true; + + @Expose @ConfigOption(name = "24h format", desc = "Use 24h format for the IRL time.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 5e3714d0219d..fb526dd0bef7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -2,7 +2,8 @@ // Requested by alpaka8123 (https://discord.com/channels/997079228510117908/1162844830360146080) // Done by J10a1n15, with lots of help from hanni, and snippets from item tracker features <3 // - +// I'm also like really sorry for anyone who has to look at this code, it looks kinda bad +// package at.hannibal2.skyhanni.features.misc @@ -189,9 +190,42 @@ class CustomScoreboard { // Rift if(IslandType.THE_RIFT.isInIsland()){ lineMap[2] = Collections.singletonList("Motes: §d$motes") - lineMap[3] = Collections.singletonList("") - lineMap[4] = Collections.singletonList("") - lineMap[5] = Collections.singletonList("") + } + + // Hide irrelevant lines + if (config.hideIrrelevantLines){ + if (!IslandType.GARDEN.isInIsland()){ + lineMap[5] = Collections.singletonList("") // Copper + } + if (IslandType.THE_RIFT.isInIsland()){ + lineMap[3] = Collections.singletonList("") // Bank + lineMap[4] = Collections.singletonList("") // Bits + lineMap[6] = Collections.singletonList("") // Gems + lineMap[17] = Collections.singletonList("") // Mayor + } + if (!IslandType.DWARVEN_MINES.isInIsland() + && !IslandType.CRYSTAL_HOLLOWS.isInIsland() + ){ + lineMap[12] = Collections.singletonList("") // Powder + } + if (!IslandType.CRYSTAL_HOLLOWS.isInIsland()){ + lineMap[19] = Collections.singletonList("") // Heat + } + if (!IslandType.DUNGEON_HUB.isInIsland() + && !IslandType.CATACOMBS.isInIsland() + && !IslandType.KUUDRA_ARENA.isInIsland() + && !IslandType.CRIMSON_ISLE.isInIsland() + ){ + lineMap[20] = Collections.singletonList("") // Party + } + if (!IslandType.HUB.isInIsland() + && !IslandType.SPIDER_DEN.isInIsland() + && !IslandType.THE_PARK.isInIsland() + && !IslandType.THE_END.isInIsland() + && !IslandType.CRIMSON_ISLE.isInIsland() + ){ + lineMap[14] = Collections.singletonList("") // Slayer + } } return formatDisplay(lineMap) From 19a1156e7e122314a84030421c9d8f692ef81120 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sun, 22 Oct 2023 14:01:17 +0200 Subject: [PATCH 25/44] Hotfix for isInIsland not working for catacombs --- .../hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index fb526dd0bef7..1ec39dd18681 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -28,6 +28,7 @@ class CustomScoreboard { private var display = emptyList>() private val timeFormat24h = SimpleDateFormat("HH:mm:ss") private val timeFormat12h = SimpleDateFormat("hh:mm:ss a") + private var inDungeon = false // Hotfix bc isInIsland doesnt seem to work private var purse = "0" private var motes = "0" private var bank = "0" @@ -74,6 +75,11 @@ class CustomScoreboard { if (line.startsWith("Heat: §c♨")){ heat = line.removePrefix("Heat: §c♨") } + if (line.contains("catacombs", true)){ + inDungeon = true + } else { + inDungeon = false + } } bits = getBits() purse = LorenzUtils.formatInteger(PurseAPI.currentPurse.toInt()) @@ -215,6 +221,7 @@ class CustomScoreboard { && !IslandType.CATACOMBS.isInIsland() && !IslandType.KUUDRA_ARENA.isInIsland() && !IslandType.CRIMSON_ISLE.isInIsland() + || inDungeon // Hotfix bc isInIsland doesnt seem to work ){ lineMap[20] = Collections.singletonList("") // Party } From e4be3d63ed961f640dd93b12e3e03115214d533f Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sun, 22 Oct 2023 14:38:06 +0200 Subject: [PATCH 26/44] Fixed dungeon detection not working (ty hanni) --- .../hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 7 ------- src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 1ec39dd18681..fb526dd0bef7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -28,7 +28,6 @@ class CustomScoreboard { private var display = emptyList>() private val timeFormat24h = SimpleDateFormat("HH:mm:ss") private val timeFormat12h = SimpleDateFormat("hh:mm:ss a") - private var inDungeon = false // Hotfix bc isInIsland doesnt seem to work private var purse = "0" private var motes = "0" private var bank = "0" @@ -75,11 +74,6 @@ class CustomScoreboard { if (line.startsWith("Heat: §c♨")){ heat = line.removePrefix("Heat: §c♨") } - if (line.contains("catacombs", true)){ - inDungeon = true - } else { - inDungeon = false - } } bits = getBits() purse = LorenzUtils.formatInteger(PurseAPI.currentPurse.toInt()) @@ -221,7 +215,6 @@ class CustomScoreboard { && !IslandType.CATACOMBS.isInIsland() && !IslandType.KUUDRA_ARENA.isInIsland() && !IslandType.CRIMSON_ISLE.isInIsland() - || inDungeon // Hotfix bc isInIsland doesnt seem to work ){ lineMap[20] = Collections.singletonList("") // Party } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index d53dd4d1bd79..28afe3b4e2e3 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -430,7 +430,7 @@ object LorenzUtils { && tileSign.signText[3].unformattedText.removeColor() == "speed cap!") } - fun inIsland(island: IslandType) = inSkyBlock && skyBlockIsland == island + fun inIsland(island: IslandType) = inSkyBlock && (skyBlockIsland == island || island == IslandType.CATACOMBS && inDungeons) fun IslandType.isInIsland() = inIsland(this) From 7b68c609d0b8828db67b32f21316ebed0059b27f Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sun, 22 Oct 2023 22:13:31 +0200 Subject: [PATCH 27/44] Added indexes instead of plain numbers --- .../java/at/hannibal2/skyhanni/SkyHanniMod.kt | 1 + .../features/misc/CustomScoreboard.kt | 109 +++++++++++------- 2 files changed, 68 insertions(+), 42 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 36762452f438..933fddca1182 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -609,6 +609,7 @@ class SkyHanniMod { loadModule(ShiftClickEquipment()) loadModule(LockMouseLook) loadModule(DungeonFinderFeatures()) + loadModule(CustomScoreboard()) init() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index fb526dd0bef7..18689d599ecb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -38,6 +38,31 @@ class CustomScoreboard { private var lobbyCode = "None" private var heat = "0" + // Indexes for the scoreboard + private var skyblockIndex = 0 + private var profileIndex = 1 + private var purseIndex = 2 + private var bankIndex = 3 + private var bitsIndex = 4 + private var copperIndex = 5 + private var gemsIndex = 6 + private var locationIndex = 8 + private var skyblockTimeIndex = 9 + private var irlTimeIndex = 10 + private var lobbyCodeIndex = 11 + private var powderIndex = 12 + private var slayerIndex = 14 + private var nextEventIndex = 15 + private var currentEventIndex = 16 + private var mayorIndex = 17 + private var heatIndex = 19 + private var partyIndex = 20 + private var petIndex = 21 + private var quiverIndex = 22 + private var maxwellIndex = 23 + private var websiteIndex = 24 + + @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!config.enabled) return @@ -121,40 +146,40 @@ class CustomScoreboard { private fun drawScoreboard() = buildList> { val lineMap = HashMap>() - lineMap[0] = Collections.singletonList("§6§lSKYBLOCK") - lineMap[1] = Collections.singletonList("${getProfileTypeAsSymbol()}${HypixelData.profileName.firstLetterUppercase()}") - lineMap[2] = Collections.singletonList("Purse: §6$purse") - lineMap[3] = Collections.singletonList("Bank: §6$bank") - lineMap[4] = Collections.singletonList("Bits: §b$bits") - lineMap[5] = Collections.singletonList("Copper: §c$copper") - lineMap[6] = Collections.singletonList("Gems: §a$gems") + lineMap[skyblockIndex] = Collections.singletonList("§6§lSKYBLOCK") + lineMap[profileIndex] = Collections.singletonList("${getProfileTypeAsSymbol()}${HypixelData.profileName.firstLetterUppercase()}") + lineMap[purseIndex] = Collections.singletonList("Purse: §6$purse") + lineMap[bankIndex] = Collections.singletonList("Bank: §6$bank") + lineMap[bitsIndex] = Collections.singletonList("Bits: §b$bits") + lineMap[copperIndex] = Collections.singletonList("Copper: §c$copper") + lineMap[gemsIndex] = Collections.singletonList("Gems: §a$gems") lineMap[7] = Collections.singletonList("") - lineMap[8] = Collections.singletonList(location) - lineMap[9] = Collections.singletonList(SkyBlockTime.now().formatted(false)) - lineMap[10] = Collections.singletonList((if (config.use24hFormat) timeFormat24h else timeFormat12h).format(System.currentTimeMillis())) - lineMap[11] = Collections.singletonList("§8$lobbyCode") - lineMap[12] = Collections.singletonList("§2Mithril §r/§2Gemstone §7Powder") //todo: could be multiline, need to decide + lineMap[locationIndex] = Collections.singletonList(location) + lineMap[skyblockTimeIndex] = Collections.singletonList(SkyBlockTime.now().formatted(false)) + lineMap[irlTimeIndex] = Collections.singletonList((if (config.use24hFormat) timeFormat24h else timeFormat12h).format(System.currentTimeMillis())) + lineMap[lobbyCodeIndex] = Collections.singletonList("§8$lobbyCode") + lineMap[powderIndex] = Collections.singletonList("§2Mithril §r/§2Gemstone §7Powder") //todo: could be multiline, need to decide lineMap[13] = Collections.singletonList("") val slayerList = mutableListOf() slayerList.add("§7Slayer") //todo: get slayer stuff - lineMap[14] = slayerList + lineMap[slayerIndex] = slayerList - lineMap[15] = Collections.singletonList("§7Next Event") + lineMap[nextEventIndex] = Collections.singletonList("§7Next Event") val eventList = mutableListOf() eventList.add("§cCurrent Event") //todo: get event stuff - lineMap[16] = eventList + lineMap[currentEventIndex] = eventList val mayorList = mutableListOf() mayorList.add(MayorElection.currentCandidate?.name ?: "") for (perk in MayorElection.currentCandidate?.perks ?: emptyList()){ mayorList.add(" §7- §e${perk.name}") } - lineMap[17] = mayorList + lineMap[mayorIndex] = mayorList lineMap[18] = Collections.singletonList("") - lineMap[19] = Collections.singletonList("Heat: §c♨$heat") + lineMap[heatIndex] = Collections.singletonList("Heat: §c♨$heat") val partyList = mutableListOf() var partyCount = 0 @@ -164,59 +189,59 @@ class CustomScoreboard { partyList.add(" §7- §7$member") partyCount++ } - lineMap[20] = partyList + lineMap[partyIndex] = partyList - lineMap[21] = Collections.singletonList(ProfileStorageData.profileSpecific?.currentPet ?: "") - lineMap[22] = Collections.singletonList("§7Quiver") - lineMap[23] = Collections.singletonList("§7Maxwell Power") - lineMap[24] = Collections.singletonList("§ewww.hypixel.net") + lineMap[petIndex] = Collections.singletonList(ProfileStorageData.profileSpecific?.currentPet ?: "") + lineMap[quiverIndex] = Collections.singletonList("§7Quiver") + lineMap[maxwellIndex] = Collections.singletonList("§7Maxwell Power") + lineMap[websiteIndex] = Collections.singletonList("§ewww.hypixel.net") // Hide empty lines if (config.hideEmptyLines){ - lineMap[2] = Collections.singletonList(if(purse == "0") "" else "Purse: §6$purse") - lineMap[3] = Collections.singletonList(if(bank == "0") "" else "Bank: §6$bank") - lineMap[4] = Collections.singletonList(if(bits == "0") "" else "Bits: §b$bits") - lineMap[5] = Collections.singletonList(if(copper == "0") "" else "Copper: §c$copper") - lineMap[6] = Collections.singletonList(if(gems == "0") "" else "Gems: §a$gems") - lineMap[8] = Collections.singletonList(if(location == "None") "" else location) - lineMap[11] = Collections.singletonList(if(lobbyCode == "None") "" else "§8$lobbyCode") - lineMap[19] = Collections.singletonList(if(heat == "0") "" else "Heat: §c♨$heat") + lineMap[purseIndex] = Collections.singletonList(if(purse == "0") "" else "Purse: §6$purse") + lineMap[bankIndex] = Collections.singletonList(if(bank == "0") "" else "Bank: §6$bank") + lineMap[bitsIndex] = Collections.singletonList(if(bits == "0") "" else "Bits: §b$bits") + lineMap[copperIndex] = Collections.singletonList(if(copper == "0") "" else "Copper: §c$copper") + lineMap[gemsIndex] = Collections.singletonList(if(gems == "0") "" else "Gems: §a$gems") + lineMap[locationIndex] = Collections.singletonList(if(location == "None") "" else location) + lineMap[lobbyCodeIndex] = Collections.singletonList(if(lobbyCode == "None") "" else "§8$lobbyCode") + lineMap[heatIndex] = Collections.singletonList(if(heat == "0") "" else "Heat: §c♨$heat") if (partyList.size == 1){ - lineMap[20] = Collections.singletonList("") + lineMap[partyIndex] = Collections.singletonList("") } } // Rift if(IslandType.THE_RIFT.isInIsland()){ - lineMap[2] = Collections.singletonList("Motes: §d$motes") + lineMap[purseIndex] = Collections.singletonList("Motes: §d$motes") } // Hide irrelevant lines if (config.hideIrrelevantLines){ if (!IslandType.GARDEN.isInIsland()){ - lineMap[5] = Collections.singletonList("") // Copper + lineMap[copperIndex] = Collections.singletonList("") } if (IslandType.THE_RIFT.isInIsland()){ - lineMap[3] = Collections.singletonList("") // Bank - lineMap[4] = Collections.singletonList("") // Bits - lineMap[6] = Collections.singletonList("") // Gems - lineMap[17] = Collections.singletonList("") // Mayor + lineMap[bankIndex] = Collections.singletonList("") + lineMap[bitsIndex] = Collections.singletonList("") + lineMap[gemsIndex] = Collections.singletonList("") + lineMap[mayorIndex] = Collections.singletonList("") } if (!IslandType.DWARVEN_MINES.isInIsland() && !IslandType.CRYSTAL_HOLLOWS.isInIsland() ){ - lineMap[12] = Collections.singletonList("") // Powder + lineMap[powderIndex] = Collections.singletonList("") } if (!IslandType.CRYSTAL_HOLLOWS.isInIsland()){ - lineMap[19] = Collections.singletonList("") // Heat + lineMap[heatIndex] = Collections.singletonList("") } if (!IslandType.DUNGEON_HUB.isInIsland() && !IslandType.CATACOMBS.isInIsland() && !IslandType.KUUDRA_ARENA.isInIsland() && !IslandType.CRIMSON_ISLE.isInIsland() ){ - lineMap[20] = Collections.singletonList("") // Party + lineMap[partyIndex] = Collections.singletonList("") } if (!IslandType.HUB.isInIsland() && !IslandType.SPIDER_DEN.isInIsland() @@ -224,7 +249,7 @@ class CustomScoreboard { && !IslandType.THE_END.isInIsland() && !IslandType.CRIMSON_ISLE.isInIsland() ){ - lineMap[14] = Collections.singletonList("") // Slayer + lineMap[slayerIndex] = Collections.singletonList("") } } @@ -267,4 +292,4 @@ class CustomScoreboard { } return "§e" } -} \ No newline at end of file +} From 69e9937e4d43efaeec9d16aeed9a312be69ea518 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sun, 22 Oct 2023 22:15:08 +0200 Subject: [PATCH 28/44] Changes the way of getting copper & bits --- .../features/misc/CustomScoreboard.kt | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 18689d599ecb..bbad315ccc8d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -85,7 +85,6 @@ class CustomScoreboard { } } - //todo add copper etc to this for (line in ScoreboardData.sidebarLinesFormatted){ if (line.startsWith(" §7⏣ ") || line.startsWith(" §5ф ")){ location = line @@ -99,10 +98,14 @@ class CustomScoreboard { if (line.startsWith("Heat: §c♨")){ heat = line.removePrefix("Heat: §c♨") } + if (line.startsWith("Bits: §b")){ + bits = line.removePrefix("Bits: §b") + } + if (line.startsWith("Copper: §c")){ + copper = line.removePrefix("Copper: §c") + } } - bits = getBits() purse = LorenzUtils.formatInteger(PurseAPI.currentPurse.toInt()) - copper = getCopper() } private fun formatDisplay(lineMap: HashMap>): MutableList> { @@ -262,24 +265,6 @@ class CustomScoreboard { return matchResult?.groupValues?.lastOrNull() } - private fun getBits() : String { - val bitsRegex = Regex("""Bits: ([\d|,]+)[\d|.]*""") - val scoreboard = ScoreboardData.sidebarLinesFormatted - val bits = scoreboard.firstOrNull { bitsRegex.matches(it.removeColor()) }?.let { - bitsRegex.find(it.removeColor())?.groupValues?.get(1) - } - return bits ?: "0" - } - - private fun getCopper() : String { - val copperRegex = Regex("""Copper: ([\d|,]+)[\d|.]*""") - val scoreboard = ScoreboardData.sidebarLinesFormatted - val copper = scoreboard.firstOrNull { copperRegex.matches(it.removeColor()) }?.let { - copperRegex.find(it.removeColor())?.groupValues?.get(1) - } - return copper ?: "0" - } - private fun getProfileTypeAsSymbol() : String{ if (HypixelData.ironman){ return "§7♲ " From 9ed44f3a69f663d6499bbb88713f8062dea5317e Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sun, 22 Oct 2023 23:20:35 +0200 Subject: [PATCH 29/44] Changed some code structure (small change) --- .../features/misc/CustomScoreboard.kt | 32 +++++++------------ 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index bbad315ccc8d..865bb40484f7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -113,17 +113,11 @@ class CustomScoreboard { for (index in config.textFormat) { lineMap[index]?.let { - // Multiline for Party Members - if (it[0] == "§9Party"){ - for (item in it){ - newList.add(listOf(item)) - } - continue - } - - // Multiline for Mayor - if (it[0] == MayorElection.currentCandidate?.name){ - for (item in it){ + // Multiline support + if (it[0] == "§9Party" + || it[0] == MayorElection.currentCandidate?.name + ) { + for (item in it) { newList.add(listOf(item)) } continue @@ -265,16 +259,12 @@ class CustomScoreboard { return matchResult?.groupValues?.lastOrNull() } - private fun getProfileTypeAsSymbol() : String{ - if (HypixelData.ironman){ - return "§7♲ " - } - if (HypixelData.stranded){ - return "§a☀ " - } - if (HypixelData.bingo){ - return "§cⒷ " //TODO COLORS, maybe bingoAPI? idk + private fun getProfileTypeAsSymbol(): String { + return when { + HypixelData.ironman -> "§7♲ " // Ironman + HypixelData.stranded -> "§a☀ " // Stranded + HypixelData.bingo -> "§cⒷ " // Bingo - TODO: Consider using colors from BingoAPI + else -> "§e" // Default case } - return "§e" } } From 8f2604b235e3c31a3cea740029b8ca904a84b442 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Tue, 24 Oct 2023 20:16:48 +0200 Subject: [PATCH 30/44] Added todolist --- .../skyhanni/features/misc/CustomScoreboard.kt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 865bb40484f7..77597376a4e4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -5,6 +5,23 @@ // I'm also like really sorry for anyone who has to look at this code, it looks kinda bad // +// +// TODO LIST +// V1 RELEASE +// - Add dungeon secrets +// - combine date and lobby +// - toggle between " " and " " +// - Hide default scoreboard +// - only show quiver when holding a bow (detect with 9th slot) +// - mayor color (from neu) +// +// V2 RELEASE +// - Soulflow API +// - Bank API +// - Custom Scoreboard Background +// - icons +// + package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod From f36c0913f432bb279538c7bd9144f92ab7f0c854 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Wed, 25 Oct 2023 19:56:07 +0200 Subject: [PATCH 31/44] Added sblevel, Removed Pet --- .../at/hannibal2/skyhanni/config/features/MiscConfig.java | 2 +- .../hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 3dd69cfe15d4..b347170fdeed 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -826,7 +826,7 @@ public static class CustomScoreboard { "", "§cHeat", "§9Party:\n- hannibal2\n- Moulberry\n- Vahvl\n- J10a1n15", - "§7Pet", + "§7Skyblock Level", "§7Quiver (approximation)", "§7Maxwell Power", "§ewww.hypixel.net", diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 77597376a4e4..4f1d746d9d1a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -8,12 +8,12 @@ // // TODO LIST // V1 RELEASE -// - Add dungeon secrets // - combine date and lobby // - toggle between " " and " " // - Hide default scoreboard // - only show quiver when holding a bow (detect with 9th slot) // - mayor color (from neu) +// - beacon power // // V2 RELEASE // - Soulflow API @@ -31,7 +31,6 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase -import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.TimeUtils.formatted import io.github.moulberry.notenoughupdates.util.SkyBlockTime @@ -74,7 +73,7 @@ class CustomScoreboard { private var mayorIndex = 17 private var heatIndex = 19 private var partyIndex = 20 - private var petIndex = 21 + private var sblevelIndex = 21 private var quiverIndex = 22 private var maxwellIndex = 23 private var websiteIndex = 24 @@ -205,7 +204,7 @@ class CustomScoreboard { } lineMap[partyIndex] = partyList - lineMap[petIndex] = Collections.singletonList(ProfileStorageData.profileSpecific?.currentPet ?: "") + lineMap[sblevelIndex] = Collections.singletonList("§7Skyblock Level") lineMap[quiverIndex] = Collections.singletonList("§7Quiver") lineMap[maxwellIndex] = Collections.singletonList("§7Maxwell Power") lineMap[websiteIndex] = Collections.singletonList("§ewww.hypixel.net") From aafa6560e697fdeacbf452bea820f59ef281f0ba Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 26 Oct 2023 16:09:17 +0200 Subject: [PATCH 32/44] Added copy actionbar command --- .../skyhanni/config/commands/Commands.kt | 5 +++++ .../skyhanni/data/ActionBarStatsData.kt | 3 +++ .../skyhanni/test/command/CopyActionBar.kt | 18 ++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/test/command/CopyActionBar.kt diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 3566d7c36ff2..038548356992 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -35,6 +35,7 @@ import at.hannibal2.skyhanni.test.PacketTest import at.hannibal2.skyhanni.test.SkyHanniConfigSearchResetCommand import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests import at.hannibal2.skyhanni.test.TestBingo +import at.hannibal2.skyhanni.test.command.CopyActionBar import at.hannibal2.skyhanni.test.command.CopyItemCommand import at.hannibal2.skyhanni.test.command.CopyNearbyEntitiesCommand import at.hannibal2.skyhanni.test.command.CopyNearbyParticlesCommand @@ -284,6 +285,10 @@ object Commands { "shplaysound", "Play the specified sound effect at the given pitch and volume." ) { SoundUtils.command(it) } + registerCommand( + "shcopyactionbar", + "Copies the actionbar to the clipboard" + ) { CopyActionBar.command(it) } } private fun internalCommands() { diff --git a/src/main/java/at/hannibal2/skyhanni/data/ActionBarStatsData.kt b/src/main/java/at/hannibal2/skyhanni/data/ActionBarStatsData.kt index 873119171ddb..1c9cbb720b44 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ActionBarStatsData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ActionBarStatsData.kt @@ -14,11 +14,14 @@ object ActionBarStatsData { ) var groups = mutableMapOf("health" to "", "riftTime" to "", "defense" to "", "mana" to "") + var actionBar = "" @SubscribeEvent fun onActionBar(event: LorenzActionBarEvent) { if (!LorenzUtils.inSkyBlock) return + actionBar = event.message + for ((groupName, pattern) in patterns) { pattern.matchMatcher(event.message) { groups[groupName] = group(groupName) diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyActionBar.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyActionBar.kt new file mode 100644 index 000000000000..8e94684af699 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyActionBar.kt @@ -0,0 +1,18 @@ +package at.hannibal2.skyhanni.test.command + +import at.hannibal2.skyhanni.data.ActionBarStatsData +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.transformIf +import at.hannibal2.skyhanni.utils.OSUtils +import at.hannibal2.skyhanni.utils.StringUtils.removeColor + +object CopyActionBar { + fun command(args: Array) { + val noColor = args.size == 1 && args[0] == "true" + var string = "" + string = ActionBarStatsData.actionBar.transformIf({noColor}) { removeColor() } + + OSUtils.copyToClipboard(string) + LorenzUtils.chat("§e[SkyHanni] actionbar copied into your clipboard!") + } +} From d6ab98bc2ece4d923d9e5162ea87cb312de34f5c Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 26 Oct 2023 16:16:26 +0200 Subject: [PATCH 33/44] Changed some elements --- .../skyhanni/config/features/MiscConfig.java | 5 +-- .../features/misc/CustomScoreboard.kt | 38 ++++++++----------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index b347170fdeed..1dfbb2056770 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -815,24 +815,21 @@ public static class CustomScoreboard { "", "§7Location", "§7Ingame Time", - "§Real Time", "§7Current Server", "§2Mithril §r/ §dGemstone §7Powder", "", "§cSlayer", - "§7Next Event", "§7Current Event", "§7Current Mayor", "", "§cHeat", "§9Party:\n- hannibal2\n- Moulberry\n- Vahvl\n- J10a1n15", "§7Skyblock Level", - "§7Quiver (approximation)", "§7Maxwell Power", "§ewww.hypixel.net", } ) - public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24)); + public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20, 21)); @Expose @ConfigOption(name = "Max Party List", desc = "Max number of party members to show in the party list. (You are not included)") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 4f1d746d9d1a..8ab6facf2fbe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -8,18 +8,18 @@ // // TODO LIST // V1 RELEASE -// - combine date and lobby +// - enums prob (why) // - toggle between " " and " " // - Hide default scoreboard -// - only show quiver when holding a bow (detect with 9th slot) // - mayor color (from neu) -// - beacon power // // V2 RELEASE // - Soulflow API // - Bank API // - Custom Scoreboard Background +// - quiver // - icons +// - beacon power // package at.hannibal2.skyhanni.features.misc @@ -42,8 +42,6 @@ import java.util.* class CustomScoreboard { private val config get() = SkyHanniMod.feature.misc.customScoreboard private var display = emptyList>() - private val timeFormat24h = SimpleDateFormat("HH:mm:ss") - private val timeFormat12h = SimpleDateFormat("hh:mm:ss a") private var purse = "0" private var motes = "0" private var bank = "0" @@ -62,21 +60,21 @@ class CustomScoreboard { private var bitsIndex = 4 private var copperIndex = 5 private var gemsIndex = 6 + private var locationIndex = 8 private var skyblockTimeIndex = 9 - private var irlTimeIndex = 10 - private var lobbyCodeIndex = 11 - private var powderIndex = 12 - private var slayerIndex = 14 - private var nextEventIndex = 15 - private var currentEventIndex = 16 - private var mayorIndex = 17 - private var heatIndex = 19 - private var partyIndex = 20 - private var sblevelIndex = 21 - private var quiverIndex = 22 - private var maxwellIndex = 23 - private var websiteIndex = 24 + private var lobbyCodeIndex = 10 + private var powderIndex = 11 + + private var slayerIndex = 13 + private var currentEventIndex = 14 + private var mayorIndex = 15 + + private var heatIndex = 17 + private var partyIndex = 18 + private var sblevelIndex = 19 + private var maxwellIndex = 20 + private var websiteIndex = 21 @SubscribeEvent @@ -169,7 +167,6 @@ class CustomScoreboard { lineMap[7] = Collections.singletonList("") lineMap[locationIndex] = Collections.singletonList(location) lineMap[skyblockTimeIndex] = Collections.singletonList(SkyBlockTime.now().formatted(false)) - lineMap[irlTimeIndex] = Collections.singletonList((if (config.use24hFormat) timeFormat24h else timeFormat12h).format(System.currentTimeMillis())) lineMap[lobbyCodeIndex] = Collections.singletonList("§8$lobbyCode") lineMap[powderIndex] = Collections.singletonList("§2Mithril §r/§2Gemstone §7Powder") //todo: could be multiline, need to decide lineMap[13] = Collections.singletonList("") @@ -178,8 +175,6 @@ class CustomScoreboard { slayerList.add("§7Slayer") //todo: get slayer stuff lineMap[slayerIndex] = slayerList - lineMap[nextEventIndex] = Collections.singletonList("§7Next Event") - val eventList = mutableListOf() eventList.add("§cCurrent Event") //todo: get event stuff lineMap[currentEventIndex] = eventList @@ -205,7 +200,6 @@ class CustomScoreboard { lineMap[partyIndex] = partyList lineMap[sblevelIndex] = Collections.singletonList("§7Skyblock Level") - lineMap[quiverIndex] = Collections.singletonList("§7Quiver") lineMap[maxwellIndex] = Collections.singletonList("§7Maxwell Power") lineMap[websiteIndex] = Collections.singletonList("§ewww.hypixel.net") From b9741079562cdf7bda6fa568bc832a595213a5b9 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 26 Oct 2023 18:34:12 +0200 Subject: [PATCH 34/44] Added skyblocklevelAPI --- .../java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 + .../skyhanni/data/SkyblockLevelAPI.kt | 37 +++++++++++++++++++ .../features/misc/CustomScoreboard.kt | 16 +++++++- 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 933fddca1182..b8551e2c7538 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -33,6 +33,7 @@ import at.hannibal2.skyhanni.data.RenderData import at.hannibal2.skyhanni.data.SackAPI import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.data.SkillExperience +import at.hannibal2.skyhanni.data.SkyblockLevelAPI import at.hannibal2.skyhanni.data.SlayerAPI import at.hannibal2.skyhanni.data.TitleData import at.hannibal2.skyhanni.data.TitleManager @@ -380,6 +381,7 @@ class SkyHanniMod { loadModule(RiftAPI) loadModule(SackAPI) loadModule(BingoAPI) + loadModule(SkyblockLevelAPI) // features loadModule(BazaarOrderHelper()) diff --git a/src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt new file mode 100644 index 000000000000..74cb8b01cdf1 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt @@ -0,0 +1,37 @@ +package at.hannibal2.skyhanni.data + +import at.hannibal2.skyhanni.events.LorenzActionBarEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class SkyblockLevelAPI { + companion object { + var currentLvl: Int = 0 + var xpSource = "" + var currentProgress = 0.0 + } + + @SubscribeEvent + fun onActionBarUpdate (event: LorenzActionBarEvent){ + val info = extractInfo(event.message) + + if (info.isNotEmpty()) { + currentLvl = info[0].toInt() + xpSource = info[1] + currentProgress = info[2].toDouble() + } + } + + private fun extractInfo(inputString: String): List { + val regexPattern = """§b\+(\d+) SkyBlock XP §7\(([^§]+)§7\)§b \((\d+)/100\)""" + val regex = Regex(regexPattern) + + val matchResult = regex.find(inputString) + + return if (matchResult != null) { + val (xpValue, source, progress) = matchResult.destructured + listOf(xpValue, source, progress) + } else { + emptyList() + } + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 8ab6facf2fbe..514b28992324 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -180,7 +180,7 @@ class CustomScoreboard { lineMap[currentEventIndex] = eventList val mayorList = mutableListOf() - mayorList.add(MayorElection.currentCandidate?.name ?: "") + mayorList.add(MayorElection.currentCandidate?.name?.let { translateMayorNameToColor(it) } ?: "") for (perk in MayorElection.currentCandidate?.perks ?: emptyList()){ mayorList.add(" §7- §e${perk.name}") } @@ -263,6 +263,20 @@ class CustomScoreboard { return formatDisplay(lineMap) } + private fun translateMayorNameToColor(input: String) : String { + return when (input) { + "Aatrox" -> "§3$input" + "Cole" -> "§e$input" + "Diana" -> "§2$input" + "Diaz" -> "§6$input" + "Finnegan" -> "§c$input" + "Foxy" -> "§d$input" + "Marina" -> "§b$input" + "Paul" -> "§c$input" + else -> "§7$input" + } + } + private fun extractLobbyCode(input: String): String? { val regex = Regex("§(\\d{3}/\\d{2}/\\d{2}) §([A-Za-z0-9]+)$") val matchResult = regex.find(input) From 8ac6938a7c8e5ac44320bc8533cf108da563b803 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 26 Oct 2023 18:48:55 +0200 Subject: [PATCH 35/44] Added sblevel to scoreboard --- .../skyhanni/config/features/MiscConfig.java | 9 +++--- .../skyhanni/data/SkyblockLevelAPI.kt | 30 ++++++++++++++++--- .../features/misc/CustomScoreboard.kt | 14 +++++++-- 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 1dfbb2056770..322912f24749 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -852,18 +852,17 @@ public static class CustomScoreboard { @FeatureToggle public boolean hideIrrelevantLines = true; - @Expose - @ConfigOption(name = "24h format", desc = "Use 24h format for the IRL time.") + @ConfigOption(name = "Show Mayor Perks", desc = "Show the perks of the current mayor.") @ConfigEditorBoolean @FeatureToggle - public boolean use24hFormat = false; + public boolean showMayorPerks = true; @Expose - @ConfigOption(name = "Show Mayor Perks", desc = "Show the perks of the current mayor.") + @ConfigOption(name = "Show SkyBlock Level Progress", desc = "Show the progress to the next SkyBlock level.") @ConfigEditorBoolean @FeatureToggle - public boolean showMayorPerks = true; + public boolean showSblvlProgess = false; @Expose public Position position = new Position(10, 80, false, true); diff --git a/src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt index 74cb8b01cdf1..fe2135561b05 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt @@ -1,13 +1,17 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.LorenzActionBarEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.TabListData import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent class SkyblockLevelAPI { companion object { - var currentLvl: Int = 0 + var currentLevel: Int = 0 var xpSource = "" - var currentProgress = 0.0 + var currentProgress = "" } @SubscribeEvent @@ -15,9 +19,27 @@ class SkyblockLevelAPI { val info = extractInfo(event.message) if (info.isNotEmpty()) { - currentLvl = info[0].toInt() + currentLevel = info[0].toInt() xpSource = info[1] - currentProgress = info[2].toDouble() + currentProgress = info[2] + } + } + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent){ + if (currentLevel == 0) return + + if (event.phase == TickEvent.Phase.END) { + val player = LorenzUtils.getPlayerName() + val tabData = TabListData.getTabList() + val levelRegex = Regex("""\[(\d{1,3})] $player""") + for (line in tabData) { + if (line.contains(player)) { + val colorlessLine = line.removeColor() + currentLevel = levelRegex.find(colorlessLine)!!.groupValues[1].toInt() + break + } + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 514b28992324..9204d01c0ee2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -181,8 +181,10 @@ class CustomScoreboard { val mayorList = mutableListOf() mayorList.add(MayorElection.currentCandidate?.name?.let { translateMayorNameToColor(it) } ?: "") - for (perk in MayorElection.currentCandidate?.perks ?: emptyList()){ - mayorList.add(" §7- §e${perk.name}") + if (config.showMayorPerks) { + for (perk in MayorElection.currentCandidate?.perks ?: emptyList()) { + mayorList.add(" §7- §e${perk.name}") + } } lineMap[mayorIndex] = mayorList @@ -199,7 +201,13 @@ class CustomScoreboard { } lineMap[partyIndex] = partyList - lineMap[sblevelIndex] = Collections.singletonList("§7Skyblock Level") + val sblevelList = mutableListOf() + sblevelList.add("Level: " + SkyblockLevelAPI.currentLevel) + if (config.showSblvlProgess){ + sblevelList.add("§7Progress: §e${SkyblockLevelAPI.currentProgress}") + } + lineMap[sblevelIndex] = sblevelList + lineMap[maxwellIndex] = Collections.singletonList("§7Maxwell Power") lineMap[websiteIndex] = Collections.singletonList("§ewww.hypixel.net") From 65be9389d93b50c1211558b7b7123daa84c3be93 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 26 Oct 2023 18:51:23 +0200 Subject: [PATCH 36/44] removed import --- .../java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 9204d01c0ee2..eaa104f6d600 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -36,7 +36,6 @@ import at.hannibal2.skyhanni.utils.TimeUtils.formatted import io.github.moulberry.notenoughupdates.util.SkyBlockTime import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent -import java.text.SimpleDateFormat import java.util.* class CustomScoreboard { From b3b06fad317854c17021eae09423e096d84299cb Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 26 Oct 2023 19:15:47 +0200 Subject: [PATCH 37/44] fixed some issues, sb level not working --- src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt | 2 +- .../at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt index fe2135561b05..cd623ee68540 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt @@ -18,7 +18,7 @@ class SkyblockLevelAPI { fun onActionBarUpdate (event: LorenzActionBarEvent){ val info = extractInfo(event.message) - if (info.isNotEmpty()) { + if (info.isNotEmpty() && info[0].isNotEmpty() && info[1].isNotEmpty() && info[2].isNotEmpty()) { currentLevel = info[0].toInt() xpSource = info[1] currentProgress = info[2] diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index eaa104f6d600..855a81d0052b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -128,7 +128,7 @@ class CustomScoreboard { // Multiline support if (it[0] == "§9Party" - || it[0] == MayorElection.currentCandidate?.name + || it[0] == translateMayorNameToColor(MayorElection.currentCandidate?.name ?: "") ) { for (item in it) { newList.add(listOf(item)) From 0903b6ce49115f3681e812791e4fdfeada391680 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 26 Oct 2023 19:25:21 +0200 Subject: [PATCH 38/44] Added empty line indexes --- .../skyhanni/features/misc/CustomScoreboard.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 855a81d0052b..096510552d7e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -59,16 +59,16 @@ class CustomScoreboard { private var bitsIndex = 4 private var copperIndex = 5 private var gemsIndex = 6 - + private var EMPTY_LINE = 7 private var locationIndex = 8 private var skyblockTimeIndex = 9 private var lobbyCodeIndex = 10 private var powderIndex = 11 - + private var EMPTY_LINE2 = 12 private var slayerIndex = 13 private var currentEventIndex = 14 private var mayorIndex = 15 - + private var EMPTY_LINE3 = 16 private var heatIndex = 17 private var partyIndex = 18 private var sblevelIndex = 19 @@ -163,12 +163,12 @@ class CustomScoreboard { lineMap[bitsIndex] = Collections.singletonList("Bits: §b$bits") lineMap[copperIndex] = Collections.singletonList("Copper: §c$copper") lineMap[gemsIndex] = Collections.singletonList("Gems: §a$gems") - lineMap[7] = Collections.singletonList("") + lineMap[EMPTY_LINE] = Collections.singletonList("") lineMap[locationIndex] = Collections.singletonList(location) lineMap[skyblockTimeIndex] = Collections.singletonList(SkyBlockTime.now().formatted(false)) lineMap[lobbyCodeIndex] = Collections.singletonList("§8$lobbyCode") lineMap[powderIndex] = Collections.singletonList("§2Mithril §r/§2Gemstone §7Powder") //todo: could be multiline, need to decide - lineMap[13] = Collections.singletonList("") + lineMap[EMPTY_LINE2] = Collections.singletonList("") val slayerList = mutableListOf() slayerList.add("§7Slayer") //todo: get slayer stuff @@ -187,7 +187,7 @@ class CustomScoreboard { } lineMap[mayorIndex] = mayorList - lineMap[18] = Collections.singletonList("") + lineMap[EMPTY_LINE3] = Collections.singletonList("") lineMap[heatIndex] = Collections.singletonList("Heat: §c♨$heat") val partyList = mutableListOf() From 95af71b3cd682519de6155c8c5a17edfc5ee2a97 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 26 Oct 2023 19:28:35 +0200 Subject: [PATCH 39/44] fixed sb lvl multiline --- .../at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 096510552d7e..03c183f57ee9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -128,7 +128,8 @@ class CustomScoreboard { // Multiline support if (it[0] == "§9Party" - || it[0] == translateMayorNameToColor(MayorElection.currentCandidate?.name ?: "") + || it[0].toString().contains(MayorElection.currentCandidate?.name ?: "") + || it[0].toString().contains("Level:") ) { for (item in it) { newList.add(listOf(item)) From c57c955555eb3abef1f5e176715a5709586a0e74 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Thu, 26 Oct 2023 19:50:56 +0200 Subject: [PATCH 40/44] Removed sb level for a future update --- .../skyhanni/config/features/MiscConfig.java | 9 +-- .../skyhanni/data/SkyblockLevelAPI.kt | 59 ------------------- .../features/misc/CustomScoreboard.kt | 14 +---- 3 files changed, 4 insertions(+), 78 deletions(-) delete mode 100644 src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 322912f24749..6a1a50ff3f94 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -824,12 +824,11 @@ public static class CustomScoreboard { "", "§cHeat", "§9Party:\n- hannibal2\n- Moulberry\n- Vahvl\n- J10a1n15", - "§7Skyblock Level", "§7Maxwell Power", "§ewww.hypixel.net", } ) - public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20, 21)); + public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20)); @Expose @ConfigOption(name = "Max Party List", desc = "Max number of party members to show in the party list. (You are not included)") @@ -858,12 +857,6 @@ public static class CustomScoreboard { @FeatureToggle public boolean showMayorPerks = true; - @Expose - @ConfigOption(name = "Show SkyBlock Level Progress", desc = "Show the progress to the next SkyBlock level.") - @ConfigEditorBoolean - @FeatureToggle - public boolean showSblvlProgess = false; - @Expose public Position position = new Position(10, 80, false, true); } diff --git a/src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt deleted file mode 100644 index cd623ee68540..000000000000 --- a/src/main/java/at/hannibal2/skyhanni/data/SkyblockLevelAPI.kt +++ /dev/null @@ -1,59 +0,0 @@ -package at.hannibal2.skyhanni.data - -import at.hannibal2.skyhanni.events.LorenzActionBarEvent -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.StringUtils.removeColor -import at.hannibal2.skyhanni.utils.TabListData -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.gameevent.TickEvent - -class SkyblockLevelAPI { - companion object { - var currentLevel: Int = 0 - var xpSource = "" - var currentProgress = "" - } - - @SubscribeEvent - fun onActionBarUpdate (event: LorenzActionBarEvent){ - val info = extractInfo(event.message) - - if (info.isNotEmpty() && info[0].isNotEmpty() && info[1].isNotEmpty() && info[2].isNotEmpty()) { - currentLevel = info[0].toInt() - xpSource = info[1] - currentProgress = info[2] - } - } - - @SubscribeEvent - fun onTick(event: TickEvent.ClientTickEvent){ - if (currentLevel == 0) return - - if (event.phase == TickEvent.Phase.END) { - val player = LorenzUtils.getPlayerName() - val tabData = TabListData.getTabList() - val levelRegex = Regex("""\[(\d{1,3})] $player""") - for (line in tabData) { - if (line.contains(player)) { - val colorlessLine = line.removeColor() - currentLevel = levelRegex.find(colorlessLine)!!.groupValues[1].toInt() - break - } - } - } - } - - private fun extractInfo(inputString: String): List { - val regexPattern = """§b\+(\d+) SkyBlock XP §7\(([^§]+)§7\)§b \((\d+)/100\)""" - val regex = Regex(regexPattern) - - val matchResult = regex.find(inputString) - - return if (matchResult != null) { - val (xpValue, source, progress) = matchResult.destructured - listOf(xpValue, source, progress) - } else { - emptyList() - } - } -} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 03c183f57ee9..fa25e1a010af 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -20,6 +20,7 @@ // - quiver // - icons // - beacon power +// - skyblock level // package at.hannibal2.skyhanni.features.misc @@ -71,9 +72,8 @@ class CustomScoreboard { private var EMPTY_LINE3 = 16 private var heatIndex = 17 private var partyIndex = 18 - private var sblevelIndex = 19 - private var maxwellIndex = 20 - private var websiteIndex = 21 + private var maxwellIndex = 19 + private var websiteIndex = 20 @SubscribeEvent @@ -129,7 +129,6 @@ class CustomScoreboard { // Multiline support if (it[0] == "§9Party" || it[0].toString().contains(MayorElection.currentCandidate?.name ?: "") - || it[0].toString().contains("Level:") ) { for (item in it) { newList.add(listOf(item)) @@ -201,13 +200,6 @@ class CustomScoreboard { } lineMap[partyIndex] = partyList - val sblevelList = mutableListOf() - sblevelList.add("Level: " + SkyblockLevelAPI.currentLevel) - if (config.showSblvlProgess){ - sblevelList.add("§7Progress: §e${SkyblockLevelAPI.currentProgress}") - } - lineMap[sblevelIndex] = sblevelList - lineMap[maxwellIndex] = Collections.singletonList("§7Maxwell Power") lineMap[websiteIndex] = Collections.singletonList("§ewww.hypixel.net") From d08cc8aca4eddaa6086b1d6128db9bb639e3d9fa Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sat, 28 Oct 2023 12:18:09 +0200 Subject: [PATCH 41/44] Added powder! --- .../java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 -- .../skyhanni/config/features/MiscConfig.java | 2 +- .../features/misc/CustomScoreboard.kt | 33 +++++++++++++++---- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index d6ce96cdf07b..b2ddafa5fedc 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -33,7 +33,6 @@ import at.hannibal2.skyhanni.data.RenderData import at.hannibal2.skyhanni.data.SackAPI import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.data.SkillExperience -import at.hannibal2.skyhanni.data.SkyblockLevelAPI import at.hannibal2.skyhanni.data.SlayerAPI import at.hannibal2.skyhanni.data.TitleData import at.hannibal2.skyhanni.data.TitleManager @@ -382,7 +381,6 @@ class SkyHanniMod { loadModule(RiftAPI) loadModule(SackAPI) loadModule(BingoAPI) - loadModule(SkyblockLevelAPI) // features loadModule(BazaarOrderHelper()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 5e1a7cb8b7ba..8d4e8e5d5efa 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -816,7 +816,7 @@ public static class CustomScoreboard { "§7Location", "§7Ingame Time", "§7Current Server", - "§2Mithril §r/ §dGemstone §7Powder", + "§7Powder\n §fMithril: §254,646\n §fGemstone: §d51,234", "", "§cSlayer", "§7Current Event", diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index fa25e1a010af..1f8ea2024c17 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -11,7 +11,7 @@ // - enums prob (why) // - toggle between " " and " " // - Hide default scoreboard -// - mayor color (from neu) +// - the things that arent done yet // // V2 RELEASE // - Soulflow API @@ -21,12 +21,18 @@ // - icons // - beacon power // - skyblock level +// - commissions // package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.* +import at.hannibal2.skyhanni.data.HypixelData +import at.hannibal2.skyhanni.data.ScoreboardData +import at.hannibal2.skyhanni.data.PurseAPI +import at.hannibal2.skyhanni.data.MayorElection +import at.hannibal2.skyhanni.data.PartyAPI +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland @@ -51,6 +57,8 @@ class CustomScoreboard { private var location = "None" private var lobbyCode = "None" private var heat = "0" + private var mithrilPowder = "0" + private var gemstonePowder = "0" // Indexes for the scoreboard private var skyblockIndex = 0 @@ -96,6 +104,12 @@ class CustomScoreboard { if (line.startsWith(" Bank: §r§6")){ bank = line.removePrefix(" Bank: §r§6") } + if (line.startsWith(" §r§fMithril Powder: §r§2")){ + mithrilPowder = line.removePrefix(" §r§fMithril Powder: §r§2") + } + if (line.startsWith(" §r§fGemstone Powder: §r§d")){ + gemstonePowder = line.removePrefix(" §r§fGemstone Powder: §r§d") + } } for (line in ScoreboardData.sidebarLinesFormatted){ @@ -108,8 +122,8 @@ class CustomScoreboard { if (extractLobbyCode(line) is String ){ lobbyCode = extractLobbyCode(line)!!.substring(1) //removes first char (number of color code) } - if (line.startsWith("Heat: §c♨")){ - heat = line.removePrefix("Heat: §c♨") + if (line.startsWith("Heat: ")){ + heat = line.removePrefix("Heat: ") } if (line.startsWith("Bits: §b")){ bits = line.removePrefix("Bits: §b") @@ -129,6 +143,7 @@ class CustomScoreboard { // Multiline support if (it[0] == "§9Party" || it[0].toString().contains(MayorElection.currentCandidate?.name ?: "") + || it[0] == "§fPowder" ) { for (item in it) { newList.add(listOf(item)) @@ -167,7 +182,13 @@ class CustomScoreboard { lineMap[locationIndex] = Collections.singletonList(location) lineMap[skyblockTimeIndex] = Collections.singletonList(SkyBlockTime.now().formatted(false)) lineMap[lobbyCodeIndex] = Collections.singletonList("§8$lobbyCode") - lineMap[powderIndex] = Collections.singletonList("§2Mithril §r/§2Gemstone §7Powder") //todo: could be multiline, need to decide + + val powderList = mutableListOf() + powderList.add("§fPowder") + powderList.add(" §7- §fMithril: §2$mithrilPowder") + powderList.add(" §7- §fGemstone: §d$gemstonePowder") + lineMap[powderIndex] = powderList + lineMap[EMPTY_LINE2] = Collections.singletonList("") val slayerList = mutableListOf() @@ -188,7 +209,7 @@ class CustomScoreboard { lineMap[mayorIndex] = mayorList lineMap[EMPTY_LINE3] = Collections.singletonList("") - lineMap[heatIndex] = Collections.singletonList("Heat: §c♨$heat") + lineMap[heatIndex] = Collections.singletonList(if(heat == "0") "Heat: §c♨ 0" else "Heat: $heat") val partyList = mutableListOf() var partyCount = 0 From 93b81382f947c9dbb3d02ce66ba9747d2c91cc1a Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sat, 28 Oct 2023 12:21:26 +0200 Subject: [PATCH 42/44] Changed Powder text color --- .../at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 1f8ea2024c17..1a144432d256 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -143,7 +143,7 @@ class CustomScoreboard { // Multiline support if (it[0] == "§9Party" || it[0].toString().contains(MayorElection.currentCandidate?.name ?: "") - || it[0] == "§fPowder" + || it[0].toString().contains("Powder") ) { for (item in it) { newList.add(listOf(item)) @@ -184,7 +184,7 @@ class CustomScoreboard { lineMap[lobbyCodeIndex] = Collections.singletonList("§8$lobbyCode") val powderList = mutableListOf() - powderList.add("§fPowder") + powderList.add("§9§lPowder") powderList.add(" §7- §fMithril: §2$mithrilPowder") powderList.add(" §7- §fGemstone: §d$gemstonePowder") lineMap[powderIndex] = powderList From 53ccab6c161054c67ed1813b64aefa63eb231dd7 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sat, 28 Oct 2023 12:30:25 +0200 Subject: [PATCH 43/44] Moved scoreboard config loc up --- .../skyhanni/config/features/MiscConfig.java | 158 +++++++++--------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 8d4e8e5d5efa..6a617bcca840 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -665,6 +665,85 @@ public static class KickDurationConfig { public Position position = new Position(400, 200, 1.3f); } + @Expose + @ConfigOption(name = "Custom Scoreboard", desc = "") + @Accordion + public MiscConfig.CustomScoreboard customScoreboard = new MiscConfig.CustomScoreboard(); + + public static class CustomScoreboard { + + @Expose + @ConfigOption( + name = "Enabled", + desc = "Show a custom scoreboard instead of the default one." //TODO: MAKE COOLER + ) + @ConfigEditorBoolean + @FeatureToggle + public boolean enabled = false; + + @Expose + @ConfigOption( + name = "Text Format", + desc = "Drag text to change the appearance of the overlay." + ) + @ConfigEditorDraggableList( + exampleText = { + "§6§lSKYBLOCK", + "§7Profile", + "§ePurse", + "§eBank", + "§bBits", + "§cCopper", + "§aGems", + "", + "§7Location", + "§7Ingame Time", + "§7Current Server", + "§7Powder\n §fMithril: §254,646\n §fGemstone: §d51,234", + "", + "§cSlayer", + "§7Current Event", + "§7Current Mayor", + "", + "§cHeat", + "§9Party:\n- hannibal2\n- Moulberry\n- Vahvl\n- J10a1n15", + "§7Maxwell Power", + "§ewww.hypixel.net", + } + ) + public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20)); + + @Expose + @ConfigOption(name = "Max Party List", desc = "Max number of party members to show in the party list. (You are not included)") + @ConfigEditorSlider( + minValue = 1, + maxValue = 25, // why do I even set it so high + minStep = 1 + ) + public Property maxPartyList = Property.of(4); + + @Expose + @ConfigOption(name = "Hide lines with no info", desc = "Hide lines that have no info to display, like hiding the party when not being in one.") + @ConfigEditorBoolean + @FeatureToggle + public boolean hideEmptyLines = true; + + @Expose + @ConfigOption(name = "Hide Info not relevant to location", desc = "Hide lines that are not relevant to the current location, like hiding copper while not in garden") + @ConfigEditorBoolean + @FeatureToggle + public boolean hideIrrelevantLines = true; + + @Expose + @ConfigOption(name = "Show Mayor Perks", desc = "Show the perks of the current mayor.") + @ConfigEditorBoolean + @FeatureToggle + public boolean showMayorPerks = true; + + @Expose + public Position position = new Position(10, 80, false, true); + } + @Expose @ConfigOption(name = "Exp Bottles", desc = "Hides all the experience orbs lying on the ground.") @ConfigEditorBoolean @@ -781,83 +860,4 @@ public static class KickDurationConfig { @Expose public Position inventoryLoadPos = new Position(394, 124, false, true); - - @Expose - @ConfigOption(name = "Custom Scoreboard", desc = "") - @Accordion - public MiscConfig.CustomScoreboard customScoreboard = new MiscConfig.CustomScoreboard(); - - public static class CustomScoreboard { - - @Expose - @ConfigOption( - name = "Enabled", - desc = "Show a custom scoreboard instead of the default one." //TODO: MAKE COOLER - ) - @ConfigEditorBoolean - @FeatureToggle - public boolean enabled = false; - - @Expose - @ConfigOption( - name = "Text Format", - desc = "Drag text to change the appearance of the overlay." - ) - @ConfigEditorDraggableList( - exampleText = { - "§6§lSKYBLOCK", - "§7Profile", - "§ePurse", - "§eBank", - "§bBits", - "§cCopper", - "§aGems", - "", - "§7Location", - "§7Ingame Time", - "§7Current Server", - "§7Powder\n §fMithril: §254,646\n §fGemstone: §d51,234", - "", - "§cSlayer", - "§7Current Event", - "§7Current Mayor", - "", - "§cHeat", - "§9Party:\n- hannibal2\n- Moulberry\n- Vahvl\n- J10a1n15", - "§7Maxwell Power", - "§ewww.hypixel.net", - } - ) - public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20)); - - @Expose - @ConfigOption(name = "Max Party List", desc = "Max number of party members to show in the party list. (You are not included)") - @ConfigEditorSlider( - minValue = 1, - maxValue = 25, // why do I even set it so high - minStep = 1 - ) - public Property maxPartyList = Property.of(4); - - @Expose - @ConfigOption(name = "Hide lines with no info", desc = "Hide lines that have no info to display, like hiding the party when not being in one.") - @ConfigEditorBoolean - @FeatureToggle - public boolean hideEmptyLines = true; - - @Expose - @ConfigOption(name = "Hide Info not relevant to location", desc = "Hide lines that are not relevant to the current location, like hiding copper while not in garden") - @ConfigEditorBoolean - @FeatureToggle - public boolean hideIrrelevantLines = true; - - @Expose - @ConfigOption(name = "Show Mayor Perks", desc = "Show the perks of the current mayor.") - @ConfigEditorBoolean - @FeatureToggle - public boolean showMayorPerks = true; - - @Expose - public Position position = new Position(10, 80, false, true); - } } From 63b20f24a17fc1686692b4d0713d21ce41b5a238 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Mon, 30 Oct 2023 00:11:15 +0100 Subject: [PATCH 44/44] Tried smth with enums, doesnt update --- .../skyhanni/config/features/MiscConfig.java | 10 +- .../features/misc/CustomScoreboard.kt | 436 +++++++++++------- 2 files changed, 269 insertions(+), 177 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 6a617bcca840..1b0d27a9a950 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -691,6 +691,7 @@ public static class CustomScoreboard { "§6§lSKYBLOCK", "§7Profile", "§ePurse", + "§dMotes", "§eBank", "§bBits", "§cCopper", @@ -711,7 +712,7 @@ public static class CustomScoreboard { "§ewww.hypixel.net", } ) - public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20)); + public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20, 21)); @Expose @ConfigOption(name = "Max Party List", desc = "Max number of party members to show in the party list. (You are not included)") @@ -734,6 +735,13 @@ public static class CustomScoreboard { @FeatureToggle public boolean hideIrrelevantLines = true; + @Expose + @ConfigOption(name = "Display Numbers First", desc = "Determines whether the number or line name displays first. " + + "§eNote: Will not update the preview above!") + @ConfigEditorBoolean + @FeatureToggle + public boolean displayNumbersFirst = false; + @Expose @ConfigOption(name = "Show Mayor Perks", desc = "Show the perks of the current mayor.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt index 1a144432d256..5ae024fff4e0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomScoreboard.kt @@ -35,7 +35,6 @@ import at.hannibal2.skyhanni.data.PartyAPI import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase import at.hannibal2.skyhanni.utils.TabListData @@ -45,45 +44,219 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent import java.util.* -class CustomScoreboard { - private val config get() = SkyHanniMod.feature.misc.customScoreboard - private var display = emptyList>() - private var purse = "0" - private var motes = "0" - private var bank = "0" - private var bits = "0" - private var copper = "0" - private var gems = "0" - private var location = "None" - private var lobbyCode = "None" - private var heat = "0" - private var mithrilPowder = "0" - private var gemstonePowder = "0" - - // Indexes for the scoreboard - private var skyblockIndex = 0 - private var profileIndex = 1 - private var purseIndex = 2 - private var bankIndex = 3 - private var bitsIndex = 4 - private var copperIndex = 5 - private var gemsIndex = 6 - private var EMPTY_LINE = 7 - private var locationIndex = 8 - private var skyblockTimeIndex = 9 - private var lobbyCodeIndex = 10 - private var powderIndex = 11 - private var EMPTY_LINE2 = 12 - private var slayerIndex = 13 - private var currentEventIndex = 14 - private var mayorIndex = 15 - private var EMPTY_LINE3 = 16 - private var heatIndex = 17 - private var partyIndex = 18 - private var maxwellIndex = 19 - private var websiteIndex = 20 - +private val config get() = SkyHanniMod.feature.misc.customScoreboard +private var display = emptyList>() +private var partyCount = 0 + +// Stats / Numbers +private var purse = "0" +private var motes = "0" +private var bank = "0" +private var bits = "0" +private var copper = "0" +private var gems = "0" +private var location = "None" +private var lobbyCode = "None" +private var heat = "0" +private var mithrilPowder = "0" +private var gemstonePowder = "0" + + +enum class CustomScoreboardElements ( + // displayLine: The line that is displayed on the scoreboard + val displayLine: List, + + // alternativeLine: The line that is displayed on the scoreboard when "displayNumbersFirst" is enabled + val alternativeLine: List, + + // islands: The islands that this line is displayed on + val islands: List, + + // visibilityOption: The option that is used to hide this line - use 0 to only display on the listed islands, 1 to hide on the listed islands + val visibilityOption : Int, + + // index: The index of the line + val index: Int, + + // data: The data that is used for this line + val data: String = "" +){ + SKYBLOCK( + listOf("§6§lSKYBLOCK"), + listOf(), + listOf(), + 0, + 0 + ), + PROFILE( + listOf(getProfileTypeAsSymbol() + HypixelData.profileName.firstLetterUppercase()), + listOf(), + listOf(), + 0, + 1 + ), + PURSE( + listOf("Purse: §6$purse"), + listOf("§6$purse Purse"), + listOf(IslandType.THE_RIFT), + 1, + 2, + purse + ), + MOTES( + listOf("Motes: §d$motes"), + listOf("§d$motes Motes"), + listOf(IslandType.THE_RIFT), + 0, + 3, + motes + ), + BANK( + listOf("Bank: §6$bank"), + listOf("§6$bank Bank"), + listOf(IslandType.THE_RIFT), + 1, + 4, + bank + ), + BITS( + listOf("Bits: §b$bits"), + listOf("§b$bits Bits"), + listOf(IslandType.THE_RIFT), + 1, + 5, + bits + ), + COPPER( + listOf("Copper: §c$copper"), + listOf("§c$copper Copper"), + listOf(IslandType.GARDEN), + 0, + 6, + copper + ), + GEMS( + listOf("Gems: §a$gems"), + listOf("§a$gems Gems"), + listOf(IslandType.THE_RIFT), + 1, + 7, + gems + ), + EMPTY_LINE( + listOf(""), + listOf(), + listOf(), + 0, + 8 + ), + LOCATION( + listOf(location), + listOf(), + listOf(), + 0, + 9 + ), + SKYBLOCK_TIME( + listOf(SkyBlockTime.now().formatted(false)), + listOf(), + listOf(), + 0, + 10 + ), + LOBBY_CODE( + listOf("§8$lobbyCode"), + listOf(), + listOf(), + 0, + 11 + ), + POWDER( + listOf("§9§lPowder") + (" §7- §fMithril: §2$mithrilPowder") + (" §7- §fGemstone: §d$gemstonePowder"), + listOf("§9§lPowder") + (" §7- §2$mithrilPowder Mithril") + (" §7- §d$gemstonePowder Gemstone"), + listOf(IslandType.CRYSTAL_HOLLOWS, IslandType.DWARVEN_MINES), + 0, + 12 + ), + EMPTY_LINE2( + listOf(""), + listOf(), + listOf(), + 0, + 13 + ), + SLAYER( + listOf("§7Slayer"), + listOf(""), + listOf(IslandType.HUB, IslandType.SPIDER_DEN, IslandType.THE_PARK, IslandType.THE_END, IslandType.CRIMSON_ISLE), + 0, + 14 + ), + CURRENT_EVENT( + listOf("§cCurrent Event"), + listOf(""), + listOf(), + 0, + 15 + ), + MAYOR( + listOf( + MayorElection.currentCandidate?.name?.let { translateMayorNameToColor(it) } ?: "" + ) + (if (config.showMayorPerks) { + MayorElection.currentCandidate?.perks?.map { " §7- §e${it.name}" } ?: emptyList() + } else { + emptyList() + }), + listOf(), + listOf(IslandType.THE_RIFT), + 1, + 16 + ), + EMPTY_LINE3( + listOf(""), + listOf(), + listOf(), + 0, + 17 + ), + HEAT( + listOf(if(heat == "0") "Heat: §c♨ 0" else "Heat: $heat"), + listOf(if(heat == "0") "§c♨ 0 Heat" else "$heat Heat"), + listOf(IslandType.CRYSTAL_HOLLOWS), + 0, + 18, + heat + ), + PARTY( + listOf( + "§9Party", + *PartyAPI.partyMembers.takeWhile { partyCount < config.maxPartyList.get() } + .map { " §7- §7$it" } + .toTypedArray() + ), + listOf(), + listOf(IslandType.CATACOMBS, IslandType.DUNGEON_HUB, IslandType.KUUDRA_ARENA, IslandType.CRIMSON_ISLE), + 0, + 19, + partyCount.toString() + ), + MAXWELL( + listOf("§7Maxwell Power"), + listOf(), + listOf(IslandType.THE_RIFT), + 1, + 20 + ), + WEBSITE( + listOf("§ewww.hypixel.net"), + listOf(), + listOf(), + 0, + 21 + ); +} +class CustomScoreboard { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!config.enabled) return @@ -96,6 +269,9 @@ class CustomScoreboard { // Draws the custom scoreboard display = drawScoreboard() + // Resets Party count + partyCount = 0 + // Gets some values for the scoreboard for (line in TabListData.getTabList()){ if (line.startsWith(" Gems: §r§a")){ @@ -135,6 +311,25 @@ class CustomScoreboard { purse = LorenzUtils.formatInteger(PurseAPI.currentPurse.toInt()) } + private fun drawScoreboard() = buildList> { + val lineMap = HashMap>() + for (element in CustomScoreboardElements.entries) { + if (element.data == "0" && config.hideEmptyLines){ // Hide empty lines + lineMap[element.index] = listOf("") + continue + } + + lineMap[element.index] = formatLine(element) + } + + return formatDisplay(lineMap) + } + + private fun formatLine(element: CustomScoreboardElements) : List{ + if (element.alternativeLine.isEmpty()) return element.displayLine + return if (config.displayNumbersFirst) element.alternativeLine else element.displayLine + } + private fun formatDisplay(lineMap: HashMap>): MutableList> { val newList = mutableListOf>() for (index in config.textFormat) { @@ -169,147 +364,36 @@ class CustomScoreboard { return newList } - private fun drawScoreboard() = buildList> { - val lineMap = HashMap>() - lineMap[skyblockIndex] = Collections.singletonList("§6§lSKYBLOCK") - lineMap[profileIndex] = Collections.singletonList("${getProfileTypeAsSymbol()}${HypixelData.profileName.firstLetterUppercase()}") - lineMap[purseIndex] = Collections.singletonList("Purse: §6$purse") - lineMap[bankIndex] = Collections.singletonList("Bank: §6$bank") - lineMap[bitsIndex] = Collections.singletonList("Bits: §b$bits") - lineMap[copperIndex] = Collections.singletonList("Copper: §c$copper") - lineMap[gemsIndex] = Collections.singletonList("Gems: §a$gems") - lineMap[EMPTY_LINE] = Collections.singletonList("") - lineMap[locationIndex] = Collections.singletonList(location) - lineMap[skyblockTimeIndex] = Collections.singletonList(SkyBlockTime.now().formatted(false)) - lineMap[lobbyCodeIndex] = Collections.singletonList("§8$lobbyCode") - - val powderList = mutableListOf() - powderList.add("§9§lPowder") - powderList.add(" §7- §fMithril: §2$mithrilPowder") - powderList.add(" §7- §fGemstone: §d$gemstonePowder") - lineMap[powderIndex] = powderList - - lineMap[EMPTY_LINE2] = Collections.singletonList("") - - val slayerList = mutableListOf() - slayerList.add("§7Slayer") //todo: get slayer stuff - lineMap[slayerIndex] = slayerList - - val eventList = mutableListOf() - eventList.add("§cCurrent Event") //todo: get event stuff - lineMap[currentEventIndex] = eventList - - val mayorList = mutableListOf() - mayorList.add(MayorElection.currentCandidate?.name?.let { translateMayorNameToColor(it) } ?: "") - if (config.showMayorPerks) { - for (perk in MayorElection.currentCandidate?.perks ?: emptyList()) { - mayorList.add(" §7- §e${perk.name}") - } - } - lineMap[mayorIndex] = mayorList - - lineMap[EMPTY_LINE3] = Collections.singletonList("") - lineMap[heatIndex] = Collections.singletonList(if(heat == "0") "Heat: §c♨ 0" else "Heat: $heat") - - val partyList = mutableListOf() - var partyCount = 0 - partyList.add("§9Party") - for (member in PartyAPI.partyMembers){ - if (partyCount >= config.maxPartyList.get()) break - partyList.add(" §7- §7$member") - partyCount++ - } - lineMap[partyIndex] = partyList - - lineMap[maxwellIndex] = Collections.singletonList("§7Maxwell Power") - lineMap[websiteIndex] = Collections.singletonList("§ewww.hypixel.net") - - // Hide empty lines - if (config.hideEmptyLines){ - lineMap[purseIndex] = Collections.singletonList(if(purse == "0") "" else "Purse: §6$purse") - lineMap[bankIndex] = Collections.singletonList(if(bank == "0") "" else "Bank: §6$bank") - lineMap[bitsIndex] = Collections.singletonList(if(bits == "0") "" else "Bits: §b$bits") - lineMap[copperIndex] = Collections.singletonList(if(copper == "0") "" else "Copper: §c$copper") - lineMap[gemsIndex] = Collections.singletonList(if(gems == "0") "" else "Gems: §a$gems") - lineMap[locationIndex] = Collections.singletonList(if(location == "None") "" else location) - lineMap[lobbyCodeIndex] = Collections.singletonList(if(lobbyCode == "None") "" else "§8$lobbyCode") - lineMap[heatIndex] = Collections.singletonList(if(heat == "0") "" else "Heat: §c♨$heat") - - if (partyList.size == 1){ - lineMap[partyIndex] = Collections.singletonList("") - } - } - - // Rift - if(IslandType.THE_RIFT.isInIsland()){ - lineMap[purseIndex] = Collections.singletonList("Motes: §d$motes") - } - - // Hide irrelevant lines - if (config.hideIrrelevantLines){ - if (!IslandType.GARDEN.isInIsland()){ - lineMap[copperIndex] = Collections.singletonList("") - } - if (IslandType.THE_RIFT.isInIsland()){ - lineMap[bankIndex] = Collections.singletonList("") - lineMap[bitsIndex] = Collections.singletonList("") - lineMap[gemsIndex] = Collections.singletonList("") - lineMap[mayorIndex] = Collections.singletonList("") - } - if (!IslandType.DWARVEN_MINES.isInIsland() - && !IslandType.CRYSTAL_HOLLOWS.isInIsland() - ){ - lineMap[powderIndex] = Collections.singletonList("") - } - if (!IslandType.CRYSTAL_HOLLOWS.isInIsland()){ - lineMap[heatIndex] = Collections.singletonList("") - } - if (!IslandType.DUNGEON_HUB.isInIsland() - && !IslandType.CATACOMBS.isInIsland() - && !IslandType.KUUDRA_ARENA.isInIsland() - && !IslandType.CRIMSON_ISLE.isInIsland() - ){ - lineMap[partyIndex] = Collections.singletonList("") - } - if (!IslandType.HUB.isInIsland() - && !IslandType.SPIDER_DEN.isInIsland() - && !IslandType.THE_PARK.isInIsland() - && !IslandType.THE_END.isInIsland() - && !IslandType.CRIMSON_ISLE.isInIsland() - ){ - lineMap[slayerIndex] = Collections.singletonList("") - } - } - - return formatDisplay(lineMap) + private fun isEnabled() : Boolean{ + return config.enabled && LorenzUtils.inSkyBlock } +} - private fun translateMayorNameToColor(input: String) : String { - return when (input) { - "Aatrox" -> "§3$input" - "Cole" -> "§e$input" - "Diana" -> "§2$input" - "Diaz" -> "§6$input" - "Finnegan" -> "§c$input" - "Foxy" -> "§d$input" - "Marina" -> "§b$input" - "Paul" -> "§c$input" - else -> "§7$input" - } +private fun translateMayorNameToColor(input: String) : String { + return when (input) { + "Aatrox" -> "§3$input" + "Cole" -> "§e$input" + "Diana" -> "§2$input" + "Diaz" -> "§6$input" + "Finnegan" -> "§c$input" + "Foxy" -> "§d$input" + "Marina" -> "§b$input" + "Paul" -> "§c$input" + else -> "§7$input" } +} - private fun extractLobbyCode(input: String): String? { - val regex = Regex("§(\\d{3}/\\d{2}/\\d{2}) §([A-Za-z0-9]+)$") - val matchResult = regex.find(input) - return matchResult?.groupValues?.lastOrNull() - } +private fun extractLobbyCode(input: String): String? { + val regex = Regex("§(\\d{3}/\\d{2}/\\d{2}) §([A-Za-z0-9]+)$") + val matchResult = regex.find(input) + return matchResult?.groupValues?.lastOrNull() +} - private fun getProfileTypeAsSymbol(): String { - return when { - HypixelData.ironman -> "§7♲ " // Ironman - HypixelData.stranded -> "§a☀ " // Stranded - HypixelData.bingo -> "§cⒷ " // Bingo - TODO: Consider using colors from BingoAPI - else -> "§e" // Default case - } +private fun getProfileTypeAsSymbol(): String { + return when { + HypixelData.ironman -> "§7♲ " // Ironman + HypixelData.stranded -> "§a☀ " // Stranded + HypixelData.bingo -> "§cⒷ " // Bingo - TODO: Consider using colors from BingoAPI + else -> "§e" // Default case } }