mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-08 21:44:35 +02:00
Implemented trade invitation code.
This commit is contained in:
parent
9649d755a9
commit
c7e38b8b00
7 changed files with 306 additions and 7 deletions
20
data/scripts/commands/ConfirmTradeCommand.lua
Normal file
20
data/scripts/commands/ConfirmTradeCommand.lua
Normal 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
|
14
data/scripts/commands/TradeOfferCancelCommand.lua
Normal file
14
data/scripts/commands/TradeOfferCancelCommand.lua
Normal 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
|
26
data/scripts/commands/TradeOfferCommand.lua
Normal file
26
data/scripts/commands/TradeOfferCommand.lua
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue