From 610595e0df9691220e0083bd34e769ea27323f8f Mon Sep 17 00:00:00 2001 From: Lorenz Date: Wed, 10 Aug 2022 19:37:16 +0200 Subject: show currently pelts owned --- .../notenoughupdates/miscgui/minionhelper/ApiData.java | 9 ++++++++- .../minionhelper/loaders/MinionHelperApiLoader.java | 14 +++++++++++++- .../miscgui/minionhelper/render/MinionHelperOverlay.java | 1 + .../minionhelper/render/MinionHelperOverlayHover.java | 11 ++++++++--- 4 files changed, 30 insertions(+), 5 deletions(-) (limited to 'src/main/java/io') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/ApiData.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/ApiData.java index 1155884b..62fda010 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/ApiData.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/ApiData.java @@ -30,6 +30,7 @@ public class ApiData { private final int barbariansReputation; private final boolean collectionApiDisabled; private final List craftedMinions; + private final int peltCount; public ApiData( Map highestCollectionTier, @@ -37,7 +38,8 @@ public class ApiData { int magesReputation, int barbariansReputation, boolean collectionApiDisabled, - List craftedMinions + List craftedMinions, + int peltCount ) { this.highestCollectionTier = highestCollectionTier; this.slayerTiers = slayerTiers; @@ -45,6 +47,7 @@ public class ApiData { this.barbariansReputation = barbariansReputation; this.collectionApiDisabled = collectionApiDisabled; this.craftedMinions = craftedMinions; + this.peltCount = peltCount; } public Map getHighestCollectionTier() { @@ -70,4 +73,8 @@ public class ApiData { public List getCraftedMinions() { return craftedMinions; } + + public int getPeltCount() { + return peltCount; + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java index b1a4ba06..cf12a099 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java @@ -134,13 +134,25 @@ public class MinionHelperApiLoader { magesReputation, barbariansReputation, !collectionApiEnabled, - loadCraftedMinions(members) + loadCraftedMinions(members), + loadPeltCount(player) ); manager.reloadData(); apiReadyToUse = true; } + private int loadPeltCount(JsonObject player) { + int peltCount = 0; + if (player.has("trapper_quest")) { + JsonObject jsonObject = player.getAsJsonObject("trapper_quest"); + if (jsonObject.has("pelt_count")) { + peltCount = jsonObject.get("pelt_count").getAsInt(); + } + } + return peltCount; + } + private Map getSlayers(JsonObject player) { JsonObject slayerLeveling = Constants.LEVELING.getAsJsonObject("slayer_xp"); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java index 0c1f9800..afea502f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java @@ -288,6 +288,7 @@ public class MinionHelperOverlay { displayName = displayName.replace(" Minion", ""); String format = manager.getPriceCalculation().calculateUpgradeCostsFormat(minion, true); + format = format.replace(" coins", ""); String requirementFormat = !minion.doesMeetRequirements() ? "§7§o" : ""; renderMap.put( requirementFormat + displayName + " " + minion.getTier() + " §r§8- " + format, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java index f3e6dc71..05bd4b62 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java @@ -122,7 +122,7 @@ public class MinionHelperOverlayHover { lines.add(""); lines.add("§7Buy from: §9" + npcName + " (NPC)"); lines.add(""); - lines.add("§7Buy cost: " + manager.getPriceCalculation().calculateUpgradeCostsFormat(minion, true)); + lines.add("§7Cost: " + manager.getPriceCalculation().calculateUpgradeCostsFormat(minion, true)); int coins = npcSource.getCoins(); if (coins != 0) { lines.add(" §8- " + manager.getPriceCalculation().formatCoins(coins)); @@ -139,11 +139,16 @@ public class MinionHelperOverlayHover { private void formatItems(List lines, Map allItems) { for (Map.Entry entry : allItems.entrySet()) { String internalName = entry.getKey(); - if (internalName.equals("SKYBLOCK_PELT")) continue; + int amount = entry.getValue(); + if (internalName.equals("SKYBLOCK_PELT")) { + int peltCount = manager.getApi().getApiData().getPeltCount(); + + lines.add(" §8- §5" + peltCount + "§8/§5" + amount + " Pelts"); + continue; + } String name = manager.getRepo().getDisplayName(internalName); - int amount = entry.getValue(); String amountText = amount != 1 ? amount + "§7x " : ""; String price = manager.getPriceCalculation().formatCoins( manager.getPriceCalculation().getPrice(internalName) * amount); -- cgit