Module:Cosmetic rarity navbox

local p = {}

local cargo_query = mw.ext.cargo.query local cosmetic = require( 'Module:Cosmetic' )._main local getArgs = require( 'Module:Arguments' ).getArgs

function p.main( frame ) local args = getArgs( frame )

local rarities = { 'Common', 'Uncommon', 'Rare', 'Mythical', 'Legendary', 'Immortal', 'Arcana', 'Ancient', 'Dota Plus Access' }

local template_args = { name = args.name, border = args.border, state = args.state or 'uncollapsed', style = 'text-align: center;', title = args.title } for i,rarity in ipairs( rarities ) do    local items = cargo_query( 'cosmetic_items', '_pageName', {      where = string.format( args.where, rarity ),      groupBy = '_pageID'    } ) local cosmetics = {} for _,v in ipairs( items ) do     cosmetics[#cosmetics+1] = tostring( cosmetic{ v._pageName, args.size } ) end template_args['group' .. i] = rarity template_args['list' .. i] = table.concat( cosmetics, ' ' ) end

return frame:expandTemplate{ title = 'Navbox', args = template_args } end

return p