Module:InfoboxNPC: Difference between revisions

From Elwiki
No edit summary
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 17: Line 17:
     infobox:addClass('infobox-npc');
     infobox:addClass('infobox-npc');


     if (args.name1 == nil and args.name2 == nil) then
     local fields = {
         addField('name', 'Full Name');
        {
    end
            id = 'name',
    addField2('name', 'Full Name');
            localize = args.l_name,
    addField('class');
            dual = true
    addField('weapon', nil, true);
        },
    addField('age', nil, true);
         {
    addField('race', nil, true);
            id = 'class',
    addField('role', nil, true);
            localize = args.l_class
    addField('village', 'Location', true);
        },
    addField('Height', nil, true);
        {
    addField('Weight', nil, true);
            id = 'weapon',
    addField('Blood', 'Blood Type', true);
            localize = args.l_weapon,
    addField('VA', 'Voice Actors', true);
            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);
     return tostring(infobox);

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