Fix Sell tab of NPC Trade

If an item had both a sell and buy price, it was only being added to the
buy list.
This commit is contained in:
Jeffrey 2013-01-08 23:26:56 -06:00
parent 0120b7554c
commit 607a6a13bc
1 changed files with 12 additions and 8 deletions

View File

@ -364,19 +364,23 @@ function onOpenNpcTrade(items)
tradeItems[SELL] = {}
for key,item in pairs(items) do
if item[4] > 0 then
local newItem = {}
newItem.ptr = item[1]
newItem.name = item[2]
newItem.weight = item[3] / 100
if item[4] > 0 then
newItem.price = item[4]
table.insert(tradeItems[BUY], newItem)
elseif item[5] > 0 then
end
if item[5] > 0 then
local newItem = {}
newItem.ptr = item[1]
newItem.name = item[2]
newItem.weight = item[3] / 100
newItem.price = item[5]
table.insert(tradeItems[SELL], newItem)
else
error("server error: item name " .. item[2] .. " has neither buy or sell price.")
end
end