Module:QuestDetails

-- -- --

local p = {} local yesno = require( 'Module:Yesno' ) local onmain = require('Module:Mainonly').on_main function p.details( frame ) local _args = frame:getParent.args local tbl = mw.html.create( 'table' ) :addClass( 'questdetails plainlinks' ) -- @todo replace with CSS :attr( 'cellspacing', '3' ) local title = mw.uri.fullUrl( mw.title.getCurrentTitle.fullText, { action = 'edit' } ) local unknown = 'Unknown [' .. tostring( title ) .. ' edit] ' local args = {} for k, v in pairs(_args) do       if v ~= '' then args[k] = v       end end local start = args.start or unknown local rponly = yesno( args.rponly ) and 'Yes' or       -- check it's actually set to something false-y yesno( args.rponly ) == false and 'No' or unknown local minlevel = args.minlevel or '' local maxlevel = args.maxlevel or '' local reqs = args.requirements or '* None' local items = args.items or '* None' local kills = args.kills or '* None' local itemschecklist = items if items ~= '* None' then itemschecklist = ' \n'..items..' ' --frame:expandTemplate{ title = 'Checklist', args = { items } } end local killschecklist = kills if kills ~= '* None' then killschecklist = ' \n'..kills..' ' --frame:expandTemplate{ title = 'Checklist', args = { kills } } end local additional = args.additional or '' tbl :tag( 'tr' ) :tag( 'th' ) :addClass( 'questdetails-header' ) :wikitext( 'Start point' ) :done :tag( 'td' ) :addClass( 'questdetails-info' ) :wikitext( start ) :done :done :tag( 'tr' ) :tag( 'th' ) :addClass( 'questdetails-header' ) :wikitext( 'RP only' ) :done :tag( 'td' ) :addClass( 'questdetails-info' ) :wikitext( rponly ) :done :done :tag( 'tr' ) :tag( 'th' ) :addClass( 'questdetails-header' ) :wikitext( 'Levels' ) :done :tag( 'td' ) :addClass( 'questdetails-info' ) :wikitext( minlevel .. ' to ' .. maxlevel ) :done :done :tag( 'tr' ) :tag( 'th' ) :addClass( 'questdetails-header' ) :wikitext( 'Requirements' ) :done :tag( 'td' ) :addClass( 'questdetails-info' ) :newline:newline :wikitext( reqs ) :done :done :tag( 'tr' ) :tag( 'th' ) :addClass( 'questdetails-header' ) :wikitext( 'Items required' ) :done :tag( 'td' ) :addClass( 'questdetails-info' ) :newline:newline :wikitext( itemschecklist ) :done :done :tag( 'tr' ) :tag( 'th' ) :addClass( 'questdetails-header' ) :wikitext( 'Enemies to defeat' ) :done :tag( 'td' ) :addClass( 'questdetails-info' ) :newline:newline :wikitext( killschecklist ) :done :done if args.additional ~= nil and yesno( args.additional ) ~= false then additionalchecklist = ' \n'..args.additional..' ' --frame:expandTemplate{ title = 'Checklist', args = { args.additional } } tbl :tag( 'tr' ) :tag( 'th' ) :addClass( 'questdetails-header' ) :wikitext( 'Additional tasks' ) :done :tag( 'td' ) :addClass( 'questdetails-info' ) :newline:newline :wikitext( additionalchecklist ) :done :done end

return tostring( tbl ) end

return p