Module:MonsterVariantsTable: Difference between revisions
m
cleanup
Californ1a (talk | contribs) mNo edit summary |
Californ1a (talk | contribs) m (cleanup) |
||
Line 15:
end
function p._main(args
local variant = args[1] or args.variant
local query = {
string.format('[[Variant of::%s
'?Image#64px;x64px = img',
'?
'?Name=name',▼
'?= page',
'?Unlock_level = unlock',
'?Has subobject.Unlock_level = unlock2',▼
'?Profession_Level_A = combat',
'?
'?
'?
'?Version anchor = version',
'sort=Profession Level A',
}
local results = mw.smw.ask(query)
mw.logObject(results)
if results == nil or results[1] == nil then
return ":''No variants found for "..variant.."''"
end
local
local sorted = p.sort_by_combat(filtered)
return tostring(p.create_table(sorted))
end▼
function p.filter_versions(data)
for _,entry in ipairs(data) do
if entry.default == true then
entry.page = ('[[%s|%s]]'):format(entry.subobject, entry.name)
table.insert(filtered, entry)
elseif entry.version == nil then
table.insert(filtered, entry)
end
end
return filtered
end
Line 46 ⟶ 61:
table.sort(data, function(a, b)
-- Determine combat values
local combatA = a.combat or
local combatB = b.combat or
-- Sort in ascending order
return combatA < combatB
Line 55 ⟶ 70:
function p.insert_row(tbl, entry)
local edit = editbutton("'''?''' (edit)", entry.name)
tbl:tag('tr')
:tag('td')
Line 63 ⟶ 79:
:done()
:tag('td')
:wikitext(entry.unlock and p.formatProfessionLevel(entry.profession, entry.unlock) or edit)
:done()
:tag('td')
:wikitext(entry.combat and p.formatProfessionLevel(entry.profession, entry.combat) or edit)
:done()
:done()
return tbl
▲end
end
Line 98 ⟶ 108:
for _,entry in ipairs(results) do
▲ local built_entry = {
end
|