Fixed bug with gaining infinite levels. (Oops.)

This commit is contained in:
GJ 2012-03-27 17:12:38 -04:00
parent fd6610f966
commit 6cfc8c7a52

View File

@ -190,13 +190,11 @@ public class Skills {
*/ */
public static void XpCheckSkill(SkillType skillType, Player player) { public static void XpCheckSkill(SkillType skillType, Player player) {
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
int skillXpLevel = PP.getSkillXpLevel(skillType);
int xpToNextLevel = PP.getXpToLevel(skillType);
if (skillXpLevel >= xpToNextLevel) { if (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) {
int skillups = 0; int skillups = 0;
while (skillXpLevel >= xpToNextLevel) { while (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) {
if (skillType.getMaxLevel() >= PP.getSkillLevel(skillType) + 1) { if (skillType.getMaxLevel() >= PP.getSkillLevel(skillType) + 1) {
skillups++; skillups++;
PP.addLevels(skillType, 1); PP.addLevels(skillType, 1);