/**
* Вызывается у гейткиперов
*/
public void reciveGift()
{
L2Player player = (L2Player) getSelf();
L2NpcInstance npc = getNpc();
if(player == null || npc == null || !L2NpcInstance.canBypassCheck(player, player.getLastNpc()))
{
return;
}
if(!isBirthdayToday(player))
{
show(Files.read(msgNotToday, player), player, npc);
return;
}
if(isGiftRecivedToday(player))
{
show(Files.read(msgAlreadyRecived, player), player, npc);
return;
}
for(L2NpcInstance n : L2World.getAroundNpc(npc))
{
if(n.getNpcId() == NPC_ALEGRIA)
{
show(Files.read(msgSpawned, player), player, npc);
return;
}
}
player.sendPacket(new PlaySound(1, "HB01", 0, 0, new Location()));
try
{
Location loc = GeoEngine.findPointToStay(npc.getX(), npc.getY(), npc.getZ(), 40, 60, npc.getReflection().getGeoIndex());
loc.setH(Util.getHeadingTo(loc, player.getLoc()));
L2Spawn spawn = new L2Spawn(NpcTable.getTemplate(NPC_ALEGRIA));
spawn.setLoc(loc);
spawn.doSpawn(true);
ThreadPoolManager.getInstance().scheduleAi(new DeSpawnScheduleTimerTask(spawn), 180000, false);
}