This will fix negative exp.
Add to MapleCharacter.java
After public int getExp() {}
Add to MapleClient.javaCode:public void setExp(int amount) { exp.set(amount); }
At public void disconnect() {
Change
toCode:chr.saveToDB(true);
Alternative method would be to set the players exp to 0 if its under 0 when the player gains exp again. In MapleCharacter.java add this in public void gainExp.Code://fix negative exp on logout if (chr.getExp() < 0) { chr.setExp(0); } chr.saveToDB(true);
*MULTI LEVEL VERSION*Code:if (this.getExp() < 0) { this.setExp(0); }
Another method would be to set the players exp to positive then issue a levelup if the players new positive exp is greater than or equal to the the required exp to levelup.
*SINGLE LEVEL VERSION*Code://if the player has negative exp while gaining exp convert to absolute value and levelup if value is greater than exp needed for level if (getExp() < 0) { setExp(Math.abs(getExp())); while (level < 200 && getExp() >= ExpTable.getExpNeededForLevel(level + 1)) { levelUp(); } }
Set the players exp to positive then issue a levelup if the players new positive exp is greater than or equal to the the required exp to levelup then set it to 0 after one level.
Code://if the player has negative exp while gaining exp convert to absolute value and levelup if value is greater than exp needed for level if (getExp() < 0) { setExp(Math.abs(getExp())); if (level < 200 && getExp() >= ExpTable.getExpNeededForLevel(level + 1)) { levelUp(); setExp(0); } }



Reply With Quote

