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 = {
        "Cost.merchant",
        "Cost.item",
        "Cost.quality",
        "Cost.quantity",
        "Cost.cost__full",
        "Cost._pageID",
        "NPCs._pageName",
        "NPCs.zone",
	}
    local tables = 'Cost, NPCs'
    local fields = table.concat(fieldstable,",")

    local cargoquery = {
        join = 'Cost.merchant = NPCs._pageName',
        where='Cost.item="' .. frame.args[1] .. '"',
        groupBy = "Cost._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.Cost.merchant .. ']]'):done()
                tr:tag("td"):wikitext():done()
                tr:tag("td"):wikitext(frame:expandTemplate{title = 'Валюта',args = {row.Cost.cost__full}}):done()
        end
	return tbl
end
return p
Advertisement