Merge pull request #215 from btarb24/master

Player command to reset a skill level (for when cap is enabled)
This commit is contained in:
nossr50
2012-08-09 13:10:44 -07:00
12 changed files with 115 additions and 8 deletions

View File

@ -108,7 +108,7 @@ public class McMMOPlayer {
* @param newValue The amount of XP to add
*/
public void addXPOverrideBonus(SkillType skillType, int xp) {
int modifiedXp = xp * Config.getInstance().xpGainMultiplier;
int modifiedXp = (int)Math.floor(xp * Config.getInstance().xpGainMultiplier);
addXPOverride(skillType, modifiedXp);
}
@ -129,7 +129,7 @@ public class McMMOPlayer {
bonusModifier = calculatePartyXPModifier(skillType);
}
int xp = (int) (newValue / skillType.getXpModifier()) * Config.getInstance().xpGainMultiplier;
int xp = (int)Math.floor((newValue / skillType.getXpModifier()) * Config.getInstance().xpGainMultiplier);
if (bonusModifier > 0) {
if (bonusModifier >= 2) {

View File

@ -903,6 +903,21 @@ public class PlayerProfile {
public void skillUp(SkillType skillType, int newValue) {
skills.put(skillType, skills.get(skillType) + newValue);
}
public void resetSkill(SkillType skillType)
{
//do a single skilltype
if (skillType != SkillType.ALL)
skills.put(skillType, 0);
else //do them all
{
for(SkillType skill : SkillType.values()) //iterate over all items in the enumeration
{
if (skill != SkillType.ALL) // skip the "all" value
skills.put(skill, 0);
}
}
}
// /**
// * Adds XP to the player, doesn't calculate for XP Rate