function Vtable510(ent, commandstruct)
if commandstruct.type == 19 then
local amt = math.floor(commandstruct.param / 8)
logger:log(ent:GetName() .. " is exchanging item " .. commandstruct.entity2:GetName() .. " (x" .. tostring(amt) .. ") to " .. commandstruct.entity1:GetName())
if ent:GetAP() < 3 then
world:CombatLog(COMBATLOG_FEW, "Not enough AP to exchange.")
return
end
ent:AdjustAP(-3)
end
ent:CallOrigVtable(510, commandstruct)
end
function OnStart()
hookexecutor:InstallVtableHook("Actor",510,Vtable510)
end