diff options
6 files changed, 146 insertions, 29 deletions
diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index b1a37ccc..3745dae3 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -26,21 +26,23 @@ - Added mastermode support for /join. - Added option to only show price tooltip when holding key. - Added option to disable neu's custom skulls. (idk why you would want it but its here) -- Added explenation to search highlight feature. +- Added explanation to search highlight feature. - Added fast render warning to storage gui. - Added info about how to get neu capes to the cosmetics gui. - Added SBA chroma support to neuec. - Redid bonemerang overlay - Moveable and a bit more info. -- Added /neuhelp (neu command list with bit of explenation) +- Added /neuhelp (neu command list with bit of explanation) - Added toggle to prismapump overlay. - Added ability to toggle the pickaxe's ability cooldown showing up as the pickaxe durability. - Added alternative command for "/neusouls" "/fairysouls". - Added pet skins to /pv. (DeDiamondPro) - Added pet candy to /pv. (DeDiamondPro) +- Added a /pv button to the right click player menu (DeDiamondPro) (fixed by DoKM) +- Replaced the chat command when clicking on a player name with /pv (Toggleable) ### **Bug Fixes** -- Fishing helper not showing "!" when rod colours are disabled. +- Fishing helper not showing "!" when the rod colours are disabled. - Decimal point values not being counted in Accessory bag overlay. - /pv not having the correct max minion tier. (Ironm00n) - Other (not Transparent) storage ui themes not having edit button. (please update your textures artists) @@ -50,11 +52,11 @@ - Fixed a spelling mistake in todo timers "Godpotf". - Fixed Reforge stones with reforges that have no stats not showing the tooltip (hot stuff/heated example) (heated can now have its stats hotfix reverted @repo guys) - Fixed dungeon win overlay. -- Remove description and price tooltip from backpack/personalvault icon in /pv. +- Remove description and price tooltip from backpack/personal vault icon in /pv. - Fixed Typo in NEUButtons Dungeon preset catacombs floor 7. (jani270) - Fixed fastrender check for cosmetics gui and profile viewer. - Change skyclient shader. (nacrt) -- Added a hidden toggle to disable the negative cape (replaced with null cape (cause i thought it looked nice)) as a user was not able to play due to a graphical bug that caused their screen to turn full green. +- Added a hidden toggle to disable the negative cape (replaced with null cape (because i thought it looked nice)) as a user was not able to play due to a graphical bug that caused their screen to turn full green. - Maybe fixed neu's slotlocking in dungeons. (limited testing) - Fixed Key's being "autoclicked" when bound to a keyboard key. - Fixed being able to drop slotlocked items by quickly swapping slots and spamming/holding Q. @@ -89,6 +91,9 @@ - Changed first time message to open /neuhelp instead of tutorial. - AOTV Etherwarp fixes. (DeDiamondPro) - Disabled Builders wand, block zapper and prismapump overlays on non private islands. +- Disabled stacktrace from apisync from showing if not in dev mode. +- Redid the tutorial class to be allow for buttons. +- Removed the tutorial screenshots to lower file size as the tutorial has been disabled. ### **Notes for texturepack creators** diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index d6b9d3c8..cdbfd433 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -2398,9 +2398,9 @@ public class NEUEventListener { tag.getCompoundTag("ExtraAttributes").getString("petInfo"), JsonObject.class); if (petInfo.has("exp") && petInfo.get("exp").isJsonPrimitive()) { JsonPrimitive exp = petInfo.getAsJsonPrimitive("exp"); - int rarityOffset = Constants.PETS.get("pet_rarity_offset").getAsJsonObject().get( - Utils.getRarityFromInt(Utils.checkItemTypePet(event.toolTip))).getAsInt(); - petlevel = GuiProfileViewer.getPetLevel(Constants.PETS.get("pet_levels").getAsJsonArray(), rarityOffset, exp.getAsLong()); + String petName = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(event.itemStack); + //Utils.getRarityFromInt(Utils.checkItemTypePet(event.toolTip))).getAsInt(); + petlevel = GuiProfileViewer.getPetLevel(petName, Utils.getRarityFromInt(Utils.checkItemTypePet(event.toolTip)), exp.getAsLong()); } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index 80fc0667..5fef4c62 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -1208,10 +1208,17 @@ public class NEUManager { HashMap<String, String> replacements = new HashMap<>(); if(level < 1) { - replacements.put("LVL", "1\u27A1100"); + if (Constants.PETS.has("custom_pet_leveling") && Constants.PETS.getAsJsonObject("custom_pet_leveling").has(petname) && Constants.PETS.getAsJsonObject("custom_pet_leveling").getAsJsonObject(petname).has("max_level")){ + int maxLvl = Constants.PETS.getAsJsonObject("custom_pet_leveling").getAsJsonObject(petname).get("max_level").getAsInt(); + replacements.put("LVL", "1\u27A1"+maxLvl); + } else { + replacements.put("LVL", "1\u27A1100"); + } } else { replacements.put("LVL", ""+level); } + + if(petnums != null) { if(petnums.has(petname)) { JsonObject petInfo = petnums.get(petname).getAsJsonObject(); @@ -1227,8 +1234,18 @@ public class NEUManager { if(level < 1) { JsonArray otherNumsMin = min.get("otherNums").getAsJsonArray(); JsonArray otherNumsMax = max.get("otherNums").getAsJsonArray(); + boolean addZero = false; + if(petInfoTier.has("stats_levelling_curve")){ + String[] stringArray = petInfoTier.get("stats_levelling_curve").getAsString().split(":"); + if(stringArray.length == 3) { + int type = Integer.parseInt(stringArray[2]); + if(type == 1){ + addZero = true; + } + } + } for(int i=0; i<otherNumsMax.size(); i++) { - replacements.put(""+i, removeUnusedDecimal(Math.floor(otherNumsMin.get(i).getAsFloat()*10)/10f)+ + replacements.put(""+i, (addZero?"0\u27A1":"")+removeUnusedDecimal(Math.floor(otherNumsMin.get(i).getAsFloat()*10)/10f)+ "\u27A1"+removeUnusedDecimal(Math.floor(otherNumsMax.get(i).getAsFloat()*10)/10f)); } @@ -1236,25 +1253,64 @@ public class NEUManager { int statMax = (int)Math.floor(entry.getValue().getAsFloat()); int statMin = (int)Math.floor(min.get("statNums").getAsJsonObject().get(entry.getKey()).getAsFloat()); String statStr = (statMin>0?"+":"")+statMin+"\u27A1"+statMax; + statStr = (addZero?"0\u27A1":"")+statStr; replacements.put(entry.getKey(), statStr); } } else { - float minMix = (100-level)/99f; - float maxMix = (level-1)/99f; + + int minStatsLevel = 0; + int maxStatsLevel = 100; + int statsLevelingType = -1; + + int statsLevel = level; + + + if(petInfoTier.has("stats_levelling_curve")) { + String[] stringArray = petInfoTier.get("stats_levelling_curve").getAsString().split(":"); + if (stringArray.length == 3) { + minStatsLevel = Integer.parseInt(stringArray[0]); + maxStatsLevel = Integer.parseInt(stringArray[1]); + statsLevelingType = Integer.parseInt(stringArray[2]); + switch (statsLevelingType) { + //Case for maybe a pet that might exist + case 0: + case 1: + if (level < minStatsLevel) { + statsLevel = 1; + } else if (level < maxStatsLevel) { + statsLevel = level - minStatsLevel + 1; + } else { + statsLevel = maxStatsLevel - minStatsLevel + 1; + } + break; + + } + } + } + float minMix = (maxStatsLevel-(minStatsLevel-(statsLevelingType==-1?0:1))-statsLevel)/99f; + float maxMix = (statsLevel-1)/99f; JsonArray otherNumsMin = min.get("otherNums").getAsJsonArray(); JsonArray otherNumsMax = max.get("otherNums").getAsJsonArray(); for(int i=0; i<otherNumsMax.size(); i++) { float val = otherNumsMin.get(i).getAsFloat()*minMix + otherNumsMax.get(i).getAsFloat()*maxMix; - replacements.put(""+i, removeUnusedDecimal(Math.floor(val*10)/10f)); + if(statsLevelingType == 1 && level < minStatsLevel){ + replacements.put("" + i, "0"); + } else { + replacements.put("" + i, removeUnusedDecimal(Math.floor(val * 10) / 10f)); + } } for(Map.Entry<String, JsonElement> entry : max.get("statNums").getAsJsonObject().entrySet()) { - float statMax = entry.getValue().getAsFloat(); - float statMin = min.get("statNums").getAsJsonObject().get(entry.getKey()).getAsFloat(); - float val = statMin*minMix + statMax*maxMix; - String statStr = (statMin>0?"+":"")+(int)Math.floor(val); - replacements.put(entry.getKey(), statStr); + if(statsLevelingType == 1 && level < minStatsLevel) { + replacements.put(entry.getKey(), "0"); + } else { + float statMax = entry.getValue().getAsFloat(); + float statMin = min.get("statNums").getAsJsonObject().get(entry.getKey()).getAsFloat(); + float val = statMin * minMix + statMax * maxMix; + String statStr = (statMin > 0 ? "+" : "") + (int) Math.floor(val); + replacements.put(entry.getKey(), statStr); + } } } } 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 7769c274..5313afd9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -1018,7 +1018,7 @@ public class PetInfoOverlay extends TextOverlay { JsonObject petsJson = Constants.PETS; if(currentPet != null && petsJson != null) { - currentPet.petLevel = GuiProfileViewer.getPetLevel(petsJson.get("pet_levels").getAsJsonArray(), currentPet.rarity.petOffset, currentPet.petLevel.totalXp); + currentPet.petLevel = GuiProfileViewer.getPetLevel(currentPet.petItem, currentPet.rarity.name(), currentPet.petLevel.totalXp); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java index 3c448cda..a45524ba 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -1209,7 +1209,65 @@ public class GuiProfileViewer extends GuiScreen { public float totalXp; } - public static PetLevel getPetLevel(JsonArray levels, int offset, float exp) { + private static JsonObject getPetInfo(String pet_name, String rarity){ + JsonObject petInfo = new JsonObject(); + //System.out.println(pet_name); + //System.out.println(rarity); + + if(Constants.PETS.has("custom_pet_leveling") && Constants.PETS.getAsJsonObject("custom_pet_leveling").has(pet_name)){ + JsonObject pet = Constants.PETS.getAsJsonObject("custom_pet_leveling").getAsJsonObject(pet_name); + if(pet.has("type") && pet.has("pet_levels")){ + int type = pet.get("type").getAsInt(); + switch (type) { + case 1: + JsonArray defaultLevels = Constants.PETS.getAsJsonArray("pet_levels"); + defaultLevels.addAll(pet.getAsJsonArray("pet_levels")); + petInfo.add("pet_levels", Constants.PETS.getAsJsonArray("pet_levels")); + break; + case 2: + petInfo.add("pet_levels", pet.getAsJsonArray("pet_levels")); + break; + default: + petInfo.add("pet_levels", Constants.PETS.getAsJsonArray("pet_levels")); + break; + } + } else { + petInfo.add("pet_levels", Constants.PETS.getAsJsonArray("pet_levels")); + } + if(pet.has("max_level")){ + petInfo.add("max_level", pet.get("max_level")); + } else { + petInfo.add("max_level", new JsonPrimitive(100)); + } + + if(pet.has("pet_rarity_offset")){ + petInfo.add("offset", pet.get("pet_rarity_offset")); + } else { + petInfo.add("offset", Constants.PETS.getAsJsonObject("pet_rarity_offset").get(rarity)); + } + + } else { + //System.out.println("Default Path"); + petInfo.add("offset", Constants.PETS.getAsJsonObject("pet_rarity_offset").get(rarity)); + petInfo.add("max_level", new JsonPrimitive(100)); + petInfo.add("pet_levels", Constants.PETS.getAsJsonArray("pet_levels")); + } + + + return petInfo; + + } + + public static PetLevel getPetLevel(String pet_name, String rarity, float exp) { + + JsonObject petInfo = getPetInfo(pet_name, rarity); + int offset = petInfo.get("offset").getAsInt(); + int maxPetLevel = petInfo.get("max_level").getAsInt(); + JsonArray levels = petInfo.getAsJsonArray("pet_levels"); + System.out.println("Offset: "+offset); + System.out.println("MaxPetLevel: "+maxPetLevel); + + float xpTotal = 0; float level = 1; float currentLevelRequirement = 0; @@ -1217,7 +1275,7 @@ public class GuiProfileViewer extends GuiScreen { boolean addLevel = true; - for(int i=offset; i<offset+99; i++) { + for(int i=offset; i<offset+maxPetLevel-1; i++) { if(addLevel) { currentLevelRequirement = levels.get(i).getAsFloat(); xpTotal += currentLevelRequirement; @@ -1228,15 +1286,17 @@ public class GuiProfileViewer extends GuiScreen { level += 1; } } else { + xpTotal += levels.get(i).getAsFloat(); + } } level += currentLevelProgress/currentLevelRequirement; if(level <= 0) { level = 1; - } else if(level > 100) { - level = 100; + } else if(level > maxPetLevel) { + level = maxPetLevel; } PetLevel levelObj = new PetLevel(); levelObj.level = level; @@ -1355,10 +1415,8 @@ public class GuiProfileViewer extends GuiScreen { tierNum = ""+(Integer.parseInt(tierNum)+1); } - int petRarityOffset = petsJson.get("pet_rarity_offset").getAsJsonObject().get(tier).getAsInt(); - JsonArray levelsArr = petsJson.get("pet_levels").getAsJsonArray(); + PetLevel levelObj = GuiProfileViewer.getPetLevel(petname, tier, exp); - PetLevel levelObj = getPetLevel(levelsArr, petRarityOffset, exp); float level = levelObj.level; float currentLevelRequirement = levelObj.currentLevelRequirement; float maxXP = levelObj.maxXP; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java index c95fadf0..76427cc8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java @@ -471,10 +471,8 @@ public class PlayerStats { tierNum = ""+(Integer.parseInt(tierNum)+1); } - int petRarityOffset = petsJson.get("pet_rarity_offset").getAsJsonObject().get(tier).getAsInt(); - JsonArray levelsArr = petsJson.get("pet_levels").getAsJsonArray(); + GuiProfileViewer.PetLevel levelObj = GuiProfileViewer.getPetLevel(petname, tier, exp); - GuiProfileViewer.PetLevel levelObj = GuiProfileViewer.getPetLevel(levelsArr, petRarityOffset, exp); float level = levelObj.level; float currentLevelRequirement = levelObj.currentLevelRequirement; float maxXP = levelObj.maxXP; |