if (Config.DEBUG)
_log.fine("player has a pet already. ignore summon skill");
return;
}
L2SummonInstance summon;
L2NpcTemplate summonTemplate = NpcTable.getInstance().getTemplate(_npcId);
if (summonTemplate.type.equalsIgnoreCase("L2SiegeSummon"))
summon = new L2SiegeSummonInstance(IdFactory.getInstance().getNextId(), summonTemplate, activeChar, this);
else
summon = new L2SummonInstance(IdFactory.getInstance().getNextId(), summonTemplate, activeChar, this);
summon.setName(summonTemplate.name);
summon.setTitle(activeChar.getName());
summon.setExpPenalty(_expPenalty);
if (summon.getLevel() >= Experience.LEVEL.length)
{
summon.getStat().setExp(Experience.LEVEL[Experience.LEVEL.length - 1]);
_log.warning("Summon ("+summon.getName()+") NpcID: "+summon.getNpcId()+" has a level above 75. Please rectify.");
}
else
{
summon.getStat().setExp(Experience.LEVEL[(summon.getLevel() % Experience.LEVEL.length)]);
}
summon.setCurrentHp(summon.getMaxHp());
summon.setCurrentMp(summon.getMaxMp());
summon.setHeading(activeChar.getHeading());
summon.setRunning();
activeChar.setPet(summon);
L2World.getInstance().storeObject(summon);
summon.spawnMe(activeChar.getX()+50, activeChar.getY()+100, activeChar.getZ());
summon.setFollowStatus(true);
summon.setShowSummonAnimation(false); // addVisibleObject created the info packets with summon animation
// if someone comes into range now, the animation shouldnt show any more
activeChar.sendPacket(new PetInfo(summon));
}