Editing Module:QuestDetails
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: | ||
local p = {} |
local p = {} |
||
local Infobox = require('Module:Infobox') |
|||
local parse = require('Module:Param Parse') |
|||
function p.details(frame) |
function p.details(frame) |
||
local args = frame:getParent().args |
local args = frame:getParent().args |
||
local mw = require('mw') |
|||
local config = { |
|||
if args.start_point then |
|||
infobox_name = 'QuestDetails', |
|||
mw.smw.set({ |
|||
class = 'questdetails', |
|||
["start_point"] = args.start_point, |
|||
} |
|||
}) |
|||
end |
|||
if args.requirements then |
|||
mw.smw.set({ |
|||
["requirements"] = '\n'..args.requirements, |
|||
}) |
|||
end |
|||
if args.recommended then |
|||
mw.smw.set({ |
|||
["recommended"] = '\n'..args.recommended, |
|||
}) |
|||
end |
|||
if args.enemies then |
|||
mw.smw.set({ |
|||
["enemies"] = args.enemies, |
|||
}) |
|||
end |
|||
local requirements; |
|||
if (args.requirements) then |
|||
requirements = args.requirements |
|||
else |
|||
requirements = 'None' |
|||
end |
|||
local |
local params = { |
||
{name = 'start_point', func = parse.has_content, smw_property = 'Start Point'}, |
|||
table |
|||
{name = 'requirements', func = parse.has_content, smw_property = 'Requirements'} |
|||
:attr( 'class', 'wikitable plainlinks' ) |
|||
} |
|||
:attr( 'cellspacing', '3' ) |
|||
:tag( 'tr' ) |
|||
local infobox = Infobox.new(config, params, args) |
|||
:tag( 'td' ) |
|||
local auto_width = { ["max-width"] = "85%", ["width"] = "auto" } |
|||
:tag( 'b' ) |
|||
infobox |
|||
:wikitext('Start Point') |
|||
:add_row{ |
|||
:done() |
|||
{ tag = 'th', class = "questdetails-header", content = 'Start Point' }, |
|||
:attr('style', 'vertical-align:top; width:15%; padding: 1em;') |
|||
{ tag = 'td', class = "questdetails-info", content=Infobox.param('start_point'), css = auto_width } |
|||
:done() |
|||
} |
|||
:tag( 'td' ) |
|||
:add_row{ |
|||
:tag('p') |
|||
{ tag = 'th', class = "questdetails-header", content = 'Requirements' }, |
|||
:wikitext( args['start_point'] ) |
|||
{tag = 'td', class = "questdetails-info", content=Infobox.param('requirements'), colspan='2' }, |
|||
:done() |
|||
} |
|||
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;') |
|||
:done() |
|||
return infobox |
|||
:done() |
|||
:tag( 'tr' ) |
|||
:tag( 'td' ) |
|||
:tag( 'b' ) |
|||
:wikitext('Requirements') |
|||
:done() |
|||
:attr('style', 'vertical-align:top; width:15%; padding: 1em;') |
|||
:done() |
|||
:tag( 'td' ) |
|||
:tag('div') |
|||
:addClass('lighttable checklist') |
|||
:newline() |
|||
:wikitext(requirements) |
|||
:attr('style', 'max-width:85%; width:auto; padding: 0.3em;') |
|||
:done() |
|||
:done() |
|||
if (args.recommended) then |
|||
table |
|||
:tag( 'tr' ) |
|||
:tag( 'td' ) |
|||
:tag( 'b' ) |
|||
:wikitext('Recommended') |
|||
:done() |
|||
:attr('style', 'vertical-align:top; width:15%; padding: 1em;') |
|||
:done() |
|||
:tag( 'td' ) |
|||
:tag('div') |
|||
:newline() |
|||
:wikitext( args.recommended ) |
|||
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;') |
|||
:done() |
|||
:done() |
|||
end |
|||
if (args.enemies) then |
|||
table |
|||
:tag( 'tr' ) |
|||
:tag( 'td' ) |
|||
:tag( 'b' ) |
|||
:wikitext('Enemies') |
|||
:done() |
|||
:attr('style', 'vertical-align:top; width:15%; padding: 1em;') |
|||
:done() |
|||
:tag( 'td' ) |
|||
:tag('p') |
|||
:wikitext( args.enemies ) |
|||
:done() |
|||
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;') |
|||
:done() |
|||
:done() |
|||
end |
|||
table:done() |
|||
return tostring( table ) |
|||
end |
end |
||