Neverwinter Wiki
Advertisement

Для документации этого модуля может быть создана страница Модуль:Vendor list/doc

local itemIcon = require('Модуль:Item_icon')

local p = {}
local cargo = mw.ext.cargo

function p.Main( frame )
    local args = frame.args
    local fieldstable = {
        "merchant",
        "item",
        "quality",
        "quantity",
        "cost__full",
        "_pageID",
	}
    local tables = 'Cost'
    local fields = table.concat(fieldstable,",")

    local cargoquery = { where='item="' .. frame.args[1] .. '"', groupBy = "_pageID" , orderBy = args.orderby}
    local result = mw.ext.cargo.query( tables, fields, cargoquery )
    local r = result[1]

        --Start the table
	local tbl = mw.html.create('table')
	tbl:addClass('wikitable')
			tbl:tag("th"):attr('style', 'width: 15%'):wikitext("Торговец"):done()
			tbl:tag("th"):attr('style', 'width: 12%'):wikitext("Область"):done()
			tbl:tag("th"):attr('style', 'width: 20%'):wikitext("Стоимость"):done()
        --if r['equip_power'] ~= "" then
			--tbl:tag("th"):wikitext("Умение экипировки"):done()
        --end
        --if r['combat_power'] ~= "" then
		    --tbl:tag("th"):wikitext("Боевое умение"):done()
        --end
		tbl:done()
         --Construct the rows in the table
	    for _,row in ipairs(result) do
            tr = tbl:tag("tr")
                tr:tag("td"):wikitext('[[' .. row.merchant .. ']]'):done()
                tr:tag("td"):wikitext():done()
                tr:tag("td"):wikitext(frame:expandTemplate{title = 'валюта',args = args[row.cost__full]}):done()
        end
	return tbl
end
return p
Advertisement