Module:InfoboxNPC: Difference between revisions

From Elwiki
No edit summary
No edit summary
Line 20: Line 20:
         addField('name', 'Full Name');
         addField('name', 'Full Name');
     end
     end
     addField2('name', 'Full Name');
 
    addField('class');
     local fields = {
    addField('weapon', nil, true);
        {
    addField('age', nil, true);
            id = 'name',
    addField('race', nil, true);
            localize = 'Full Name',
    addField('role', nil, true);
            special = true
    addField('village', 'Location', true);
        },
    addField('Height', nil, true);
        {
    addField('Weight', nil, true);
            id = 'class'
    addField('Blood', 'Blood Type', true);
        },
    addField('groups', 'Affiliations', nil, true);
        {
    addField('VA', 'Voice Actors', true, true);
            id = 'weapon',
            dual = true
        },
        {
            id = 'age',
            dual = true
        },
        {
            id = 'race',
            dual = true
        },
        {
            id = 'role',
            dual = true
        },
        {
            id = 'village',
            localize = 'Location',
            dual = true
        },
        {
            id = 'Height',
            dual = true
        },
        {
            id = 'Weight',
            dual = true
        },
        {
            id = 'Blood',
            localize = 'Blood Type',
            dual = true
        },
        {
            id = 'groups',
            localize = 'Affiliations',
            collapsed = true
        },
        {
            id = 'VA',
            localize = 'Voice Actors',
            dual = true,
            collapsed = true
        }
    }
 
    addFields(fields);
      
      
     return tostring(infobox);
     return tostring(infobox);

Revision as of 13:14, 8 September 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');

    if (args.name1 == nil and args.name2 == nil) then
        addField('name', 'Full Name');
    end

    local fields = {
        {
            id = 'name',
            localize = 'Full Name',
            special = true
        },
        {
            id = 'class'
        },
        {
            id = 'weapon',
            dual = true
        },
        {
            id = 'age',
            dual = true
        },
        {
            id = 'race',
            dual = true
        },
        {
            id = 'role',
            dual = true
        },
        {
            id = 'village',
            localize = 'Location',
            dual = true
        },
        {
            id = 'Height',
            dual = true
        },
        {
            id = 'Weight',
            dual = true
        },
        {
            id = 'Blood',
            localize = 'Blood Type',
            dual = true
        },
        {
            id = 'groups',
            localize = 'Affiliations',
            collapsed = true
        },
        {
            id = 'VA',
            localize = 'Voice Actors',
            dual = true,
            collapsed = true
        }
    }

    addFields(fields);
    
    return tostring(infobox);

end

return p