diff --git a/src/main/java/de/hysky/skyblocker/config/categories/MiningCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/MiningCategory.java index 796a6105eb..7d49c6752e 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/MiningCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/MiningCategory.java @@ -85,6 +85,14 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig newValue -> config.mining.dwarvenHud.style = newValue) .controller(ConfigUtils::createEnumCyclingListController) .build()) + .option(Option.createBuilder() + .name(Text.translatable("skyblocker.config.mining.dwarvenHud.showNumbers")) + .description(OptionDescription.of(Text.translatable("skyblocker.config.mining.dwarvenHud.showNumbers.@Tooltip"))) + .binding(defaults.mining.dwarvenHud.showNumbers, + () -> config.mining.dwarvenHud.showNumbers, + newValue -> config.mining.dwarvenHud.showNumbers = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) .option(ButtonOption.createBuilder() .name(Text.translatable("skyblocker.config.mining.dwarvenHud.screen")) .text(Text.translatable("text.skyblocker.open")) diff --git a/src/main/java/de/hysky/skyblocker/config/configs/MiningConfig.java b/src/main/java/de/hysky/skyblocker/config/configs/MiningConfig.java index dcf70f247f..cd988b165d 100644 --- a/src/main/java/de/hysky/skyblocker/config/configs/MiningConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/configs/MiningConfig.java @@ -48,6 +48,9 @@ public static class DwarvenHud { @SerialEntry public DwarvenHudStyle style = DwarvenHudStyle.SIMPLE; + @SerialEntry + public boolean showNumbers = false; + @SerialEntry public int commissionsX = 10; diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java index 16c36dde35..f6d6ed6db4 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java @@ -89,11 +89,12 @@ protected static void render(HudCommsWidget hcw, HudPowderWidget hpw, DrawContex /** * Renders hud to window without using the widget rendering - * @param context DrawContext to draw the hud to - * @param comHudX X coordinate of the commissions hud - * @param comHudY Y coordinate of the commissions hud - * @param powderHudX X coordinate of the powder hud - * @param powderHudY Y coordinate of the powder hud + * + * @param context DrawContext to draw the hud to + * @param comHudX X coordinate of the commissions hud + * @param comHudY Y coordinate of the commissions hud + * @param powderHudX X coordinate of the powder hud + * @param powderHudY Y coordinate of the powder hud * @param commissions the commissions to render to the commissions hud */ @Deprecated(since = "1.20.3+1.20.6", forRemoval = true) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/component/ProgressComponent.java b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/component/ProgressComponent.java index 9522be43b5..50ff64622e 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/component/ProgressComponent.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/component/ProgressComponent.java @@ -49,6 +49,10 @@ public ProgressComponent(ItemStack ico, Text text, float pcnt, int color) { this(ico, text, Text.of(pcnt + "%"), pcnt, color); } + public ProgressComponent(ItemStack ico, Text text, float pcnt, int max, int color) { + this(ico, text, Text.of(Math.round(max * (pcnt/100)) + "/" + max), pcnt, color); + } + public ProgressComponent() { this(null, null, null, 100, 0); } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/hud/HudCommsWidget.java b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/hud/HudCommsWidget.java index 44a06c99e0..c7ebead5e1 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/hud/HudCommsWidget.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/hud/HudCommsWidget.java @@ -1,5 +1,6 @@ package de.hysky.skyblocker.skyblock.tabhud.widget.hud; +import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.skyblock.dwarven.DwarvenHud.Commission; import de.hysky.skyblocker.skyblock.tabhud.util.Colors; import de.hysky.skyblocker.skyblock.tabhud.util.Ico; @@ -7,6 +8,7 @@ import de.hysky.skyblocker.skyblock.tabhud.widget.component.Component; import de.hysky.skyblocker.skyblock.tabhud.widget.component.PlainTextComponent; import de.hysky.skyblocker.skyblock.tabhud.widget.component.ProgressComponent; +import de.hysky.skyblocker.utils.Utils; import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.minecraft.util.Formatting; @@ -54,17 +56,97 @@ public void updateContent() { } Component comp; + var max = getCommissionMax(comm.commission()); if (isFancy) { - comp = new ProgressComponent(Ico.BOOK, c, p, Colors.pcntToCol(p)); + if (SkyblockerConfigManager.get().mining.dwarvenHud.showNumbers && max != 0) { + comp = new ProgressComponent(Ico.BOOK, c, p, max, Colors.pcntToCol(p)); + } else { + comp = new ProgressComponent(Ico.BOOK, c, p, Colors.pcntToCol(p)); + } } else { - comp = new PlainTextComponent( - Text.literal(comm.commission() + ": ").append( - Text.literal(comm.progression()).withColor(Colors.pcntToCol(p)) - ) - ); + if (SkyblockerConfigManager.get().mining.dwarvenHud.showNumbers && max != 0) { + comp = new PlainTextComponent( + Text.literal(comm.commission() + ": ").append( + Text.literal(p == 100f ? "DONE" : Math.round(max * (p / 100)) + "/" + max).withColor(Colors.pcntToCol(p)) + ) + ); + } else { + comp = new PlainTextComponent( + Text.literal(comm.commission() + ": ").append( + Text.literal(comm.progression()).withColor(Colors.pcntToCol(p)) + ) + ); + } } this.addComponent(comp); } } + /** + * Gets the actions needed to complete a commission + * + * @param commission the string name of the commission + * @return the actions needed to complete the commission + */ + private static int getCommissionMax(String commission) { + switch (commission) { + case "Mithril Miner" -> { + return 350; + } + case "Lava Springs Mithril", "Royal Mines Mithril", "Cliffside Veins Mithril", "Rampart's Quarry Mithril", + "Upper Mines Mithril" -> { + return 250; + } + case "Titanium Miner" -> { + return 15; + } + case "Lava Springs Titanium", "Royal Mines Titanium", "Cliffside Veins Titanium", + "Rampart's Quarry Titanium", "Upper Mines Titanium", "Treasure Hoarder Puncher", "Star Sentry Puncher", + "Maniac Slayer" -> { + return 10; + } + case "Goblin Slayer" -> { + return Utils.isInCrystalHollows() ? 13 : 100; + } + case "Glacite Walker Slayer", "Mines Slayer" -> { + return 50; + } + case "Goblin Raid Slayer", "Lucky Raffle" -> { + return 20; + } + case "Golden Goblin Slayer", "Boss Corleone Slayer", "Mineshaft Explorer", "Scrap Collector", "Goblin Raid", + "Raffle", "Jade Crystal Hunter", "Amber Crystal Hunter", "Topaz Crystal Hunter", + "Sapphire Crystal Hunter", "Amethyst Crystal Hunter" -> { + return 1; + } + case "2x Mithril Powder Collector" -> { + return 500; + } + case "Hard Stone Miner", "Jade Gemstone Collector", "Amber Gemstone Collector", "Topaz Gemstone Collector", + "Sapphire Gemstone Collector", "Amethyst Gemstone Collector", "Ruby Gemstone Collector" -> { + return 1000; + } + case "Chest Looter", "Corpse Looter" -> { + return 3; + } + case "Team Treasurite Member Slayer", "Yog Slayer", "Automaton Slayer" -> { + return 13; + } + case "Sludge Slayer" -> { + return 25; + } + case "Thyst Slayer" -> { + return 5; + } + case "Glacite Collector", "Umber Collector", "Tungsten Collector", "Citrine Gemstone Collector", + "Peridot Gemstone Collector", "Onyx Gemstone Collector", "Aquamarine Gemstone Collector" -> { + return 1500; + } + default -> { + return 0; + } + + } + } + } diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 129381a27d..ff9815cdd8 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -525,6 +525,8 @@ "skyblocker.config.mining.dwarvenHud.enabledCommissions": "Enable Commissions", "skyblocker.config.mining.dwarvenHud.enabledPowder": "Enable Powder", "skyblocker.config.mining.dwarvenHud.screen": "Dwarven HUD Config...", + "skyblocker.config.mining.dwarvenHud.showNumbers": "Show Commission Numbers", + "skyblocker.config.mining.dwarvenHud.showNumbers.@Tooltip": "Show the number of actions for each commission instead of a percentage.", "skyblocker.config.mining.dwarvenHud.style": "Style for HUD", "skyblocker.config.mining.dwarvenHud.style.@Tooltip[0]": "Simple: Shows name and percentage.", "skyblocker.config.mining.dwarvenHud.style.@Tooltip[1]": "\nFancy: Shows name, percentage, progress bar and an icon.",