Module:InfoboxNPC: Difference between revisions
From Elwiki
m (Protected "Module:NPCbox": Easily broken pages ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))) |
No edit summary |
||
(7 intermediate revisions by the same user not shown) | |||
Line 17: | Line 17: | ||
infobox:addClass('infobox-npc'); | 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); | 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