aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java23
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java32
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java87
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java88
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java11
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java25
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java18
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt3
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/UrsaClient.kt12
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/hypixelapi/Collection.kt2
18 files changed, 183 insertions, 182 deletions
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 6f488107..c9f67fd5 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
@@ -126,14 +126,7 @@ public class MinionHelperApiLoader {
int localPelts = manager.getLocalPelts();
if (localPelts != -1) return localPelts;
- 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;
+ return Utils.getElementAsInt(Utils.getElement(player, "quests.trapper_quest.pelt_count"), 0);
}
private Map<String, Integer> getSlayers(JsonObject player) {
@@ -141,7 +134,7 @@ public class MinionHelperApiLoader {
Map<String, Integer> slayerTier = new HashMap<>();
if (player.has("slayer_bosses")) {
- JsonObject slayerBosses = player.getAsJsonObject("slayer_bosses");
+ JsonObject slayerBosses = player.getAsJsonObject("slayer.slayer_bosses");
for (Map.Entry<String, JsonElement> entry : slayerBosses.entrySet()) {
String name = entry.getKey();
JsonObject slayerEntry = entry.getValue().getAsJsonObject();
@@ -166,8 +159,10 @@ public class MinionHelperApiLoader {
private Map<String, Integer> getCollections(JsonObject player) {
Map<String, Integer> highestCollectionTier = new HashMap<>();
- if (player.has("unlocked_coll_tiers")) {
- for (JsonElement element : player.get("unlocked_coll_tiers").getAsJsonArray()) {
+
+ JsonElement collectionTiers = Utils.getElement(player, "player_data.unlocked_coll_tiers");
+ if (collectionTiers != null) {
+ for (JsonElement element : collectionTiers.getAsJsonArray()) {
String text = element.getAsString();
String[] split = text.split("_");
int level = Integer.parseInt(split[split.length - 1]);
@@ -190,7 +185,7 @@ public class MinionHelperApiLoader {
highestCollectionTier.put(name, level);
}
if (!collectionApiEnabled) {
- Utils.addChatMessage("§e[NEU] Collection API detected!");
+ Utils.addChatMessage("§e[NEU Minion Helper] Collection API detected!");
}
collectionApiEnabled = true;
} else {
@@ -206,8 +201,8 @@ public class MinionHelperApiLoader {
List<String> craftedMinions = new ArrayList<>();
for (Map.Entry<String, JsonElement> entry : members.entrySet()) {
JsonObject value = entry.getValue().getAsJsonObject();
- if (value.has("crafted_generators")) {
- for (JsonElement e : value.get("crafted_generators").getAsJsonArray()) {
+ if (value.has("player_data.crafted_generators")) {
+ for (JsonElement e : value.get("player_data.crafted_generators").getAsJsonArray()) {
String rawGenerator = e.getAsString();
String[] split = rawGenerator.split("_");
String tier = split[split.length - 1];
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java
index 41e5fc5a..025b09b7 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java
@@ -336,17 +336,19 @@ public class BasicPage extends GuiProfileViewerPage {
guiLeft + 68, guiTop + 38, true, 0
);
}
+ double networthInCookies = -1;
if (NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo("BOOSTER_COOKIE") != null &&
- NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo("BOOSTER_COOKIE").has("avg_buy")) {
- double networthInCookies =
- (
+ NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo("BOOSTER_COOKIE").has("avg_buy"))
+
+ networthInCookies = (
networth /
NotEnoughUpdates.INSTANCE.manager.auctionManager
.getBazaarInfo("BOOSTER_COOKIE")
.get("avg_buy")
.getAsDouble()
);
- String networthIRLMoney = StringUtils.formatNumber(Math.round(
+
+ String networthIRLMoney = StringUtils.formatNumber(Math.round(
((networthInCookies * 325) / 675) * 4.99));
if (mouseX > guiLeft + offset - fontWidth / 2 && mouseX < guiLeft + offset + fontWidth / 2) {
@@ -359,7 +361,7 @@ public class BasicPage extends GuiProfileViewerPage {
EnumChatFormatting.DARK_GREEN +
"$" +
EnumChatFormatting.GOLD +
- networthIRLMoney
+ (networthInCookies >= 0 ? networthIRLMoney : EnumChatFormatting.RED + "ERROR")
);
if (NotEnoughUpdates.INSTANCE.config.profileViewer.useSoopyNetworth
@@ -375,7 +377,8 @@ public class BasicPage extends GuiProfileViewerPage {
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
getInstance().tooltipToDisplay.addAll(nwCategoryHover);
- getInstance().tooltipToDisplay.add(EnumChatFormatting.RED + "This is calculated using the current");
+ getInstance().tooltipToDisplay.add(
+ EnumChatFormatting.RED + "The IRL price is calculated using the current");
getInstance().tooltipToDisplay.add(
EnumChatFormatting.RED + "price of booster cookies on bazaar and the price");
getInstance().tooltipToDisplay.add(
@@ -387,13 +390,10 @@ public class BasicPage extends GuiProfileViewerPage {
} else {
getInstance().tooltipToDisplay.add(EnumChatFormatting.GRAY + "[SHIFT for Info]");
}
- if (!NotEnoughUpdates.INSTANCE.config.hidden.dev) {
- getInstance().tooltipToDisplay.add("");
- getInstance().tooltipToDisplay.add(EnumChatFormatting.RED + "THIS IS IN NO WAY ENDORSING IRL TRADING!");
- }
+ getInstance().tooltipToDisplay.add("");
+ getInstance().tooltipToDisplay.add(EnumChatFormatting.RED + "THIS IS IN NO WAY ENDORSING IRL TRADING!");
}
}
- }
} else {
int errFontWidth = fr.getStringWidth("Net Worth: " + stateStr);
if (errFontWidth >= 117) {
@@ -699,8 +699,8 @@ public class BasicPage extends GuiProfileViewerPage {
"% to " + level.maxLevel + ")");
if (entry.getKey().equals("farming")) {
// double drops + pelts
- int doubleDrops = Utils.getElementAsInt(Utils.getElement(selectedProfile.getProfileJson(), "jacob2.perks.double_drops"), 0);
- int peltCount = Utils.getElementAsInt(Utils.getElement(selectedProfile.getProfileJson(), "trapper_quest.pelt_count"), 0);
+ int doubleDrops = Utils.getElementAsInt(Utils.getElement(selectedProfile.getProfileJson(), "jacobs_contest.perks.double_drops"), 0);
+ int peltCount = Utils.getElementAsInt(Utils.getElement(selectedProfile.getProfileJson(), "quests.trapper_quest.pelt_count"), 0);
if (doubleDrops == 15) {
tooltipToDisplay.add("§7Double Drops: §6" + (doubleDrops * 2) + "%");
@@ -709,7 +709,9 @@ public class BasicPage extends GuiProfileViewerPage {
tooltipToDisplay.add("§7Pelts: §e" + peltCount);
// medals
- JsonObject medals_inv = Utils.getElement(selectedProfile.getProfileJson(), "jacob2.medals_inv").getAsJsonObject();
+ JsonObject medals_inv = Utils
+ .getElementOrDefault(selectedProfile.getProfileJson(), "jacobs_contest.medals_inv", new JsonObject())
+ .getAsJsonObject();
tooltipToDisplay.add(" ");
for (String medalName : medalNames) {
String textWithoutFormattingCodes =
@@ -737,7 +739,7 @@ public class BasicPage extends GuiProfileViewerPage {
for (int i = 0; i < 5; i++) {
if (i >= maxLevel) break;
float tier = Utils.getElementAsFloat(
- Utils.getElement(selectedProfile.getProfileJson(), "slayer_bosses." + slayerNameLower + ".boss_kills_tier_" + i),
+ Utils.getElement(selectedProfile.getProfileJson(), "slayer.slayer_bosses." + slayerNameLower + ".boss_kills_tier_" + i),
0
);
tooltipToDisplay.add(EnumChatFormatting.GRAY + "T" + (i + 1) + " Kills: " +
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java
index 8b8285c6..84eebc19 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java
@@ -133,8 +133,10 @@ public class ExtraPage extends GuiProfileViewerPage {
return;
}
String displayName = itemInformation.get(essenceName).getAsJsonObject().get("displayname").getAsString();
- int essenceNumber =
- profileInfo.has(essenceName.toLowerCase()) ? profileInfo.get(essenceName.toLowerCase()).getAsInt() : 0;
+ int essenceNumber = Utils.getElementAsInt(Utils.getElement(
+ profileInfo,
+ "currencies.essence." + essenceName.replace("ESSENCE_", "") + ".current"
+ ), 0);
Utils.renderAlignedString(
EnumChatFormatting.GOLD + displayName,
@@ -153,12 +155,7 @@ public class ExtraPage extends GuiProfileViewerPage {
if (essenceShops.get(essenceName) == null) continue;
for (Map.Entry<String, JsonElement> entry : essenceShops.get(essenceName).getAsJsonObject().entrySet()) {
- int perkTier =
- (profileInfo.has("perks") && profileInfo.get("perks").getAsJsonObject().has(entry.getKey()) ? profileInfo
- .get("perks")
- .getAsJsonObject()
- .get(entry.getKey())
- .getAsInt() : 0);
+ int perkTier = Utils.getElementAsInt(Utils.getElement(profileInfo, "player_data.perks." + entry.getKey()), 0);
int max = entry.getValue().getAsJsonObject().get("costs").getAsJsonArray().size();
EnumChatFormatting formatting = perkTier == max ? EnumChatFormatting.GREEN : EnumChatFormatting.AQUA;
String name = entry.getValue().getAsJsonObject().get("name").getAsString();
@@ -190,8 +187,11 @@ public class ExtraPage extends GuiProfileViewerPage {
float yStartBottom = 105;
float yOffset = 10;
- float bankBalance = Utils.getElementAsFloat(Utils.getElement(selectedProfile.getOuterProfileJson(), "banking.balance"), 0);
- float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "coin_purse"), 0);
+ float bankBalance = Utils.getElementAsFloat(Utils.getElement(
+ selectedProfile.getOuterProfileJson(),
+ "banking.balance"
+ ), 0);
+ float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "currencies.coin_purse"), 0);
Utils.renderAlignedString(
EnumChatFormatting.GOLD + "Bank Balance",
@@ -209,7 +209,7 @@ public class ExtraPage extends GuiProfileViewerPage {
);
{
- String first_join = getTimeSinceString(profileInfo, "first_join");
+ String first_join = getTimeSinceString(profileInfo, "profile.first_join");
if (first_join != null) {
Utils.renderAlignedString(
EnumChatFormatting.AQUA + "Joined",
@@ -275,7 +275,7 @@ public class ExtraPage extends GuiProfileViewerPage {
76
));
- float fairySouls = Utils.getElementAsFloat(Utils.getElement(profileInfo, "fairy_souls_collected"), 0);
+ float fairySouls = Utils.getElementAsFloat(Utils.getElement(profileInfo, "fairy_soul.total_collected"), 0);
int fairySoulMax = 227;
if (Constants.FAIRYSOULS != null && Constants.FAIRYSOULS.has("Max Souls")) {
@@ -350,16 +350,19 @@ public class ExtraPage extends GuiProfileViewerPage {
);
}
- float auctions_bids = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_bids"), 0);
+ float auctions_bids = Utils.getElementAsFloat(Utils.getElement(profileInfo, "player_stats.auctions.bids"), 0);
float auctions_highest_bid = Utils.getElementAsFloat(
- Utils.getElement(profileInfo, "stats.auctions_highest_bid"),
+ Utils.getElement(profileInfo, "player_stats.auctions.highest_bid"),
0
);
- float auctions_won = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_won"), 0);
- float auctions_created = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_created"), 0);
- float auctions_gold_spent = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_gold_spent"), 0);
+ float auctions_won = Utils.getElementAsFloat(Utils.getElement(profileInfo, "player_stats.auctions.won"), 0);
+ float auctions_created = Utils.getElementAsFloat(Utils.getElement(profileInfo, "player_stats.auctions.created"), 0);
+ float auctions_gold_spent = Utils.getElementAsFloat(Utils.getElement(
+ profileInfo,
+ "player_stats.auctions.gold_spent"
+ ), 0);
float auctions_gold_earned = Utils.getElementAsFloat(
- Utils.getElement(profileInfo, "stats.auctions_gold_earned"),
+ Utils.getElement(profileInfo, "player_stats.auctions.gold_earned"),
0
);
@@ -408,21 +411,21 @@ public class ExtraPage extends GuiProfileViewerPage {
float pet_milestone_ores_mined = Utils.getElementAsFloat(Utils.getElement(
profileInfo,
- "stats.pet_milestone_ores_mined"
+ "player_stats.pets.milestone.ores_mined"
), 0);
float pet_milestone_sea_creatures_killed = Utils.getElementAsFloat(
- Utils.getElement(profileInfo, "stats.pet_milestone_sea_creatures_killed"),
+ Utils.getElement(profileInfo, "player_stats.pets.milestone.sea_creatures_killed"),
0
);
- float items_fished = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.items_fished"), 0);
+ float items_fished = Utils.getElementAsFloat(Utils.getElement(profileInfo, "player_stats.items_fished.total"), 0);
float items_fished_treasure = Utils.getElementAsFloat(
- Utils.getElement(profileInfo, "stats.items_fished_treasure"),
+ Utils.getElement(profileInfo, "player_stats.items_fished.treasure"),
0
);
float items_fished_large_treasure = Utils.getElementAsFloat(Utils.getElement(
profileInfo,
- "stats.items_fished_large_treasure"
+ "player_stats.items_fished.large_treasure"
), 0);
Utils.renderAlignedString(
@@ -462,36 +465,36 @@ public class ExtraPage extends GuiProfileViewerPage {
76
);
- drawEssence(profileInfo, xStart, yStartTop, xOffset, yOffset, mouseX, mouseY);
+ drawEssence(selectedProfile.getProfileJson(), xStart, yStartTop, xOffset, yOffset, mouseX, mouseY);
if (topKills == null) {
topKills = new TreeMap<>();
- JsonObject stats = Utils.getElementOrDefault(profileInfo, "stats", new JsonObject()).getAsJsonObject();
+ JsonObject stats = Utils
+ .getElementOrDefault(profileInfo, "player_stats.kills", new JsonObject())
+ .getAsJsonObject();
for (Map.Entry<String, JsonElement> entry : stats.entrySet()) {
- if (entry.getKey().startsWith("kills_")) {
- if (entry.getValue().isJsonPrimitive()) {
- JsonPrimitive prim = (JsonPrimitive) entry.getValue();
- if (prim.isNumber()) {
- String name = WordUtils.capitalizeFully(entry.getKey().substring("kills_".length()).replace("_", " "));
- Set<String> kills = topKills.computeIfAbsent(prim.getAsInt(), k -> new HashSet<>());
- kills.add(name);
- }
+ if (entry.getValue().isJsonPrimitive()) {
+ JsonPrimitive prim = (JsonPrimitive) entry.getValue();
+ if (prim.isNumber()) {
+ String name = WordUtils.capitalizeFully(entry.getKey().replace("_", " "));
+ Set<String> kills = topKills.computeIfAbsent(prim.getAsInt(), k -> new HashSet<>());
+ kills.add(name);
}
}
}
}
if (topDeaths == null) {
topDeaths = new TreeMap<>();
- JsonObject stats = Utils.getElementOrDefault(profileInfo, "stats", new JsonObject()).getAsJsonObject();
+ JsonObject stats = Utils
+ .getElementOrDefault(profileInfo, "player_stats.deaths", new JsonObject())
+ .getAsJsonObject();
for (Map.Entry<String, JsonElement> entry : stats.entrySet()) {
- if (entry.getKey().startsWith("deaths_")) {
- if (entry.getValue().isJsonPrimitive()) {
- JsonPrimitive prim = (JsonPrimitive) entry.getValue();
- if (prim.isNumber()) {
- String name = WordUtils.capitalizeFully(entry.getKey().substring("deaths_".length()).replace("_", " "));
- Set<String> deaths = topDeaths.computeIfAbsent(prim.getAsInt(), k -> new HashSet<>());
- deaths.add(name);
- }
+ if (entry.getValue().isJsonPrimitive()) {
+ JsonPrimitive prim = (JsonPrimitive) entry.getValue();
+ if (prim.isNumber()) {
+ String name = WordUtils.capitalizeFully(entry.getKey().replace("_", " "));
+ Set<String> deaths = topDeaths.computeIfAbsent(prim.getAsInt(), k -> new HashSet<>());
+ deaths.add(name);
}
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java
index c4dc7cd6..d1528051 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java
@@ -283,7 +283,7 @@ public class InventoriesPage extends GuiProfileViewerPage {
if (equipmentItems == null) {
equipmentItems = new ItemStack[4];
- JsonArray equippment = inventoryInfo.get("equippment_contents");
+ JsonArray equippment = inventoryInfo.get("equipment_contents");
for (int i = 0; i < equippment.size(); i++) {
if (equippment.get(i) != null && equippment.get(i).isJsonObject()) {
equipmentItems[i] = NotEnoughUpdates.INSTANCE.manager.jsonToStack(equippment.get(i).getAsJsonObject(), false);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java
index 809c5fb7..8309b9db 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java
@@ -234,7 +234,7 @@ public class PlayerStats {
public static Stats getPassiveBonuses(Map<String, ProfileViewer.Level> skyblockInfo, JsonObject profile) {
Stats passiveBonuses = new Stats();
- Stats fairyBonus = getFairyBonus((int) Utils.getElementAsFloat(Utils.getElement(profile, "fairy_exchanges"), 0));
+ Stats fairyBonus = getFairyBonus((int) Utils.getElementAsFloat(Utils.getElement(profile, "fairy_soul.fairy_exchanges"), 0));
Stats skillBonus = getSkillBonus(skyblockInfo);
Stats petBonus = getTamingBonus(profile);
@@ -691,9 +691,7 @@ public class PlayerStats {
quiverInfo.arrows.putIfAbsent(internalName, count);
}
- if (profileInfo.has("favorite_arrow")) {
- quiverInfo.selectedArrow = profileInfo.get("favorite_arrow").getAsString();
- }
+ quiverInfo.selectedArrow = Utils.getElementAsString(Utils.getElement(profileInfo, "item_data.favorite_arrow"), null);
return quiverInfo;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java
index 417ca9e6..038b9e14 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java
@@ -59,7 +59,7 @@ public class ProfileViewerUtils {
public static JsonArray readInventoryInfo(JsonObject profileInfo, String bagName) {
String bytes = Utils.getElementAsString(
- Utils.getElement(profileInfo, bagName + ".data"),
+ Utils.getElement(profileInfo, "inventory.bag_contents." + bagName + ".data"),
"Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java
index f5e22e0a..a8fd019c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java
@@ -72,7 +72,7 @@ public class SkyblockProfiles {
"inv_contents",
"talisman_bag",
"candy_inventory_contents",
- "equippment_contents"
+ "equipment_contents"
);
private static final List<String> skills = Arrays.asList(
"taming",
@@ -216,6 +216,17 @@ public class SkyblockProfiles {
return highestProfileName.equals(profileName);
}
+ private long handleSoopyApiResponse(JsonObject response) {
+ if (response == null
+ || !response.has("success")
+ || !response.get("success").getAsBoolean()
+ || !response.has("data")) {
+ return -3; // Error
+ } else {
+ return response.get("data").getAsLong();
+ }
+ }
+
private void loadSoopyData(Runnable callback) {
if (updatingSoopyData.get()) {
return;
@@ -226,36 +237,20 @@ public class SkyblockProfiles {
soopyNetworthLeaderboardPosition = -2; // Loading
profileViewer.getManager().apiUtils
.request()
- .url("https://soopy.dev/api/v2/leaderboard/networth/user/" + this.uuid)
+ .url("https://api.soopy.dev/lb/lbpos/networth/" + this.uuid)
.requestJson()
.handle((jsonObject, throwable) -> {
- if (jsonObject == null || !jsonObject.has("success") || !jsonObject.get("success").getAsBoolean()
- || !jsonObject.has("data")
- || !jsonObject.getAsJsonObject("data").has("data")
- || !jsonObject.getAsJsonObject("data").getAsJsonObject("data").has("position")) {
- soopyNetworthLeaderboardPosition = -3; // Error
- } else {
- soopyNetworthLeaderboardPosition = jsonObject.getAsJsonObject("data").getAsJsonObject("data").get(
- "position").getAsLong();
- }
+ soopyNetworthLeaderboardPosition = handleSoopyApiResponse(jsonObject);
return null;
});
soopyWeightLeaderboardPosition = -2; // Loading
profileViewer.getManager().apiUtils
.request()
- .url("https://soopy.dev/api/v2/leaderboard/weight/user/" + this.uuid)
+ .url("https://api.soopy.dev/lb/lbpos/weight/" + this.uuid)
.requestJson()
.handle((jsonObject, throwable) -> {
- if (jsonObject == null || !jsonObject.has("success") || !jsonObject.get("success").getAsBoolean()
- || !jsonObject.has("data")
- || !jsonObject.getAsJsonObject("data").has("data")
- || !jsonObject.getAsJsonObject("data").getAsJsonObject("data").has("position")) {
- soopyWeightLeaderboardPosition = -3; // Error
- } else {
- soopyWeightLeaderboardPosition = jsonObject.getAsJsonObject("data").getAsJsonObject("data").get(
- "position").getAsLong();
- }
+ soopyWeightLeaderboardPosition = handleSoopyApiResponse(jsonObject);
return null;
});
@@ -271,7 +266,7 @@ public class SkyblockProfiles {
ProfileViewerUtils.lastSoopyRequestTime.put(uuid, currentTime);
profileViewer.getManager().apiUtils
.request()
- .url("https://soopy.dev/api/v2/player_networth/" + this.uuid)
+ .url("https://soopy.dev/api/v2/player_networth2/" + this.uuid)
.method("POST")
.postData("application/json", profilesArray.toString())
.requestJson()
@@ -751,12 +746,22 @@ public class SkyblockProfiles {
JsonArray contents = new JsonArray();
if (invName.equals("backpack_contents")) {
- JsonObject backpackData = getBackpackData(Utils.getElement(profileJson, "backpack_contents"));
+ JsonObject backpackData = getBackpackData(Utils.getElement(profileJson, "inventory.backpack_contents"));
inventoryNameToInfo.put("backpack_sizes", backpackData.getAsJsonArray("backpack_sizes"));
contents = backpackData.getAsJsonArray("contents");
} else {
+ String path = "inventory." + invName + ".data";
+ if (invName.endsWith("bag") || invName.equals("quiver")) {
+ path = "inventory.bag_contents." + invName + ".data";
+ } else if (invName.equals("candy_inventory_contents")) {
+ path = "shared_inventory.candy_inventory_contents"; //the mappings said that this is the new path but i cant verify that because the data doesnt exist.
+ }
+
String contentBytes = Utils.getElementAsString(
- Utils.getElement(profileJson, invName + ".data"),
+ Utils.getElement(
+ profileJson,
+ path
+ ),
defaultNbtData
);
@@ -851,7 +856,7 @@ public class SkyblockProfiles {
}
public boolean skillsApiEnabled() {
- return getProfileJson().has("experience_skill_combat");
+ return Utils.getElementAsLong(Utils.getElement(getProfileJson(), "player_data.experience.SKILL_COMBAT"), -1 ) != -1;
}
/**
@@ -883,13 +888,13 @@ public class SkyblockProfiles {
.getAsJsonObject()
.entrySet()) {
skillExperience += Utils.getElementAsFloat(
- Utils.getElement(memberProfileJson.getValue(), "experience_skill_social2"),
+ Utils.getElement(memberProfileJson.getValue(), "player_data.experience.SKILL_SOCIAL"),
0
);
}
} else {
skillExperience += Utils.getElementAsFloat(
- Utils.getElement(profileJson, "experience_skill_" + skillName),
+ Utils.getElement(profileJson, "player_data.experience.SKILL_" + skillName.toUpperCase()),
0
);
}
@@ -903,7 +908,7 @@ public class SkyblockProfiles {
int maxLevel = ProfileViewerUtils.getLevelingCap(leveling, skillName);
if (skillName.equals("farming")) {
- maxLevel += Utils.getElementAsInt(Utils.getElement(profileJson, "jacob2.perks.farming_level_cap"), 0);
+ maxLevel += Utils.getElementAsInt(Utils.getElement(profileJson, "jacobs_contest.perks.farming_level_cap"), 0);
}
out.put(skillName, ProfileViewerUtils.getLevel(levelingArray, skillExperience, maxLevel, false));
}
@@ -965,7 +970,7 @@ public class SkyblockProfiles {
for (String slayerName : Weight.SLAYER_NAMES) {
float slayerExperience = Utils.getElementAsFloat(Utils.getElement(
profileJson,
- "slayer_bosses." + slayerName + ".xp"
+ "slayer.slayer_bosses." + slayerName + ".xp"
), 0);
out.put(
slayerName,
@@ -995,12 +1000,13 @@ public class SkyblockProfiles {
return petsInfo;
}
- JsonElement petsEle = getProfileJson().get("pets");
- if (petsEle != null && petsEle.isJsonArray()) {
- JsonArray petsArr = petsEle.getAsJsonArray();
+ JsonArray petsArray = Utils
+ .getElementOrDefault(getProfileJson(), "pets_data.pets", new JsonArray())
+ .getAsJsonArray();
+ if (petsArray.size() > 0) {
JsonObject activePet = null;
- for (JsonElement petEle : petsEle.getAsJsonArray()) {
+ for (JsonElement petEle : petsArray.getAsJsonArray()) {
JsonObject petObj = petEle.getAsJsonObject();
if (petObj.has("active") && petObj.get("active").getAsBoolean()) {
activePet = petObj;
@@ -1011,7 +1017,7 @@ public class SkyblockProfiles {
// TODO: STOP DOING THIS AAAAA
petsInfo = new JsonObject();
petsInfo.add("active_pet", activePet);
- petsInfo.add("pets", petsArr);
+ petsInfo.add("pets", petsArray);
return petsInfo;
}
@@ -1162,7 +1168,7 @@ public class SkyblockProfiles {
}
float bankBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "banking.balance"), 0);
- float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "coin_purse"), 0);
+ float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "currencies.coin_purse"), 0);
networth += bankBalance + purseBalance;
return this.networth = networth;
@@ -1188,7 +1194,6 @@ public class SkyblockProfiles {
public void updateBeastMasterMultiplier() {
if (!getUuid().equals(Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", ""))) return;
- JsonObject stats = getProfileJson().get("stats").getAsJsonObject();
boolean hasBeastmasterCrest = false;
PetInfoOverlay.Rarity currentBeastRarity = PetInfoOverlay.Rarity.COMMON;
for (JsonElement talisman : getInventoryInfo().get("talisman_bag")) {
@@ -1205,8 +1210,9 @@ public class SkyblockProfiles {
}
}
if (hasBeastmasterCrest) {
- if (stats.has("mythos_kills")) {
- int mk = stats.get("mythos_kills").getAsInt();
+ JsonObject stats = getProfileJson().get("player_stats").getAsJsonObject();
+
+ int mk = Utils.getElementAsInt(Utils.getElement(stats, "mythos.kills"), 0);
float petXpBoost = mk > 10000 ? 1f : mk > 7500 ? 0.9f : mk > 5000 ? 0.8f : mk > 2500 ? 0.7f :
mk > 1000
? 0.6f
@@ -1217,10 +1223,8 @@ public class SkyblockProfiles {
: mk > 100
? 0.3f
: mk > 25 ? 0.2f : 0.1f;
- PetInfoOverlay.getConfig().beastMultiplier = petXpBoost * currentBeastRarity.beastcreatMultiplyer;
- } else {
- PetInfoOverlay.getConfig().beastMultiplier = 0.1f * currentBeastRarity.beastcreatMultiplyer;
- }
+ PetInfoOverlay.getConfig().beastMultiplier =
+ (petXpBoost == 0 ? 0.1f : petXpBoost) * currentBeastRarity.beastcreatMultiplyer;
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java
index 1633c593..7bd4805a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java
@@ -27,6 +27,7 @@ import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.SkyblockProfiles;
import io.github.moulberry.notenoughupdates.profileviewer.level.LevelPage;
import io.github.moulberry.notenoughupdates.util.Constants;
+import io.github.moulberry.notenoughupdates.util.Utils;
import io.github.moulberry.notenoughupdates.util.hypixelapi.ProfileCollectionInfo;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@@ -107,8 +108,10 @@ public class CoreTaskLevel extends GuiTaskLevel {
// museum is not possible
// fairy soul
- int fairySoulsCollected = object.get("fairy_souls_collected").getAsInt();
- int sbXpGainedFairy = ((fairySoulsCollected / 5)) * coreTask.get("fairy_souls_xp").getAsInt();
+ int sbXpGainedFairy = Utils.getElementAsInt(Utils.getElement(
+ selectedProfile.getProfileJson(),
+ "fairy_soul.total_collected"
+ ), 0) / 5 * coreTask.get("fairy_souls_xp").getAsInt();
int sbXpCollection = -1;
int sbXpMinionTier = -1; // keeping at -1 here because cobblestone 1 minion XP isn't included for some reason?
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java
index 2ca2788c..7d42ce30 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java
@@ -53,12 +53,10 @@ public class EssenceTaskLevel extends GuiTaskLevel {
String name = stringJsonElementEntry.getKey();
JsonObject individualObjects = stringJsonElementEntry.getValue().getAsJsonObject();
for (Map.Entry<String, JsonElement> jsonElementEntry : individualObjects.entrySet()) {
- String key = jsonElementEntry.getKey();
- if (!essencePerks.has(key)) {
- continue;
- }
-
- int essenceAmount = essencePerks.get(key).getAsInt();
+ int essenceAmount = Utils.getElementAsInt(Utils.getElement(
+ object,
+ "player_data.perks." + jsonElementEntry.getKey()
+ ), 0);
int amountReceivedForEach = 0;
for (int i = essenceAmount - 1; i >= 0; i--) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java
index f44e8af8..a846b416 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java
@@ -23,6 +23,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.profileviewer.level.LevelPage;
+import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@@ -69,11 +70,10 @@ public class EventTaskLevel extends GuiTaskLevel {
}
}
- int sbXpUniqueMedals = 0;
- if(object.has("jacob2") && object.getAsJsonObject("jacob2").has("unique_golds2")) {
- int size = object.getAsJsonObject("jacob2").getAsJsonArray("unique_golds2").size();
- sbXpUniqueMedals = size * eventTask.get("jacob_farming_contest_xp").getAsInt();
- }
+ int sbXpUniqueMedals = Utils
+ .getElementOrDefault(object, "jacobs_contest.unique_brackets.gold", new JsonArray())
+ .getAsJsonArray()
+ .size() * eventTask.get("jacob_farming_contest_xp").getAsInt();
lore.add(levelPage.buildLore("Mining Fiesta", sbXpMiningFiesta, eventTask.get("mining_fiesta").getAsInt(), false));
lore.add(levelPage.buildLore(
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java
index c0bb9319..af18aff6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java
@@ -157,12 +157,13 @@ public class MiscTaskLevel extends GuiTaskLevel {
// personal bank
int sbXpPersonalBank = 0;
- if (object.has("personal_bank_upgrade")) {
- int personalBankUpgrade = object.get("personal_bank_upgrade").getAsInt();
- JsonArray personalBankUpgradesXpArr = miscellaneousTask.getAsJsonArray("personal_bank_upgrades_xp");
- for (int i = 1; i <= personalBankUpgrade; i++) {
- sbXpPersonalBank += personalBankUpgradesXpArr.get(i - 1).getAsInt();
- }
+ int personalBankUpgrade = Utils.getElementAsInt(Utils.getElement(
+ selectedProfile.getProfileJson(),
+ "profile.personal_bank_upgrade"
+ ), 0);
+ JsonArray personalBankUpgradesXp = miscellaneousTask.getAsJsonArray("personal_bank_upgrades_xp");
+ for (int i = 1; i <= personalBankUpgrade; i++) {
+ sbXpPersonalBank += personalBankUpgradesXp.get(i - 1).getAsInt();
}
int sbXpTimeCharm = 0;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java
index 107aa38c..aae11c93 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java
@@ -99,7 +99,11 @@ public class SkillRelatedTaskLevel extends GuiTaskLevel{
}
int sbXpCommissionMilestone = 0;
- JsonArray tutorialArray = object.get("tutorial").getAsJsonArray();
+ JsonArray tutorialArray = Utils.getElementOrDefault(
+ selectedProfile.getProfileJson(),
+ "objectives.tutorial",
+ new JsonArray()
+ ).getAsJsonArray();
JsonArray commissionMilestoneXpArray = miningObj.get("commission_milestone_xp").getAsJsonArray();
for (JsonElement jsonElement : tutorialArray) {
if (jsonElement.getAsJsonPrimitive().isString() && jsonElement.getAsString().startsWith(
@@ -115,7 +119,7 @@ public class SkillRelatedTaskLevel extends GuiTaskLevel{
// rock mines
float pet_milestone_ores_mined = Utils.getElementAsFloat(Utils.getElement(
object,
- "stats.pet_milestone_ores_mined"
+ "player_stats.pets.milestone.ores_mined"
), 0);
int sbXpRockPet = 0;
@@ -131,8 +135,8 @@ public class SkillRelatedTaskLevel extends GuiTaskLevel{
// farming
JsonObject farmingObj = skillRelatedTask.get("farming").getAsJsonObject();
int anitaShopUpgradesXp = farmingObj.get("anita_shop_upgrades_xp").getAsInt();
- int doubleDrops = Utils.getElementAsInt(Utils.getElement(object, "jacob2.perks.double_drops"), 0);
- int farmingLevelCap = Utils.getElementAsInt(Utils.getElement(object, "jacob2.perks.farming_level_cap"), 0);
+ int doubleDrops = Utils.getElementAsInt(Utils.getElement(object, "jacobs_contest.perks.double_drops"), 0);
+ int farmingLevelCap = Utils.getElementAsInt(Utils.getElement(object, "jacobs_contest.perks.farming_level_cap"), 0);
int sbXpGainedByAnita = (doubleDrops + farmingLevelCap) * anitaShopUpgradesXp;
@@ -156,7 +160,7 @@ public class SkillRelatedTaskLevel extends GuiTaskLevel{
}
float petMilestoneKilled = Utils.getElementAsFloat(
- Utils.getElement(object, "stats.pet_milestone_sea_creatures_killed"),
+ Utils.getElement(object, "player_stats.pets.milestone.sea_creatures_killed"),
0
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java
index 3a64b257..0ec3aa1c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java
@@ -166,11 +166,10 @@ public class SlayingTaskLevel extends GuiTaskLevel {
int sbXpBestiary = GuiProfileViewer.getSelectedProfile().getBestiaryXp();
- int mythologicalKillsXp = 0;
- if (object.has("stats")) {
- JsonObject stats = object.get("stats").getAsJsonObject();
- if (stats.has("mythos_kills")) mythologicalKillsXp += (stats.get("mythos_kills").getAsLong() / 100);
- }
+ int mythologicalKillsXp = Utils.getElementAsInt(Utils.getElement(
+ selectedProfile.getProfileJson(),
+ "player_stats.mythos.kills"
+ ), 0) / 100;
int mythologicalKillsMax = slayingTask.get("mythological_kills").getAsInt();
if (mythologicalKillsXp > mythologicalKillsMax) mythologicalKillsXp = mythologicalKillsMax;
@@ -196,7 +195,7 @@ public class SlayingTaskLevel extends GuiTaskLevel {
for (int i = 0; i < 5; i++) {
if (i >= maxLevel) break;
float tier = Utils.getElementAsFloat(
- Utils.getElement(object, "slayer_bosses." + entry.getKey() + ".boss_kills_tier_" + i),
+ Utils.getElement(object, "slayer.slayer_bosses." + entry.getKey() + ".boss_kills_tier_" + i),
0
);
if (tier != 0) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java
index 85fc7ee5..62948b9b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java
@@ -106,10 +106,10 @@ public class RiftPage extends GuiProfileViewerPage {
drawArmorAndEquipment(armorData, guiLeft, guiTop, 27, 64, mouseX, mouseY, true);
}
- if (riftInventory.has("equippment_contents") &&
- riftInventory.getAsJsonObject("equippment_contents").has("data")) {
+ if (riftInventory.has("equipment_contents") &&
+ riftInventory.getAsJsonObject("equipment_contents").has("data")) {
List<JsonObject> equipmentData = readBase64(riftInventory
- .getAsJsonObject("equippment_contents")
+ .getAsJsonObject("equipment_contents")
.get("data")
.getAsString());
drawArmorAndEquipment(equipmentData, guiLeft, guiTop, 46, 64, mouseX, mouseY, false);
@@ -156,8 +156,7 @@ public class RiftPage extends GuiProfileViewerPage {
List<String> tooltip = petItemstackFromPetInfo.getTooltip(Minecraft.getMinecraft().thePlayer, false);
tooltip.set(3, "§7Found: §9" + size + "/9 Soul Pieces");
tooltip.set(5, "§7Rift Time: §a+" + riftTime + "s");
- tooltip.set(6, "§7Mana Regen: §a+" + manaRegen + "%");
-
+ if (pet.rarity == PetInfoOverlay.Rarity.EPIC) tooltip.set(6, "§7Mana Regen: §a+" + manaRegen + "%");
getInstance().tooltipToDisplay = tooltip;
}
} else if (size > 0) {
@@ -166,10 +165,7 @@ public class RiftPage extends GuiProfileViewerPage {
}
}
- int motesPurse = 0;
- if (profileInfo.has("motes_purse")) {
- motesPurse = profileInfo.get("motes_purse").getAsInt();
- }
+ float motesPurse = Utils.getElementAsFloat(Utils.getElement(profileInfo, "currencies.motes_purse"), 0);
Utils.drawStringCenteredScaledMaxWidth(
"§dMotes: §f" + Utils.shortNumberFormat(motesPurse, 0),
guiLeft + 45,
@@ -181,11 +177,12 @@ public class RiftPage extends GuiProfileViewerPage {
if ((mouseX > guiLeft + 3 && mouseX < guiLeft + 90) &&
(mouseY > guiTop + 3 && mouseY < guiTop + 25)) {
- JsonObject stats = profileInfo.get("stats").getAsJsonObject();
- if (stats.has("rift_lifetime_motes_earned")) {
- getInstance().tooltipToDisplay = Collections.singletonList(
- "§dLifetime Motes: §f" + Utils.shortNumberFormat(stats.get("rift_lifetime_motes_earned").getAsInt(), 0));
- }
+ int stats = Utils.getElementAsInt(Utils.getElement(
+ selectedProfile.getProfileJson(),
+ "player_stats.rift.lifetime_motes_earned"
+ ), 0);
+ getInstance().tooltipToDisplay = Collections.singletonList(
+ "§dLifetime Motes: §f" + Utils.shortNumberFormat(stats, 0));
}
// Timecharms
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java
index 340756d9..f26cab17 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java
@@ -164,12 +164,10 @@ public class TrophyFishPage extends GuiProfileViewerPage {
GlStateManager.disableLighting();
RenderHelper.enableGUIStandardItemLighting();
- JsonObject stats = profileInformation.getAsJsonObject("stats");
-
- int thunderKills = 0;
- if (stats != null && stats.has("kills_thunder")) {
- thunderKills = stats.getAsJsonObject().get("kills_thunder").getAsInt();
- }
+ int thunderKills = Utils.getElementAsInt(Utils.getElement(
+ selectedProfile.getProfileJson(),
+ "bestiary.kills.thunder_400"
+ ), 0);
ItemStack thunder_sc = NotEnoughUpdates.INSTANCE.manager.jsonToStack(
NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("THUNDER_SC")
);
@@ -184,10 +182,10 @@ public class TrophyFishPage extends GuiProfileViewerPage {
NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("LORD_JAWBUS_SC")
);
Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(lord_jawbus_sc, guiLeft + 16, guiTop + 120);
- int jawbusKills = 0;
- if (stats != null && stats.has("kills_lord_jawbus")) {
- jawbusKills = stats.getAsJsonObject().get("kills_lord_jawbus").getAsInt();
- }
+ int jawbusKills = Utils.getElementAsInt(Utils.getElement(
+ selectedProfile.getProfileJson(),
+ "bestiary.kills.lord_jawbus_600"
+ ), 0);
Utils.drawStringF(
EnumChatFormatting.AQUA + "Lord Jawbus Kills: §f" + jawbusKills,
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt
index ebd53c4d..8e5a2973 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt
@@ -369,8 +369,7 @@ class SacksPage(pvInstance: GuiProfileViewer) : GuiProfileViewerPage(pvInstance)
val sackTypes = sacksJson.getAsJsonObject("sacks")
val selectedProfile = selectedProfile?.profileJson ?: return
- if (!selectedProfile.has("sacks_counts") || !selectedProfile.get("sacks_counts").isJsonObject) return
- val sacksInfo = selectedProfile.get("sacks_counts").asJsonObject
+ val sacksInfo = Utils.getElementOrDefault(selectedProfile, "inventory.sacks_counts", JsonObject()).asJsonObject
var totalValue = 0.0
var totalItems = 0
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/UrsaClient.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/UrsaClient.kt
index 2320163d..312c5d9b 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/UrsaClient.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/UrsaClient.kt
@@ -181,21 +181,21 @@ class UrsaClient(val apiUtil: ApiUtil) {
companion object {
@JvmStatic
- fun profiles(uuid: UUID) = KnownRequest("v1/hypixel/profiles/${uuid}", JsonObject::class.java)
+ fun profiles(uuid: UUID) = KnownRequest("v1/hypixel/v2/profiles/${uuid}", JsonObject::class.java)
@JvmStatic
- fun player(uuid: UUID) = KnownRequest("v1/hypixel/player/${uuid}", JsonObject::class.java)
+ fun player(uuid: UUID) = KnownRequest("v1/hypixel/v2/player/${uuid}", JsonObject::class.java)
@JvmStatic
- fun guild(uuid: UUID) = KnownRequest("v1/hypixel/guild/${uuid}", JsonObject::class.java)
+ fun guild(uuid: UUID) = KnownRequest("v1/hypixel/v2/guild/${uuid}", JsonObject::class.java)
@JvmStatic
- fun bingo(uuid: UUID) = KnownRequest("v1/hypixel/bingo/${uuid}", JsonObject::class.java)
+ fun bingo(uuid: UUID) = KnownRequest("v1/hypixel/v2/bingo/${uuid}", JsonObject::class.java)
@JvmStatic
- fun museumForProfile(profileUuid: String) = KnownRequest("v1/hypixel/museum/${profileUuid}", JsonObject::class.java)
+ fun museumForProfile(profileUuid: String) = KnownRequest("v1/hypixel/v2/museum/${profileUuid}", JsonObject::class.java)
@JvmStatic
- fun status(uuid: UUID) = KnownRequest("v1/hypixel/status/${uuid}", JsonObject::class.java)
+ fun status(uuid: UUID) = KnownRequest("v1/hypixel/v2/status/${uuid}", JsonObject::class.java)
}
}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/hypixelapi/Collection.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/hypixelapi/Collection.kt
index e5c7263c..9a6a8c9f 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/hypixelapi/Collection.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/hypixelapi/Collection.kt
@@ -118,7 +118,7 @@ data class ProfileCollectionInfo(
}
val generators = members.entrySet().mapNotNull { (uuid, data) ->
if (data !is JsonObject) return null
- data["crafted_generators"] as? JsonArray
+ data.getAsJsonObject("player_data")?.get("crafted_generators") as? JsonArray
}.flatMap { it.toList() }
return ProfileCollectionInfo(
collectionData.allCollections.mapValues { (name, collection) ->