diff --git a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java index 3a8a4a1f5f..26e59b40b0 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java @@ -273,6 +273,8 @@ public String toString() { public static class ItemTooltip { public boolean enableNPCPrice = true; + @ConfigEntry.Gui.Tooltip + public boolean enableMotesPrice = true; public boolean enableAvgBIN = true; @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) @ConfigEntry.Gui.Tooltip() @@ -369,6 +371,9 @@ public static class Barn { public static class Rift { public boolean mirrorverseWaypoints = true; + @ConfigEntry.BoundedDiscrete(min = 0, max = 5) + @ConfigEntry.Gui.Tooltip + public int mcGrubberStacks = 0; } public static class Slayer { diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java index e2d2d41505..dc2a89f874 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java @@ -40,6 +40,7 @@ public class PriceInfoTooltip { private static JsonObject threeDayAvgPricesJson; private static JsonObject lowestPricesJson; private static JsonObject isMuseumJson; + private static JsonObject motesPricesJson; private static boolean nullMsgSend = false; private final static Gson gson = new Gson(); private static final Map apiAddresses; @@ -63,6 +64,17 @@ else if (npcPricesJson.has(name)) { .append(getCoinsMessage(npcPricesJson.get(name).getAsDouble(), count))); } } + + if (SkyblockerConfig.get().general.itemTooltip.enableMotesPrice && Utils.isInTheRift()) { + if(motesPricesJson == null) { + nullWarning(); + } + else if (motesPricesJson.has(name)) { + lines.add(Text.literal(String.format("%-20s", "Motes Price:")) + .formatted(Formatting.LIGHT_PURPLE) + .append(getMotesMessage(motesPricesJson.get(name).getAsInt(), count))); + } + } boolean bazaarExist = false; if (SkyblockerConfig.get().general.itemTooltip.enableBazaarPrice && !bazaarOpened) { @@ -289,6 +301,23 @@ private static Text getCoinsMessage(double price, int count) { return priceTextTotal.append(priceTextEach); } } + + private static Text getMotesMessage(int price, int count) { + float motesMultiplier = SkyblockerConfig.get().locations.rift.mcGrubberStacks * 0.05f + 1; + if (count == 1) { + String priceString = String.format(Locale.ENGLISH, "%1$,.1f", price * motesMultiplier).replace(".0", ""); + return Text.literal(priceString + " Motes").formatted(Formatting.DARK_AQUA); + } + else { + String priceStringTotal = String.format(Locale.ENGLISH, "%1$,.1f", price * count * motesMultiplier).replace(".0", ""); + MutableText priceTextTotal = Text.literal(priceStringTotal + " Motes ").formatted(Formatting.DARK_AQUA); + + String priceStringEach = String.format(Locale.ENGLISH, "%1$,.1f", price * motesMultiplier).replace(".0", ""); + MutableText priceTextEach = Text.literal( "(" + priceStringEach + " each)").formatted(Formatting.GRAY); + + return priceTextTotal.append(priceTextEach); + } + } // If these options is true beforehand, the client will get first data of these options while loading. // After then, it will only fetch the data if it is on Skyblock. @@ -326,6 +355,9 @@ else if (type == SkyblockerConfig.Average.THREE_DAY) { if (SkyblockerConfig.get().general.itemTooltip.enableMuseumDate && isMuseumJson == null) futureList.add(CompletableFuture.runAsync(() -> isMuseumJson = downloadPrices("museum"))); + + if (SkyblockerConfig.get().general.itemTooltip.enableMotesPrice && motesPricesJson == null) + futureList.add(CompletableFuture.runAsync(() -> motesPricesJson = downloadPrices("motes"))); minute++; CompletableFuture.allOf(futureList.toArray(new CompletableFuture[0])) @@ -354,5 +386,6 @@ private static JsonObject downloadPrices(String type) { apiAddresses.put("lowest bins", "https://lb.tricked.pro/lowestbins"); apiAddresses.put("npc", "https://hysky.de/api/npcprice"); apiAddresses.put("museum", "https://hysky.de/api/museum"); + apiAddresses.put("motes", "https://hysky.de/api/motesprice"); } } diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index df610333dc..20c2c27fa1 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -38,6 +38,8 @@ "text.autoconfig.skyblocker.option.general.tabHud.tabHudScale.@Tooltip": "Value in %, relative to your vanilla GUI scale", "text.autoconfig.skyblocker.option.general.itemTooltip": "Item Tooltip", "text.autoconfig.skyblocker.option.general.itemTooltip.enableNPCPrice": "Enable NPC Price", + "text.autoconfig.skyblocker.option.general.itemTooltip.enableMotesPrice": "Enable Motes Price", + "text.autoconfig.skyblocker.option.general.itemTooltip.enableMotesPrice.@Tooltip": "Displays the Motes sell price of an item while in The Rift.", "text.autoconfig.skyblocker.option.general.itemTooltip.enableAvgBIN": "Enable Avg. BIN Price", "text.autoconfig.skyblocker.option.general.itemTooltip.avg": "Average Type", "text.autoconfig.skyblocker.option.general.itemTooltip.avg.@Tooltip": "You can choose how many days of average price to be", @@ -204,6 +206,8 @@ "text.autoconfig.skyblocker.option.locations.rift": "The Rift", "text.autoconfig.skyblocker.option.locations.rift.mirrorverseWaypoints": "Enable Mirrorverse Waypoints", + "text.autoconfig.skyblocker.option.locations.rift.mcGrubberStacks": "McGrubber Stacks", + "text.autoconfig.skyblocker.option.locations.rift.mcGrubberStacks.@Tooltip": "Used for calculating Motes sell prices.", "text.autoconfig.skyblocker.category.messages": "Messages", "text.autoconfig.skyblocker.option.messages.chatFilterResult.PASS": "Disabled",