Added the skeletons of the rest of the item commands.

This commit is contained in:
Filip Maj 2017-10-21 13:01:14 -04:00
parent fe4b9cb2bf
commit 2a489953db
5 changed files with 157 additions and 0 deletions

View File

@ -0,0 +1,23 @@
--[[
BazaarDealCommand Script
Handles various bazaar transfer options
All bazaar args have a Reward (The item the person who fufills the request gets) and a Seek (The item the player wants, either gil or an item).
--]]
function onEventStarted(player, actor, triggerName, rewardItem, seekItem, bazaarMode, arg1, bazaarActor, rewardAmount, seekAmount, arg2, arg3, type9ItemIds)
--Get reward reference or itemId
--Get seek reference or itemid
--Tell worldmaster to add bazaar entry with reward, seek, rewardAmount, seekAmount, and bazaarMode
--Remove reward items from inventory
player:EndEvent();
end

View File

@ -0,0 +1,13 @@
--[[
BazaarUndealCommand Script
Handles canceling bazaar items
--]]
function onEventStarted(player, actor, triggerName, rewardItem, arg1, bazaarType, arg2, bazaarActor, rewardAmount, seekAmount, arg3, arg4, type9ItemIds)
player:EndEvent();
end

View File

@ -0,0 +1,13 @@
--[[
ItemMovePackageCommand Script
Handles moving items across item packages (IE: Taking loot)
--]]
function onEventStarted(player, actor, triggerName, itemReference, targetPackage, sourcePackage, arg1, arg2, unknown, arg3, arg4, arg5, type9ItemIds)
player:EndEvent();
end

View File

@ -0,0 +1,13 @@
--[[
ItemTransferCommand Script
Handles giving an item to another party member.
--]]
function onEventStarted(player, actor, triggerName, itemReference, targetPackage, sourcePackage, arg1, targetPlayer, arg2, arg3, arg4, arg5, type9ItemIds)
player:EndEvent();
end

View File

@ -0,0 +1,95 @@
--[[
TradeExecuteCommand Script
Handles all trading between players
Functions:
processTradeCommandOpenTray() - Opens the trade widget.
processTradeCommandCloseTray() - Closes the trade widget.
processTradeCommandReply(command, params) - Operates the trade widget.
processUpdateTradeCommandTrayData() - ?
Commands:
set: TradeWidget resets "Set Mode" (turned on once item selected while waiting for reply).
back: TradeWidget resets "Choose Mode" (turned on when ui operation is done).
fix: You have accepted the deal.
targetfix: Target has accepted the deal.
doedit: You have canceled your accept.
reedit: Target has canceled their accept.
--]]
require ("global")
function onEventStarted(player, actor, triggerName)
callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processTradeCommandOpenTray");
tradeOffering = player:GetTradeOfferings();
while (true) do
widgetOpen, chosenOperation, tradeSlot, type7, quantity, packageId, quality = callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processUpdateTradeCommandTrayData");
--Abort script if client script dead
if (widgetOpen == false or widgetOpen == nil) then
break;
end
--Handle you/target canceling/finishing the trade
if (not player:IsTrading() or not player:GetOtherTrader():IsTrading()) then
break;
end
--Handle target accepting
if (player:GetOtherTrader():IsTradeAccepted() == true) then
callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processTradeCommandReply", "targetfix");
else
callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processTradeCommandReply", "reedit");
end
--Check if both accepted the trade
if (player:IsTradeAccepted() and player:GetOtherTrader():IsTradeAccepted()) then
callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processTradeCommandCloseTray");
GetWorldManager():SwapTradedItems(player, player:GetOtherTrader());
break;
end
--Clear Item
if (chosenOperation == 1) then
player:RemoveTradeItem(tradeSlot - 1);
callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processTradeCommandReply", "set");
--Clear All
elseif (chosenOperation == 2) then
player:ClearTradeItems(1);
callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processTradeCommandReply", "set");
--Item Chosen
elseif (chosenOperation == 3) then
player:AddTradeItem(tradeSlot - 1, type7.slot, quantity);
callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processTradeCommandReply", "set", 2, 2, 2, 2);
--Gil Chosen
elseif (chosenOperation == 4) then
player:AddTradeGil(quantity);
callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processTradeCommandReply", "set");
--Cancel
elseif (chosenOperation == 11) then
player:FinishTradeTransaction();
break;
--OK
elseif (chosenOperation == 12) then
callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processTradeCommandReply", "fix");
player:AcceptTrade(true);
--Reedit
elseif (chosenOperation == 13) then
callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processTradeCommandReply", "doedit");
player:AcceptTrade(false);
end
wait(1);
end
player:EndEvent();
end