Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Added option to display numbers for commissions #876

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.mining.dwarvenHud.style = newValue)
.controller(ConfigUtils::createEnumCyclingListController)
.build())
.option(Option.<Boolean>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"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public static class DwarvenHud {
@SerialEntry
public DwarvenHudStyle style = DwarvenHudStyle.SIMPLE;

@SerialEntry
public boolean showNumbers = false;

@SerialEntry
public int commissionsX = 10;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public ProgressComponent(ItemStack ico, Text d, Text b, float pcnt, int color) {
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) {
MisterCheezeCake marked this conversation as resolved.
Show resolved Hide resolved
this(ico, text, Text.of(Math.round(max * (pcnt/100)) + "/" + max), pcnt, color);
}

public ProgressComponent() {
this(null, null, null, 100, 0);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
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;
import de.hysky.skyblocker.skyblock.tabhud.widget.Widget;
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;
Expand Down Expand Up @@ -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 != null) {
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 != null) {
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 Integer getCommissionMax(String commission) {
kevinthegreat1 marked this conversation as resolved.
Show resolved Hide resolved
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 null;
}

}
}

}
2 changes: 2 additions & 0 deletions src/main/resources/assets/skyblocker/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Skyblocker",
"description": "Hypixel Skyblock Mod",
"authors": ["LifeIsAParadox/wohlhabend", "kevinthegreat1", "AzureAaron"],
"contributors": ["xMrVizzy", "d3dx9", "ExternalTime", "Zailer43", "TacoMonkey", "KonaeAkira", "Fix3dll", "null2264", "HyperSoop", "edgarogh", "TheColdPot", "Julienraptor01", "ADON15c", "catandA", "msg-programs", "lantice3720", "Futuremappermydud", "koloiyolo", "viciscat", "Grayray75", "alexiayaa", "KhafraDev", "btwonion", "Kaluub", "Emirlol", "LegendaryLilac", "olim88", "Ghost-3", "esteban4567890", "Fluboxer", "VeritasDL", "TheDearbear", "BigloBot", "f3shqt", "UpFault"],
"contributors": ["xMrVizzy", "d3dx9", "ExternalTime", "Zailer43", "TacoMonkey", "KonaeAkira", "Fix3dll", "null2264", "HyperSoop", "edgarogh", "TheColdPot", "Julienraptor01", "ADON15c", "catandA", "msg-programs", "lantice3720", "Futuremappermydud", "koloiyolo", "viciscat", "Grayray75", "alexiayaa", "KhafraDev", "btwonion", "Kaluub", "Emirlol", "LegendaryLilac", "olim88", "Ghost-3", "esteban4567890", "Fluboxer", "VeritasDL", "TheDearbear", "BigloBot", "f3shqt", "UpFault", "MisterCheezeCake"],
kevinthegreat1 marked this conversation as resolved.
Show resolved Hide resolved
"contact": {
"homepage": "https://hysky.de",
"sources": "https://github.com/SkyblockerMod/Skyblocker",
Expand Down