diff options
author | Walker Selby <git@walkerselby.com> | 2023-11-10 05:43:54 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 16:43:54 +1100 |
commit | d33907135ac7143296213e9631ccea89b94d856f (patch) | |
tree | aeb3c9080d0e5a77383bfc7f543ed73248385709 /src/main | |
parent | dcdf1ffb4d515b4b69d53cb6b7a138ded0c6b6c5 (diff) | |
download | NotEnoughUpdates-d33907135ac7143296213e9631ccea89b94d856f.tar.gz NotEnoughUpdates-d33907135ac7143296213e9631ccea89b94d856f.tar.bz2 NotEnoughUpdates-d33907135ac7143296213e9631ccea89b94d856f.zip |
Fix: Update Class Average logic to prevent "false" average >= 50 (#921)
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java index d53e44d0..edfebdce 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java @@ -543,12 +543,22 @@ public class DungeonPage extends GuiProfileViewerPage { } float classLevelSum = 0; + float classLevelSumOverflow = 0; + int numMaxed = 0; for (int i = 0; i < Weight.DUNGEON_CLASS_NAMES.size(); i++) { String className = Weight.DUNGEON_CLASS_NAMES.get(i); String colour = className.equalsIgnoreCase(activeClass) ? EnumChatFormatting.GREEN.toString() : EnumChatFormatting.WHITE.toString(); ProfileViewer.Level levelObj = levelingInfo.get("cosmetic_" + className); - classLevelSum += levelObj.level; + // If the class is maxed but not all are, we need to calculate the average level differently. + if (levelObj.level >= 50) { + levelObj.maxed = true; + numMaxed++; + classLevelSum += 50; + classLevelSumOverflow += levelObj.level; + } else { + classLevelSum += levelObj.level; + } getInstance() .renderXpBar( @@ -564,9 +574,12 @@ public class DungeonPage extends GuiProfileViewerPage { } ProfileViewer.Level classAverage = new ProfileViewer.Level(); - classAverage.level = classLevelSum / Weight.DUNGEON_CLASS_NAMES.size(); - if (classAverage.level >= 50) { + // If all classes maxed, calculate including overflow, otherwise, calculate with cap at 50. + if (numMaxed == Weight.DUNGEON_CLASS_NAMES.size()) { classAverage.maxed = true; + classAverage.level = classLevelSumOverflow / Weight.DUNGEON_CLASS_NAMES.size(); + } else { + classAverage.level = classLevelSum / Weight.DUNGEON_CLASS_NAMES.size(); } getInstance().renderXpBar( |