Increase XP tracker accuracy to 2 decimal places (#5845)
This commit is contained in:
@@ -29,6 +29,7 @@ import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JMenuItem;
|
||||
@@ -54,6 +55,8 @@ import net.runelite.client.util.StackFormatter;
|
||||
|
||||
class XpInfoBox extends JPanel
|
||||
{
|
||||
private static final DecimalFormat TWO_DECIMAL_FORMAT = new DecimalFormat("0.00");
|
||||
|
||||
// Templates
|
||||
private static final String HTML_TOOL_TIP_TEMPLATE =
|
||||
"<html>%s actions done<br/>"
|
||||
@@ -197,8 +200,8 @@ class XpInfoBox extends JPanel
|
||||
actionsLeft.setText(htmlLabel("Actions: ", xpSnapshotSingle.getActionsRemainingToGoal()));
|
||||
|
||||
// Update progress bar
|
||||
progressBar.setValue(xpSnapshotSingle.getSkillProgressToGoal());
|
||||
progressBar.setCenterLabel(xpSnapshotSingle.getSkillProgressToGoal() + "%");
|
||||
progressBar.setValue((int) xpSnapshotSingle.getSkillProgressToGoal());
|
||||
progressBar.setCenterLabel(TWO_DECIMAL_FORMAT.format(xpSnapshotSingle.getSkillProgressToGoal()) + "%");
|
||||
progressBar.setLeftLabel("Lvl. " + xpSnapshotSingle.getStartLevel());
|
||||
progressBar.setRightLabel(xpSnapshotSingle.getEndGoalXp() == Experience.MAX_SKILL_XP
|
||||
? "200M"
|
||||
|
||||
@@ -38,7 +38,7 @@ class XpSnapshotSingle
|
||||
private int xpGainedInSession;
|
||||
private int xpRemainingToGoal;
|
||||
private int xpPerHour;
|
||||
private int skillProgressToGoal;
|
||||
private double skillProgressToGoal;
|
||||
private int actionsInSession;
|
||||
private int actionsRemainingToGoal;
|
||||
private int actionsPerHour;
|
||||
|
||||
@@ -115,11 +115,11 @@ class XpStateSingle
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
private int getSkillProgress()
|
||||
private double getSkillProgress()
|
||||
{
|
||||
double xpGained = getCurrentXp() - startLevelExp;
|
||||
double xpGoal = endLevelExp - startLevelExp;
|
||||
return (int) ((xpGained / xpGoal) * 100);
|
||||
return (xpGained / xpGoal) * 100;
|
||||
}
|
||||
|
||||
private String getTimeTillLevel()
|
||||
|
||||
Reference in New Issue
Block a user