aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java32
1 files changed, 29 insertions, 3 deletions
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 501af179..c78a6167 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -29,6 +29,8 @@ import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField;
import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay;
import io.github.moulberry.notenoughupdates.profileviewer.bestiary.BestiaryPage;
import io.github.moulberry.notenoughupdates.profileviewer.trophy.TrophyFishPage;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.DungeonsWeight;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.SkillsWeight;
import io.github.moulberry.notenoughupdates.util.AsyncDependencyLoader;
import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.PronounDB;
@@ -58,6 +60,7 @@ import java.awt.*;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Collections;
@@ -76,6 +79,8 @@ public class GuiProfileViewer extends GuiScreen {
public static final ResourceLocation pv_elements = new ResourceLocation("notenoughupdates:pv_elements.png");
public static final ResourceLocation pv_ironman = new ResourceLocation("notenoughupdates:pv_ironman.png");
public static final ResourceLocation pv_bingo = new ResourceLocation("notenoughupdates:pv_bingo.png");
+
+ public final static DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.#");
public static final ResourceLocation pv_stranded = new ResourceLocation("notenoughupdates:pv_stranded.png");
public static final ResourceLocation pv_unknown = new ResourceLocation("notenoughupdates:pv_unknown.png");
public static final ResourceLocation resource_packs =
@@ -1024,9 +1029,11 @@ public class GuiProfileViewer extends GuiScreen {
if (mouseY > y - 4 && mouseY < y + 13) {
String levelStr;
String totalXpStr = null;
- if (skillName.contains("Catacombs")) totalXpStr =
- EnumChatFormatting.GRAY + "Total XP: " + EnumChatFormatting.DARK_PURPLE +
- numberFormat.format(levelObj.totalXp);
+ if (skillName.contains("Catacombs")) {
+ totalXpStr = EnumChatFormatting.GRAY + "Total XP: " + EnumChatFormatting.DARK_PURPLE +
+ numberFormat.format(levelObj.totalXp) + EnumChatFormatting.DARK_GRAY + " (" +
+ DECIMAL_FORMAT.format(getPercentage(skillName.toLowerCase(), levelObj)) + "% to 50)";
+ }
if (levelObj.maxed) {
levelStr = EnumChatFormatting.GOLD + "MAXED!";
} else {
@@ -1238,6 +1245,25 @@ public class GuiProfileViewer extends GuiScreen {
}
}
+ public float getPercentage(String skillName, ProfileViewer.Level level) {
+ if (level.maxed) {
+ return 100;
+ }
+ if (skillName.contains("catacombs")) {
+ return (level.totalXp / DungeonsWeight.CATACOMBS_LEVEL_50_XP) * 100;
+ } else if (ExtraPage.slayers.containsKey(skillName)) {
+ return (level.totalXp / 1000000) * 100;
+ } else if (skillName.equalsIgnoreCase("social")) {
+ return (level.totalXp / 272800) * 100;
+ } else {
+ if (level.maxLevel == 60) {
+ return (level.totalXp / SkillsWeight.SKILLS_LEVEL_60) * 100;
+ } else {
+ return (level.totalXp / SkillsWeight.SKILLS_LEVEL_50) * 100;
+ }
+ }
+ }
+
/**
* Renders a subsection of the blurred framebuffer on to the corresponding section of the screen.
* Essentially, this method will "blur" the background inside the bounds specified by [x->x+blurWidth, y->y+blurHeight]