Module:Build order

local p = {} local cargo = mw.ext.cargo local getArgs = require( 'Module:Arguments' ).getArgs

local i18n = { default_title = 'Skill Build', talent = 'Talent' }

function p.main(frame) local args = getArgs(frame, {   wrappers = {      'Template:Build order'    }  }) return p._main(args) end

function p._main(args) local hero = args.hero or mw.title.getCurrentTitle.baseText -- Creates a table with the format ["Ability"] = "image" local abilities = { [i18n.talent] = 'File:Talent icon.png' } for k,v in pairs(cargo.query('abilities', 'title, image', { where='_pageName="' .. hero .. '"', groupBy='source, title' })) do   abilities[v.title] = v.image end local levels = mw.html.create('tr') local images = mw.html.create('tr') for i=1,25 do   if args['lvl' .. i] then -- Add the current level to the levels row. levels:tag('td'):wikitext(i):done -- Add the ability icon to the ability icon row. local image = string.format('40px|link=%s#%s', (abilities[args['lvl' .. i]] or 'File:Unknown icon.png'), hero, args['lvl' .. i]) images:tag('td'):wikitext(image):done end end

local wikitable = mw.html.create('table') :addClass('wikitable') :css('text-align', 'center') -- The table header. :newline :tag('tr') :tag('th') :addClass('header') :attr('colspan', 25) :wikitext(args.title or i18n.default_title) :done :done :newline -- The levels row. :node(levels) :newline -- The ability icon row. :node(images) :newline

return wikitable end

return p