mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-20 11:47:48 +00:00
Added the skeletons of the rest of the item commands.
This commit is contained in:
parent
fe4b9cb2bf
commit
2a489953db
5 changed files with 157 additions and 0 deletions
23
data/scripts/commands/BazaarDealCommand.lua
Normal file
23
data/scripts/commands/BazaarDealCommand.lua
Normal 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
|
13
data/scripts/commands/BazaarUndealCommand.lua
Normal file
13
data/scripts/commands/BazaarUndealCommand.lua
Normal 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
|
13
data/scripts/commands/ItemMovePackageCommand.lua
Normal file
13
data/scripts/commands/ItemMovePackageCommand.lua
Normal 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
|
13
data/scripts/commands/ItemTransferCommand.lua
Normal file
13
data/scripts/commands/ItemTransferCommand.lua
Normal 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
|
95
data/scripts/commands/TradeExecuteCommand.lua
Normal file
95
data/scripts/commands/TradeExecuteCommand.lua
Normal 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
|
Loading…
Add table
Reference in a new issue