Wire up Party Config pt 2

This commit is contained in:
nossr50
2019-03-16 23:52:50 -07:00
parent 70b3ca3094
commit 82dec38e5c
16 changed files with 106 additions and 50 deletions

View File

@@ -156,6 +156,36 @@ public class FormulaManager {
}
}
/**
* Get the cached amount of experience needed to reach the next party level,
* if cache doesn't contain the given value it is calculated and added
* to the cached data.
*
* Parties use the exponential leveling formula
*
* @param level level to check
* @return amount of experience needed to reach next level
*/
public int getPartyCachedXpToLevel(int level) {
int experience;
/**
* Retro mode XP requirements are the default requirements
* Standard mode XP requirements are multiplied by a factor of 10
*/
int base = ExperienceConfig.getInstance().getBase(FormulaType.EXPONENTIAL);
double multiplier = ExperienceConfig.getInstance().getMultiplier(FormulaType.EXPONENTIAL);
double exponent = ExperienceConfig.getInstance().getExponent(FormulaType.EXPONENTIAL);
if (!experienceNeededExponential.containsKey(level)) {
experience = (int) Math.floor((multiplier * Math.pow(level, exponent) + base));
experience *= mcMMO.getConfigManager().getConfigParty().getPartyXP().getPartyLevel().getPartyXpCurveMultiplier();
experienceNeededExponential.put(level, experience);
}
return experienceNeededExponential.get(level);
}
/**
* Load formula file.
*/