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 ret = infobox.new(_args) |
|||
ret:defineParams { |
|||
if args.start_point then |
|||
{ name = 'start_point' }, |
|||
{ name = 'requirements' }, |
|||
["start_point"] = tostring(args.start_point), |
|||
} |
|||
end |
|||
if args.requirements then |
|||
mw.smw.set({ |
|||
["requirements"] = tostring(args.requirements), |
|||
}) |
|||
end |
|||
if args.recommended then |
|||
mw.smw.set({ |
|||
["recommended"] = tostring(args.recommended), |
|||
}) |
|||
end |
|||
if args.enemies then |
|||
mw.smw.set({ |
|||
["enemies"] = tostring(args.enemies), |
|||
}) |
|||
end |
|||
ret:create() |
|||
local requirements; |
|||
ret:cleanParams() |
|||
if (args.requirements) then |
|||
requirements = args.requirements |
|||
ret:addClass('questdetails') |
|||
else |
|||
ret:attr { cellspacing = '3' } |
|||
end |
|||
local auto_width = { ["max-width"] = "85%", ["width"] = "auto" } |
|||
ret:addRow { |
|||
local table = mw.html.create( 'table' ) |
|||
{ tag = 'th', class = "questdetails-header", content = 'Start point' }, |
|||
table |
|||
{ tag = 'argd', class = "questdetails-info", content=infobox.param('name'), css = auto_width } |
|||
:attr( 'class', 'wikitable plainlinks' ) |
|||
} |
|||
:attr( 'cellspacing', '3' ) |
|||
:tag( 'tr' ) |
|||
ret:addRow { |
|||
{ tag = 'th', class = "questdetails-header", content = 'Requirements' }, |
|||
:tag( 'b' ) |
|||
{ tag = 'td', class = "questdetails-info", content=infobox.param('requirements'), colspan = 2 } |
|||
:wikitext('Start Point') |
|||
} |
|||
:attr('style', 'vertical-align:top; width:15%; padding: 0 1em;') |
|||
return ret |
|||
:done() |
|||
:tag( 'td' ) |
|||
:tag('p') |
|||
:wikitext( args['start_point'] ) |
|||
:done() |
|||
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;') |
|||
:done() |
|||
:done() |
|||
:tag( 'tr' ) |
|||
:tag( 'td' ) |
|||
:tag( 'b' ) |
|||
:wikitext('Requirements') |
|||
:done() |
|||
:attr('style', 'vertical-align:top; width:15%; padding: 0 1em;') |
|||
:done() |
|||
:tag( 'td' ) |
|||
:tag('p') |
|||
:wikitext( requirements ) |
|||
:done() |
|||
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;') |
|||
:done() |
|||
:done() |
|||
if (args.recommended) then |
|||
table |
|||
:tag( 'tr' ) |
|||
:tag( 'td' ) |
|||
:tag( 'b' ) |
|||
:wikitext('Recommended') |
|||
:done() |
|||
:attr('style', 'vertical-align:top; width:15%; padding: 0 1em;') |
|||
:done() |
|||
:tag( 'td' ) |
|||
:tag('p') |
|||
:wikitext( args.recommended ) |
|||
:done() |
|||
: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: 0 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 |
||