Fixed minor skill exploits + EXP system

Fixed minor issues regarding exploits with some skills available on the
"empowerme" command, and fixed an error with the EXP system.
This commit is contained in:
ronancpl
2017-06-06 11:48:32 -03:00
parent 83d20e3c8b
commit dbac58e871
36 changed files with 130 additions and 62 deletions

View File

@@ -2087,15 +2087,22 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
int equip = (int)Math.min((long)((gain / 10) * pendantExp), Integer.MAX_VALUE);
long total = gain + equip + party;
gainExpInternal(total, equip, party, show, inChat, white);
}
private void gainExpInternal(long gain, int equip, int party, boolean show, boolean inChat, boolean white) {
long total = gain;
if (level < getMaxLevel()) {
if ((long) this.exp.get() + total > (long) Integer.MAX_VALUE) {
int gainFirst = ExpTable.getExpNeededForLevel(level) - this.exp.get();
total -= gainFirst + 1;
this.gainExp(gainFirst + 1, party, false, inChat, white);
long leftover = 0;
long nextExp = exp.get() + total;
if (nextExp > (long)Integer.MAX_VALUE) {
total = Integer.MAX_VALUE - exp.get();
leftover = nextExp - Integer.MAX_VALUE;
}
updateSingleStat(MapleStat.EXP, this.exp.addAndGet((int)Math.min(total, Integer.MAX_VALUE)));
updateSingleStat(MapleStat.EXP, exp.addAndGet((int)total));
if (show && gain != 0) {
client.announce(MaplePacketCreator.getShowExpGain(gain, equip, party, inChat, white));
client.announce(MaplePacketCreator.getShowExpGain((int)Math.min(gain, Integer.MAX_VALUE), equip, party, inChat, white));
}
while (exp.get() >= ExpTable.getExpNeededForLevel(level)) {
levelUp(true);
@@ -2105,6 +2112,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
break;
}
}
if(leftover > 0) gainExpInternal(leftover, equip, party, false, inChat, white);
}
}

View File

@@ -791,10 +791,10 @@ public class Commands {
} else if (sub[0].equals("buffmap")) {
for (MapleCharacter chr : player.getMap().getCharacters()){
//GM Skills : Haste(Super) - Holy Symbol - Bless - Hyper Body - Echo of Hero
SkillFactory.getSkill(4101004).getEffect(SkillFactory.getSkill(4101004).getMaxLevel()).applyTo(chr);
SkillFactory.getSkill(2311003).getEffect(SkillFactory.getSkill(2311003).getMaxLevel()).applyTo(chr);
SkillFactory.getSkill(1301007).getEffect(SkillFactory.getSkill(1301007).getMaxLevel()).applyTo(chr);
SkillFactory.getSkill(2301004).getEffect(SkillFactory.getSkill(2301004).getMaxLevel()).applyTo(chr);
SkillFactory.getSkill(9101001).getEffect(SkillFactory.getSkill(9101001).getMaxLevel()).applyTo(chr);
SkillFactory.getSkill(9101002).getEffect(SkillFactory.getSkill(9101002).getMaxLevel()).applyTo(chr);
SkillFactory.getSkill(9101003).getEffect(SkillFactory.getSkill(9101003).getMaxLevel()).applyTo(chr);
SkillFactory.getSkill(9101008).getEffect(SkillFactory.getSkill(9101008).getMaxLevel()).applyTo(chr);
SkillFactory.getSkill(1005).getEffect(SkillFactory.getSkill(1005).getMaxLevel()).applyTo(chr);
chr.setHp(chr.getMaxHp());
chr.updateSingleStat(MapleStat.HP, chr.getMaxHp());
@@ -847,13 +847,14 @@ public class Commands {
Equip eu = (Equip) equip.getItem(i);
if(eu == null) continue;
short incval= (short)newStat;
short incval = (short)newStat;
eu.setWdef(incval);
eu.setAcc(incval);
eu.setAvoid(incval);
eu.setJump(incval);
eu.setMatk(incval);
eu.setMdef(incval);
eu.setHp(incval);
eu.setMp(incval);
eu.setSpeed(incval);
eu.setHands(incval);
@@ -1376,7 +1377,7 @@ public class Commands {
}
}
player.yellowMessage("Skills maxed out.");
} else if (sub[0].equals("mesos")) {
} else if (sub[0].equals("mesos")) {
if (sub.length >= 2) {
player.gainMeso(Integer.parseInt(sub[1]), true);
}
@@ -1930,6 +1931,27 @@ public class Commands {
} else if (sub.length > 1) {
time *= Integer.parseInt(sub[1]);
}
if(time > 1) {
int seconds = (int) (time / 1000) % 60 ;
int minutes = (int) ((time / (1000*60)) % 60);
int hours = (int) ((time / (1000*60*60)) % 24);
int days = (int) ((time / (1000*60*60*24)));
String strTime = "";
if(days > 0) strTime += days + " days, ";
if(hours > 0) strTime += hours + " hours, ";
strTime += minutes + " minutes, ";
strTime += seconds + " seconds";
for(World w : Server.getInstance().getWorlds()) {
for(MapleCharacter chr: w.getPlayerStorage().getAllCharacters()) {
chr.dropMessage("Server is undergoing maintenance process, and will be shutdown in " + strTime + ". Prepare yourself to quit safely in the mean time.");
}
}
}
TimerManager.getInstance().schedule(Server.getInstance().shutdown(false), time);
break;
case "face":