Jump to content

Code to get experience per level and experience to each level


danieljvdm

Recommended Posts

Here's a method I wrote:

 

 

public int experienceForLevel(int level) {
 
double total = 0;
for (int i = 1; i < level; i++) {
total += Math.floor(i + 300 * Math.pow(2, i / 7.0));
}
 
return (int) Math.floor(total / 4);
}
 
You can then use this to get the xp to level:
 
int currentAttLevel = client.getSkills().getCurrentLevel(Skill.ATTACK);
int currentAttLevelXp = client.getSkills().getExperience(Skill.ATTACK);
 
int nextAttLevel = currentAttLevel + 1;
int nextAttLevelXp = experienceForLevel(nextAttLevel);
 
 int xpToLevel = nextAttLevelXp - currentAttLevelXp;
 

 

And then just a simple xp/hr if you need it.

 

 int attExpHour = (int) ((3600000.0 / runTime) * attExp);
 int defExpHour = (int) ((3600000.0 / runTime) * defExp);
 int strExpHour = (int) ((3600000.0 / runTime) * strExp);

 

  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...