Neverwinter Wiki
мНет описания правки
мНет описания правки
Строка 9: Строка 9:
 
join = 'Drops._pageName = NPCs._pageName',
 
join = 'Drops._pageName = NPCs._pageName',
 
where = 'Drops.drops_item = "'..frame.args[1]..'"',
 
where = 'Drops.drops_item = "'..frame.args[1]..'"',
orderBy = '_pageName',
+
orderBy = 'Drops._pageName',
 
}
 
}
 
local result = cargo.query( tables, fields, args )
 
local result = cargo.query( tables, fields, args )

Версия от 13:12, 6 мая 2021

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

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

function p.main( frame )
	local cargo = mw.ext.cargo
	tables = 'Drops, NPCs'
    fields = 'Drops._pageName,Drops.name,Drops.drops_item,Drops.quantity,NPCs.zone'
    local args = {
    	join = 'Drops._pageName = NPCs._pageName',
    	where = 'Drops.drops_item = "'..frame.args[1]..'"',
    	orderBy = 'Drops._pageName',
    }
    local result = cargo.query( tables, fields, args )
    local r = result[1]
    local text = {}
	for k, v in ipairs(result) do
		if v["Drops.quantity"] ~= "" then
			text[k] = '<li>' .. Drops._pageName .. NPCs.zone .. ' (' .. v["Drops.quantity"] .. ')</li>'
		else
			text[k] = '<li>' .. Drops._pageName .. NPCs.zone .. '</li>'
		end
    end
    return '<ul>'..table.concat(text,'\n')..'</ul>'
end

return p