Для документации этого модуля может быть создана страница Модуль:Vendor list/doc
local itemIcon = require('Модуль:Item_icon')
local p = {}
function p.Main( frame )
local cargo = mw.ext.cargo
tables = 'Cost, NPCs'
fields = 'Cost.merchant,Cost.item,Cost.quality,Cost.quantity,Cost.cost__full,Cost._pageID,NPCs._pageName,NPCs.zone'
local itemORcost = {}
if frame.args['валюта'] ~= "" then
itemORcost = 'cost HOLDS LIKE "%' .. frame.args['валюта'] .. '%"'
else
itemORcost = 'Cost.item="' .. frame.args[1] .. '"'
end
local args = {
join = 'Cost.merchant = NPCs._pageName',
where=itemORcost,
--groupBy = "" ,
--orderBy = args.orderby,
}
local result = cargo.query( tables, fields, args )
local r = result[1]
--Start the table
local tbl = mw.html.create('table')
tbl:addClass('wikitable')
if frame.args['валюта'] ~= "" then
tbl:tag("th"):wikitext("Предмет"):done()
end
tbl:tag("th"):wikitext("Торговец"):done()
tbl:tag("th"):wikitext("Область"):done()
tbl:tag("th"):wikitext("Стоимость"):done()
tbl:done()
for _,row in ipairs(result) do
tr = tbl:tag("tr")
if frame.args['валюта'] ~= "" then
tr:tag("td"):wikitext(itemIcon.Main({args={row["Cost.item"],""}})):done()
end
tr:tag("td"):wikitext('[[' .. row["Cost.merchant"] .. ']]'):done()
local zone = ''
if row["NPCs.zone"] ~= "" then
zone = '[[' .. row["NPCs.zone"] .. ']]'
else
zone = '-'
end
tr:tag("td"):wikitext(zone):done()
tr:tag("td"):wikitext(frame:expandTemplate{title = 'Валюта',args = {row["Cost.cost__full"]}}):done()
end
return tbl
end
return p