Module:QuestDetails

-- -- Module:Quest details --

local p = {} local yesno = require( 'Module:Yesno' ) function p.details( frame ) local args = frame:getParent.args local tbl = mw.html.create( 'table' ) :addClass( 'questdetails' ) -- @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 icon = args.icon and  or  local start = args.start or unknown local members = yesno( args.members ) and ' Members only' or       -- check it's actually set to something false-y yesno( args.members ) == false and ' Free to play' or unknown local difficulties = { none = 'None', tutorial = ' Tutorial', novice = ' Novice', intermediate = ' Intermediate', experienced = ' Experienced', master = ' Master', grandmaster = ' Grandmaster', special = ' Special' }   local difficulty = difficulties[mw.ustring.lower(args.difficulty or '')] or unknown local length = args.length or unknown local reqs = args.requirements or 'None' local items = args.items or '* None' local kills = args.kills or 'None' tbl :tag( 'tr' ) :tag( 'th' ) :addClass( 'questdetails-header' ) :wikitext( 'Start point' ) :done :tag( 'td' ) :addClass( 'questdetails-info' ) :wikitext( ' ' .. icon .. start ) :done :done :tag( 'tr' ) :tag( 'th' ) :addClass( 'questdetails-header' ) :wikitext( 'Member requirement' ) :done :tag( 'td' ) :addClass( 'questdetails-info' ) :wikitext( members) :done :done :tag( 'tr' ) :tag( 'th' ) :addClass( 'questdetails-header' ) :wikitext( 'Official difficulty' ) :done :tag( 'td' ) :addClass( 'questdetails-info' ) :wikitext( difficulty ) :done :done :tag( 'tr' ) :tag( 'th' ) :addClass( 'questdetails-header' ) :wikitext( 'Length' ) :done :tag( 'td' ) :addClass( 'questdetails-info' ) :wikitext( length ) :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' ) :tag( 'i' ) :wikitext( 'Items from the tool belt are not listed unless they do not work or are not automatically added.' ) :done :newline:newline :wikitext( items ) :done :done if args.recommended ~= nil and yesno( args.recommended ) ~= false then tbl :tag( 'tr' ) :tag( 'th' ) :addClass( 'questdetails-header' ) :wikitext( 'Items recommended' ) :done :tag( 'td' ) :addClass( 'questdetails-info' ) :newline:newline :wikitext( args.recommended ) :done :done end tbl :tag( 'tr' ) :tag( 'th' ) :addClass( 'questdetails-header' ) :wikitext( 'Enemies to defeat' ) :done :tag( 'td' ) :addClass( 'questdetails-info' ) :newline:newline :wikitext( kills ) :done :done

return tostring( tbl ) end

return p