final Map<Player, Damage> dmgs = getDamages();
final int exp = DataConversions
.roundUp(Formulae.combatExperience(npc) / 4D);
int newXP = 0;
for (final Player p : dmgs.keySet()) {
Damage dmg = dmgs.get(p);
int total = dmg.getTotalDamage();
if (total > npc.getDef().hits) {
total = npc.getDef().hits;
}
if (p != null) {
newXP = (exp * total) / npc.getDef().hits;
p.incExp(4, roundAndCast(newXP * 4 * dmg.getRangePortion()),
true);
p.getActionSender().sendStat(4);
switch (p.getCombatStyle()) {
case 0:
for (int x = 0; x < 3; x++) {
p.incExp(x,
roundAndCast(newXP * dmg.getCombatPortion()),
true);
p.getActionSender().sendStat(x);
}
break;
case 1:
p.incExp(2,
roundAndCast(newXP * 3 * dmg.getCombatPortion()),
true);
p.getActionSender().sendStat(2);
break;
case 2:
p.incExp(0,
roundAndCast(newXP * 3 * dmg.getCombatPortion()),
true);
p.getActionSender().sendStat(0);
break;
case 3:
p.incExp(1,
roundAndCast(newXP * 3 * dmg.getCombatPortion()),
true);
p.getActionSender().sendStat(1);
break;
}
p.incExp(3, roundAndCast(newXP * dmg.getCombatPortion()), true);
p.getActionSender().sendStat(3);
}
}
}