From 04d6f54c067a5cdab61186eb37f67fef11affa57 Mon Sep 17 00:00:00 2001 From: efefury <69400149+efefury@users.noreply.github.com> Date: Sun, 10 Jul 2022 16:04:00 +0200 Subject: ah profit cool gui display (#178) Co-authored-by: Lulonaut Co-authored-by: nopo --- .../moulberry/notenoughupdates/util/XPInformation.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java index 158f9917..80027aff 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java @@ -249,9 +249,21 @@ public class XPInformation { } public double getPetLevel(String petId, double exp, String rarity) { + if (Constants.PETS == null || !Constants.PETS.has("pet_levels")) { + Utils.showOutdatedRepoNotification(); + return 0; + } Stream pet_levels = StreamSupport.stream(Constants.PETS.get("pet_levels").getAsJsonArray().spliterator(), false); + if (!Constants.PETS.has("pet_rarity_offset")) { + Utils.showOutdatedRepoNotification(); + return 0; + } int pet_rarity_offset = Constants.PETS.getAsJsonObject("pet_rarity_offset").get(rarity).getAsInt(); + if (!Constants.PETS.has("custom_pet_leveling")) { + Utils.showOutdatedRepoNotification(); + return 0; + } JsonObject custom_pet_leveling = Constants.PETS.getAsJsonObject("custom_pet_leveling").getAsJsonObject(petId); List xpLevelsRequired = pet_levels.skip(pet_rarity_offset).limit(100).map(JsonElement::getAsInt).collect(Collectors.toList()); -- cgit