handleRes(activeChar, null);
}
private void handleRes(L2Player activeChar, String player)
{
L2Object obj = activeChar.getTarget();
if(player != null)
{
L2Player plyr = L2World.getPlayer(player);
if(plyr != null)
{
obj = plyr;
}
else
{
try
{
int radius = Math.max(Integer.parseInt(player), 100);
for(L2Character character : activeChar.getAroundCharacters(radius, 200))
{
character.setCurrentHpMp(character.getMaxHp(), character.getMaxMp(), true);
character.setCurrentCp(character.getMaxCp());
if(character.isPlayer())
{
((L2Player) character).restoreExp();
}
// If the target is an NPC, then abort it's auto decay and respawn.
else
{
DecayTaskManager.getInstance().cancelDecayTask(character);
}
character.broadcastPacket(new SocialAction(character.getObjectId(), SocialAction.LEVEL_UP));
character.broadcastPacket(new Revive(character));
character.doRevive();
}
activeChar.sendMessage("Resurrected within " + radius + " unit radius.");
return;
}
catch(NumberFormatException e)
{
activeChar.sendMessage("Enter valid player name or radius");
return;
}
}
}
if(obj == null)
{
obj = activeChar;
}
if(obj.isCharacter())
{
L2Character target = (L2Character) obj;
if(!target.isDead())
{
return;