Module:InfoboxNPC: Difference between revisions

From Elwiki
No edit summary
No edit summary
 
Line 20: Line 20:
         {
         {
             id = 'name',
             id = 'name',
             localize = 'Full Name',
             localize = args.l_name,
             dual = true
             dual = true
         },
         },
         {
         {
             id = 'class'
             id = 'class',
            localize = args.l_class
         },
         },
         {
         {
             id = 'weapon',
             id = 'weapon',
            localize = args.l_weapon,
             dual = true
             dual = true
         },
         },
         {
         {
             id = 'age',
             id = 'age',
            localize = args.l_age,
             dual = true
             dual = true
         },
         },
         {
         {
             id = 'race',
             id = 'race',
            localize = args.l_race,
             dual = true
             dual = true
         },
         },
         {
         {
             id = 'role',
             id = 'role',
            localize = args.l_role,
             dual = true
             dual = true
         },
         },
         {
         {
             id = 'village',
             id = 'village',
             localize = 'Location',
             localize = args.l_village,
             dual = true
             dual = true
         },
         },
         {
         {
             id = 'Height',
             id = 'Height',
            localize = args.l_height,
             dual = true
             dual = true
         },
         },
         {
         {
             id = 'Weight',
             id = 'Weight',
            localize = args.l_weight,
             dual = true
             dual = true
         },
         },
         {
         {
             id = 'Blood',
             id = 'Blood',
             localize = 'Blood Type',
             localize = args.l_blood,
             dual = true
             dual = true
         },
         },
         {
         {
             id = 'groups',
             id = 'groups',
             localize = 'Affiliations',
             localize = args.l_groups,
             collapsed = true
             collapsed = true
         },
         },
         {
         {
             id = 'VA',
             id = 'VA',
             localize = 'Voice Actors',
             localize = args.l_va,
             dual = true,
             dual = true,
             collapsed = true
             collapsed = true

Latest revision as of 11:25, 13 October 2023

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