Module:MissionDetails: Difference between revisions

No edit summary
mNo edit summary
 
(8 intermediate revisions by the same user not shown)
Line 16: Line 16:
     impossible = 'Impossible',
     impossible = 'Impossible',
}
}
difficulties[1].style.color=red;   
function p.details( frame )
function p.details( frame )
     local _args = frame:getParent().args
     local _args = frame:getParent().args
Line 35: Line 34:
     local icon = args.icon and '[[File:' .. args.icon .. '|50px|right]]' or ''
     local icon = args.icon and '[[File:' .. args.icon .. '|50px|right]]' or ''
     local start = args.start or unknown
     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 difficulty = difficulties[mw.ustring.lower(args.difficulty or '')] or unknown
     local difficulty = difficulties[mw.ustring.lower(args.difficulty or '')] or unknown
     local length = args.length or unknown
     local length = args.length or unknown
Line 56: Line 52:
             :tag( 'td' )
             :tag( 'td' )
                 :addClass( 'missiondetails-info' )
                 :addClass( 'missiondetails-info' )
                 :wikitext( '[[File:mission map icon.png|17px|link=]] ' .. icon .. start )
                 :wikitext( '' .. icon .. start )
                :done()
            :done()
        :tag( 'tr' )
            :tag( 'th' )
                :addClass( 'missiondetails-header' )
                :wikitext( 'Member requirement' )
                :done()
            :tag( 'td' )
                :addClass( 'missiondetails-info' )
                :wikitext( members )
                 :done()
                 :done()
             :done()
             :done()
Line 98: Line 84:
                 :addClass( 'qc-active' )
                 :addClass( 'qc-active' )
                 :tag( 'i' )
                 :tag( 'i' )
                     :wikitext( 'Skill requirements are not boostable unless marked with a [B] for boostable.' )
                     :wikitext( '' )
                     :done()
                     :done()
                 :newline():newline()
                 :newline():newline()
Line 112: Line 98:
                 :addClass( 'missiondetails-info' )
                 :addClass( 'missiondetails-info' )
                 :tag( 'i' )
                 :tag( 'i' )
                     :wikitext( 'Items from the [[tool belt]] are not listed unless they do not work or are not automatically added.' )
                     :wikitext( '' )
                     :done()
                     :done()
                 :newline():newline()
                 :newline():newline()
Line 168: Line 154:
items = args.items or 'None',
items = args.items or 'None',
kills = args.kills or 'None',
kills = args.kills or 'None',
members = yesno(args.members,false)
}
}
local jsongood, encsmwJSON = pcall(mw.text.jsonEncode, smwJSON)
local jsongood, encsmwJSON = pcall(mw.text.jsonEncode, smwJSON)
Line 191: Line 176:
local smw = {
local smw = {
['Official difficulty'] = args.difficulty or nil,
['Official difficulty'] = args.difficulty or nil,
['Is members only'] = yesno(args.members,false),
['Official length'] = args.length or nil,
['Official length'] = args.length or nil,
}
}
local smwstat = mw.smw.set(smw)
if not smwstat == true then
err = err .. ' ' .. smwstat.error
end
return tostring(info) .. tostring(err)
return tostring(info) .. tostring(err)