diff options
author | vicisacat <victor.branchu@gmail.com> | 2024-03-24 17:47:39 +0100 |
---|---|---|
committer | vicisacat <victor.branchu@gmail.com> | 2024-04-12 17:19:28 +0200 |
commit | 1afa4bfdf9c8fc4a80d252868d72001c7a34f185 (patch) | |
tree | c6cd239b9765801d7034ad384b57950e2e7d1204 /src/main/java/de | |
parent | 047b356c63d5e271930f09a8ac40073bae6c8167 (diff) | |
download | Skyblocker-1afa4bfdf9c8fc4a80d252868d72001c7a34f185.tar.gz Skyblocker-1afa4bfdf9c8fc4a80d252868d72001c7a34f185.tar.bz2 Skyblocker-1afa4bfdf9c8fc4a80d252868d72001c7a34f185.zip |
localization and config
Diffstat (limited to 'src/main/java/de')
5 files changed, 53 insertions, 21 deletions
diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index bf98ac1f..a8f22bbc 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -251,6 +251,9 @@ public class SkyblockerConfig { public SearchOverlay searchOverlay = new SearchOverlay(); @SerialEntry + public FancyAuctionHouse fancyAuctionHouse = new FancyAuctionHouse(); + + @SerialEntry public List<Integer> lockedSlots = new ArrayList<>(); @SerialEntry @@ -269,6 +272,13 @@ public class SkyblockerConfig { public Object2ObjectOpenHashMap<String, CustomArmorAnimatedDyes.AnimatedDye> customAnimatedDyes = new Object2ObjectOpenHashMap<>(); } + public static class FancyAuctionHouse { + @SerialEntry + public boolean enabled = true; + @SerialEntry + public boolean highlightCheapBIN = true; + } + public static class TabHudConf { @SerialEntry public boolean tabHudEnabled = true; diff --git a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java index e310cb85..a74b9483 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java @@ -739,6 +739,26 @@ public class GeneralCategory { .controller(ConfigUtils::createBooleanController) .build()) .build()) + + // Fancy Auction House + .group(OptionGroup.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.betterAuctionHouse")) + .collapsed(true) + .option(Option.<Boolean>createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.betterAuctionHouse.enabled")) + .binding(defaults.general.fancyAuctionHouse.enabled, + () -> config.general.fancyAuctionHouse.enabled, + newValue -> config.general.fancyAuctionHouse.enabled = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) + .option(Option.<Boolean>createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.betterAuctionHouse.highlightUnderAvgPrice")) + .binding(defaults.general.fancyAuctionHouse.highlightCheapBIN, + () -> config.general.fancyAuctionHouse.highlightCheapBIN, + newValue -> config.general.fancyAuctionHouse.highlightCheapBIN = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) + .build()) .build(); } } diff --git a/src/main/java/de/hysky/skyblocker/mixin/HandledScreenProviderMixin.java b/src/main/java/de/hysky/skyblocker/mixin/HandledScreenProviderMixin.java index 75d604a6..566cc18f 100644 --- a/src/main/java/de/hysky/skyblocker/mixin/HandledScreenProviderMixin.java +++ b/src/main/java/de/hysky/skyblocker/mixin/HandledScreenProviderMixin.java @@ -31,7 +31,7 @@ public interface HandledScreenProviderMixin<T extends ScreenHandler> { T screenHandler = type.create(id, player.getInventory()); if (!(screenHandler instanceof GenericContainerScreenHandler containerScreenHandler)) return; String nameLowercase = name.getString().toLowerCase(); - if (PartyFinderScreen.possibleInventoryNames.contains(nameLowercase)) { + if (SkyblockerConfigManager.get().general.betterPartyFinder && PartyFinderScreen.possibleInventoryNames.contains(nameLowercase)) { if (SkyblockerConfigManager.get().general.betterPartyFinder && screenHandler instanceof GenericContainerScreenHandler containerScreenHandler && PartyFinderScreen.possibleInventoryNames.contains(name.getString().toLowerCase())) { if (client.currentScreen != null) { String lowerCase = client.currentScreen.getTitle().getString().toLowerCase(); @@ -51,21 +51,21 @@ public interface HandledScreenProviderMixin<T extends ScreenHandler> { } ci.cancel(); - } else if (nameLowercase.contains("auctions browser") || nameLowercase.contains("auctions: ")) { + } else if (SkyblockerConfigManager.get().general.fancyAuctionHouse.enabled && (nameLowercase.contains("auctions browser") || nameLowercase.contains("auctions: "))) { AuctionHouseScreenHandler auctionHouseScreenHandler = AuctionHouseScreenHandler.of(containerScreenHandler, false); client.player.currentScreenHandler = auctionHouseScreenHandler; if (client.currentScreen instanceof AuctionBrowserScreen auctionBrowserScreen) { auctionBrowserScreen.changeHandler(auctionHouseScreenHandler); } else client.setScreen(new AuctionBrowserScreen(auctionHouseScreenHandler, client.player.getInventory())); ci.cancel(); - } else if (nameLowercase.contains("auction view")) { + } else if (SkyblockerConfigManager.get().general.fancyAuctionHouse.enabled && nameLowercase.contains("auction view")) { AuctionHouseScreenHandler auctionHouseScreenHandler = AuctionHouseScreenHandler.of(containerScreenHandler, true); client.player.currentScreenHandler = auctionHouseScreenHandler; if (client.currentScreen instanceof AuctionViewScreen auctionViewScreen) { auctionViewScreen.changeHandler(auctionHouseScreenHandler); } else client.setScreen(new AuctionViewScreen(auctionHouseScreenHandler, client.player.getInventory(), name)); ci.cancel(); - } else if ((nameLowercase.contains("confirm purchase") || nameLowercase.contains("confirm bid")) && client.currentScreen instanceof AuctionViewScreen auctionViewScreen) { + } else if (SkyblockerConfigManager.get().general.fancyAuctionHouse.enabled && (nameLowercase.contains("confirm purchase") || nameLowercase.contains("confirm bid")) && client.currentScreen instanceof AuctionViewScreen auctionViewScreen) { client.setScreen(auctionViewScreen.getConfirmPurchasePopup(name)); client.player.currentScreenHandler = containerScreenHandler; ci.cancel(); diff --git a/src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionBrowserScreen.java b/src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionBrowserScreen.java index 0e40758f..8e0c695b 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionBrowserScreen.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionBrowserScreen.java @@ -2,6 +2,7 @@ package de.hysky.skyblocker.skyblock.auction; import com.google.gson.JsonElement; import de.hysky.skyblocker.SkyblockerMod; +import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.skyblock.auction.widgets.AuctionTypeWidget; import de.hysky.skyblocker.skyblock.auction.widgets.CategoryTabWidget; import de.hysky.skyblocker.skyblock.auction.widgets.RarityWidget; @@ -162,7 +163,7 @@ public class AuctionBrowserScreen extends AbstractCustomHypixelGUI<AuctionHouseS @Override protected void drawSlot(DrawContext context, Slot slot) { - if (isSlotHighlighted.getOrDefault(slot.id, false)) { + if (SkyblockerConfigManager.get().general.fancyAuctionHouse.highlightCheapBIN && isSlotHighlighted.getOrDefault(slot.id, false)) { context.drawBorder(slot.x, slot.y, 16, 16, new Color(0, 255, 0, 100).getRGB()); } super.drawSlot(context, slot); @@ -272,6 +273,7 @@ public class AuctionBrowserScreen extends AbstractCustomHypixelGUI<AuctionHouseS } } else if (slotId > 9 && slotId < (handler.getRows()-1)*9 && slotId%9 > 1 && slotId%9 < 8) { List<Text> tooltip = stack.getTooltip(client.player, TooltipContext.BASIC); + if (!SkyblockerConfigManager.get().general.fancyAuctionHouse.highlightCheapBIN) return; for (int k = tooltip.size() - 1; k >= 0; k--) { Text text = tooltip.get(k); String string = text.getString(); diff --git a/src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionViewScreen.java b/src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionViewScreen.java index 1654334c..82cd4a91 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionViewScreen.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionViewScreen.java @@ -36,7 +36,7 @@ public class AuctionViewScreen extends AbstractCustomHypixelGUI<AuctionHouseScre public final boolean isBinAuction; private TextWidget priceWidget; - private final Text clickToEditBidText = Text.literal("Click to edit Bid!").setStyle(Style.EMPTY.withUnderline(true)); + private final Text clickToEditBidText = Text.translatable("skyblocker.fancyAuctionHouse.editBid").setStyle(Style.EMPTY.withUnderline(true)); private TextWidget infoTextWidget; public String minBid = ""; @@ -59,7 +59,7 @@ public class AuctionViewScreen extends AbstractCustomHypixelGUI<AuctionHouseScre protected void init() { super.init(); verticalLayout.spacing(2).getMainPositioner().alignHorizontalCenter(); - priceTextWidget = new TextWidget(Text.literal(isBinAuction ? "Price:" : "New Bid:"), textRenderer).alignCenter(); + priceTextWidget = new TextWidget(isBinAuction ? Text.translatable("skyblocker.fancyAuctionHouse.price") : Text.translatable("skyblocker.fancyAuctionHouse.newBid"), textRenderer).alignCenter(); verticalLayout.add(priceTextWidget); priceWidget = new TextWidget(Text.literal("?"), textRenderer).alignCenter(); @@ -70,7 +70,7 @@ public class AuctionViewScreen extends AbstractCustomHypixelGUI<AuctionHouseScre infoTextWidget = new TextWidget(Text.literal("Can't Afford"), textRenderer).alignCenter(); verticalLayout.add(infoTextWidget); - buyButton = ButtonWidget.builder(Text.literal(isBinAuction ? "Buy!" : "Bid!"), button -> { + buyButton = ButtonWidget.builder(isBinAuction ? Text.translatable("skyblocker.fancyAuctionHouse.buy") : Text.translatable("skyblocker.fancyAuctionHouse.bid"), button -> { if (buySlotID == -1) return; clickSlot(buySlotID); }).size(60, 15).build(); @@ -91,30 +91,30 @@ public class AuctionViewScreen extends AbstractCustomHypixelGUI<AuctionHouseScre buyState = newState; switch (buyState) { case CANT_AFFORD -> { - infoTextWidget.setMessage(Text.literal("Can't Afford!").withColor(Colors.RED)); + infoTextWidget.setMessage(Text.translatable("skyblocker.fancyAuctionHouse.cantAfford").withColor(Colors.RED)); buyButton.active = false; } - case TOP_BID -> infoTextWidget.setMessage(Text.literal("Already top bid!").withColor(Colors.LIGHT_YELLOW)); + case TOP_BID -> infoTextWidget.setMessage(Text.translatable("skyblocker.fancyAuctionHouse.alreadyTopBid").withColor(Colors.LIGHT_YELLOW)); case AFFORD -> infoTextWidget.setMessage(Text.empty()); case COLLECT_AUCTION -> { - infoTextWidget.setMessage(changeProfile ? Text.literal("On a different profile"): wonAuction ? Text.empty() : Text.literal("Didn't win :(")); + infoTextWidget.setMessage(changeProfile ? Text.translatable("skyblocker.fancyAuctionHouse.differentProfile"): wonAuction ? Text.empty() : Text.translatable("skyblocker.fancyAuctionHouse.didntWin")); //priceWidget.setMessage(Text.empty()); priceWidget.active = false; if (changeProfile) { - buyButton.setMessage(Text.literal("Change Profile").setStyle(Style.EMPTY.withColor(Formatting.AQUA))); + buyButton.setMessage(Text.translatable("skyblocker.fancyAuctionHouse.changeProfile").setStyle(Style.EMPTY.withColor(Formatting.AQUA))); } else if (wonAuction) { - buyButton.setMessage(Text.literal("Collect Auction")); + buyButton.setMessage(Text.translatable("skyblocker.fancyAuctionHouse.collectAuction")); } else { - buyButton.setMessage(Text.literal("Collect Bid")); + buyButton.setMessage(Text.translatable("skyblocker.fancyAuctionHouse.collectBid")); } buyButton.setWidth(textRenderer.getWidth(buyButton.getMessage()) + 4); - priceTextWidget.setMessage(Text.literal("Auction Ended!")); + priceTextWidget.setMessage(Text.translatable("skyblocker.fancyAuctionHouse.auctionEnded")); priceTextWidget.setWidth(textRenderer.getWidth(priceTextWidget.getMessage())); } case CANCELLABLE_AUCTION -> { - buyButton.setMessage(Text.literal("Cancel Auction").setStyle(Style.EMPTY.withColor(Formatting.RED))); + buyButton.setMessage(Text.translatable("skyblocker.fancyAuctionHouse.cancelAuction").setStyle(Style.EMPTY.withColor(Formatting.RED))); buyButton.setWidth(textRenderer.getWidth(buyButton.getMessage()) + 4); buyButton.active = true; @@ -124,7 +124,7 @@ public class AuctionViewScreen extends AbstractCustomHypixelGUI<AuctionHouseScre buyButton.visible = false; priceWidget.active = false; - infoTextWidget.setMessage(Text.literal("This is your auction!")); + infoTextWidget.setMessage(Text.translatable("skyblocker.fancyAuctionHouse.yourAuction")); } } infoTextWidget.setWidth(textRenderer.getWidth(infoTextWidget.getMessage())); @@ -245,7 +245,7 @@ public class AuctionViewScreen extends AbstractCustomHypixelGUI<AuctionHouseScre String[] split = string.split(":"); if (split.length < 2) continue; if (buyState != BuyState.CANT_AFFORD && !isBinAuction) { - infoTextWidget.setMessage(Text.literal("You pay: " + split[1].trim())); + infoTextWidget.setMessage(Text.translatable("skyblocker.fancyAuctionHouse.youPay", split[1].trim())); infoTextWidget.setWidth(textRenderer.getWidth(infoTextWidget.getMessage())); } @@ -279,9 +279,9 @@ public class AuctionViewScreen extends AbstractCustomHypixelGUI<AuctionHouseScre // This really shouldn't be possible to be null in its ACTUAL use case. //noinspection DataFlowIssue return new PopupScreen.Builder(this, title) - .button(Text.literal("Confirm"), popupScreen -> this.client.interactionManager.clickSlot(this.client.player.currentScreenHandler.syncId, 11, 0, SlotActionType.PICKUP, client.player)) - .button(Text.literal("Cancel"), popupScreen -> this.client.interactionManager.clickSlot(this.client.player.currentScreenHandler.syncId, 15, 0, SlotActionType.PICKUP, client.player)) - .message(Text.literal(isBinAuction ? "Price: " : "New Bid: ").append(priceText)).build(); + .button(Text.translatable("text.skyblocker.confirm"), popupScreen -> this.client.interactionManager.clickSlot(this.client.player.currentScreenHandler.syncId, 11, 0, SlotActionType.PICKUP, client.player)) + .button(Text.translatable("gui.cancel"), popupScreen -> this.client.interactionManager.clickSlot(this.client.player.currentScreenHandler.syncId, 15, 0, SlotActionType.PICKUP, client.player)) + .message((isBinAuction ? Text.translatable("skyblocker.fancyAuctionHouse.price") : Text.translatable("skyblocker.fancyAuctionHouse.newBid")).append(" ").append(priceText)).build(); } private enum BuyState { |