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: | ||
require('strict') |
|||
require('Module:Mw.html extension') |
|||
local p = {} |
local p = {} |
||
function p.details(frame) |
function p.details(frame) |
||
local args = frame:getParent().args |
local args = frame:getParent().args |
||
local mw = require('mw') |
|||
if args.start_point then |
|||
local questJson = mw.text.jsonEncode({ |
|||
mw.smw.set({ |
|||
start_point = args.start_point, |
|||
["start_point"] = args.start_point, |
|||
required_for = args.required_for, |
|||
}) |
|||
next_quest = args.next_quest, |
|||
end |
|||
requirements = args.requirements, |
|||
if args.required_for then |
|||
items = args.items and '\n'..args.items, |
|||
mw.smw.set({ |
|||
recommended = args.recommended and '\n'..args.recommended, |
|||
["required_for"] = args.required_for, |
|||
enemies = args.enemies, |
|||
}) |
|||
episode_nth = args.episode_nth or 9999 |
|||
end |
|||
if args.next_quest then |
|||
mw.smw.set({ |
|||
["next_quest"] = args.next_quest, |
|||
}) |
|||
end |
|||
if args.requirements then |
|||
mw.smw.set({ |
|||
["requirements"] = '\n'..args.requirements, |
|||
}) |
|||
end |
|||
if args.items then |
|||
mw.smw.set({ |
|||
["items"] = '\n'..args.items, |
|||
}) |
|||
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 override_seq = args.override_seq or 9999 |
|||
mw.smw.set({ |
|||
["override_seq"] = override_seq, |
|||
}) |
|||
local requirements; |
|||
if (args.requirements) then |
|||
requirements = args.requirements |
|||
else |
|||
requirements = 'None' |
|||
end |
|||
local table = mw.html.create( 'table' ) |
|||
mw.smw.set({ |
|||
table |
|||
start_point = args.start_point, |
|||
:attr( 'class', 'wikitable plainlinks' ) |
|||
required_for = args.required_for, |
|||
:attr( 'cellspacing', '3' ) |
|||
next_quest = args.next_quest, |
|||
:tag( 'tr' ) |
|||
requirements = args.requirements, |
|||
:tag( 'td' ) |
|||
items = args.items and '\n'..args.items, |
|||
:tag( 'b' ) |
|||
recommended = args.recommended and '\n'..args.recommended, |
|||
:wikitext('Start Point') |
|||
enemies = args.enemies, |
|||
:done() |
|||
episode_nth = args.episode_nth or 9999, |
|||
:attr('style', 'vertical-align:top; width:15%; padding: 1em;') |
|||
['Quest JSON'] = questJson |
|||
}) |
|||
local table = mw.html.create('table') |
|||
:addClass('wikitable plainlinks') |
|||
:attr{ cellspacing = '3' } |
|||
:tag('tr') |
|||
:tag('td') |
|||
:css{ |
|||
['vertical-align'] = 'top', |
|||
['width'] = '15%', |
|||
['padding'] = '1em' |
|||
} |
|||
:tag('b') |
|||
:wikitext('Start Point') |
|||
:done() |
|||
:done() |
:done() |
||
:tag('td') |
:tag( 'td' ) |
||
:tag('p') |
|||
:wikitext( args['start_point'] ) |
|||
['max-width'] = '85%', |
|||
:done() |
|||
['width'] = 'auto', |
|||
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;') |
|||
['padding-right'] = '2em' |
|||
} |
|||
:tag('p') |
|||
:wikitext(args.start_point) |
|||
:done() |
|||
:done() |
:done() |
||
:done() |
|||
:IF(args.required_for) |
|||
if (args.required_for) then |
|||
:tag('tr') |
|||
table |
|||
:tag('td') |
|||
:tag( 'tr' ) |
|||
:css{ |
|||
:tag( 'td' ) |
|||
['vertical-align'] = 'top', |
|||
:tag( 'b' ) |
|||
:wikitext('Required for') |
|||
:done() |
|||
:attr('style', 'vertical-align:top; width:15%; padding: 1em;') |
|||
:tag('b') |
|||
:wikitext('Required for') |
|||
:done() |
|||
:done() |
:done() |
||
:tag('td') |
:tag( 'td' ) |
||
:tag('div') |
|||
:newline() |
|||
:css{ |
|||
:wikitext( args.required_for ) |
|||
['max-width'] = '85%', |
|||
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;') |
|||
['width'] = 'auto', |
|||
['padding-left'] = '1em', |
|||
['padding-right'] = '2em' |
|||
} |
|||
:newline() |
|||
:wikitext(args.required_for) |
|||
:done() |
|||
:done() |
:done() |
||
:done() |
|||
end |
|||
table |
|||
:tag( 'tr' ) |
|||
:tag( 'td' ) |
|||
:attr('style', 'vertical-align:top; width:15%; padding: 1em;') |
|||
:tag( 'b' ) |
|||
:wikitext('Requirements') |
|||
:done() |
|||
:done() |
:done() |
||
: |
:tag( 'td' ) |
||
:attr('style', 'max-width:85%; width:auto; padding: 0.3em;') |
|||
:tag('tr') |
|||
:tag(' |
:tag('div') |
||
:addClass('lighttable checklist') |
|||
:css{ |
|||
:newline() |
|||
['vertical-align'] = 'top', |
|||
:wikitext(requirements) |
|||
['width'] = '15%', |
|||
:newline() |
|||
['padding'] = '1em' |
|||
:done() |
|||
} |
|||
:tag('b') |
|||
:wikitext('Requirements') |
|||
:done() |
|||
:done() |
:done() |
||
:done() |
|||
:css{ |
|||
if (args.items) then |
|||
['max-width'] = '85%', |
|||
table |
|||
['width'] = 'auto', |
|||
:tag( 'tr' ) |
|||
['padding'] = '1em', |
|||
:tag( 'td' ) |
|||
['padding-right'] = '2em' |
|||
:attr('style', 'vertical-align:top; width:15%; padding: 1em;') |
|||
} |
|||
:tag(' |
:tag( 'b' ) |
||
: |
:wikitext('Items') |
||
:done() |
|||
:wikitext(args.requirements or 'None') |
|||
:newline() |
|||
:done() |
:done() |
||
: |
:tag( 'td' ) |
||
:attr('style', 'max-width:85%; width:auto; padding: 0.3em;') |
|||
:done() |
|||
: |
:tag('div') |
||
:addClass('lighttable checklist') |
|||
:tag('tr') |
|||
: |
:newline() |
||
:wikitext(args.items) |
|||
:css{ |
|||
:newline() |
|||
['vertical-align'] = 'top', |
|||
:done() |
|||
['width'] = '15%', |
|||
['padding'] = '1em' |
|||
} |
|||
:tag('b') |
|||
:wikitext('Items') |
|||
:done() |
|||
:done() |
:done() |
||
:done() |
|||
end |
|||
:css{ |
|||
['max-width'] = '85%', |
|||
if (args.recommended) then |
|||
['width'] = 'auto', |
|||
table |
|||
['padding'] = '1em', |
|||
:tag( 'tr' ) |
|||
['padding-right'] = '2em' |
|||
:tag( 'td' ) |
|||
} |
|||
:tag( 'b' ) |
|||
:wikitext('Recommended') |
|||
:newline() |
|||
:wikitext(args.items) |
|||
:newline() |
|||
:done() |
|||
:done() |
|||
:done() |
|||
:END() |
|||
:IF(args.recommended) |
|||
:tag('tr') |
|||
:tag('td') |
|||
:css{ |
|||
['vertical-align'] = 'top', |
|||
['width'] = '15%', |
|||
['padding'] = '1em' |
|||
} |
|||
:tag('b') |
|||
:wikitext('Recommended') |
|||
:done() |
:done() |
||
:attr('style', 'vertical-align:top; width:15%; padding: 1em;') |
|||
:done() |
:done() |
||
:tag('td') |
:tag( 'td' ) |
||
:attr('style', 'max-width:85%; width:auto; padding-left: 1em;') |
|||
:css{ |
|||
:tag('div') |
|||
['max-width'] = '85%', |
|||
:addClass('lighttable checklist') |
|||
['width'] = 'auto', |
|||
:newline() |
|||
['padding-left'] = '1em', |
|||
:wikitext( args.recommended ) |
|||
['padding-right'] = '2em' |
|||
:newline() |
|||
} |
|||
:tag('div') |
|||
:addClass('lighttable checklist') |
|||
:newline() |
|||
:wikitext(args.recommended) |
|||
:newline() |
|||
:done() |
|||
:done() |
:done() |
||
:done() |
|||
end |
|||
:END() |
|||
:IF(args.enemies) |
|||
if (args.enemies) then |
|||
:tag('tr') |
|||
table |
|||
:tag('td') |
|||
:tag( 'tr' ) |
|||
:css{ |
|||
:tag( 'td' ) |
|||
['vertical-align'] = 'top', |
|||
:tag( 'b' ) |
|||
:wikitext('Enemies') |
|||
:done() |
|||
:attr('style', 'vertical-align:top; width:15%; padding: 1em;') |
|||
:tag('b') |
|||
:wikitext('Enemies') |
|||
:done() |
|||
:done() |
:done() |
||
:tag('td') |
:tag( 'td' ) |
||
:tag('div') |
|||
:newline() |
|||
['max-width'] = '85%', |
|||
:wikitext( args.enemies ) |
|||
['width'] = 'auto', |
|||
:done() |
|||
['padding-left'] = '1em', |
|||
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;') |
|||
} |
|||
:tag('div') |
|||
:newline() |
|||
:wikitext(args.enemies) |
|||
:done() |
|||
:done() |
:done() |
||
:done() |
|||
end |
|||
:END() |
|||
:done() |
|||
table:done() |
|||
return table |
|||
return tostring( table ) |
|||
end |
end |
||