Module:Sandbox/Mona37/IncreaseTest

From Fallen London Wiki (Staging)

Documentation for this module may be created at Module:Sandbox/Mona37/IncreaseTest/doc

local IncreaseTest = {}

function IncreaseTest.Increase(frame)
    local args = frame:getParent().args
    local subcategory = ''
    local out = ''
    
    if args[1] == nil then
        out = out .. 'Error: Missing parameter 1'
    else
        if args['image'] then
            out = out ..' [[File:'.. args['image'] ..']] '
        else
            out = out ..' '.. frame:expandTemplate{title = 'I', args = { args[1] } } .. ' '
        end
        if args['now'] then
            out = out ..' An occurrence! Your <b>\'[['.. args[1] ..']]\'</b> Quality is now '.. args['now'] ..'!'
        else
            if not args['Change description'] then
                out = out .. '\'\'\'[['.. args[1] ..']]\'\'\'' 
            end
            if args['to'] then
                out = out ..' has increased to '.. args['to'] ..'!'
            else
                if args['Change description'] then
                    out = out .. ' \'\''.. args['Change description'] ..'\'\''
                else
                    out = out ..' is increasing…'
                end
                out = out ..' ('
                if args[2] then
                    out = out .. args[2]
                else
                    out = out ..'+? CP'
                    out = out ..frame:preprocess('<includeonly>[[Category:Missing CP]]</includeonly>')
                end
                if args['Quirk cap'] then
                    out = out ..', up to level '.. args['Quirk cap']
                    if args['Quirk cap'] == '5' then
                        subcategory = '|1'
                    elseif args['Quirk cap'] == '10' then
                        subcategory = '|2'
                    elseif args['Quirk cap'] == '15' then
                        subcategory = '|3'
                    end
                end
                out = out .. ')'
            end
        end
        out = out .. frame:preprocess('<includeonly>[[Category:'.. args[1] ..' Gain'.. subcategory ..']]</includeonly>')
    end
    
    return out
end
 
return IncreaseTest