Module:QuestDetails: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
mNo edit summary |
m (Simplify / cleanup (This code should have the exact same effect)) |
||
Line 1: | Line 1: | ||
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') |
|||
mw.smw.set({ |
|||
start_point = args.start_point, |
|||
required_for = args.required_for, |
|||
mw.smw.set({ |
|||
next_quest = args.next_quest, |
|||
["start_point"] = args.start_point, |
|||
requirements = args.requirements and '\n'..args.requirements, |
|||
}) |
|||
items = args.items and '\n'..args.items, |
|||
end |
|||
recommended = args.recommended and '\n'..args.recommended, |
|||
if args.required_for then |
|||
enemies = args.enemies, |
|||
mw.smw.set({ |
|||
override_seq = args.override_seq or 9999 |
|||
["required_for"] = args.required_for, |
|||
}) |
|||
}) |
|||
end |
|||
local requirements = args.requirements or 'None' |
|||
if args.next_quest then |
|||
mw.smw.set({ |
|||
local table = mw.html.create('table') |
|||
["next_quest"] = args.next_quest, |
|||
:addClass('wikitable plainlinks') |
|||
}) |
|||
:attr{ cellspacing = '3' } |
|||
end |
|||
:tag('tr') |
|||
if args.requirements then |
|||
:tag('td') |
|||
mw.smw.set({ |
|||
:css{ |
|||
["requirements"] = '\n'..args.requirements, |
|||
['vertical-align'] = 'top', |
|||
}) |
|||
['width'] = '15%', |
|||
end |
|||
['padding'] = '1em' |
|||
if args.items then |
|||
} |
|||
mw.smw.set({ |
|||
:tag('b') |
|||
["items"] = '\n'..args.items, |
|||
:wikitext('Start Point') |
|||
}) |
|||
:done() |
|||
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' ) |
|||
table |
|||
:attr( 'class', 'wikitable plainlinks' ) |
|||
:attr( 'cellspacing', '3' ) |
|||
:tag( 'tr' ) |
|||
:tag( 'td' ) |
|||
:tag( 'b' ) |
|||
:wikitext('Start Point') |
|||
:done() |
|||
:attr('style', 'vertical-align:top; width:15%; padding: 1em;') |
|||
:done() |
:done() |
||
:tag( |
:tag('td') |
||
:css{ |
|||
['max-width'] = '85%', |
|||
:wikitext( args['start_point'] ) |
|||
['width'] = 'auto', |
|||
:done() |
|||
['padding-left'] = '1em', |
|||
['padding-right'] = '2em' |
|||
} |
|||
:tag('p') |
|||
:wikitext(args.start_point) |
|||
:done() |
|||
:done() |
:done() |
||
:done() |
|||
:IF(args.required_for) |
|||
:tag('tr') |
|||
if (args.required_for) then |
|||
:tag('td') |
|||
table |
|||
:css{ |
|||
:tag( 'tr' ) |
|||
['vertical-align'] = 'top', |
|||
:tag( 'td' ) |
|||
['width'] = '15%', |
|||
['padding'] = '1em' |
|||
} |
|||
:tag('b') |
|||
:attr('style', 'vertical-align:top; width:15%; padding: 1em;') |
|||
:wikitext('Required for') |
|||
:done() |
|||
:done() |
:done() |
||
:tag( |
:tag('td') |
||
:tag('div') |
|||
:css{ |
|||
:newline() |
|||
['max-width'] = '85%', |
|||
:wikitext( args.required_for ) |
|||
['width'] = 'auto', |
|||
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;') |
|||
['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() |
||
:END() |
|||
:tag('tr') |
|||
:attr('style', 'max-width:85%; width:auto; padding: 0.3em;') |
|||
:tag('td') |
|||
:css{ |
|||
:addClass('lighttable checklist') |
|||
['vertical-align'] = 'top', |
|||
:newline() |
|||
['width'] = '15%', |
|||
:wikitext(requirements) |
|||
['padding'] = '1em' |
|||
:newline() |
|||
} |
|||
:done() |
|||
:tag('b') |
|||
:wikitext('Requirements') |
|||
:done() |
|||
:done() |
:done() |
||
:tag('td') |
|||
:css{ |
|||
['max-width'] = '85%', |
|||
if (args.items) then |
|||
['width'] = 'auto', |
|||
table |
|||
['padding'] = '0.3em' |
|||
:tag( 'tr' ) |
|||
} |
|||
:tag( 'td' ) |
|||
:tag('div') |
|||
:attr('style', 'vertical-align:top; width:15%; padding: 1em;') |
|||
:addClass('lighttable checklist') |
|||
:newline() |
|||
:wikitext(requirements) |
|||
:newline() |
|||
:done() |
:done() |
||
:done() |
|||
:done() |
|||
:attr('style', 'max-width:85%; width:auto; padding: 0.3em;') |
|||
:IF(args.items) |
|||
:tag('tr') |
|||
:addClass('lighttable checklist') |
|||
:tag('td') |
|||
:css{ |
|||
:wikitext(args.items) |
|||
['vertical-align'] = 'top', |
|||
:newline() |
|||
['width'] = '15%', |
|||
:done() |
|||
['padding'] = '1em' |
|||
} |
|||
:tag('b') |
|||
:wikitext('Items') |
|||
:done() |
|||
:done() |
:done() |
||
:tag('td') |
|||
:css{ |
|||
end |
|||
['max-width'] = '85%', |
|||
['width'] = 'auto', |
|||
if (args.recommended) then |
|||
['padding'] = '0.3em' |
|||
table |
|||
} |
|||
:tag( 'tr' ) |
|||
:tag('div') |
|||
:addClass('lighttable checklist') |
|||
: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( |
:tag('td') |
||
:css{ |
|||
:attr('style', 'max-width:85%; width:auto; padding-left: 1em;') |
|||
['max-width'] = '85%', |
|||
:tag('div') |
|||
['width'] = 'auto', |
|||
:addClass('lighttable checklist') |
|||
['padding-left'] = '1em' |
|||
:newline() |
|||
} |
|||
:wikitext( args.recommended ) |
|||
:tag('div') |
|||
:addClass('lighttable checklist') |
|||
:newline() |
|||
:wikitext(args.recommended) |
|||
:newline() |
|||
:done() |
|||
:done() |
:done() |
||
:done() |
|||
:END() |
|||
end |
|||
:IF(args.enemies) |
|||
:tag('tr') |
|||
if (args.enemies) then |
|||
:tag('td') |
|||
table |
|||
:css{ |
|||
:tag( 'tr' ) |
|||
['vertical-align'] = 'top', |
|||
:tag( 'td' ) |
|||
['width'] = '15%', |
|||
['padding'] = '1em' |
|||
} |
|||
:tag('b') |
|||
:attr('style', 'vertical-align:top; width:15%; padding: 1em;') |
|||
:wikitext('Enemies') |
|||
:done() |
|||
:done() |
:done() |
||
:tag( |
:tag('td') |
||
:css{ |
|||
['max-width'] = '85%', |
|||
:newline() |
|||
['width'] = 'auto', |
|||
:wikitext( args.enemies ) |
|||
['padding-left'] = '1em', |
|||
:done() |
|||
['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 |
||
Revision as of 16:14, 22 November 2024
Module documentation
This documentation is transcluded from Module:QuestDetails/doc. [edit] [history] [purge]
This module does not have any documentation. Please consider adding documentation at Module:QuestDetails/doc. [edit]
Module:QuestDetails's function details is invoked by Template:QuestDetails.
Module:QuestDetails requires Module:Mw.html extension.
require('Module:Mw.html extension')
local p = {}
function p.details(frame)
local args = frame:getParent().args
mw.smw.set({
start_point = args.start_point,
required_for = args.required_for,
next_quest = args.next_quest,
requirements = args.requirements and '\n'..args.requirements,
items = args.items and '\n'..args.items,
recommended = args.recommended and '\n'..args.recommended,
enemies = args.enemies,
override_seq = args.override_seq or 9999
})
local requirements = args.requirements or 'None'
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()
:tag('td')
:css{
['max-width'] = '85%',
['width'] = 'auto',
['padding-left'] = '1em',
['padding-right'] = '2em'
}
:tag('p')
:wikitext(args.start_point)
:done()
:done()
:done()
:IF(args.required_for)
:tag('tr')
:tag('td')
:css{
['vertical-align'] = 'top',
['width'] = '15%',
['padding'] = '1em'
}
:tag('b')
:wikitext('Required for')
:done()
:done()
:tag('td')
:tag('div')
:css{
['max-width'] = '85%',
['width'] = 'auto',
['padding-left'] = '1em',
['padding-right'] = '2em'
}
:newline()
:wikitext(args.required_for)
:done()
:done()
:done()
:END()
:tag('tr')
:tag('td')
:css{
['vertical-align'] = 'top',
['width'] = '15%',
['padding'] = '1em'
}
:tag('b')
:wikitext('Requirements')
:done()
:done()
:tag('td')
:css{
['max-width'] = '85%',
['width'] = 'auto',
['padding'] = '0.3em'
}
:tag('div')
:addClass('lighttable checklist')
:newline()
:wikitext(requirements)
:newline()
:done()
:done()
:done()
:IF(args.items)
:tag('tr')
:tag('td')
:css{
['vertical-align'] = 'top',
['width'] = '15%',
['padding'] = '1em'
}
:tag('b')
:wikitext('Items')
:done()
:done()
:tag('td')
:css{
['max-width'] = '85%',
['width'] = 'auto',
['padding'] = '0.3em'
}
:tag('div')
:addClass('lighttable checklist')
: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()
:tag('td')
:css{
['max-width'] = '85%',
['width'] = 'auto',
['padding-left'] = '1em'
}
:tag('div')
:addClass('lighttable checklist')
:newline()
:wikitext(args.recommended)
:newline()
:done()
:done()
:done()
:END()
:IF(args.enemies)
:tag('tr')
:tag('td')
:css{
['vertical-align'] = 'top',
['width'] = '15%',
['padding'] = '1em'
}
:tag('b')
:wikitext('Enemies')
:done()
:done()
:tag('td')
:css{
['max-width'] = '85%',
['width'] = 'auto',
['padding-left'] = '1em',
['padding-right'] = '2em'
}
:tag('div')
:newline()
:wikitext(args.enemies)
:done()
:done()
:done()
:END()
:done()
return table
end
return p