Skip to content

Commit

Permalink
Merge pull request runelite#4468 from LeviSchuck/xp-126
Browse files Browse the repository at this point in the history
Fix level 126 next goal to be max XP (200,000,000) instead of -1 xp
  • Loading branch information
deathbeam authored Jul 25, 2018
2 parents 08db509 + 96c3f07 commit 3d46b17
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class Experience
* The maximum virtual skill level for any skill (200M experience).
*/
public static final int MAX_VIRT_LEVEL = 126;
public static final int MAX_SKILL_XP = 200_000_000;

/**
* The total experience required for each skill level.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.Experience;
import net.runelite.api.Skill;
import net.runelite.client.game.SkillIconManager;
import net.runelite.client.ui.ColorScheme;
Expand Down Expand Up @@ -200,7 +201,9 @@ private void rebuildAsync(boolean updated, boolean skillPaused, XpSnapshotSingle
progressBar.setValue(xpSnapshotSingle.getSkillProgressToGoal());
progressBar.setCenterLabel(xpSnapshotSingle.getSkillProgressToGoal() + "%");
progressBar.setLeftLabel("Lvl. " + xpSnapshotSingle.getStartLevel());
progressBar.setRightLabel("Lvl. " + xpSnapshotSingle.getEndLevel());
progressBar.setRightLabel(xpSnapshotSingle.getEndGoalXp() == Experience.MAX_SKILL_XP
? "200M"
: "Lvl. " + xpSnapshotSingle.getEndLevel());

progressBar.setToolTipText(String.format(
HTML_TOOL_TIP_TEMPLATE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class XpSnapshotSingle
{
private int startLevel;
private int endLevel;
private int startGoalXp;
private int endGoalXp;
private int xpGainedInSession;
private int xpRemainingToGoal;
private int xpPerHour;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ boolean update(int currentXp, int goalStartXp, int goalEndXp)
if (goalEndXp <= 0 || currentXp > goalEndXp)
{
int currentLevel = Experience.getLevelForXp(currentXp);
endLevelExp = currentLevel + 1 <= Experience.MAX_VIRT_LEVEL ? Experience.getXpForLevel(currentLevel + 1) : -1;
endLevelExp = currentLevel + 1 <= Experience.MAX_VIRT_LEVEL
? Experience.getXpForLevel(currentLevel + 1)
: Experience.MAX_SKILL_XP;
}
else
{
Expand Down Expand Up @@ -253,6 +255,8 @@ XpSnapshotSingle snapshot()
.actionsRemainingToGoal(getActionsRemaining())
.actionsPerHour(getActionsHr())
.timeTillGoal(getTimeTillLevel())
.startGoalXp(startLevelExp)
.endGoalXp(endLevelExp)
.build();
}
}

0 comments on commit 3d46b17

Please sign in to comment.