mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-08 21:44:35 +02:00
Merge branch 'develop' of https://bitbucket.org/Ioncannon/ffxiv-classic-server into develop
Fix Excruciate removign status from enemy rather than caster
This commit is contained in:
commit
f2e34174c4
272 changed files with 8223 additions and 2425 deletions
29
data/scripts/commands/BazaarCheckCommand.lua
Normal file
29
data/scripts/commands/BazaarCheckCommand.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
--[[
|
||||
|
||||
BazaarCheckCommand Script
|
||||
|
||||
Handles what happens when you examine a player's bazaar
|
||||
|
||||
--]]
|
||||
|
||||
require ("global")
|
||||
|
||||
function onEventStarted(player, actor, triggerName, name, arg1, arg2, arg3, bazaarActorId)
|
||||
|
||||
local bazaarActor = nil;
|
||||
|
||||
if (name ~= nil) then
|
||||
bazaarActor = player:GetZone():FindPCInZone(name);
|
||||
elseif (bazaarActorId ~= nil) then
|
||||
bazaarActor = player:GetZone():FindActorInArea(bazaarActorId);
|
||||
end
|
||||
|
||||
if (bazaarActor ~= nil) then
|
||||
callClientFunction(player, "delegateCommand", GetStaticActor("BazaarCheckCommand"), "processChackBazaar");
|
||||
else
|
||||
--Show error
|
||||
end
|
||||
|
||||
player:EndEvent();
|
||||
|
||||
end
|
71
data/scripts/commands/BazaarDealCommand.lua
Normal file
71
data/scripts/commands/BazaarDealCommand.lua
Normal file
|
@ -0,0 +1,71 @@
|
|||
--[[
|
||||
|
||||
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)
|
||||
|
||||
local originalReward = nil;
|
||||
local originalSeek = nil;
|
||||
|
||||
--Handle special case for offers
|
||||
if (seekItem == nil) then
|
||||
originalSeek = player:GetItemPackage(0):GetItemAtSlot(rewardItem.seekSlot);
|
||||
originalReward = player:GetItemPackage(0):GetItemAtSlot(rewardItem.offerSlot);
|
||||
end
|
||||
|
||||
--Handle Reward
|
||||
if (type(rewardItem) == "number") then
|
||||
rewardItem = GetWorldManager():CreateItem(rewardItem, rewardAmount);
|
||||
player:RemoveItem(1000001, rewardAmount);
|
||||
elseif (seekItem == nil) then
|
||||
rewardItem = originalReward;
|
||||
if (bazaarMode ~= 11) then
|
||||
rewardItem = GetWorldManager():CreateItem(rewardItem.itemId, rewardAmount, rewardItem.quality, rewardItem.modifiers);
|
||||
end
|
||||
else
|
||||
rewardItem = player:GetItem(rewardItem);
|
||||
originalReward = rewardItem;
|
||||
if (bazaarMode ~= 11) then
|
||||
rewardItem = GetWorldManager():CreateItem(rewardItem.itemId, rewardAmount, rewardItem.quality, rewardItem.modifiers);
|
||||
end
|
||||
end
|
||||
|
||||
--Handle Seek
|
||||
if (type(seekItem) == "number") then
|
||||
seekItem = GetWorldManager():CreateItem(seekItem, seekAmount);
|
||||
elseif (seekItem == nil) then
|
||||
seekItem = originalSeek;
|
||||
if (bazaarMode ~= 11) then
|
||||
seekItem = GetWorldManager():CreateItem(seekItem.itemId, seekAmount, seekItem.quality, seekItem.modifiers);
|
||||
end
|
||||
else
|
||||
seekItem = player:GetItem(seekItem);
|
||||
originalSeek = seekItem;
|
||||
if (bazaarMode ~= 11) then
|
||||
seekItem = GetWorldManager():CreateItem(seekItem.itemId, seekAmount, seekItem.quality, seekItem.modifiers);
|
||||
end
|
||||
end
|
||||
|
||||
--If not selling, remove the seek item
|
||||
if (bazaarMode ~= 11 and bazaarMode ~= 12 and bazaarMode ~= 13) then
|
||||
if (originalSeek ~= nil) then
|
||||
player:RemoveItem(originalSeek, seekAmount);
|
||||
end
|
||||
end
|
||||
|
||||
--Remove the reward item
|
||||
if (originalReward ~= nil) then
|
||||
player:RemoveItem(originalReward, rewardAmount);
|
||||
end
|
||||
|
||||
GetWorldManager():AddToBazaar(player, rewardItem, seekItem, rewardAmount, seekAmount, bazaarMode);
|
||||
|
||||
player:EndEvent();
|
||||
|
||||
end
|
53
data/scripts/commands/BazaarTradeCommand.lua
Normal file
53
data/scripts/commands/BazaarTradeCommand.lua
Normal file
|
@ -0,0 +1,53 @@
|
|||
--[[
|
||||
|
||||
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: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
|
22
data/scripts/commands/BazaarUndealCommand.lua
Normal file
22
data/scripts/commands/BazaarUndealCommand.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
--[[
|
||||
|
||||
BazaarUndealCommand Script
|
||||
|
||||
Handles canceling bazaar items
|
||||
|
||||
25107 - Your bazaar is either full or already contains that unique item.
|
||||
25111 - Unable to complete transaction.
|
||||
25112 - You are unable to remove the item from your bazaar. You cannot hold any more items.
|
||||
25113 - Offered and sought items cannot be identical.
|
||||
25114 - Items in less than mint condition cannot be offered.
|
||||
25115 - Items in less than mint condition cannot be placed in your bazaar.
|
||||
|
||||
--]]
|
||||
|
||||
function onEventStarted(player, actor, triggerName, rewardItem, arg1, bazaarType, arg2, bazaarActor, rewardAmount, seekAmount, arg3, arg4, type9ItemIds)
|
||||
|
||||
GetWorldManager():RemoveFromBazaar(player, player:GetItem(rewardItem));
|
||||
|
||||
player:EndEvent();
|
||||
|
||||
end
|
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
|
|
@ -6,7 +6,7 @@ Notes:
|
|||
|
||||
Gearset activating could be optimized a bit more by doing the item packets in one go.
|
||||
|
||||
The param "invActionInfo" has the vars: actorId, unknown, slot, and inventoryType.
|
||||
The param "equippedItem" has the vars: actorId, unknown, slot, and inventoryType.
|
||||
The param "itemDBIds" has the vars: item1 and item2.
|
||||
|
||||
--]]
|
||||
|
@ -53,12 +53,12 @@ GRAPHICSLOT_L_RINGFINGER = 24;
|
|||
GRAPHICSLOT_R_INDEXFINGER = 25;
|
||||
GRAPHICSLOT_L_INDEXFINGER = 26;
|
||||
|
||||
function onEventStarted(player, actor, triggerName, invActionInfo, param1, param2, param3, param4, param5, param6, param7, equipSlot, itemDBIds)
|
||||
function onEventStarted(player, actor, triggerName, equippedItem, param1, param2, param3, param4, param5, param6, param7, equipSlot, itemDBIds)
|
||||
equipSlot = equipSlot-1;
|
||||
|
||||
--Equip Item
|
||||
if (invActionInfo ~= nil) then
|
||||
item = player:GetInventory(0):GetItemAtSlot(invActionInfo.slot);
|
||||
if (equippedItem ~= nil) then
|
||||
item = player:GetItemPackage(equippedItem.itemPackage):GetItemAtSlot(equippedItem.slot);
|
||||
equipItem(player, equipSlot, item);
|
||||
player:SendAppearance();
|
||||
--Unequip Item
|
||||
|
@ -69,6 +69,8 @@ function onEventStarted(player, actor, triggerName, invActionInfo, param1, param
|
|||
end
|
||||
end
|
||||
|
||||
player.CalculateBaseStats(); --player.RecalculateStats();
|
||||
|
||||
player:EndEvent();
|
||||
end
|
||||
|
||||
|
@ -83,7 +85,7 @@ function loadGearset(player, classId)
|
|||
for slot = 0, 34 do
|
||||
|
||||
if (slot ~= EQUIPSLOT_MAINHAND and slot ~= EQUIPSLOT_UNDERSHIRT and slot ~= EQUIPSLOT_UNDERGARMENT) then
|
||||
itemAtSlot = player:GetEquipment():GetItemAtSlot(slot);
|
||||
itemAtSlot = slot;
|
||||
itemAtGearsetSlot = gearset[slot];
|
||||
|
||||
if (itemAtSlot ~= nil or itemAtGearsetSlot ~= nil) then
|
||||
|
@ -98,10 +100,8 @@ function loadGearset(player, classId)
|
|||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
player:GetEquipment():ToggleDBWrite(true);
|
||||
|
||||
end
|
||||
player:GetEquipment():ToggleDBWrite(true);
|
||||
end
|
||||
|
||||
function equipItem(player, equipSlot, item)
|
||||
|
@ -151,7 +151,7 @@ function equipItem(player, equipSlot, item)
|
|||
player:DoClassChange(classId);
|
||||
end
|
||||
|
||||
player:GetEquipment():Equip(equipSlot, item);
|
||||
player:GetEquipment():Set(equipSlot, item);
|
||||
|
||||
if (equipSlot == EQUIPSLOT_MAINHAND and gItem:IsNailWeapon() == false) then graphicSlot = GRAPHICSLOT_MAINHAND;
|
||||
elseif (equipSlot == EQUIPSLOT_OFFHAND) then graphicSlot = GRAPHICSLOT_OFFHAND;
|
||||
|
@ -163,19 +163,23 @@ function equipItem(player, equipSlot, item)
|
|||
elseif (equipSlot == EQUIPSLOT_HANDS) then graphicSlot = GRAPHICSLOT_HANDS;
|
||||
elseif (equipSlot == EQUIPSLOT_FEET) then graphicSlot = GRAPHICSLOT_FEET;
|
||||
elseif (equipSlot == EQUIPSLOT_WAIST) then graphicSlot = GRAPHICSLOT_WAIST;
|
||||
elseif (equipSlot == EQUIPSLOT_RFINGER) then graphicSlot = GRAPHICSLOT_RFINGER;
|
||||
elseif (equipSlot == EQUIPSLOT_LFINGER) then graphicSlot = GRAPHICSLOT_LFINGER;
|
||||
elseif (equipSlot == EQUIPSLOT_NECK) then graphicSlot = GRAPHICSLOT_NECK;
|
||||
elseif (equipSlot == EQUIPSLOT_RFINGER) then graphicSlot = GRAPHICSLOT_R_RINGFINGER;
|
||||
elseif (equipSlot == EQUIPSLOT_LFINGER) then graphicSlot = GRAPHICSLOT_L_RINGFINGER;
|
||||
end
|
||||
|
||||
|
||||
--Graphic Slot was set, otherwise it's a special case
|
||||
if (graphicSlot ~= nil) then
|
||||
player:GraphicChange(graphicSlot, item);
|
||||
elseif (gItem:IsNailWeapon()) then
|
||||
player:GraphicChange(GRAPHICSLOT_MAINHAND, item);
|
||||
player:GraphicChange(GRAPHICSLOT_OFFHAND, item);
|
||||
player:GraphicChange(GRAPHICSLOT_OFFHAND, item);
|
||||
elseif (equipSlot == EQUIPSLOT_EARS) then
|
||||
player:GraphicChange(GRAPHICSLOT_R_EAR, item);
|
||||
player:GraphicChange(GRAPHICSLOT_L_EAR, item);
|
||||
elseif (equipSlot == EQUIPSLOT_WRIST) then
|
||||
player:GraphicChange(GRAPHICSLOT_R_WRIST, item);
|
||||
player:GraphicChange(GRAPHICSLOT_L_WRIST, item);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -187,7 +191,7 @@ function unequipItem(player, equipSlot, item)
|
|||
player:SendGameMessage(player, worldMaster, 30730, 0x20, equipSlot+1, item.itemId, item.quality, 0, 0, 1); --Unable to unequip
|
||||
elseif (item ~= nil) then
|
||||
player:SendGameMessage(player, worldMaster, 30602, 0x20, equipSlot+1, item.itemId, item.quality, 0, 0, 1); --Item Removed
|
||||
player:GetEquipment():Unequip(equipSlot);
|
||||
player:GetEquipment():Clear(equipSlot);
|
||||
|
||||
if (equipSlot == EQUIPSLOT_BODY) then --Show Undershirt
|
||||
item = player:GetEquipment():GetItemAtSlot(EQUIPSLOT_UNDERSHIRT);
|
||||
|
@ -204,9 +208,11 @@ function unequipItem(player, equipSlot, item)
|
|||
elseif (equipSlot == EQUIPSLOT_PACK) then player:GraphicChange(GRAPHICSLOT_PACK, nil);
|
||||
elseif (equipSlot == EQUIPSLOT_HEAD) then player:GraphicChange(GRAPHICSLOT_HEAD, nil);
|
||||
elseif (equipSlot == EQUIPSLOT_WAIST) then player:GraphicChange(GRAPHICSLOT_WAIST, nil);
|
||||
elseif (equipSlot == EQUIPSLOT_NECK) then player:GraphicChange(GRAPHICSLOT_NECK, nil);
|
||||
elseif (equipSlot == EQUIPSLOT_EARS) then player:GraphicChange(GRAPHICSLOT_L_EAR, nil); player:GraphicChange(GRAPHICSLOT_R_EAR, nil);
|
||||
elseif (equipSlot == EQUIPSLOT_RFINGER) then player:GraphicChange(GRAPHICSLOT_RFINGER, nil);
|
||||
elseif (equipSlot == EQUIPSLOT_LFINGER) then player:GraphicChange(GRAPHICSLOT_LFINGER, nil);
|
||||
elseif (equipSlot == EQUIPSLOT_WRIST) then player:GraphicChange(GRAPHICSLOT_L_WRIST, nil); player:GraphicChange(GRAPHICSLOT_R_WRIST, nil);
|
||||
elseif (equipSlot == EQUIPSLOT_RFINGER) then player:GraphicChange(GRAPHICSLOT_R_RINGFINGER, nil);
|
||||
elseif (equipSlot == EQUIPSLOT_LFINGER) then player:GraphicChange(GRAPHICSLOT_L_RINGFINGER, nil);
|
||||
end
|
||||
end
|
||||
return true;
|
||||
|
|
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
|
|
@ -9,7 +9,7 @@ The param "itemDBIds" has the vars: item1 and item2.
|
|||
|
||||
--]]
|
||||
|
||||
function onEventStarted(player, actor, triggerName, invActionInfo, param1, param2, param3, param4, param5, param6, param7, param8, itemDBIds)
|
||||
player:GetInventory(0x00):RemoveItemAtSlot(invActionInfo.slot);
|
||||
function onEventStarted(player, actor, triggerName, itemReference, targetPackage, sourcePackage, arg1, arg2, unknown, arg3, arg4, arg5, type9ItemIds)
|
||||
player:GetItemPackage(itemReference.itemPackage):RemoveItemAtSlot(itemReference.slot);
|
||||
player:EndEvent();
|
||||
end
|
||||
|
|
97
data/scripts/commands/TradeExecuteCommand.lua
Normal file
97
data/scripts/commands/TradeExecuteCommand.lua
Normal file
|
@ -0,0 +1,97 @@
|
|||
--[[
|
||||
|
||||
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, itemActor, quantity, itemPackageId, itemSlot = callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processUpdateTradeCommandTrayData");
|
||||
|
||||
--Abort script if client script dead
|
||||
if (widgetOpen == false or widgetOpen == nil) then
|
||||
player:FinishTradeTransaction();
|
||||
break;
|
||||
end
|
||||
|
||||
--Handle you/target canceling/finishing the trade
|
||||
if (not player:IsTrading() or not player:GetOtherTrader():IsTrading()) then
|
||||
player:FinishTradeTransaction();
|
||||
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():CompleteTrade(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();
|
||||
callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processTradeCommandReply", "set");
|
||||
--Item Chosen
|
||||
elseif (chosenOperation == 3) then
|
||||
player:AddTradeItem(tradeSlot - 1, itemActor, quantity);
|
||||
callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processTradeCommandReply", "set", 2, 2, 2, 2);
|
||||
--Gil Chosen
|
||||
elseif (chosenOperation == 4) then
|
||||
player:AddTradeItem(tradeSlot - 1, itemActor, 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
|
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
|
|
@ -26,7 +26,7 @@ function onTrigger(player, argc, currency, qty, name, lastName)
|
|||
currency = tonumber(currency) or nil;
|
||||
qty = tonumber(qty) or 1;
|
||||
|
||||
local removed = player:GetInventory(INVENTORY_CURRENCY):RemoveItem(currency, qty);
|
||||
local removed = player:GetItemPackage(INVENTORY_CURRENCY):RemoveItem(currency, qty);
|
||||
local messageID = MESSAGE_TYPE_SYSTEM_ERROR;
|
||||
local message = "Attempting to remove currency" -- "unable to remove currency";
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ function onTrigger(player, argc, item, qty, location, name, lastName)
|
|||
location = INVENTORY_NORMAL;
|
||||
end;
|
||||
|
||||
local removed = player:GetInventory(location):RemoveItem(item, qty);
|
||||
local removed = player:GetItemPackage(location):RemoveItem(item, qty);
|
||||
|
||||
if removed then -- RemoveItem() currently returns nothing for verification, this statement can't work
|
||||
message = string.format("Removed item %u of kind %u to %s", item, location, player:GetName());
|
||||
|
|
|
@ -27,7 +27,7 @@ function onTrigger(player, argc, keyitem, qty, name, lastName)
|
|||
qty = tonumber(qty) or 1;
|
||||
local location = INVENTORY_KEYITEMS;
|
||||
|
||||
local removed = player:GetInventory(location):RemoveItem(keyitem, qty);
|
||||
local removed = player:GetItemPackage(location):RemoveItem(keyitem, qty);
|
||||
local messageID = MESSAGE_TYPE_SYSTEM_ERROR;
|
||||
local message = "Attempting to remove keyitem" -- "unable to remove keyitem";
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ function onTrigger(player, argc, qty, name, lastName)
|
|||
qty = tonumber(qty) or 1;
|
||||
location = INVENTORY_CURRENCY;
|
||||
|
||||
local added = player:GetInventory(location):AddItem(currency, qty, 1);
|
||||
local added = player:GetItemPackage(location):AddItem(currency, qty, 1);
|
||||
local messageID = MESSAGE_TYPE_SYSTEM_ERROR;
|
||||
local message = "unable to add gil";
|
||||
|
||||
|
|
|
@ -46,8 +46,7 @@ function onTrigger(player, argc, item, qty, location, name, lastName)
|
|||
location = INVENTORY_NORMAL;
|
||||
end;
|
||||
|
||||
|
||||
local invCheck = player:getInventory(location):AddItem(item, qty, 1);
|
||||
local invCheck = player:getItemPackage(location):addItem(item, qty, 1);
|
||||
|
||||
if (invCheck == INV_ERROR_FULL) then
|
||||
-- Your inventory is full.
|
||||
|
|
|
@ -27,7 +27,7 @@ function onTrigger(player, argc, keyitem, name, lastName)
|
|||
qty = 1;
|
||||
location = INVENTORY_KEYITEMS;
|
||||
|
||||
local added = player:GetInventory(location):AddItem(keyitem, qty, 1);
|
||||
local added = player:GetItemPackage(location):AddItem(keyitem, qty, 1);
|
||||
local messageID = MESSAGE_TYPE_SYSTEM_ERROR;
|
||||
local message = "unable to add keyitem";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue