From e7194adb19102fe2d5ada5f89534f1fc9d115165 Mon Sep 17 00:00:00 2001 From: Stephen White Date: Thu, 27 Apr 2023 20:42:43 -0300 Subject: Extra bazaar tooltip info (#689) --- .../notenoughupdates/ItemPriceInformation.java | 80 +++++++++++++++++++++- .../notenoughupdates/auction/APIManager.java | 9 +++ .../options/seperateSections/TooltipTweaks.java | 13 +++- 3 files changed, 100 insertions(+), 2 deletions(-) (limited to 'src/main/java/io') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java index 537ba270..7d408e0f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java @@ -139,7 +139,7 @@ public class ItemPriceInformation { stackMultiplier = shiftStackMultiplier; } - //values = {"", "Buy", "Sell", "Buy (Insta)", "Sell (Insta)", "Raw Craft Cost"} + //values = {"", "Buy", "Sell", "Buy (Insta)", "Sell (Insta)", "Raw Craft Cost", "Instabuys (Hourly)", "Instasells (Hourly)", "Instabuys (Daily)", "Instasells (Daily)", "Instabuys (Weekly)", "Instasells (Weekly)"} for (int lineId : lines) { switch (lineId) { case 0: @@ -204,6 +204,84 @@ public class ItemPriceInformation { tooltip.add(formatPrice("Raw Craft Cost: ", cost)); } break; + case 5: + if (bazaarInfo.has("instabuys_hourly")) { + if (!added) { + tooltip.add(""); + added = true; + } + + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + + "Insta-Buys (Hourly): " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + + format.format(bazaarInfo.get("instabuys_hourly").getAsFloat())); + } + break; + case 6: + if (bazaarInfo.has("instasells_hourly")) { + if (!added) { + tooltip.add(""); + added = true; + } + + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + + "Insta-Sells (Hourly): " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + + format.format(bazaarInfo.get("instasells_hourly").getAsFloat())); + } + break; + case 7: + if (bazaarInfo.has("instabuys_daily")) { + if (!added) { + tooltip.add(""); + added = true; + } + + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + + "Insta-Buys (Daily): " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + + format.format(bazaarInfo.get("instabuys_daily").getAsFloat())); + } + break; + case 8: + if (bazaarInfo.has("instasells_daily")) { + if (!added) { + tooltip.add(""); + added = true; + } + + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + + "Insta-Sells (Daily): " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + + format.format(bazaarInfo.get("instasells_daily").getAsFloat())); + } + break; + case 9: + if (bazaarInfo.has("instabuys_weekly")) { + if (!added) { + tooltip.add(""); + added = true; + } + + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + + "Insta-Buys (Weekly): " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + + format.format(bazaarInfo.get("instabuys_weekly").getAsFloat())); + } + break; + case 10: + if (bazaarInfo.has("instasells_weekly")) { + if (!added) { + tooltip.add(""); + added = true; + } + + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + + "Insta-Sells (Weekly): " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + + format.format(bazaarInfo.get("instasells_weekly").getAsFloat())); + } + break; } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java index ac60ffd9..329ab796 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java @@ -750,6 +750,15 @@ public class APIManager { productInfo.addProperty("avg_buy", quickStatus.get("buyPrice").getAsFloat()); productInfo.addProperty("avg_sell", quickStatus.get("sellPrice").getAsFloat()); + float instasellsWeekly = quickStatus.get("sellMovingWeek").getAsFloat(); + float instabuysWeekly = quickStatus.get("buyMovingWeek").getAsFloat(); + productInfo.addProperty("instasells_weekly", instasellsWeekly); + productInfo.addProperty("instabuys_weekly", instabuysWeekly); + productInfo.addProperty("instasells_daily", instasellsWeekly / 7); + productInfo.addProperty("instabuys_daily", instabuysWeekly / 7); + productInfo.addProperty("instasells_hourly", instasellsWeekly / 7 / 24); + productInfo.addProperty("instabuys_hourly", instabuysWeekly / 7 / 24); + for (JsonElement element : product.get("sell_summary").getAsJsonArray()) { if (element.isJsonObject()) { JsonObject sellSummaryFirst = element.getAsJsonObject(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java index ae4a5aff..cd6ecb26 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java @@ -68,7 +68,18 @@ public class TooltipTweaks { "\u00a7eDrag text to rearrange" ) @ConfigEditorDraggableList( - exampleText = {"\u00a7eBuy", "\u00a7eSell", "\u00a7eBuy (Insta)", "\u00a7eSell (Insta)", "\u00a7eRaw Craft Cost"} + exampleText = { + "\u00a7eBuy", + "\u00a7eSell", + "\u00a7eBuy (Insta)", + "\u00a7eSell (Insta)", + "\u00a7eRaw Craft Cost", + "\u00a7eInsta-Buys (Hourly)", + "\u00a7eInsta-Sells (Hourly)", + "\u00a7eInsta-Buys (Daily)", + "\u00a7eInsta-Sells (Daily)", + "\u00a7eInsta-Buys (Weekly)", + "\u00a7eInsta-Sells (Weekly)"} ) @ConfigAccordionId(id = 0) public List priceInfoBaz = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4)); -- cgit