Module:InfoboxSE

From Elwiki

Documentation for this module may be created at Module:InfoboxSE/doc

require('Module:CommonFunctions')
local getArgs = require('Module:Arguments').getArgs
local p = {}

-- Main process
function p.main(frame)
    local args = getArgs(frame);

    local status_type = '';
    if args['Buff'] == nil then
        status_type = 'Debuff';
    else
        status_type = 'Buff';
    end

    local max_stacks = 1;
    if args['MaxStack'] ~= nil then
        max_stacks = args['MaxStacks'];
    end

    local infobox = require('Module:InfoboxProto').main(frame, args['Name']);
    infobox:addClass('infobox-status');

    local fields = {
        {
            id = 'Name',
            localize = 'Debuff Name'
        },
        {
            id = 'Buff',
            localize = 'Status Type',
            value = status_type
        },
        {
            id = 'Icon'
        },
        {
            id = 'MaxStack',
            localize = 'Max Stacks',
            value = max_stacks
        }
    }

    addFields(fields);

    return tostring(infobox) .. '[[Category: Status Effects]][[Category: ' .. status_type .. 's]]';

end

return p