Module:QuestList: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(work in progress, will finish later) |
mNo edit summary |
||
Line 33: | Line 33: | ||
:addClass('wikitable quest-table sortable align-center-2 align-left-3') |
:addClass('wikitable quest-table sortable align-center-2 align-left-3') |
||
:css{ |
:css{ |
||
[' |
['width'] = '55%' |
||
} |
} |
||
:attr{ cellspacing = '3' } |
:attr{ cellspacing = '3' } |
Revision as of 19:23, 11 December 2024
Documentation for this module may be created at Module:QuestList/doc
require('strict')
require('Module:Mw.html extension')
local parse = require('Module:Param Parse')
local p = {}
function p.main(frame)
local args = frame:getParent().args
local episode = ''
local quest_type = ''
if (args.episode) then
episode = ('[[Episode::%s]]'):format( args.episode )
end
if (args.type) then
quest_type = ('[[Quest type::%s]]'):format( args.type )
end
local data = mw.smw.ask{
'[[Category:Quests]]',
episode,
quest_type,
'[[Name::+]]',
'?Difficulty',
'?Requirements',
'order=asc',
'sort=override_seq,Difficulty',
'limit=500',
'link=all'
}
local table = mw.html.create('table')
:addClass('wikitable quest-table sortable align-center-2 align-left-3')
:css{
['width'] = '55%'
}
:attr{ cellspacing = '3' }
:IF( args.episode )
:tag('tr')
:tag('th')
:attr('colspan', 3)
:wikitext( parse.episode_func( args.episode ) )
:done()
:done()
:END()
:tag('tr')
:tag('th')
:wikitext("Quest")
:done()
:tag('th')
:wikitext("Difficulty")
:done()
:tag('th')
:wikitext("Requirements")
:done()
:done()
for _, quest in ipairs( data ) do
table
:tag('tr')
:tag('td')
:wikitext( quest[1] )
:done()
:tag('td')
:wikitext( parse.difficulty_func( tostring( quest['Difficulty']) ) )
:done()
:tag('td')
:IF(quest['Requirements'])
:tag('div')
:addClass('lighttable checklist')
:newline()
:wikitextIf( quest['Requirements'], quest['Requirements'] )
:newline()
:done()
:ELSE()
:tag('p')
:wikitext('None')
:done()
:END()
:done()
:done()
end
return table
end
return p