local targetAids = {
1000,
1001,
1002
}
local ec = EventCallback
function ec.onTradeRequest(player, target, item)
if item:getActionId() > 0 and isInArray(targetAids, item:getActionId()) then
player:sendCancelMessage("Your item cannot be traded.")
return false
end
if item:isContainer() then
local containerItems = item:getItems(true)
for _, subItem in pairs(containerItems) do -- # we want to avoid linear search
if subItem:getActionId() > 0 and isInArray(targetAids, subItem:getActionId()) then
player:sendCancelMessage("Your container contains items that cannot be traded.")
return false
end
end
end...