Editing Module:QuestList
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
require('strict') |
require('strict') |
||
require('Module:Mw.html extension') |
require('Module:Mw.html extension') |
||
local purge = require('Module:Purge')._purge |
|||
local parse = require('Module:Param Parse') |
local parse = require('Module:Param Parse') |
||
Line 8: | Line 7: | ||
function p.main(frame) |
function p.main(frame) |
||
local args = frame:getParent().args |
local args = frame:getParent().args |
||
local episode = '' |
|||
local quest_type = '' |
|||
-- get all episodes by episode sequence order -- |
|||
local episodes = mw.smw.ask{ |
|||
if (args.episode) then |
|||
'[[Category:Episodes]]', |
|||
('[[ |
episode = ('[[Episode::%s]]'):format( args.episode ) |
||
end |
|||
'[[Episode sequence number::+]]', |
|||
'[[Release Date::+]]', |
|||
if (args.type) then |
|||
'?Name#-', |
|||
quest_type = ('[[Quest type::%s]]'):format( args.type ) |
|||
'?Premium', |
|||
end |
|||
local data = mw.smw.ask{ |
|||
'[[Category:Quests]]', |
|||
episode, |
|||
quest_type, |
|||
'[[Name::+]]', |
|||
'?Difficulty', |
|||
'?Requirements', |
|||
'order=asc', |
'order=asc', |
||
'sort= |
'sort=override_seq,Difficulty', |
||
' |
'limit=500', |
||
' |
'link=all' |
||
} |
} |
||
local table = mw.html.create('table') |
local table = mw.html.create('table') |
||
:addClass('wikitable quest-table sortable align-center-2 align-left-3') |
|||
if (episodes == nil) then |
|||
:css{ |
|||
table:wikitext("No quests available for " .. args.episode .. " " .. purge('source-'..mw.uri.anchorEncode(args.episode), '(update)', 'span')) |
|||
['style'] = '55%' |
|||
else |
|||
} |
|||
:attr{ cellspacing = '3' } |
|||
:addClass('wikitable quest-table align-center-2 align-center-3 align-left-4') |
|||
:IF( args.episode ) |
|||
:css{ |
|||
:tag('tr') |
|||
['width'] = '65%' |
|||
:tag('th') |
|||
:attr |
:attr('colspan', 3) |
||
:wikitext( parse.episode_func( args.episode ) ) |
|||
:done() |
|||
for _, episode in ipairs(episodes) do |
|||
:done() |
|||
:END() |
|||
:tag('tr') |
|||
:tag('th') |
|||
:wikitext("Quest") |
|||
:wikitextIf(episode.Premium == true, '[[File:Premium Pass icon.png|16px]] ') |
|||
:done() |
|||
:wikitext('[[File:'.. episode.Name ..' episode icon.png|16px]] ' .. episode[1]) |
|||
: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() |
:done() |
||
: |
:ELSE() |
||
:tag(' |
:tag('p') |
||
: |
:wikitext('None') |
||
:wikitext('Quest') |
|||
:done() |
:done() |
||
:END() |
|||
:done() |
|||
:done() |
|||
end |
|||
:tag('th') |
|||
:wikitext('Difficulty') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Requirements') |
|||
:done() |
|||
:done() |
|||
if ( episode ) then |
|||
-- get all quests for episode -- |
|||
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 ( quests ) then |
|||
-- get quests for episode -- |
|||
for _, quest in ipairs( quests ) do |
|||
table |
|||
:tag('tr') |
|||
:tag('td') |
|||
:wikitext( quest[1] ) |
|||
:done() |
|||
:tag('td') |
|||
:css { |
|||
['width'] = '50px' |
|||
} |
|||
:wikitext( quest['Quest type'] ) |
|||
: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 |
|||
table:done() |
|||
end |
|||
return table |
return table |
||
end |
end |
||