diff options
| author | NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> | 2024-09-08 18:10:33 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-08 10:10:33 +0200 |
| commit | fdea5ffb563a4950581718102ed8b53d72f92ad9 (patch) | |
| tree | a722cadbdb6d6b12447d46b45986e3b70a0064b0 | |
| parent | 23a09500c31057d76a6b6d09be2bf33c0f13cee6 (diff) | |
| download | notenoughupdates-fdea5ffb563a4950581718102ed8b53d72f92ad9.tar.gz notenoughupdates-fdea5ffb563a4950581718102ed8b53d72f92ad9.tar.bz2 notenoughupdates-fdea5ffb563a4950581718102ed8b53d72f92ad9.zip | |
Fix golden dragon egg in pet overlay (#1342)
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java index 66565be2..b9ab7119 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -377,7 +377,7 @@ public class PetInfoOverlay extends TextOverlay { String petName = EnumChatFormatting.GREEN + "[Lvl " + currentPet.petLevel.getCurrentLevel() + "] " + currentPet.rarity.chatFormatting + - getPetNameFromId(currentPet.petType); + getPetNameFromId(currentPet.petType, currentPet.petLevel.getCurrentLevel()); float levelPercent = getLevelPercent(currentPet); String lvlStringShort = null; @@ -946,7 +946,7 @@ public class PetInfoOverlay extends TextOverlay { Matcher petNameMatcher = TAB_LIST_PET_NAME.matcher(line); if (petNameMatcher.matches()) { String petName = petNameMatcher.group(2); - if (!getPetNameFromId(currentPet.petType).equalsIgnoreCase(petName)) { + if (!getPetNameFromId(currentPet.petType, currentPet.petLevel.getCurrentLevel()).equalsIgnoreCase(petName)) { break; } @@ -1118,14 +1118,23 @@ public class PetInfoOverlay extends TextOverlay { return rarity; } - private static String getPetNameFromId(String petId) { + static boolean shownMissingRepo = false; + + private static String getPetNameFromId(String petId, int petLevel) { JsonObject pets = Constants.PETS; String defaultName = WordUtils.capitalizeFully(petId.replace("_", " ")); if (pets == null) return defaultName; - if (!pets.has("id_to_display_name")) { + if (!pets.has("id_to_display_name") && !shownMissingRepo) { Utils.showOutdatedRepoNotification("pets.json id_to_display_name"); + shownMissingRepo = true; return defaultName; } + + if ("GOLDEN_DRAGON".equals(petId)) { + if (petLevel < 100) return "Golden Dragon Egg"; + return defaultName; + } + JsonObject idToDisplayName = pets.get("id_to_display_name").getAsJsonObject(); if (idToDisplayName.has(petId)) { return idToDisplayName.get(petId).getAsString(); |
