FANDOM


-- <pre>
-- {{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 <small>[' .. tostring( title ) .. ' edit]</small>'
    local args = {}
 
    for k, v in pairs(_args) do
        if v ~= '' then
            args[k] = v
        end
    end
 
    local icon = args.icon and '[[File:' .. args.icon .. '|50px|right]]' or ''
    local start = args.start or unknown
    local members = yesno( args.members ) and '[[File:P2P icon.png|30px|link=]] Members only' or
        -- check it's actually set to something false-y
        yesno( args.members ) == false and '[[File:F2P icon.png|30px|link=]] Free to play' or unknown
    local difficulties = {
        none = 'None',
        tutorial = '[[File:Novice.svg|7px|Tutorial|link=]] Tutorial',
        novice = '[[File:Novice.svg|7px|Novice|link=]] Novice',
        intermediate = '[[File:Intermediate.svg|7px|Intermediate|link=]] Intermediate',
        experienced = '[[File:Experienced.svg|7px|Experienced|link=]] Experienced',
        master = '[[File:Master.svg|7px|Master|link=]] Master',
        grandmaster = '[[File:Grandmaster.svg|7px|Grandmaster|link=]] Grandmaster',
        special = '[[File:Special.svg|7px|Special|link=]] Special'
    }
    local difficulty = difficulties[mw.ustring.lower(args.difficulty or '')] or unknown
    local length = args.length or unknown
    local etime = args.etime or ''
    local reqs = args.requirements or 'None'
    local items = args.items or '* None'
    local kills = args.kills or 'None'
 
    if etime ~= '' then
        etime = ' ('..etime..')'
    end
 
    tbl
        :tag( 'tr' )
            :tag( 'th' )
                :addClass( 'questdetails-header' )
                :wikitext( 'Start point' )
                :done()
            :tag( 'td' )
                :addClass( 'questdetails-info' )
                :wikitext( '[[File:Quest map icon.png|17px|link=]] ' .. 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..etime )
                :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( '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

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.