Module:Variants: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(Add profession icon, and show both professions in table.)
(Format low➨high for items with a range of profession levels; Align levels to the right)
Line 17: Line 17:
'?Profession Level A',
'?Profession Level A',
'?Profession Level B',
'?Profession Level B',
'?Profession Level A High',
'?Profession Level B High',
get_images and '?Image#64px;x64px = Image' or nil,
get_images and '?Image#64px;x64px = Image' or nil,
limit = args.limit or 500,
limit = args.limit or 500,
Line 69: Line 71:
:done()
:done()
:done()
:done()
local function formatProfessionLevel(profession, level, high)
if not profession then
return nil
end
local level_text = tostring(level)
if high then
level_text = ('%s➨%d'):format(level_text, high)
end
return ('%s [[File:%s small icon.png|21x21px|link=%s]]'):format(level_text, profession, profession)
end


for _, entry in ipairs(smw_data) do
for _, entry in ipairs(smw_data) do
Line 82: Line 95:
:done()
:done()
:tag('td')
:tag('td')
:css{ ['border-right'] = 'none' }
:css{ ['text-align'] = 'right' }
:wikitext(entry['Profession Level A']..' [[File:'..entry['Profession A']..' small icon.png|21x21px|link='..entry['Profession A']..']]')
:wikitext(formatProfessionLevel(entry['Profession A'], entry['Profession Level A'], entry['Profession Level A High']))
:done()
:IF(entry['Profession B'])
:IF(entry['Profession B'])
:tag('td')
:tag('td')
:css{ ['text-align'] = 'right' }
:wikitextIf(entry['Profession B'], (entry['Profession Level B'] or '')..' [[File:'..(entry['Profession B'] or '')..' small icon.png|21x21px|link='..(entry['Profession B'] or '')..']]')
:wikitext(formatProfessionLevel(entry['Profession B'], entry['Profession Level B'], entry['Profession Level B High']))
:done()
:done()
:END()
:END()