@Override 56 public void onAction(L2PcInstance player) 57 { 58 if (!canTarget(player)) return; 59 60 player.setLastFolkNPC(this); 61 62 // Check if the L2PcInstance already target the L2NpcInstance 63 if (this != player.getTarget()) 64 { 65 // Set the target of the L2PcInstance player 66 player.setTarget(this); 67 68 // Send a Server->Client packet MyTargetSelected to the L2PcInstance player 69 MyTargetSelected my = new MyTargetSelected(getObjectId(), 0); 70 player.sendPacket(my); 71 72 // Send a Server->Client packet ValidateLocation to correct the L2NpcInstance position and heading on the client 73 player.sendPacket(new ValidateLocation(this)); 74 } 75 else 76 { 77 // Calculate the distance between the L2PcInstance and the L2NpcInstance 78 if (!canInteract(player)) 79 { 80 // Notify the L2PcInstance AI with AI_INTENTION_INTERACT 81 player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this); 82 } 83 else 84 { 85 showMessageWindow(player); 86 } 87 } 88 // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet 89 player.sendPacket(new ActionFailed()); 90 }