aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorjani270 <69345714+jani270@users.noreply.github.com>2024-04-11 00:04:06 +0200
committerGitHub <noreply@github.com>2024-04-11 00:04:06 +0200
commit2f29e7829634276681ad3d188a8bf9178a733e93 (patch)
tree1ee6c9791012f41ced07873f5a30c8144cb3437d /src/main/java/io
parent1ef07edc10d830421a6ffa765e205b5f2cf5e919 (diff)
downloadNotEnoughUpdates-2f29e7829634276681ad3d188a8bf9178a733e93.tar.gz
NotEnoughUpdates-2f29e7829634276681ad3d188a8bf9178a733e93.tar.bz2
NotEnoughUpdates-2f29e7829634276681ad3d188a8bf9178a733e93.zip
meta: Add APIDataJson (#1062)
Co-authored-by: Linnea Gräf <nea@nea.moe>
Diffstat (limited to 'src/main/java/io')
-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