L2PcInstance activeChar = getClient().getActiveChar();
L2FolkInstance folk = activeChar.getLastFolkNPC();
if ((folk instanceof L2MerchantInstance) && activeChar.getDistance(folk.getX(), folk.getY()) > L2NpcInstance.INTERACTION_DISTANCE)
return; // If talking to a merchant and too far
else if (!(folk instanceof L2MerchantInstance) && !activeChar.isGM())
return; // If not talking to a merchant and not a gm (gm shop)
L2MerchantInstance merchant = null;
// prevent cast exception and allow GMs use gmshop
if (folk instanceof L2MerchantInstance)
merchant = (L2MerchantInstance)folk;
if (_listId > 1000000) // lease