From 508e4450fd7d84b42dcb72c5eb06f65347e56adf Mon Sep 17 00:00:00 2001 From: Lulonaut Date: Wed, 31 Jul 2024 16:34:14 +0200 Subject: Add percentage progress to next skill level in pv (#1281) Show the percentage progress to the next skill level in pv --- .../moulberry/notenoughupdates/profileviewer/BasicPage.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java index 6c43f14b..adb3ce4c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java @@ -723,14 +723,19 @@ public class BasicPage extends GuiProfileViewerPage { EnumChatFormatting.GRAY + "Progress: " + EnumChatFormatting.GOLD + "MAXED!"); } else { int maxXp = (int) level.maxXpForLevel; + float currentXp = ((level.level % 1) * maxXp); + String currentProgressPercentage = StringUtils.formatToTenths((currentXp / maxXp) * 100); + getInstance() .tooltipToDisplay.add( EnumChatFormatting.GRAY + "Progress: " + EnumChatFormatting.DARK_PURPLE + - StringUtils.shortNumberFormat(Math.round((level.level % 1) * maxXp)) + + StringUtils.shortNumberFormat(Math.round(currentXp)) + "/" + - StringUtils.shortNumberFormat(maxXp)); + StringUtils.shortNumberFormat(maxXp) + + EnumChatFormatting.DARK_GRAY + " (" + currentProgressPercentage + "% to " + + ((int) level.level + 1) + ")"); } String totalXpS = StringUtils.formatNumber((long) level.totalXp); tooltipToDisplay.add(EnumChatFormatting.GRAY + "Total XP: " + EnumChatFormatting.DARK_PURPLE + totalXpS + -- cgit