Implemented trade invitation code.

This commit is contained in:
Filip Maj 2017-09-17 15:04:29 -04:00
parent 9649d755a9
commit c7e38b8b00
7 changed files with 306 additions and 7 deletions

View file

@ -0,0 +1,20 @@
--[[
ConfirmTradeCommand Script
Handles what happens when you accept/refuse a trade
--]]
function onEventStarted(player, actor, triggerName, groupType, result)
--Accept
if (result == 1) then
GetWorldManager():AcceptTrade(player);
--Refuse
elseif (result == 2) then
GetWorldManager():RefuseTrade(player);
end
player:EndEvent();
end

View file

@ -0,0 +1,14 @@
--[[
TradeOfferCommand Script
Handles what happens a player cancels a trade
--]]
function onEventStarted(player, actor, triggerName, commandId, result)
GetWorldManager():CancelTrade(player);
player:EndEvent();
end

View file

@ -0,0 +1,26 @@
--[[
TradeOfferCommand Script
Handles what happens when you invite to trade
--]]
function onEventStarted(player, actor, triggerName, name, arg1, arg2, arg3, actorId)
local otherActor = nil;
if (name ~= nil) then
otherActor = player:GetZone():FindPCInZone(name);
elseif (actorId ~= nil) then
otherActor = player:GetZone():FindActorInArea(actorId);
end
if (otherActor ~= nil) then
GetWorldManager():CreateTradeGroup(player, otherActor);
else
end
player:EndEvent();
end