Merge pull request #184 from Quintinon/master
Fix for Issue #162 - NPCs Trade window showing Sell items correctly
This commit is contained in:
commit
a8c9adb052
|
@ -364,19 +364,23 @@ function onOpenNpcTrade(items)
|
||||||
tradeItems[SELL] = {}
|
tradeItems[SELL] = {}
|
||||||
|
|
||||||
for key,item in pairs(items) do
|
for key,item in pairs(items) do
|
||||||
|
|
||||||
|
if item[4] > 0 then
|
||||||
local newItem = {}
|
local newItem = {}
|
||||||
newItem.ptr = item[1]
|
newItem.ptr = item[1]
|
||||||
newItem.name = item[2]
|
newItem.name = item[2]
|
||||||
newItem.weight = item[3] / 100
|
newItem.weight = item[3] / 100
|
||||||
|
|
||||||
if item[4] > 0 then
|
|
||||||
newItem.price = item[4]
|
newItem.price = item[4]
|
||||||
table.insert(tradeItems[BUY], newItem)
|
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]
|
newItem.price = item[5]
|
||||||
table.insert(tradeItems[SELL], newItem)
|
table.insert(tradeItems[SELL], newItem)
|
||||||
else
|
|
||||||
error("server error: item name " .. item[2] .. " has neither buy or sell price.")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue