L2PcInstance activeChar = getClient().getActiveChar();
L2FolkInstance folk = activeChar.getTarget();
if (!activeChar.isGM()) // No GM
{
if (folk == null // No target (ie GM Shop)
|| !(folk instanceof L2MerchantInstance)) // Target not a merchant
return;
}
else if ((folk instanceof L2MerchantInstance) // Target is a merchant
&& activeChar.getDistance(folk.getX(), folk.getY()) > L2NpcInstance.INTERACTION_DISTANCE) // Distance is too far
return; // If talking to a merchant and too far