Skip to content

Commit

Permalink
fix conflicts with new config
Browse files Browse the repository at this point in the history
  • Loading branch information
olim88 committed May 9, 2024
1 parent f1e643b commit 67e317b
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,28 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
.build())
.build())

//Input Calculator
.group(OptionGroup.createBuilder()
.name(Text.translatable("text.autoconfig.skyblocker.option.uiAndVisuals.inputCalculator"))
.collapsed(true)
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("text.autoconfig.skyblocker.option.uiAndVisuals.inputCalculator.enabled"))
.description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.uiAndVisuals.inputCalculator.enabled.@Tooltip")))
.binding(defaults.uiAndVisuals.inputCalculator.enabled,
() -> config.uiAndVisuals.inputCalculator.enabled,
newValue -> config.uiAndVisuals.inputCalculator.enabled = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("text.autoconfig.skyblocker.option.uiAndVisuals.inputCalculator.requiresEquals"))
.description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.uiAndVisuals.inputCalculator.requiresEquals.@Tooltip")))
.binding(defaults.uiAndVisuals.inputCalculator.requiresEquals,
() -> config.uiAndVisuals.inputCalculator.requiresEquals,
newValue -> config.uiAndVisuals.inputCalculator.requiresEquals = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.build())

//Flame Overlay
.group(OptionGroup.createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.flameOverlay"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public class UIAndVisualsConfig {
@SerialEntry
public SearchOverlay searchOverlay = new SearchOverlay();

@SerialEntry
public InputCalculator inputCalculator = new InputCalculator();

@SerialEntry
public FlameOverlay flameOverlay = new FlameOverlay();

Expand Down Expand Up @@ -239,6 +242,14 @@ public static class SearchOverlay {
public List<String> auctionHistory = new ArrayList<>();
}

public static class InputCalculator {
@SerialEntry
public boolean enabled = true;

@SerialEntry
public boolean requiresEquals = true;
}

public static class FlameOverlay {
@SerialEntry
public int flameHeight = 100;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ public abstract class SignEditScreenMixin {
@Inject(method = "render", at = @At("HEAD"))
private void skyblocker$render(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
//if the sign is being used to enter number send it to the sign calculator
if (Utils.isOnSkyblock() && SkyblockerConfigManager.get().general.inputCalculator.enabled && Objects.equals(messages[1], "^^^^^^^^^^^^^^^")) {
if (Utils.isOnSkyblock() && SkyblockerConfigManager.get().uiAndVisuals.inputCalculator.enabled && Objects.equals(messages[1], "^^^^^^^^^^^^^^^")) {
SignCalculator.renderCalculator(context, messages[0], context.getScaledWindowWidth() / 2, 55);
}
}

@Inject(method = "finishEditing", at = @At("HEAD"))
private void skyblocker$finishEditing(CallbackInfo ci) {
//if the sign is being used to enter number get number from calculator for if maths has been done
if (Utils.isOnSkyblock() && SkyblockerConfigManager.get().general.inputCalculator.enabled && Objects.equals(messages[1], "^^^^^^^^^^^^^^^")) {
if (Utils.isOnSkyblock() && SkyblockerConfigManager.get().uiAndVisuals.inputCalculator.enabled && Objects.equals(messages[1], "^^^^^^^^^^^^^^^")) {
boolean isPrice = messages[2].contains("price");
String value = SignCalculator.getNewValue(isPrice);
if (value.length() >= 15) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected void init() {
public void renderBackground(DrawContext context, int mouseX, int mouseY, float delta) {
super.renderBackground(context, mouseX, mouseY, delta);
drawPopupBackground(context, layout.getX(), layout.getY(), layout.getWidth(), layout.getHeight());
if (SkyblockerConfigManager.get().general.inputCalculator.enabled) {
if (SkyblockerConfigManager.get().uiAndVisuals.inputCalculator.enabled) {
SignCalculator.renderCalculator(context, textFieldWidget.getText(), context.getScaledWindowWidth() / 2, textFieldWidget.getY() - 8);
}
}
Expand All @@ -73,7 +73,7 @@ private void buttonMinimumBid(ButtonWidget widget) {
}

private void done(ButtonWidget widget) {
if (SkyblockerConfigManager.get().general.inputCalculator.enabled) {
if (SkyblockerConfigManager.get().uiAndVisuals.inputCalculator.enabled) {
if (!isStringGood(SignCalculator.getNewValue(false))) return;
sendPacket(SignCalculator.getNewValue(false));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class SignCalculator {
private static Double output;

public static void renderCalculator(DrawContext context, String message, int renderX, int renderY) {
if (SkyblockerConfigManager.get().general.inputCalculator.requiresEquals) {
if (SkyblockerConfigManager.get().uiAndVisuals.inputCalculator.requiresEquals) {
if (message.startsWith("=")) {
message = message.substring(1);
}
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/assets/skyblocker/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,13 @@
"skyblocker.config.uiAndVisuals.searchOverlay.maxSuggestions": "Maximum Suggestions",
"skyblocker.config.uiAndVisuals.searchOverlay.maxSuggestions.@Tooltip": "The maximum number of suggested items to show.",

"text.autoconfig.skyblocker.option.uiAndVisuals.inputCalculator": "Input Calculator",
"text.autoconfig.skyblocker.option.uiAndVisuals.inputCalculator.enabled": "Enable Sign Calculator",
"text.autoconfig.skyblocker.option.uiAndVisuals.inputCalculator.enabled.@Tooltip": "Enables the ability for you to do calculations when inputting values such as price for the ah.\n Key:\n S = 64\n E = 160\n K = 1,000\n M = 1,000,000\n B = 1,000,000,000\n\n purse/P = current purse value",
"text.autoconfig.skyblocker.option.uiAndVisuals.inputCalculator.requiresEquals": "Only show with \"=\".",
"text.autoconfig.skyblocker.option.uiAndVisuals.inputCalculator.requiresEquals.@Tooltip": "Only show the calculator when the message start with \"=\".",
"text.autoconfig.skyblocker.option.uiAndVisuals.inputCalculator.invalidEquation": "Invalid Equation",

"skyblocker.config.uiAndVisuals.tabHud": "Fancy tab HUD (Temporarily disabled outside dungeons)",
"skyblocker.config.uiAndVisuals.tabHud.enableHudBackground": "Enable HUD Background",
"skyblocker.config.uiAndVisuals.tabHud.enableHudBackground.@Tooltip": "Enables the background of the non-tab HUD.",
Expand Down

0 comments on commit 67e317b

Please sign in to comment.