diff options
| author | kr45732 <52721908+kr45732@users.noreply.github.com> | 2022-08-16 14:28:45 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-16 20:28:45 +0200 |
| commit | 65158242ac750931ec358e50c394171cfee490ce (patch) | |
| tree | 0a499fe6d2280428836689cb8e2ed57fb9a2abde /src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java | |
| parent | 51a8977344343eac1899ed59f63621c7d87d7d00 (diff) | |
| download | notenoughupdates-65158242ac750931ec358e50c394171cfee490ce.tar.gz notenoughupdates-65158242ac750931ec358e50c394171cfee490ce.tar.bz2 notenoughupdates-65158242ac750931ec358e50c394171cfee490ce.zip | |
Fix pets crashes (#226)
* fix some stuff maybe
* Boulberry Bushing
* spam jani logs
* maybe fix sob
* more spam
* does dat fix anytihnkgMjl
* more spam (real)
* ae
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java | 41 |
1 files changed, 0 insertions, 41 deletions
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 f9f1663e..58794e07 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java @@ -21,7 +21,6 @@ package io.github.moulberry.notenoughupdates.util; import com.google.common.base.Splitter; import com.google.gson.JsonArray; -import com.google.gson.JsonElement; import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.core.util.StringUtils; import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer; @@ -34,9 +33,6 @@ import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import java.util.stream.StreamSupport; public class XPInformation { private static final XPInformation INSTANCE = new XPInformation(); @@ -249,41 +245,4 @@ public class XPInformation { skillInfoMap.put(skill.toLowerCase(), info); } } - - public double getPetLevel(String petId, double exp, String rarity) { - if (Constants.PETS == null || !Constants.PETS.has("pet_levels")) { - Utils.showOutdatedRepoNotification(); - return 0; - } - Stream<JsonElement> 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<Integer> xpLevelsRequired = - pet_levels.skip(pet_rarity_offset).limit(100).map(JsonElement::getAsInt).collect(Collectors.toList()); - if (custom_pet_leveling != null && custom_pet_leveling.get("type").getAsInt() == 1) - xpLevelsRequired.addAll(StreamSupport - .stream(custom_pet_leveling.getAsJsonArray("pet_levels").spliterator(), false) - .map(JsonElement::getAsInt) - .collect(Collectors.toList())); - double remainingExp = exp; - for (int i = 0; i < xpLevelsRequired.size(); i++) { - int xpForCurrentLevel = xpLevelsRequired.get(i); - if (remainingExp >= xpForCurrentLevel) { - remainingExp -= xpForCurrentLevel; - } else { - return i + 1 + remainingExp / xpForCurrentLevel; - } - } - return xpLevelsRequired.size(); - } - } |
