// player.startAttack(this);
}
else
{
// Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
player.sendPacket(new ActionFailed());
}
}
else if(!isAutoAttackable(player))
{
// Calculate the distance between the L2PcInstance and the L2NpcInstance
if (!canInteract(player))
{
// Notify the L2PcInstance AI with AI_INTENTION_INTERACT
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
}
else
{
// Send a Server->Client packet SocialAction to the all L2PcInstance on the _knownPlayer of the L2NpcInstance
// to display a social action of the L2NpcInstance on their client
SocialAction sa = new SocialAction(getObjectId(), Rnd.get(8));
broadcastPacket(sa);
// Open a chat window on client with the text of the L2NpcInstance
if(isEventMob){ L2Event.showEventHtml(player, String.valueOf(getObjectId())); }
else
{
Quest[] qlst = getTemplate().getEventQuests(Quest.QuestEventType.NPC_FIRST_TALK);
if ( (qlst != null) && qlst.length == 1)
qlst[0].notifyFirstTalk(this, player);
else
showChatWindow(player, 0);
}
}
}
else
player.sendPacket(new ActionFailed());
}
}