Im tring to fix the negative EXP in my mapleblade repack.
is it wrong that i do this?
and Is it wrong that i do this?PHP Code:public void setExp(int amount) {
this.exp.set(amount);
exp.set(amount);
}
PHP Code:public void gainExp(int gain, boolean show, boolean inChat) {
gainExp(gain, show, inChat, true);
//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(true);
}
}
}
public void gainExp(int gain, boolean show, boolean inChat, boolean white) {
gainExp(gain, show, inChat, white, 0);
//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(true);
}
}
}
public void gainExp(int gain, boolean show, boolean inChat, boolean white, int party) {
if (level < getMaxLevel()) {
int total = gain;
if (party > 1 && client.getPlayer().getReborns() == 0) {
total += party * gain * 2;
}
if (party > 1) {
total += party * gain / 20;
}
if ((long) this.exp.get() + (long) gain > (long) Integer.MAX_VALUE) {
int gainFirst = ExpTable.getExpNeededForLevel(level) - this.exp.get();
gain -= gainFirst + 1;
this.gainExp(gainFirst + 1, false, inChat, white);
}
updateSingleStat(MapleStat.EXP, this.exp.addAndGet(gain));
if (show && gain != 0) {
client.getSession().write(MaplePacketCreator.getShowExpGain(gain, inChat, white, (byte) (total != gain ? party - 1 : 0)));
}
if (MapleCharacter.getMultiLevel()) {
while (level < getMaxLevel() && exp.get() >= ExpTable.getExpNeededForLevel(level)) {
levelUp(true);
}
} else if (exp.get() >= ExpTable.getExpNeededForLevel(level)) {
levelUp(true);
int need = ExpTable.getExpNeededForLevel(level);
if (exp.get() >= need) {
setExp(need - 1);
updateSingleStat(MapleStat.EXP, need);
}
}
//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(true);
}
}
}
}


Reply With Quote![[help] Negative Exp help.](http://ragezone.com/hyper728.png)

