mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-09 05:54:50 +02:00
Added bazaar scripts and missing class file.
This commit is contained in:
parent
c0312079ef
commit
0cb2fe1a68
7 changed files with 169 additions and 5 deletions
51
data/scripts/commands/BazaarTradeCommand.lua
Normal file
51
data/scripts/commands/BazaarTradeCommand.lua
Normal file
|
@ -0,0 +1,51 @@
|
|||
--[[
|
||||
|
||||
BazaarTradeCommand Script
|
||||
|
||||
Handles bazaar trade
|
||||
|
||||
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, seekItemOrCost, seekAmount, arg1, bazaarActorId, rewardAmount, rewardItemId, nameIndex, arg2, type9ItemIds)
|
||||
|
||||
local originalReward = nil;
|
||||
local originalSeek = nil;
|
||||
local bazaarActor = nil;
|
||||
|
||||
--Get the bazaar actor
|
||||
if (bazaarActorId ~= nil) then
|
||||
bazaarActor = player:GetZone():FindActorInArea(bazaarActorId);
|
||||
end
|
||||
|
||||
--Abort if no actor
|
||||
if (bazaarActor == nil) then
|
||||
player:EndEvent();
|
||||
return;
|
||||
end
|
||||
|
||||
--If seekItem is a number, we are buying an item (ExecuteBazaarBuy)
|
||||
if (type(seekItemOrCost) == "number") then
|
||||
if (player:GetCurrentGil() >= seekItemOrCost) then
|
||||
if (GetWorldManager():BazaarBuyOperation(bazaarActor, player, bazaarActor:GetItem(rewardItem), rewardAmount, seekItemOrCost)) then
|
||||
else
|
||||
end
|
||||
else
|
||||
--Show no gil error
|
||||
end
|
||||
else --Else we are fufilling a sought out item (ExecuteBazaarSell)
|
||||
local rewardItem = player:GetItem(rewardItem);
|
||||
local seekItem = player:GetItem(seekItemOrCost);
|
||||
|
||||
if (rewardItem ~= nil and seekItem ~= nil) then
|
||||
if (GetWorldManager():BazaarSellOperation(bazaarActor, player, rewardItem, rewardAmount, seekItem, seekAmount)) then
|
||||
else
|
||||
end
|
||||
else
|
||||
end
|
||||
end
|
||||
|
||||
player:EndEvent();
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue