mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-08 21:44:35 +02:00
Updated Map Server namespace. Moved all other data folders (www and sql) to data folder. Renamed boot name to Project Meteor.
This commit is contained in:
parent
18ef69f3d1
commit
91549bff7a
1823 changed files with 102704 additions and 901 deletions
55
Data/scripts/commands/BazaarTradeCommand.lua
Normal file
55
Data/scripts/commands/BazaarTradeCommand.lua
Normal file
|
@ -0,0 +1,55 @@
|
|||
--[[
|
||||
|
||||
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).
|
||||
|
||||
--]]
|
||||
|
||||
--TODO REFACTOR
|
||||
|
||||
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:SendGameMessage(player, worldMaster, 25111, 0x20);
|
||||
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
|
||||
player:SendGameMessage(player, worldMaster, 25111, 0x20);
|
||||
end
|
||||
else
|
||||
player:SendGameMessage(player, worldMaster, 40252, 0x20);
|
||||
end
|
||||
else --Else we are fufilling a sought out item (ExecuteBazaarSell)
|
||||
local rewardItem = bazaarActor: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
|
||||
player:SendGameMessage(player, worldMaster, 25111, 0x20);
|
||||
end
|
||||
else
|
||||
end
|
||||
end
|
||||
|
||||
player:EndEvent();
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue