Still some work to do, but now the convert XP command is less clunky

This commit is contained in:
nossr50
2019-05-30 16:12:32 -07:00
parent 84b9b255aa
commit 1532791c3f
6 changed files with 31 additions and 42 deletions

View File

@@ -59,16 +59,15 @@ public class FormulaManager {
*
* @param primarySkillType skill where new levels and experience are calculated for
* @param experience total amount of experience
* @param formulaType The new {@link FormulaType}
* @return the amount of levels and experience
*/
public int[] calculateNewLevel(PrimarySkillType primarySkillType, int experience, FormulaType formulaType) {
public int[] calculateNewLevel(PrimarySkillType primarySkillType, int experience) {
int newLevel = 0;
int remainder = 0;
int maxLevel = mcMMO.getConfigManager().getConfigLeveling().getLevelCap(primarySkillType);
while (experience > 0 && newLevel < maxLevel) {
int experienceToNextLevel = getXPtoNextLevel(newLevel, formulaType);
int experienceToNextLevel = getXPtoNextLevel(newLevel, currentFormula);
if (experience - experienceToNextLevel < 0) {
remainder = experience;
@@ -198,4 +197,8 @@ public class FormulaManager {
return calculateXPNeeded(level, FormulaType.LINEAR);
}
}
public void setCurrentFormula(FormulaType currentFormula) {
this.currentFormula = currentFormula;
}
}