Module:QuestDetails: Difference between revisions

m
Simplify / cleanup (This code should have the exact same effect)
mNo edit summary
m (Simplify / cleanup (This code should have the exact same effect))
Line 1:
require('Module:Mw.html extension')
 
local p = {}
 
function p.details(frame)
local args = frame:getParent().args
 
local mw = require('mw')
mw.smw.set({
if start_point = args.start_point then,
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()
:tag( 'td' )
:tag('p')css{
['max-width'] = '85%',
:wikitext( args['start_point'] )
['width'] = 'auto',
:done()
:attr( ['style', 'max-width:85%; width:auto; padding-left:'] 1em; padding-right:= 2em;')1em',
['padding-right'] = '2em'
}
:tag('p')
:wikitext(args.start_point)
: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' )
:tag( ['bwidth'] )= '15%',
:wikitext( ['Requiredpadding'] for= '1em')
:done() }
:tag('b')
:attr('style', 'vertical-align:top; width:15%; padding: 1em;')
:wikitext('Required for')
:done()
:done()
: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()
end
table
:tag( 'tr' )
:tag( 'td' )
:attr('style', 'vertical-align:top; width:15%; padding: 1em;')
:tag( 'b' )
:wikitext('Requirements')
:done()
:done()
:tagEND( 'td' )
:tag('tr')
:attr('style', 'max-width:85%; width:auto; padding: 0.3em;')
:tag('divtd')
:css{
:addClass('lighttable checklist')
['vertical-align'] = 'top',
:newline()
['width'] = '15%',
:wikitext(requirements)
['padding'] = '1em'
:newline()
}
:done()
:tag('b')
:wikitext('Requirements')
:done()
:done()
:donetag('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;')
:tagaddClass('lighttable checklist'b' )
:wikitextnewline('Items')
:donewikitext(requirements)
:newline()
:done()
:tagdone( 'td' )
:done()
:attr('style', 'max-width:85%; width:auto; padding: 0.3em;')
:tagIF('div'args.items)
:tag('tr')
:addClass('lighttable checklist')
:newlinetag('td')
:css{
:wikitext(args.items)
['vertical-align'] = 'top',
:newline()
['width'] = '15%',
:done()
['padding'] = '1em'
}
:tag('b')
:wikitext('Items')
:done()
:done()
:donetag('td')
:css{
end
['max-width'] = '85%',
['width'] = 'auto',
if (args.recommended) then
['padding'] = '0.3em'
table
}
:tag( 'tr' )
:tag( 'tddiv' )
:tagaddClass('lighttable checklist'b' )
:wikitextnewline('Recommended')
: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()
:attr('style', 'vertical-align:top; width:15%; padding: 1em;')
:done()
: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 )
:newlinetag('div')
:addClass('lighttable checklist')
:newline()
:wikitext(args.recommended)
:newline()
: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' )
:tag( ['bwidth'] )= '15%',
:wikitext( ['padding'] = 'Enemies1em')
:done() }
:tag('b')
:attr('style', 'vertical-align:top; width:15%; padding: 1em;')
:wikitext('Enemies')
:done()
:done()
:tag( 'td' )
:tag('div')css{
['max-width'] = '85%',
:newline()
['width'] = 'auto',
:wikitext( args.enemies )
['padding-left'] = '1em',
:done()
:attr( ['style', 'max-width:85%; width:auto; padding-left:right'] 1em; padding-right:= '2em;')
}
:tag('div')
:newline()
:wikitext(args.enemies)
:done()
:done()
:done()
:END()
end
:done()
 
table:done()
return table
return tostring( table )
end
 
661

edits