aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java57
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java84
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/data/APIDataJson.java249
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java23
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java20
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java81
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java38
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftJson.java48
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java295
10 files changed, 539 insertions, 365 deletions
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 84eebc19..03b24a42 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java
@@ -26,10 +26,12 @@ import com.google.gson.JsonPrimitive;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import io.github.moulberry.notenoughupdates.profileviewer.data.APIDataJson;
import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.Weight;
import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.Rectangle;
import io.github.moulberry.notenoughupdates.util.Utils;
+import lombok.var;
import net.minecraft.client.Minecraft;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
@@ -180,6 +182,12 @@ public class ExtraPage extends GuiProfileViewerPage {
JsonObject profileInfo = selectedProfile.getProfileJson();
Map<String, ProfileViewer.Level> skyblockInfo = selectedProfile.getLevelingInfo();
+ APIDataJson data = selectedProfile.getAPIDataJson();
+ if (data == null) {
+ return;
+ }
+ var player_stats = data.player_stats;
+ var auctions = player_stats.auctions;
float xStart = 22;
float xOffset = 103;
@@ -191,7 +199,7 @@ public class ExtraPage extends GuiProfileViewerPage {
selectedProfile.getOuterProfileJson(),
"banking.balance"
), 0);
- float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "currencies.coin_purse"), 0);
+ float purseBalance = data.currencies.coin_purse;
Utils.renderAlignedString(
EnumChatFormatting.GOLD + "Bank Balance",
@@ -275,7 +283,7 @@ public class ExtraPage extends GuiProfileViewerPage {
76
));
- float fairySouls = Utils.getElementAsFloat(Utils.getElement(profileInfo, "fairy_soul.total_collected"), 0);
+ int fairySouls = data.fairy_soul.total_collected;
int fairySoulMax = 227;
if (Constants.FAIRYSOULS != null && Constants.FAIRYSOULS.has("Max Souls")) {
@@ -283,7 +291,7 @@ public class ExtraPage extends GuiProfileViewerPage {
}
Utils.renderAlignedString(
EnumChatFormatting.LIGHT_PURPLE + "Fairy Souls",
- EnumChatFormatting.WHITE.toString() + (int) fairySouls + "/" + fairySoulMax,
+ EnumChatFormatting.WHITE.toString() + fairySouls + "/" + fairySoulMax,
guiLeft + xStart,
guiTop + yStartBottom,
76
@@ -350,21 +358,12 @@ public class ExtraPage extends GuiProfileViewerPage {
);
}
- float auctions_bids = Utils.getElementAsFloat(Utils.getElement(profileInfo, "player_stats.auctions.bids"), 0);
- float auctions_highest_bid = Utils.getElementAsFloat(
- Utils.getElement(profileInfo, "player_stats.auctions.highest_bid"),
- 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, "player_stats.auctions.gold_earned"),
- 0
- );
+ float auctions_bids = auctions.bids;
+ float auctions_highest_bid = auctions.highest_bid;
+ float auctions_won = auctions.won;
+ float auctions_created = auctions.created;
+ float auctions_gold_spent = auctions.gold_spent;
+ float auctions_gold_earned = auctions.gold_earned;
Utils.renderAlignedString(
EnumChatFormatting.DARK_PURPLE + "Auction Bids",
@@ -409,24 +408,12 @@ public class ExtraPage extends GuiProfileViewerPage {
76
);
- float pet_milestone_ores_mined = Utils.getElementAsFloat(Utils.getElement(
- profileInfo,
- "player_stats.pets.milestone.ores_mined"
- ), 0);
- float pet_milestone_sea_creatures_killed = Utils.getElementAsFloat(
- Utils.getElement(profileInfo, "player_stats.pets.milestone.sea_creatures_killed"),
- 0
- );
+ float pet_milestone_ores_mined = player_stats.pets.milestone.ores_mined;
+ float pet_milestone_sea_creatures_killed = player_stats.pets.milestone.sea_creatures_killed;
- float items_fished = Utils.getElementAsFloat(Utils.getElement(profileInfo, "player_stats.items_fished.total"), 0);
- float items_fished_treasure = Utils.getElementAsFloat(
- Utils.getElement(profileInfo, "player_stats.items_fished.treasure"),
- 0
- );
- float items_fished_large_treasure = Utils.getElementAsFloat(Utils.getElement(
- profileInfo,
- "player_stats.items_fished.large_treasure"
- ), 0);
+ float items_fished = player_stats.items_fished.total;
+ float items_fished_treasure = player_stats.items_fished.treasure;
+ float items_fished_large_treasure = player_stats.items_fished.large_treasure;
Utils.renderAlignedString(
EnumChatFormatting.GREEN + "Ores Mined",
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java
index a1dba262..cbfcd60f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java
@@ -19,12 +19,13 @@
package io.github.moulberry.notenoughupdates.profileviewer;
-import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
import com.google.common.collect.Lists;
-import com.google.gson.JsonObject;
import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
+import io.github.moulberry.notenoughupdates.profileviewer.data.APIDataJson;
import io.github.moulberry.notenoughupdates.util.Utils;
+import lombok.var;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
@@ -74,6 +75,12 @@ public class MiningPage extends GuiProfileViewerPage {
return;
}
+ APIDataJson data = selectedProfile.getAPIDataJson();
+ if (data == null) {
+ return;
+ }
+ var core = data.mining_core;
+ var nodes = core.nodes;
JsonObject profileInfo = selectedProfile.getProfileJson();
float xStart = 22;
@@ -85,71 +92,64 @@ public class MiningPage extends GuiProfileViewerPage {
// Get stats
JsonElement miningCore = profileInfo.get("mining_core");
- JsonElement nodes = Utils.getElement(miningCore, "nodes");
- float mithrilPowder = Utils.getElementAsFloat(Utils.getElement(miningCore, "powder_mithril"), 0);
- float gemstonePowder = Utils.getElementAsFloat(Utils.getElement(miningCore, "powder_gemstone"), 0);
- float mithrilPowderTotal = Utils.getElementAsFloat(Utils.getElement(
- miningCore,
- "powder_spent_mithril"
- ), 0);
- float gemstonePowderTotal = Utils.getElementAsFloat(Utils.getElement(
- miningCore,
- "powder_spent_gemstone"
- ), 0);
+ float mithrilPowder = core.powder_mithril;
+ float gemstonePowder = core.powder_gemstone;
+ float mithrilPowderTotal = core.powder_spent_mithril;
+ float gemstonePowderTotal = core.powder_spent_gemstone;
double nucleusRunsCompleted = Stream.of("amber", "amethyst", "jade", "sapphire", "topaz")
.mapToDouble(crystal -> Utils.getElementAsFloat(Utils.getElement(miningCore, "crystals." + crystal + "_crystal.total_placed"), 0))
.min()
.orElse(0);
- int miningFortune = Utils.getElementAsInt(Utils.getElement(nodes, "mining_fortune"), 0);
+ int miningFortune = nodes.mining_fortune;
int miningFortuneStat = miningFortune * 5;
- int miningSpeed = Utils.getElementAsInt(Utils.getElement(nodes, "mining_speed"), 0);
+ int miningSpeed = nodes.mining_speed;
int miningSpeedStat = miningSpeed * 20;
- int dailyPowder = Utils.getElementAsInt(Utils.getElement(nodes, "daily_powder"), 0);
+ int dailyPowder = nodes.daily_powder;
int dailyPowderStat = dailyPowder * 36 + 364;
- int effMiner = Utils.getElementAsInt(Utils.getElement(nodes, "efficient_miner"), 0);
+ int effMiner = nodes.efficient_miner;
float effMinerStat = (float) (effMiner * 0.4 + 10.4);
float effMinerStat2 = Math.max(1, (float) (effMiner * .06 + 0.31));
- int tittyInsane = Utils.getElementAsInt(Utils.getElement(nodes, "titanium_insanium"), 0);
+ int tittyInsane = nodes.titanium_insanium;
float tittyInsaneStat = (float) (tittyInsane * .1 + 2);
- int luckOfCave = Utils.getElementAsInt(Utils.getElement(nodes, "random_event"), 0);
- int madMining = Utils.getElementAsInt(Utils.getElement(nodes, "mining_madness"), 0);
- int skyMall = Utils.getElementAsInt(Utils.getElement(nodes, "daily_effect"), 0);
- int goblinKiller = Utils.getElementAsInt(Utils.getElement(nodes, "goblin_killer"), 0);
- int seasonMine = Utils.getElementAsInt(Utils.getElement(nodes, "mining_experience"), 0);
+ int luckOfCave = nodes.random_event;
+ int madMining = nodes.mining_madness;
+ int skyMall = nodes.daily_effect;
+ int goblinKiller = nodes.goblin_killer;
+ int seasonMine = nodes.mining_experience;
float seasonMineStat = (float) (seasonMine * 0.1 + 5);
- int quickForge = Utils.getElementAsInt(Utils.getElement(nodes, "forge_time"), 0);
+ int quickForge = nodes.forge_time;
float quickForgeStat = (float) (quickForge * .5 + 10);
- int frontLoad = Utils.getElementAsInt(Utils.getElement(nodes, "front_loaded"), 0);
- int orbit = Utils.getElementAsInt(Utils.getElement(nodes, "experience_orbs"), 0);
+ int frontLoad = nodes.front_loaded;
+ int orbit = nodes.experience_orbs;
float orbitStat = (float) (orbit * .01 + 0.2);
- int crystallized = Utils.getElementAsInt(Utils.getElement(nodes, "fallen_star_bonus"), 0);
+ int crystallized = nodes.fallen_star_bonus;
int crystallizedStat = (crystallized - 1) * 6 + 20;
int crystallizedStat2 = (crystallized - 1) * 5 + 20;
- int professional = Utils.getElementAsInt(Utils.getElement(nodes, "professional"), 0);
+ int professional = nodes.professional;
int professionalStat = professional * 5 + 50;
- int greatExplorer = Utils.getElementAsInt(Utils.getElement(nodes, "great_explorer"), 0);
+ int greatExplorer = nodes.great_explorer;
int greatExplorerStat = greatExplorer * 4 + 16;
int greatExplorerStat2 = greatExplorer / 5 + 1;
- int fortunate = Utils.getElementAsInt(Utils.getElement(nodes, "fortunate"), 0);
+ int fortunate = nodes.fortunate;
int fortunateStat = fortunate * 4 + 20;
- int lonesomeMiner = ((Utils.getElementAsInt(Utils.getElement(nodes, "lonesome_miner"), 0)));
+ int lonesomeMiner = nodes.lonesome_miner;
float lonesomeMinerStat = (float) (lonesomeMiner * .5 + 5);
- int miningFortune2 = Utils.getElementAsInt(Utils.getElement(nodes, "mining_fortune_2"), 0);
+ int miningFortune2 = nodes.mining_fortune_2;
int miningFortune2Stat = miningFortune2 * 5;
- int miningSpeed2 = Utils.getElementAsInt(Utils.getElement(nodes, "mining_speed_2"), 0);
+ int miningSpeed2 = nodes.mining_speed_2;
int miningSpeed2Stat = miningSpeed2 * 40;
- int miningSpeedBoost = Utils.getElementAsInt(Utils.getElement(nodes, "mining_speed_boost"), 0);
- int veinSeeker = Utils.getElementAsInt(Utils.getElement(nodes, "vein_seeker"), 0);
- int powderBuff = Utils.getElementAsInt(Utils.getElement(nodes, "powder_buff"), 0);
- int potm = ((Utils.getElementAsInt(Utils.getElement(nodes, "special_0"), 0)));
- int fortnite = Utils.getElementAsInt(Utils.getElement(nodes, "precision_mining"), 0);
- int starPowder = Utils.getElementAsInt(Utils.getElement(nodes, "star_powder"), 0);
- int pickoblus = Utils.getElementAsInt(Utils.getElement(nodes, "pickaxe_toss"), 0);
- int maniacMiner = Utils.getElementAsInt(Utils.getElement(nodes, "maniac_miner"), 0);
- int mole = Utils.getElementAsInt(Utils.getElement(nodes, "mole"), 0);
+ int miningSpeedBoost = nodes.mining_speed_boost;
+ int veinSeeker = nodes.vein_seeker;
+ int powderBuff = nodes.powder_buff;
+ int potm = nodes.special_0;
+ int fortnite = nodes.precision_mining;
+ int starPowder = nodes.star_powder;
+ int pickoblus = nodes.pickaxe_toss;
+ int maniacMiner = nodes.maniac_miner;
+ int mole = nodes.mole;
float moleStat = (float) (mole * 0.051);
double molePerkStat = (double) mole / 20 - 0.55 + 50;
double molePerkStat2 = (double) Math.round(molePerkStat * 100) / 100;
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 90efc59c..25111031 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java
@@ -24,13 +24,12 @@ import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.events.ProfileDataLoadedEvent;
import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay;
import io.github.moulberry.notenoughupdates.miscfeatures.profileviewer.bestiary.BestiaryData;
-import io.github.moulberry.notenoughupdates.profileviewer.rift.RiftJson;
+import io.github.moulberry.notenoughupdates.profileviewer.data.APIDataJson;
import io.github.moulberry.notenoughupdates.profileviewer.weight.senither.SenitherWeight;
import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.Weight;
import io.github.moulberry.notenoughupdates.util.Constants;
@@ -518,7 +517,7 @@ public class SkyblockProfiles {
private SoopyNetworth soopyNetworth = null;
private MuseumData museumData = null;
@Getter
- private @Nullable RiftJson riftJson;
+ private @Nullable APIDataJson APIDataJson;
private final AtomicBoolean updatingMuseumData = new AtomicBoolean(false);
public class MuseumData {
@@ -702,9 +701,9 @@ public class SkyblockProfiles {
this.gamemode = Utils.getElementAsString(outerProfileJson.get("game_mode"), null);
try {
- riftJson = gson.fromJson(getProfileJson().get("rift"), RiftJson.class);
+ APIDataJson = gson.fromJson(getProfileJson(), APIDataJson.class);
} catch (Exception exception) {
- NotEnoughUpdates.LOGGER.error("Could not read rift data", exception);
+ NotEnoughUpdates.LOGGER.error("Could not read data", exception);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/data/APIDataJson.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/data/APIDataJson.java
new file mode 100644
index 00000000..9714f0da
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/data/APIDataJson.java
@@ -0,0 +1,249 @@
+/*
+ * Copyright (C) 2024 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.profileviewer.data;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.List;
+
+import static io.github.moulberry.notenoughupdates.profileviewer.rift.RiftPage.readBase64;
+
+public class APIDataJson {
+ public Leveling leveling = new Leveling();
+
+ public static class Leveling {
+ public int highest_pet_score = 0;
+ public int mining_fiesta_ores_mined = 0;
+ public int fishing_festival_sharks_killed = 0;
+
+ public Completions completions = new Completions();
+
+ public static class Completions {
+ public int NUCLEUS_RUNS = 0;
+ }
+ }
+
+ public Currencies currencies = new Currencies();
+
+ public static class Currencies {
+ public float coin_purse = 0;
+ public float motes_purse = 0;
+ }
+
+ public Profile profile = new Profile();
+
+ public static class Profile {
+ public int personal_bank_upgrade = 0;
+ }
+
+ public Experimentation experimentation = new Experimentation();
+
+ public static class Experimentation {
+ public int serums_drank = 0;
+ }
+
+ public Player_Stats player_stats = new Player_Stats();
+
+ public static class Player_Stats {
+ public Pets pets = new Pets();
+
+ public static class Pets {
+ public Milestone milestone = new Milestone();
+
+ public static class Milestone {
+ public float ores_mined = 0;
+ public float sea_creatures_killed = 0;
+ }
+ }
+
+ public Auctions auctions = new Auctions();
+
+ public static class Auctions {
+ public float highest_bid = 0;
+ public float bids = 0;
+ public float won = 0;
+ public float created = 0;
+ public float gold_spent = 0;
+ public float gold_earned = 0;
+ }
+
+ public ItemsFished items_fished = new ItemsFished();
+
+ public static class ItemsFished {
+ public float total = 0;
+ public float treasure = 0;
+ public float large_treasure = 0;
+ }
+
+ public Rift rift = new Rift();
+
+ public static class Rift {
+ public int lifetime_motes_earned = 0;
+ }
+ }
+
+ public FairySouls fairy_soul = new FairySouls();
+
+ public static class FairySouls {
+ public int total_collected = 0;
+ }
+
+ public @Nullable NetherData nether_island_player_data;
+
+ public static class NetherData {
+ public @Nullable JsonObject dojo;
+
+ public @Nullable Abiphone abiphone;
+
+ public static class Abiphone {
+
+ public OperatorChip operator_chip = new OperatorChip();
+
+ public static class OperatorChip {
+ public int repaired_index = 0;
+ }
+ }
+ }
+
+ public MiningCore mining_core = new MiningCore();
+
+ public static class MiningCore {
+ public float powder_mithril = 0;
+ public float powder_gemstone = 0;
+ public float powder_spent_mithril = 0;
+ public float powder_spent_gemstone = 0;
+
+ public Nodes nodes = new Nodes();
+
+ public static class Nodes {
+ public int mining_fortune = 0;
+ public int mining_speed = 0;
+ public int daily_powder = 0;
+ public int efficient_miner = 0;
+ public int titanium_insanium = 0;
+ public int random_event = 0;
+ public int mining_madness = 0;
+ public int daily_effect = 0;
+ public int goblin_killer = 0;
+ public int mining_experience = 0;
+ public int forge_time = 0;
+ public int front_loaded = 0;
+ public int experience_orbs = 0;
+ public int fallen_star_bonus = 0;
+ public int professional = 0;
+ public int great_explorer = 0;
+ public int fortunate = 0;
+ public int lonesome_miner = 0;
+ public int mining_fortune_2 = 0;
+ public int mining_speed_2 = 0;
+ public int mining_speed_boost = 0;
+ public int vein_seeker = 0;
+ public int powder_buff = 0;
+ public int special_0 = 0;
+ public int precision_mining = 0;
+ public int star_powder = 0;
+ public int pickaxe_toss = 0;
+ public int maniac_miner = 0;
+ public int mole = 0;
+ }
+ }
+
+ public @Nullable Rift rift;
+
+ public static class Rift {
+ public @Nullable RiftDeadCats dead_cats;
+
+ public static class RiftDeadCats {
+ public List<String> found_cats = new ArrayList<>();
+ public Pet montezuma = new Pet();
+
+ public static class Pet {
+ public String type = "UNKNOWN";
+ public String tier = "EPIC";
+ public Long exp = 0L;
+ public int candyUsed = 0;
+ }
+ }
+
+ public RiftInventory inventory = new RiftInventory();
+
+ public static class RiftInventory {
+ public @Nullable Inventory inv_contents;
+ public @Nullable Inventory inv_armor;
+ public @Nullable Inventory equipment_contents;
+ public @Nullable Inventory ender_chest_contents;
+
+ public static class Inventory {
+ private String data;
+
+ public List<JsonObject> readItems() {
+ if (data == null) return null;
+ return readBase64(data);
+ }
+ }
+ }
+
+ public @Nullable RiftGallery gallery;
+
+ public static class RiftGallery {
+ public @Nullable JsonArray secured_trophies;
+ }
+
+ public RiftCastle castle = new RiftCastle();
+
+ public static class RiftCastle {
+ public int grubber_stacks = 0;
+ }
+
+ public RiftEnigma enigma = new RiftEnigma();
+
+ public static class RiftEnigma {
+ public List<String> found_souls = new ArrayList<>();
+ }
+ }
+
+ public PlayerData player_data = new PlayerData();
+
+ public static class PlayerData {
+ public int reaper_peppers_eaten = 0;
+ }
+
+ public @Nullable AccessoryBagStorage accessory_bag_storage;
+
+ public static class AccessoryBagStorage {
+ public int bag_upgrades_purchased = 0;
+ public int highest_magical_power = 0;
+ public List<String> unlocked_powers = new ArrayList<>();
+ }
+
+ public JacobsContest jacobs_contest = new JacobsContest();
+
+ public static class JacobsContest {
+ public Perks perks = new Perks();
+
+ public static class Perks {
+ public int double_drops = 0;
+ public int farming_level_cap = 0;
+ }
+ }
+}
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 7bd4805a..8bd8e658 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
@@ -25,9 +25,9 @@ import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.SkyblockProfiles;
+import io.github.moulberry.notenoughupdates.profileviewer.data.APIDataJson;
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;
@@ -63,6 +63,10 @@ public class CoreTaskLevel extends GuiTaskLevel {
if (selectedProfile == null) {
return;
}
+ APIDataJson data = selectedProfile.getAPIDataJson();
+ if (data == null) {
+ return;
+ }
Map<String, ProfileViewer.Level> skyblockInfo = selectedProfile.getLevelingInfo();
int sbXpGainedSkillLVL = 0;
@@ -90,28 +94,19 @@ public class CoreTaskLevel extends GuiTaskLevel {
// mp acc
int sbXpGainedMp = 0;
- if (object.has("accessory_bag_storage") &&
- object.getAsJsonObject("accessory_bag_storage").has("highest_magical_power")) {
- sbXpGainedMp = object.getAsJsonObject("accessory_bag_storage").get("highest_magical_power").getAsInt();
+ if (data.accessory_bag_storage != null) {
+ sbXpGainedMp = data.accessory_bag_storage.highest_magical_power;
}
// pets
- int petScore = 0;
- if (object.has("leveling") &&
- object.getAsJsonObject("leveling").has("highest_pet_score")) {
- petScore = object.getAsJsonObject("leveling").get("highest_pet_score").getAsInt();
-
- }
+ int petScore = data.leveling.highest_pet_score;
int sbXpPetScore = petScore * coreTask.get("pet_score_xp").getAsInt();
// museum is not possible
// fairy soul
- int sbXpGainedFairy = Utils.getElementAsInt(Utils.getElement(
- selectedProfile.getProfileJson(),
- "fairy_soul.total_collected"
- ), 0) / 5 * coreTask.get("fairy_souls_xp").getAsInt();
+ int sbXpGainedFairy = data.fairy_soul.total_collected / 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/EventTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java
index a846b416..86c4926a 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
@@ -22,6 +22,9 @@ package io.github.moulberry.notenoughupdates.profileviewer.level.task;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
+import io.github.moulberry.notenoughupdates.profileviewer.SkyblockProfiles;
+import io.github.moulberry.notenoughupdates.profileviewer.data.APIDataJson;
import io.github.moulberry.notenoughupdates.profileviewer.level.LevelPage;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.init.Items;
@@ -40,6 +43,15 @@ public class EventTaskLevel extends GuiTaskLevel {
public void drawTask(JsonObject object, int mouseX, int mouseY, int guiLeft, int guiTop) {
List<String> lore = new ArrayList<>();
+ SkyblockProfiles.SkyblockProfile selectedProfile = GuiProfileViewer.getSelectedProfile();
+ if (selectedProfile == null) {
+ return;
+ }
+ APIDataJson data = selectedProfile.getAPIDataJson();
+ if (data == null) {
+ return;
+ }
+
int sbXpMiningFiesta = 0;
int sbXpFishingFestival = 0;
int sbXpSpookyFestival = 0;
@@ -48,12 +60,8 @@ public class EventTaskLevel extends GuiTaskLevel {
if (object.has("leveling")) {
JsonObject leveling = object.getAsJsonObject("leveling");
- int miningFiestaOresMined = 0;
- int fishingFestivalSharksKilled = 0;
- if (leveling.has("mining_fiesta_ores_mined"))
- miningFiestaOresMined = leveling.get("mining_fiesta_ores_mined").getAsInt();
- if (leveling.has("fishing_festival_sharks_killed")) fishingFestivalSharksKilled = leveling.get(
- "fishing_festival_sharks_killed").getAsInt();
+ int miningFiestaOresMined = data.leveling.mining_fiesta_ores_mined;
+ int fishingFestivalSharksKilled = data.leveling.fishing_festival_sharks_killed;
sbXpMiningFiesta = getCapOrAmount(miningFiestaOresMined, 1_000_000, 5_000);
sbXpFishingFestival = getCapOrAmount(fishingFestivalSharksKilled, 5_000, 50);
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 af18aff6..59ee9abd 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
@@ -25,8 +25,9 @@ import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.profileviewer.CrimsonIslePage;
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.SkyblockProfiles;
+import io.github.moulberry.notenoughupdates.profileviewer.data.APIDataJson;
import io.github.moulberry.notenoughupdates.profileviewer.level.LevelPage;
-import io.github.moulberry.notenoughupdates.util.Utils;
+import lombok.var;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@@ -48,24 +49,28 @@ public class MiscTaskLevel extends GuiTaskLevel {
JsonObject miscellaneousTask = levelPage.getConstant().getAsJsonObject("miscellaneous_task");
// I love doing this on god!!!
+ SkyblockProfiles.SkyblockProfile selectedProfile = GuiProfileViewer.getSelectedProfile();
+ if (selectedProfile == null) {
+ return;
+ }
+ APIDataJson data = selectedProfile.getAPIDataJson();
+ if (data == null) {
+ return;
+ }
+ if (data.nether_island_player_data == null) {
+ return;
+ }
+ var netherData = data.nether_island_player_data;
int sbXpAccessoryUpgrade = 0;
int sbXpReaperPeppers = 0;
int sbXpUnlockedPowers = 0;
int sbXpAbiphone = 0;
- if (object.has("accessory_bag_storage")) {
- JsonObject accessoryBagStorage = object.getAsJsonObject("accessory_bag_storage");
-
- sbXpAccessoryUpgrade = Utils.getElementAsInt(Utils.getElement(
- accessoryBagStorage,
- "bag_upgrades_purchased"
- ), 0) * miscellaneousTask.get("accessory_bag_upgrades_xp").getAsInt();
- sbXpReaperPeppers =
- miscellaneousTask.get("reaper_peppers_xp").getAsInt() * Utils.getElementAsInt(Utils.getElement(
- object,
- "reaper_peppers_eaten"
- ), 0);
- if (accessoryBagStorage.has("unlocked_powers")) sbXpUnlockedPowers = accessoryBagStorage.getAsJsonArray(
- "unlocked_powers").size() * miscellaneousTask.get("unlocking_powers_xp").getAsInt();
+ if (data.accessory_bag_storage != null && data.accessory_bag_storage.unlocked_powers != null) {
+ sbXpAccessoryUpgrade = data.accessory_bag_storage.bag_upgrades_purchased * miscellaneousTask.get(
+ "accessory_bag_upgrades_xp").getAsInt();
+ sbXpReaperPeppers = data.player_data.reaper_peppers_eaten * miscellaneousTask.get("reaper_peppers_xp").getAsInt();
+ sbXpUnlockedPowers = data.accessory_bag_storage.unlocked_powers.size() * miscellaneousTask.get(
+ "unlocking_powers_xp").getAsInt();
}
int sbXpDojo = 0;
@@ -74,14 +79,13 @@ public class MiscTaskLevel extends GuiTaskLevel {
JsonObject netherIslandPlayerData = object.getAsJsonObject("nether_island_player_data");
JsonObject abiphoneObject = netherIslandPlayerData.getAsJsonObject("abiphone");
- if (abiphoneObject != null && abiphoneObject.has("operator_chip") &&
- abiphoneObject.getAsJsonObject("operator_chip").has("repaired_index")) {
- int repairedIndex = abiphoneObject.getAsJsonObject("operator_chip").get("repaired_index").getAsInt();
+ if (abiphoneObject != null && netherData.abiphone != null) {
+ int repairedIndex = netherData.abiphone.operator_chip.repaired_index;
sbXpRelays += (repairedIndex + 1) * miscellaneousTask.get("unlocking_relays_xp").getAsInt();
}
- if (netherIslandPlayerData.has("dojo")) {
- JsonObject dojoScoresObj = netherIslandPlayerData.getAsJsonObject("dojo");
+ if (netherData.dojo != null) {
+ JsonObject dojoScoresObj = netherData.dojo;
int pointsTotal = 0;
for (int i = 0; i < CrimsonIslePage.apiDojoTestNames.size(); i++) {
@@ -124,10 +128,7 @@ public class MiscTaskLevel extends GuiTaskLevel {
}
}
- SkyblockProfiles.SkyblockProfile selectedProfile = GuiProfileViewer.getSelectedProfile();
- if (selectedProfile == null) {
- return;
- }
+
// community upgrades
int sbXpCommunityUpgrade = 0;
@@ -157,38 +158,26 @@ public class MiscTaskLevel extends GuiTaskLevel {
// personal bank
int sbXpPersonalBank = 0;
- int personalBankUpgrade = Utils.getElementAsInt(Utils.getElement(
- selectedProfile.getProfileJson(),
- "profile.personal_bank_upgrade"
- ), 0);
+ int personalBankUpgrade = data.profile.personal_bank_upgrade;
JsonArray personalBankUpgradesXp = miscellaneousTask.getAsJsonArray("personal_bank_upgrades_xp");
for (int i = 1; i <= personalBankUpgrade; i++) {
sbXpPersonalBank += personalBankUpgradesXp.get(i - 1).getAsInt();
}
int sbXpTimeCharm = 0;
- int sbXpBurger = 0;
- if (object.has("rift")) {
- JsonObject rift = object.getAsJsonObject("rift");
- if (rift.has("gallery") &&
- rift.getAsJsonObject("gallery").has("secured_trophies")) {
- JsonArray timeCharms = rift.getAsJsonObject("gallery").getAsJsonArray(
- "secured_trophies");
- sbXpTimeCharm += timeCharms.size() * miscellaneousTask.get("timecharm_xp").getAsInt();
- }
-
+ if (data.rift != null && data.rift.gallery != null && data.rift.gallery.secured_trophies != null) {
+ JsonArray timecharms = data.rift.gallery.secured_trophies;
+ sbXpTimeCharm += timecharms.size() * miscellaneousTask.get("timecharm_xp").getAsInt();
+ }
- if (rift.has("castle") && rift.getAsJsonObject("castle").has("grubber_stacks") && miscellaneousTask.has("mcgrubber_burger_xp")) {
- sbXpBurger = miscellaneousTask.get("mcgrubber_burger_xp").getAsInt()
- * rift.getAsJsonObject("castle").get("grubber_stacks").getAsInt();
- }
+ int sbXpBurger = 0;
+ if (data.rift != null) {
+ sbXpBurger = data.rift.castle.grubber_stacks * miscellaneousTask.get("mcgrubber_burger_xp").getAsInt();
}
int sbXpSerum = 0;
- if (object.has("experimentation") &&
- object.getAsJsonObject("experimentation").has("serums_drank")
- && miscellaneousTask.has("metaphysical_serum_xp")) {
- sbXpSerum = miscellaneousTask.get("metaphysical_serum_xp").getAsInt() * object.getAsJsonObject("experimentation").get("serums_drank").getAsInt();
+ if (miscellaneousTask.has("metaphysical_serum_xp")) {
+ sbXpSerum = miscellaneousTask.get("metaphysical_serum_xp").getAsInt() * data.experimentation.serums_drank;
}
List<String> lore = new ArrayList<>();
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 aae11c93..03ec71a7 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
@@ -25,6 +25,7 @@ import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.SkyblockProfiles;
+import io.github.moulberry.notenoughupdates.profileviewer.data.APIDataJson;
import io.github.moulberry.notenoughupdates.profileviewer.level.LevelPage;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.init.Items;
@@ -46,6 +47,10 @@ public class SkillRelatedTaskLevel extends GuiTaskLevel{
if (selectedProfile == null) {
return;
}
+ APIDataJson data = selectedProfile.getAPIDataJson();
+ if (data == null) {
+ return;
+ }
Map<String, ProfileViewer.Level> levelingInfo = selectedProfile.getLevelingInfo();
if (levelingInfo == null) {
@@ -63,12 +68,10 @@ public class SkillRelatedTaskLevel extends GuiTaskLevel{
hotmXP += hotmXpArray.get(i - 1).getAsInt();
}
- float mithrilPowder = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_mithril"), 0);
- float gemstonePowder = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_gemstone"), 0);
- float mithril = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_spent_mithril"), 0) +
- mithrilPowder;
- float gemstone = (Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_spent_gemstone"), 0)) +
- gemstonePowder;
+ float mithrilPowder = data.mining_core.powder_mithril;
+ float gemstonePowder = data.mining_core.powder_gemstone;
+ float mithril = data.mining_core.powder_spent_mithril + mithrilPowder;
+ float gemstone = data.mining_core.powder_spent_gemstone + gemstonePowder;
// PUNKT NULL
@@ -93,7 +96,7 @@ public class SkillRelatedTaskLevel extends GuiTaskLevel{
int sbXpPotmTier = 0;
JsonArray potmXpArray = miningObj.get("potm_xp").getAsJsonArray();
- int potm = ((Utils.getElementAsInt(Utils.getElement(object, "mining_core.nodes.special_0"), 0)));
+ int potm = (data.mining_core.nodes.special_0);
for (int i = 1; i <= potm; i++) {
sbXpPotmTier += potmXpArray.get(i - 1).getAsInt();
}
@@ -117,10 +120,7 @@ public class SkillRelatedTaskLevel extends GuiTaskLevel{
}
// rock mines
- float pet_milestone_ores_mined = Utils.getElementAsFloat(Utils.getElement(
- object,
- "player_stats.pets.milestone.ores_mined"
- ), 0);
+ float pet_milestone_ores_mined = data.player_stats.pets.milestone.ores_mined;
int sbXpRockPet = 0;
int rockMilestoneXp = miningObj.get("rock_milestone_xp").getAsInt();
@@ -135,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, "jacobs_contest.perks.double_drops"), 0);
- int farmingLevelCap = Utils.getElementAsInt(Utils.getElement(object, "jacobs_contest.perks.farming_level_cap"), 0);
+ int doubleDrops = data.jacobs_contest.perks.double_drops;
+ int farmingLevelCap = data.jacobs_contest.perks.farming_level_cap;
int sbXpGainedByAnita = (doubleDrops + farmingLevelCap) * anitaShopUpgradesXp;
@@ -159,10 +159,7 @@ public class SkillRelatedTaskLevel extends GuiTaskLevel{
}
}
- float petMilestoneKilled = Utils.getElementAsFloat(
- Utils.getElement(object, "player_stats.pets.milestone.sea_creatures_killed"),
- 0
- );
+ float petMilestoneKilled = data.player_stats.pets.milestone.sea_creatures_killed;
int sbXpDolphinPet = 0;
int dolphinMilestoneXp = fishingObj.get("dolphin_milestone_xp").getAsInt();
@@ -175,16 +172,13 @@ public class SkillRelatedTaskLevel extends GuiTaskLevel{
}
int sbXpNucleus = 0;
- JsonObject leveling = object.getAsJsonObject("leveling");
- if (leveling != null && leveling.has("completions") && leveling.getAsJsonObject("completions").has("NUCLEUS_RUNS")) {
- int nucleusRuns = leveling.getAsJsonObject("completions").get("NUCLEUS_RUNS").getAsInt();
- JsonElement nucleusXp = miningObj.get("crystal_nucleus_xp");
+ int nucleusRuns = data.leveling.completions.NUCLEUS_RUNS;
+ JsonElement nucleusXp = miningObj.get("crystal_nucleus_xp");
if (nucleusXp == null) {
Utils.showOutdatedRepoNotification("crystal_nucleus_xp from sblevels.json");
} else {
sbXpNucleus += nucleusRuns * nucleusXp.getAsInt();
}
- }
List<String> lore = new ArrayList<>();
lore.add(levelPage.buildLore("Heart of the Mountain", sbXpHotmTier, miningObj.get("hotm").getAsInt(), false));
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftJson.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftJson.java
deleted file mode 100644
index 684dd68b..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftJson.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2024 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.profileviewer.rift;
-
-import com.google.gson.annotations.Expose;
-
-import java.util.List;
-
-public class RiftJson {
-
- @Expose
- public RiftDeadCats dead_cats;
-
- public static class RiftDeadCats {
- @Expose
- public List<String> found_cats;
- @Expose
- public Pet montezuma;
-
- public static class Pet {
- @Expose
- public String type;
- @Expose
- public String tier;
- @Expose
- public Long exp;
- @Expose
- public int candyUsed;
- }
- }
-}
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 7259260e..1a72d2e6 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
@@ -19,7 +19,6 @@
package io.github.moulberry.notenoughupdates.profileviewer.rift;
-import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@@ -31,9 +30,11 @@ import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewerPage;
import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.SkyblockProfiles;
+import io.github.moulberry.notenoughupdates.profileviewer.data.APIDataJson;
import io.github.moulberry.notenoughupdates.util.ItemUtils;
import io.github.moulberry.notenoughupdates.util.PetLeveling;
import io.github.moulberry.notenoughupdates.util.Utils;
+import lombok.var;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
@@ -89,13 +90,12 @@ public class RiftPage extends GuiProfileViewerPage {
return;
}
JsonObject profileInfo = selectedProfile.getProfileJson();
- // TODO change everything to RiftJson walker moment
- RiftJson rift = selectedProfile.getRiftJson();
- if (!profileInfo.has("rift") || rift == null) {
+ APIDataJson data = selectedProfile.getAPIDataJson();
+ if (!profileInfo.has("rift") || data == null || data.rift == null) {
drawErrorMessage();
return;
}
-
+ var rift = data.rift;
JsonObject riftData = profileInfo.getAsJsonObject("rift");
JsonObject riftInventory = riftData.getAsJsonObject("inventory");
if (riftInventory == null) {
@@ -103,26 +103,27 @@ public class RiftPage extends GuiProfileViewerPage {
return;
}
- JsonObject riftArmor = riftInventory.getAsJsonObject("inv_armor");
- if (riftArmor != null && riftArmor.has("data")) {
- List<JsonObject> armorData = readBase64(riftArmor.get("data").getAsString());
- drawArmorAndEquipment(armorData, guiLeft, guiTop, 27, 64, mouseX, mouseY, true);
+ APIDataJson.Rift.RiftInventory.Inventory riftArmor = rift.inventory.inv_armor;
+ if (riftArmor != null) {
+ List<JsonObject> armorData = riftArmor.readItems();
+ if (armorData != null) {
+ drawArmorAndEquipment(armorData, guiLeft, guiTop, 27, 64, mouseX, mouseY, true);
+ }
}
- if (riftInventory.has("equipment_contents") &&
- riftInventory.getAsJsonObject("equipment_contents").has("data")) {
- List<JsonObject> equipmentData = readBase64(riftInventory
- .getAsJsonObject("equipment_contents")
- .get("data")
- .getAsString());
- drawArmorAndEquipment(equipmentData, guiLeft, guiTop, 46, 64, mouseX, mouseY, false);
+ APIDataJson.Rift.RiftInventory.Inventory riftEquipment = rift.inventory.equipment_contents;
+ if (riftEquipment != null) {
+ List<JsonObject> equipmentData = riftEquipment.readItems();
+ if (equipmentData != null) {
+ drawArmorAndEquipment(equipmentData, guiLeft, guiTop, 46, 64, mouseX, mouseY, false);
+ }
}
// pet
Minecraft.getMinecraft().getTextureManager().bindTexture(GuiProfileViewer.pv_elements);
Utils.drawTexturedRect(guiLeft + 35, guiTop + 156, 20, 20, 0, 20 / 256f, 0, 20 / 256f, GL11.GL_NEAREST);
- RiftJson.RiftDeadCats deadCats = rift.dead_cats;
+ APIDataJson.Rift.RiftDeadCats deadCats = rift.dead_cats;
if (deadCats != null && deadCats.found_cats != null) {
List<String> foundCats = deadCats.found_cats;
@@ -130,7 +131,7 @@ public class RiftPage extends GuiProfileViewerPage {
int riftTime = size * 15;
int manaRegen = size * 2;
- RiftJson.RiftDeadCats.Pet montezuma = deadCats.montezuma;
+ APIDataJson.Rift.RiftDeadCats.Pet montezuma = deadCats.montezuma;
if (montezuma != null) {
PetInfoOverlay.Pet pet = new PetInfoOverlay.Pet();
@@ -155,7 +156,7 @@ public class RiftPage extends GuiProfileViewerPage {
}
}
- float motesPurse = Utils.getElementAsFloat(Utils.getElement(profileInfo, "currencies.motes_purse"), 0);
+ float motesPurse = data.currencies.motes_purse;
Utils.drawStringCenteredScaledMaxWidth(
"§dMotes: §f" + Utils.shortNumberFormat(motesPurse, 0),
guiLeft + 45,
@@ -167,22 +168,15 @@ public class RiftPage extends GuiProfileViewerPage {
if ((mouseX > guiLeft + 3 && mouseX < guiLeft + 90) &&
(mouseY > guiTop + 3 && mouseY < guiTop + 25)) {
- int stats = Utils.getElementAsInt(Utils.getElement(
- selectedProfile.getProfileJson(),
- "player_stats.rift.lifetime_motes_earned"
- ), 0);
+ int stats = data.player_stats.rift.lifetime_motes_earned;
getInstance().tooltipToDisplay = Collections.singletonList(
"§dLifetime Motes: §f" + Utils.shortNumberFormat(stats, 0));
}
// Timecharms
- JsonArray timecharm = Utils.getElementOrDefault(
- selectedProfile.getProfileJson(),
- "rift.gallery.secured_trophies",
- new JsonArray()
- ).getAsJsonArray();
- if (timecharm != null) {
+ if (rift.gallery != null && rift.gallery.secured_trophies != null) {
+ JsonArray timecharm = rift.gallery.secured_trophies;
Utils.renderAlignedString(
EnumChatFormatting.RED + "Timecharms:",
EnumChatFormatting.WHITE.toString() + timecharm.size() + "/7",
@@ -196,15 +190,17 @@ public class RiftPage extends GuiProfileViewerPage {
List<String> displayNames = new ArrayList<>();
for (JsonElement jsonElement : timecharm) {
- String timecharmType = jsonElement.getAsJsonObject().get("type").getAsString();
+ String timecharmType = jsonElement.getAsJsonObject().get("type").getAsString().toUpperCase();
ItemStack timecharmItem = NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery().withKnownInternalName(
- "RIFT_TROPHY_" + timecharmType.toUpperCase()).resolveToItemStack();
+ "RIFT_TROPHY_" + timecharmType).resolveToItemStack();
if (timecharmItem != null) {
displayNames.add(timecharmItem.getDisplayName() + "§7: §a✔");
} else {
displayNames.add(EnumChatFormatting.RED.toString() + EnumChatFormatting.BOLD + "ERROR LOADING TIMECHARM!");
- displayNames.add(EnumChatFormatting.RED.toString() + EnumChatFormatting.BOLD + "PLEASE REPORT THIS AT " + EnumChatFormatting.GOLD + "discord.gg/moulberry");
- displayNames.add(EnumChatFormatting.RED.toString() + EnumChatFormatting.BOLD + "WITH THE FOLLOWING TEXT: " + EnumChatFormatting.AQUA + timecharmType.toUpperCase());
+ displayNames.add(EnumChatFormatting.RED.toString() + EnumChatFormatting.BOLD + "PLEASE REPORT THIS AT " +
+ EnumChatFormatting.GOLD + "discord.gg/moulberry");
+ displayNames.add(EnumChatFormatting.RED.toString() + EnumChatFormatting.BOLD + "WITH THE FOLLOWING TEXT: " +
+ EnumChatFormatting.AQUA + timecharmType);
}
}
getInstance().tooltipToDisplay = displayNames;
@@ -213,9 +209,10 @@ public class RiftPage extends GuiProfileViewerPage {
renderItem("GLASS", 316, 36, guiLeft, guiTop);
}
- int grubberStacks = Utils.getElementAsInt(Utils.getElement(profileInfo, "rift.castle.grubber_stacks"), 0);
- Utils.renderAlignedString(EnumChatFormatting.GOLD + "Burger:",
+ int grubberStacks = rift.castle.grubber_stacks;
+ Utils.renderAlignedString(
+ EnumChatFormatting.GOLD + "Burger:",
EnumChatFormatting.WHITE.toString() + grubberStacks + "/5",
guiLeft + 331,
guiTop + 87,
@@ -261,21 +258,19 @@ public class RiftPage extends GuiProfileViewerPage {
}
}
- int foundSouls = Utils.getElementOrDefault(
- selectedProfile.getProfileJson(),
- "rift.enigma.found_souls",
- new JsonArray()
- ).getAsJsonArray().size();
+ if (rift.enigma != null && rift.enigma.found_souls != null ) {
+ int foundSouls = rift.enigma.found_souls.size();
- Utils.renderAlignedString(
- EnumChatFormatting.DARK_PURPLE + "Enigma Souls:",
- EnumChatFormatting.WHITE.toString() + foundSouls + "/42",
- guiLeft + 331,
- guiTop + 110,
- 83
- );
+ Utils.renderAlignedString(
+ EnumChatFormatting.DARK_PURPLE + "Enigma Souls:",
+ EnumChatFormatting.WHITE.toString() + foundSouls + "/42",
+ guiLeft + 331,
+ guiTop + 110,
+ 83
+ );
- renderItem("SKYBLOCK_ENIGMA_SOUL", 314, 106, guiLeft, guiTop);
+ renderItem("SKYBLOCK_ENIGMA_SOUL", 314, 106, guiLeft, guiTop);
+ }
// button
@@ -306,108 +301,114 @@ public class RiftPage extends GuiProfileViewerPage {
drawErrorMessage();
return;
}
- JsonObject enderChestContents = riftInventory.getAsJsonObject("ender_chest_contents");
- String data = enderChestContents.get("data").getAsString();
- List<JsonObject> jsonObjects = readBase64(data);
- pages = (int) (Math.ceil(jsonObjects.size() / 45d));
-
- drawArrows(onPage, pages, 190, 77);
-
- for (int i = 0; i <= pages; i++) {
- if (i != onPage) continue;
-
- List<JsonObject> page = jsonObjects.subList(
- Math.min(i == 0 ? 0 : i * 45, jsonObjects.size() - 45),
- i == 0 ? 45 : jsonObjects.size()
- ); // if anybody has an idea how to make this less hard coded on 2 pages (more pages) please do it for me, i am doing this at 4 am
-
- int row = 0;
- int slot = 0;
-
- for (int j = 0; j < page.size(); j++) {
- JsonObject jsonObject = page.get(j);
- if (j % 9 == 0 && j > 0) {
- slot = 0;
- row++;
- }
-
- int x = (inventoryX - guiLeft) + 8 + (slot * 18);
- int y = 91 + (row * 18);
- slot++;
- if (jsonObject != null) {
- ItemStack itemStack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(jsonObject);
-
- if ((mouseX >= guiLeft + x && mouseX <= guiLeft + x + 16) &&
- (mouseY >= guiTop + y && mouseY <= guiTop + y + 16)) {
- getInstance().tooltipToDisplay =
- itemStack.getTooltip(
- Minecraft.getMinecraft().thePlayer,
- Minecraft.getMinecraft().gameSettings.advancedItemTooltips
- );
+ APIDataJson.Rift.RiftInventory.Inventory riftEnderChest = rift.inventory.ender_chest_contents;
+ if (riftEnderChest != null) {
+ List<JsonObject> enderChestContents = riftEnderChest.readItems();
+ if (enderChestContents != null) {
+ pages = (int) (Math.ceil(enderChestContents.size() / 45d));
+
+ drawArrows(onPage, pages, 190, 77);
+
+ for (int i = 0; i <= pages; i++) {
+ if (i != onPage) continue;
+
+ List<JsonObject> page = enderChestContents.subList(
+ Math.min(i == 0 ? 0 : i * 45, enderChestContents.size() - 45),
+ i == 0 ? 45 : enderChestContents.size()
+ ); // if anybody has an idea how to make this less hard coded on 2 pages (more pages) please do it for me, i am doing this at 4 am
+
+ int row = 0;
+ int slot = 0;
+
+ for (int j = 0; j < page.size(); j++) {
+ JsonObject jsonObject = page.get(j);
+ if (j % 9 == 0 && j > 0) {
+ slot = 0;
+ row++;
+ }
+
+ int x = (inventoryX - guiLeft) + 8 + (slot * 18);
+ int y = 91 + (row * 18);
+ slot++;
+ if (jsonObject != null) {
+ ItemStack itemStack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(jsonObject);
+
+ if ((mouseX >= guiLeft + x && mouseX <= guiLeft + x + 16) &&
+ (mouseY >= guiTop + y && mouseY <= guiTop + y + 16)) {
+ getInstance().tooltipToDisplay =
+ itemStack.getTooltip(
+ Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().gameSettings.advancedItemTooltips
+ );
+ }
+ renderItem(itemStack, x, y, guiLeft, guiTop);
+ }
}
- renderItem(itemStack, x, y, guiLeft, guiTop);
}
}
}
} else {
-
if (riftInventory == null || !riftInventory.has("inv_contents")) {
drawErrorMessage();
return;
}
- String invData = riftInventory.getAsJsonObject("inv_contents").get("data").getAsString();
- List<JsonObject> jsonObjects = readBase64(invData);
-
- List<JsonObject> hotbar = new ArrayList<>();
- for (int i = 0; i < 9; i++) {
- hotbar.add(jsonObjects.get(i));
- }
- jsonObjects.removeAll(hotbar);
- int hotbarSlot = 0;
- for (JsonObject jsonObject : hotbar) {
- if (jsonObject != null) {
- int drawX = 123 + (hotbarSlot * 18);
- ItemStack itemStack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(jsonObject);
-
- if ((mouseX >= guiLeft + drawX && mouseX <= guiLeft + drawX + 16) &&
- (mouseY >= guiTop + 154 && mouseY <= guiTop + 154 + 16)) {
- getInstance().tooltipToDisplay =
- itemStack.getTooltip(
- Minecraft.getMinecraft().thePlayer,
- Minecraft.getMinecraft().gameSettings.advancedItemTooltips
- );
+ APIDataJson.Rift.RiftInventory.Inventory riftInventory2 = rift.inventory.inv_contents;
+ if (riftInventory2 != null) {
+ List<JsonObject> inventoryContents = riftInventory2.readItems();
+ if (inventoryContents != null) {
+
+ List<JsonObject> hotbar = new ArrayList<>();
+ for (int i = 0; i < 9; i++) {
+ hotbar.add(inventoryContents.get(i));
}
+ inventoryContents.removeAll(hotbar);
+ int hotbarSlot = 0;
+ for (JsonObject jsonObject : hotbar) {
+ if (jsonObject != null) {
+ int drawX = 123 + (hotbarSlot * 18);
+ ItemStack itemStack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(jsonObject);
+
+ if ((mouseX >= guiLeft + drawX && mouseX <= guiLeft + drawX + 16) &&
+ (mouseY >= guiTop + 154 && mouseY <= guiTop + 154 + 16)) {
+ getInstance().tooltipToDisplay =
+ itemStack.getTooltip(
+ Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().gameSettings.advancedItemTooltips
+ );
+ }
+
+ renderItem(itemStack, drawX, 154, guiLeft, guiTop);
+ }
+ hotbarSlot++;
- renderItem(itemStack, drawX, 154, guiLeft, guiTop);
- }
- hotbarSlot++;
-
- }
+ }
- int row = 1;
- int slot = 0;
- for (int i = 0; i < jsonObjects.size(); i++) {
- JsonObject jsonObject = jsonObjects.get(i);
- if (i % 9 == 0 && i > 0) {
- slot = 0;
- row++;
- }
+ int row = 1;
+ int slot = 0;
+ for (int i = 0; i < inventoryContents.size(); i++) {
+ JsonObject jsonObject = inventoryContents.get(i);
+ if (i % 9 == 0 && i > 0) {
+ slot = 0;
+ row++;
+ }
- if (jsonObject != null) {
- ItemStack itemStack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(jsonObject);
- int x1 = (inventoryX - guiLeft) + (slot * 18) + 8;
- int y1 = (inventoryY - guiTop) + (row * 18);
- if ((mouseX >= guiLeft + x1 && mouseX <= guiLeft + x1 + 16) &&
- (mouseY >= guiTop + y1 && mouseY <= guiTop + y1 + 16)) {
- getInstance().tooltipToDisplay =
- itemStack.getTooltip(
- Minecraft.getMinecraft().thePlayer,
- Minecraft.getMinecraft().gameSettings.advancedItemTooltips
- );
+ if (jsonObject != null) {
+ ItemStack itemStack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(jsonObject);
+ int x1 = (inventoryX - guiLeft) + (slot * 18) + 8;
+ int y1 = (inventoryY - guiTop) + (row * 18);
+ if ((mouseX >= guiLeft + x1 && mouseX <= guiLeft + x1 + 16) &&
+ (mouseY >= guiTop + y1 && mouseY <= guiTop + y1 + 16)) {
+ getInstance().tooltipToDisplay =
+ itemStack.getTooltip(
+ Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().gameSettings.advancedItemTooltips
+ );
+ }
+ renderItem(itemStack, x1, y1, guiLeft, guiTop);
+ }
+ slot++;
}
- renderItem(itemStack, x1, y1, guiLeft, guiTop);
}
- slot++;
}
}
}
@@ -536,19 +537,19 @@ public class RiftPage extends GuiProfileViewerPage {
);
}
}
- }
+ }
- public List<JsonObject> readBase64(String data) {
- List<JsonObject> itemStacks = new ArrayList<>();
- try {
- NBTTagList items = CompressedStreamTools.readCompressed(
- new ByteArrayInputStream(Base64.getDecoder().decode(data))
- ).getTagList("i", 10);
- for (int j = 0; j < items.tagCount(); j++) {
- JsonObject item = NotEnoughUpdates.INSTANCE.manager.getJsonFromNBTEntry(items.getCompoundTagAt(j));
- itemStacks.add(item);
- }
- } catch (IOException ignored) {
+ public static List<JsonObject> readBase64 (String data){
+ List<JsonObject> itemStacks = new ArrayList<>();
+ try {
+ NBTTagList items = CompressedStreamTools.readCompressed(
+ new ByteArrayInputStream(Base64.getDecoder().decode(data))
+ ).getTagList("i", 10);
+ for (int j = 0; j < items.tagCount(); j++) {
+ JsonObject item = NotEnoughUpdates.INSTANCE.manager.getJsonFromNBTEntry(items.getCompoundTagAt(j));
+ itemStacks.add(item);
+ }
+ } catch (IOException ignored) {
}
return itemStacks;
}