Module:InfoboxSE: Difference between revisions

From Elwiki
m (Ritsu moved page Module:SEbox to Module:InfoboxSE without leaving a redirect)
No edit summary
 
Line 22: Line 22:
     infobox:addClass('infobox-status');
     infobox:addClass('infobox-status');


     addField('Name', 'Debuff Name');
     local fields = {
    addField('Buff', 'Status Type', nil, status_type);
        {
    addField('Icon');
            id = 'Name',
    addField('MaxStack', 'Max Stacks', nil, max_stacks);
            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]]';
     return tostring(infobox) .. '[[Category: Status Effects]][[Category: ' .. status_type .. 's]]';

Latest revision as of 13:23, 8 September 2023

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