runelite-api: add combat level formula to Experience

This commit is contained in:
Adam
2017-08-15 17:51:30 -04:00
parent 68c9172af2
commit 20b10998d3
2 changed files with 30 additions and 1 deletions

View File

@@ -88,4 +88,27 @@ public class Experience
return high + 2;
}
public static double getCombatLevelPrecise(int attackLevel, int strengthLevel,
int defenceLevel, int hitpointsLevel, int magicLevel,
int rangeLevel, int prayerLevel)
{
double melee = 0.25 * (defenceLevel + hitpointsLevel + Math.floor(prayerLevel / 2))
+ 0.325 * (attackLevel + strengthLevel);
double range = 0.25 * (defenceLevel + hitpointsLevel + Math.floor(prayerLevel / 2))
+ 0.325 * (Math.floor(rangeLevel / 2));
double magic = 0.25 * (defenceLevel + hitpointsLevel + Math.floor(prayerLevel / 2))
+ 0.325 * (Math.floor(magicLevel / 2));
return Math.max(melee, Math.max(range, magic));
}
public static int getCombatLevel(int attackLevel, int strengthLevel,
int defenceLevel, int hitpointsLevel, int magicLevel,
int rangeLevel, int prayerLevel)
{
return (int) getCombatLevelPrecise(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, magicLevel, rangeLevel, prayerLevel);
}
}