Module:QuestList: Difference between revisions

m
no edit summary
(work in progress, will finish later)
 
mNo edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1:
require('strict')
require('Module:Mw.html extension')
local purge = require('Module:Purge')._purge
local parse = require('Module:Param Parse')
 
Line 7 ⟶ 8:
function p.main(frame)
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
episode = ('[[EpisodeName::%s]]'):format( args.episode or '+' ),
'[[Episode sequence number::+]]',
end
'[[Release Date::+]]',
'?Name#-',
if (args.type) then
'?Premium',
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,DifficultyEpisode sequence number',
'limitlink=500none',
'linkformat=allplainlist'
}
local table = mw.html.create('table')
if (episodes == nil) then
:addClass('wikitable quest-table sortable align-center-2 align-left-3')
table:wikitext("No quests available for " .. args.episode .. " " .. purge('source-'..mw.uri.anchorEncode(args.episode), '(update)', 'span'))
:css{
else
['style'] = '55%'
}table
:addClass('wikitable quest-table align-center-2 align-center-3 align-left-4')
:attr{ cellspacing = '3' }
:css{
:IF( args.episode )
['width'] = '65%'
:tag('tr')
:tag('th')}
:attr({ cellspacing = 'colspan3', 3)}
:wikitext( parse.episode_func( args.episode ) )
for _, episode in ipairs(episodes) do
:done()
:done() table
:ENDtag('tr')
:tag('trth')
:tagattr('thcolspan', 4)
:wikitextIf(episode.Premium == true, '[[File:Premium Pass icon.png|16px]] ')
:wikitext("Quest")
:wikitext('[[File:'.. episode.Name ..' episode icon.png|16px]] ' .. episode[1])
: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()
:ELSEdone()
:tag('ptr')
:wikitexttag('Noneth')
:wikitext('Quest')
:done()
:ENDtag('th')
:donewikitext('Type')
:done()
:tag('th')
end
: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
 
end
 
2,207

edits