HikariCP config + MaxHP/MP & EXP overhaul + Venom fix

Overhauled the HikariCP connection, now it properly tries the best to hand out a DB connection. Fixed "commands" NPC crashing out players when entering the command multiple times in a short time. Rebalanced HP/MP gain on leveling up/AP resetting. Rebalanced HP/MP loss when AP resetting to use the same amount they would be earning on levelup. Fixed EXP distribution now computing overall monster maxHP plus heal instead of flat monter maxHP, that rendered on distributions of over 100% of the raw EXP. Added concurrency protection on MapleMonster. Fixed an issue on venom skills that would let an "1 dmg" appear to the client alongside the DOT.
This commit is contained in:
ronancpl
2017-10-27 13:00:36 -02:00
parent 08658f406b
commit 5f1abf3fb3
35 changed files with 757 additions and 362 deletions

View File

@@ -63,7 +63,7 @@ public final class UseCashItemHandler extends AbstractMaplePacketHandler {
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
final MapleCharacter player = c.getPlayer();
if (System.currentTimeMillis() - player.getLastUsedCashItem() < 3000) {
player.dropMessage(1, "You have used a cash item recently. Wait a moment and try again.");
player.dropMessage(1, "You have used a cash item recently. Wait a moment, then try again.");
c.announce(MaplePacketCreator.enableActions());
return;
}
@@ -83,6 +83,11 @@ public final class UseCashItemHandler extends AbstractMaplePacketHandler {
return;
}
if (itemType == 505) { // AP/SP reset
if(!player.isAlive()) {
c.announce(MaplePacketCreator.enableActions());
return;
}
if (itemId > 5050000) {
int SPTo = slea.readInt();
int SPFrom = slea.readInt();
@@ -101,80 +106,76 @@ public final class UseCashItemHandler extends AbstractMaplePacketHandler {
switch (APFrom) {
case 64: // str
if (player.getStr() < 5) {
c.getPlayer().message("You don't have the minimum STR required to swap.");
c.announce(MaplePacketCreator.enableActions());
return;
}
player.addStat(1, -1);
break;
case 128: // dex
if (player.getDex() < 5) {
c.getPlayer().message("You don't have the minimum DEX required to swap.");
c.announce(MaplePacketCreator.enableActions());
return;
}
player.addStat(2, -1);
break;
case 256: // int
if (player.getInt() < 5) {
c.getPlayer().message("You don't have the minimum INT required to swap.");
c.announce(MaplePacketCreator.enableActions());
return;
}
player.addStat(3, -1);
break;
case 512: // luk
if (player.getLuk() < 5) {
c.getPlayer().message("You don't have the minimum LUK required to swap.");
c.announce(MaplePacketCreator.enableActions());
return;
}
player.addStat(4, -1);
break;
case 2048: // HP
if (APTo != 8192) {
c.announce(MaplePacketCreator.enableActions());
return;
c.getPlayer().message("You can only swap HP ability points to MP.");
c.announce(MaplePacketCreator.enableActions());
return;
}
int hplose = 0;
final int jobid = player.getJob().getId();
if (jobid == 0 || jobid == 1000 || jobid == 2000 || jobid >= 1200 && jobid <= 1211) { // Beginner
hplose -= 12;
} else if (jobid >= 100 && jobid <= 132) { // Warrior
Skill improvinghplose = SkillFactory.getSkill(1000001);
int improvinghploseLevel = c.getPlayer().getSkillLevel(improvinghplose);
hplose -= 24;
if (improvinghploseLevel >= 1) {
hplose -= improvinghplose.getEffect(improvinghploseLevel).getY();
}
} else if (jobid >= 200 && jobid <= 232) { // Magician
hplose -= 10;
} else if (jobid >= 500 && jobid <= 522) { // Pirate
Skill improvinghplose = SkillFactory.getSkill(5100000);
int improvinghploseLevel = c.getPlayer().getSkillLevel(improvinghplose);
hplose -= 22;
if (improvinghploseLevel > 0) {
hplose -= improvinghplose.getEffect(improvinghploseLevel).getY();
}
} else if (jobid >= 1100 && jobid <= 1111) { // Soul Master
Skill improvinghplose = SkillFactory.getSkill(11000000);
int improvinghploseLevel = c.getPlayer().getSkillLevel(improvinghplose);
hplose -= 27;
if (improvinghploseLevel >= 1) {
hplose -= improvinghplose.getEffect(improvinghploseLevel).getY();
}
} else if ((jobid >= 1300 && jobid <= 1311) || (jobid >= 1400 && jobid <= 1411)) { // Wind Breaker and Night Walker
hplose -= 17;
} else if (jobid >= 300 && jobid <= 322 || jobid >= 400 && jobid <= 422 || jobid >= 2000 && jobid <= 2112) { // Aran
hplose -= 20;
} else { // GameMaster
hplose -= 20;
int hp = player.getHp();
int level_ = player.getLevel();
boolean canWash_ = true;
if (hp < level_ * 14 + 148) {
canWash_ = false;
}
player.setHp(player.getHp() + hplose);
player.setMaxHp(player.getMaxHp() + hplose);
statupdate.add(new Pair<>(MapleStat.HP, player.getHp()));
statupdate.add(new Pair<>(MapleStat.MAXHP, player.getMaxHp()));
if (!canWash_) {
c.getPlayer().message("You don't have the minimum HP pool required to swap.");
c.announce(MaplePacketCreator.enableActions());
return;
}
int hplose = -DistributeAPHandler.calcHpChange(player, player.getJob(), true);
int nextHp = Math.max(1, player.getHp() + hplose), nextMaxHp = Math.max(50, player.getMaxHp() + hplose);
player.setHp(nextHp);
player.setMaxHp(nextMaxHp);
statupdate.add(new Pair<>(MapleStat.HP, nextHp));
statupdate.add(new Pair<>(MapleStat.MAXHP, nextMaxHp));
break;
case 8192: // MP
if (APTo != 2048) {
c.announce(MaplePacketCreator.enableActions());
return;
c.getPlayer().message("You can only swap MP ability points to HP.");
c.announce(MaplePacketCreator.enableActions());
return;
}
int mp = player.getMp();
int level = player.getLevel();
MapleJob job = player.getJob();
boolean canWash = true;
if (job.isA(MapleJob.SPEARMAN) && mp < 4 * level + 156) {
canWash = false;
@@ -185,30 +186,26 @@ public final class UseCashItemHandler extends AbstractMaplePacketHandler {
} else if (mp < level * 14 + 148) {
canWash = false;
}
if (canWash) {
int minmp = 0;
if (job.isA(MapleJob.WARRIOR) || job.isA(MapleJob.DAWNWARRIOR1) || job.isA(MapleJob.ARAN1)) {
minmp += 4;
} else if (job.isA(MapleJob.MAGICIAN) || job.isA(MapleJob.BLAZEWIZARD1)) {
minmp += 36;
} else if (job.isA(MapleJob.BOWMAN) || job.isA(MapleJob.WINDARCHER1) || job.isA(MapleJob.THIEF) || job.isA(MapleJob.NIGHTWALKER1)) {
minmp += 12;
} else if (job.isA(MapleJob.PIRATE) || job.isA(MapleJob.THUNDERBREAKER1)) {
minmp += 16;
} else {
minmp += 8;
}
player.setMp(player.getMp() - minmp);
player.setMaxMp(player.getMaxMp() - minmp);
statupdate.add(new Pair<>(MapleStat.MP, player.getMp()));
statupdate.add(new Pair<>(MapleStat.MAXMP, player.getMaxMp()));
break;
if (!canWash) {
c.getPlayer().message("You don't have the minimum MP pool required to swap.");
c.announce(MaplePacketCreator.enableActions());
return;
}
int mplose = -DistributeAPHandler.calcMpChange(player, job, true);
int nextMp = Math.max(0, player.getMp() + mplose), nextMaxMp = Math.max(5, player.getMaxMp() + mplose);
player.setHp(nextMp);
player.setMaxHp(nextMaxMp);
statupdate.add(new Pair<>(MapleStat.HP, nextMp));
statupdate.add(new Pair<>(MapleStat.MAXHP, nextMaxMp));
break;
default:
c.announce(MaplePacketCreator.updatePlayerStats(MaplePacketCreator.EMPTY_STATUPDATE, true, c.getPlayer()));
return;
}
DistributeAPHandler.addStat(c, APTo);
DistributeAPHandler.addStat(c, APTo, true);
c.announce(MaplePacketCreator.updatePlayerStats(statupdate, true, c.getPlayer()));
}
remove(c, itemId);