Merge pull request #631 from nvisser/xp-next-level

Add time until next level to XP tracker
This commit is contained in:
Adam
2018-03-18 19:26:20 -04:00
committed by GitHub
2 changed files with 17 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ package net.runelite.client.plugins.xptracker;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalTime;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Experience;
@@ -50,6 +51,11 @@ class SkillXPInfo
return toHourly(xpGained);
}
int getXpSec()
{
return getXpHr() / 3600;
}
int getActionsHr()
{
return toHourly(actions);
@@ -85,6 +91,15 @@ class SkillXPInfo
return (int) ((xpGained / xpGoal) * 100);
}
String getTimeTillLevel()
{
if (getXpSec() > 0)
{
return LocalTime.MIN.plusSeconds( getXpRemaining() / getXpSec() ).toString();
}
return "\u221e";
}
void reset(int currentXp)
{
if (startXp != -1)

View File

@@ -238,6 +238,8 @@ class XpInfoBox extends JPanel
+ XpPanel.formatLine(xpInfo.getActions(), "actions")
+ "<br/>"
+ XpPanel.formatLine(xpInfo.getActionsHr(), "actions/hr")
+ "<br/>"
+ xpInfo.getTimeTillLevel() + " till next lvl"
+ "</html>");
}