Module:QuestList: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
No edit summary |
(query episodes) |
||
Line 7: | Line 7: | ||
function p.main(frame) |
function p.main(frame) |
||
local args = frame:getParent().args |
local args = frame:getParent().args |
||
local episode = '' |
|||
-- get all episodes by episode sequence order -- |
|||
local quest_type = '' |
|||
local episodes = mw.smw.ask{ |
|||
'[[Category:Episodes]]', |
|||
if (args.episode) then |
|||
('[[Name::%s]]'):format( args.episode or '+' ), |
|||
'[[Episode sequence number::+]]', |
|||
end |
|||
'[[Release Date::+]]', |
|||
'?Name#-', |
|||
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', |
'order=asc', |
||
'sort= |
'sort=Episode sequence number', |
||
' |
'link=none', |
||
' |
'format=plainlist' |
||
} |
} |
||
local table = mw.html.create('table') |
local table = mw.html.create('table') |
||
:addClass('wikitable quest-table |
:addClass('wikitable quest-table align-center-2 align-center-3 align-left-4') |
||
:css{ |
:css{ |
||
['width'] = ' |
['width'] = '55%' |
||
} |
} |
||
:attr{ cellspacing = '3' } |
:attr{ cellspacing = '3' } |
||
:IF( args.episode ) |
|||
for _, episode in ipairs(episodes) do |
|||
: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 |
table |
||
:tag('tr') |
:tag('tr') |
||
:tag(' |
:tag('th') |
||
: |
:attr('colspan', 4) |
||
:wikitext('[[File:'.. episode.Name ..' episode icon.png|16px]] ' .. episode[1]) |
|||
:done() |
|||
:done() |
:done() |
||
:tag(' |
:tag('tr') |
||
: |
:tag('th') |
||
:wikitext('Quest') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext( parse.difficulty_func( tostring( quest['Difficulty']) ) ) |
|||
:wikitext('Type') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Difficulty') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Requirements') |
|||
:done() |
|||
:done() |
:done() |
||
if ( episode ) then |
|||
:css{ |
|||
-- get all quests for episode -- |
|||
['width'] = '55%' |
|||
local quests = mw.smw.ask{ |
|||
'[[Category:Quests]]', |
|||
'[[Name::+]]', |
|||
('[[Episode::%s]]'):format( episode.Name ), |
|||
'?Quest type', |
|||
'?Difficulty', |
|||
'?Requirements', |
|||
'order=asc', |
|||
'sort=Quest type,override_seq,Difficulty' |
|||
} |
} |
||
:IF(quest['Requirements']) |
|||
if ( quests ) then |
|||
-- get quests for episode -- |
|||
:addClass('lighttable checklist') |
|||
for _, quest in ipairs( quests ) do |
|||
:newline() |
|||
table |
|||
:wikitextIf( quest['Requirements'], quest['Requirements'] ) |
|||
: |
:tag('tr') |
||
: |
:tag('td') |
||
: |
:wikitext( quest[1] ) |
||
: |
:done() |
||
: |
:tag('td') |
||
: |
:css { |
||
['width'] = '50px' |
|||
:END() |
|||
} |
|||
:wikitext( quest['Quest type'] ) |
|||
:done() |
|||
:done() |
|||
:tag('td') |
|||
:wikitext( parse.difficulty_func( tostring(quest.Difficulty ) ) ) |
|||
:done() |
|||
:tag('td') |
|||
:css { |
|||
['width'] = '55%' |
|||
} |
|||
:tag('div') |
|||
:addClass('lighttable checklist') |
|||
:newline() |
|||
:wikitext( quest.Requirements ) |
|||
:newline() |
|||
:done() |
|||
:done() |
|||
:done() |
|||
end |
|||
end |
|||
end |
|||
end |
end |
||
table:done() |
|||
return table |
return table |