Module:InfoboxNPC

From Elwiki

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

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

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

    if args.roleset then
        title = args.role1 .. '&' .. args.role2;
    else
        title = args.role;
    end

    local infobox = require('Module:InfoboxProto').main(frame, title);
    infobox:addClass('infobox-npc');

    local fields = {
        {
            id = 'name',
            localize = args.l_name,
            dual = true
        },
        {
            id = 'class',
            localize = args.l_class
        },
        {
            id = 'weapon',
            localize = args.l_weapon,
            dual = true
        },
        {
            id = 'age',
            localize = args.l_age,
            dual = true
        },
        {
            id = 'race',
            localize = args.l_race,
            dual = true
        },
        {
            id = 'role',
            localize = args.l_role,
            dual = true
        },
        {
            id = 'village',
            localize = args.l_village,
            dual = true
        },
        {
            id = 'Height',
            localize = args.l_height,
            dual = true
        },
        {
            id = 'Weight',
            localize = args.l_weight,
            dual = true
        },
        {
            id = 'Blood',
            localize = args.l_blood,
            dual = true
        },
        {
            id = 'groups',
            localize = args.l_groups,
            collapsed = true
        },
        {
            id = 'VA',
            localize = args.l_va,
            dual = true,
            collapsed = true
        }
    }

    addFields(fields);
    
    return tostring(infobox);

end

return p