{
if (Config.ENABLE_ALL_EXCEPTIONS)
e.printStackTrace();
}
L2Character target = null;
for (L2Object target2 : targets)
{
target = (L2Character) target2;
// We should not heal if char is dead or invulnerable (celestial?)
if (target == null || target.isDead() || target.isInvul())
continue;
// We should not heal walls and door
if (target instanceof L2DoorInstance)
continue;
// We should not heal siege flags
if (target instanceof L2NpcInstance && ((L2NpcInstance) target).getNpcId() == 35062)
{
activeChar.getActingPlayer().sendMessage("You cannot heal siege flags!");
continue;
}
// Player holding a cursed weapon can't be healed and can't heal
if (target != activeChar)
{
if (target instanceof L2PcInstance && ((L2PcInstance) target).isCursedWeaponEquiped())
continue;
else if (player != null && player.isCursedWeaponEquiped())
continue;
}
double hp = skill.getPower();
if (skill.getSkillType() == SkillType.HEAL_PERCENT)
{
hp = target.getMaxHp() * hp / 100.0;
}
else
{
if (bss)
{
hp *= 1.5;
}
else if (sps)
{
hp *= 1.3;
}
}
if (skill.getSkillType() == SkillType.HEAL_STATIC)
hp = skill.getPower();
else if (skill.getSkillType() != SkillType.HEAL_PERCENT)
hp *= target.calcStat(Stats.HEAL_EFFECTIVNESS, 100, null, null) / 100;
target.setCurrentHp(hp + target.getCurrentHp());
target.setLastHealAmount((int) hp);
StatusUpdate su = new StatusUpdate(target.getObjectId());
su.addAttribute(StatusUpdate.CUR_HP, (int) target.getCurrentHp());
target.sendPacket(su);
su = null;
if (target instanceof L2PcInstance)
{
if (skill.getId() == 4051)
{
SystemMessage sm = new SystemMessage(SystemMessageId.REJUVENATING_HP);
target.sendPacket(sm);
sm = null;
}
else
{
if (activeChar instanceof L2PcInstance && activeChar != target)
{
SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_RESTORED_BY_S1);
sm.addString(activeChar.getName());
sm.addNumber((int) hp);
target.sendPacket(sm);
sm = null;
}
else
{
SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_RESTORED);
sm.addNumber((int) hp);
target.sendPacket(sm);
sm = null;
}
}
}
target = null;