- Joined
- Sep 29, 2008
- Messages
- 804
- Reaction score
- 219
When a player dies, they gain EXP.
Using SXMaple, why does this happen?
Using SXMaple, why does this happen?
PHP:
public void playerDead() {
if (this.getSubclass() == 2) {
int rand = Randomizer.nextInt(100);
if (rand >= 60) {
this.dropMessage(5, "You've cheated death!");
this.getStat().setHp(this.getStat().getMaxHp() / 2, this);
}
}
if (this.getHardcore() == 1) {
MapleInventory equipped = this.getInventory(MapleInventoryType.EQUIPPED);
List<Short> ids = new LinkedList<Short>();
for (Item item : equipped.list()) {
ids.add(item.getPosition());
}
for (short idf : ids) {
MapleInventoryManipulator.drop(this.getClient(), MapleInventoryType.EQUIPPED, idf, (short) 1);
}
World.Broadcast.broadcastMessage(MaplePacketCreator.serverNotice(6, 6, "[Hardcore]" + this.getName() + " has died in " + this.getMap().getMapName() + " Ch " + this.getClient().getChannel() + " - All of the equips the player wore were dropped in the map!"));
}
final MapleStatEffect statss = getStatForBuff(MapleBuffStat.SOUL_STONE);
if (statss != null) {
dropMessage(5, "You have been revived by Soul Stone.");
getStat().setHp(((getStat().getMaxHp() / 100) * statss.getX()), this);
setStance(0);
changeMap(getMap(), getMap().getPortal(0));
return;
}
if (getEventInstance() != null) {
getEventInstance().playerKilled(this);
}
cancelEffectFromBuffStat(MapleBuffStat.SHADOWPARTNER);
cancelEffectFromBuffStat(MapleBuffStat.MORPH);
cancelEffectFromBuffStat(MapleBuffStat.SOARING);
cancelEffectFromBuffStat(MapleBuffStat.MONSTER_RIDING);
cancelEffectFromBuffStat(MapleBuffStat.MECH_CHANGE);
cancelEffectFromBuffStat(MapleBuffStat.RECOVERY);
cancelEffectFromBuffStat(MapleBuffStat.HP_BOOST);
cancelEffectFromBuffStat(MapleBuffStat.MP_BOOST);
cancelEffectFromBuffStat(MapleBuffStat.ENHANCED_MAXHP);
cancelEffectFromBuffStat(MapleBuffStat.ENHANCED_MAXMP);
cancelEffectFromBuffStat(MapleBuffStat.MAXHP);
cancelEffectFromBuffStat(MapleBuffStat.MAXMP);
dispelSummons();
checkFollow();
dotHP = 0;
lastDOTTime = 0;
if (!GameConstants.isBeginnerJob(job) && !inPVP()) {
int charms = getItemQuantity(5130000, false);
if (charms > 0) {
MapleInventoryManipulator.removeById(client, MapleInventoryType.CASH, 5130000, 1, true, false);
charms--;
if (charms > 0xFF) {
charms = 0xFF;
}
client.getSession().write(MTSCSPacket.useCharm((byte) charms, (byte) 0));
} else {
float diepercentage = 0.0f;
int expforlevel = getNeededExp();
if (map.isTown() || FieldLimitType.RegularExpLoss.check(map.getFieldLimit())) {
diepercentage = 0.01f;
} else {
diepercentage = (float) (0.1f - ((traits.get(MapleTraitType.charisma).getLevel() / 20) / 100f));
}
int v10 = (int) (exp.get() - (long) ((double) expforlevel * diepercentage));
if (v10 < 0) {
v10 = 0;
}
exp.addAndGet(v10);
}
this.updateSingleStat(MapleStat.EXP, this.exp.get());
}
if (!stats.checkEquipDurabilitys(this, -100)) { //i guess this is how it works ?
dropMessage(5, "An item has run out of durability but has no inventory room to go to.");
} //lol
if (pyramidSubway != null) {
stats.setHp((short) 50, this);
pyramidSubway.fail(this);
}
}