« Module:Infobox/Consommable » : différence entre les versions

Kharmitch (discussion | contributions)
mAucun résumé des modifications
Kharmitch (discussion | contributions)
Aucun résumé des modifications
Ligne 1 : Ligne 1 :
local localdata = require('Module:Infobox/Localdata')
local localdata = require('Module:Infobox/Localdata')


function buildPerkLabel(localdata, index)
function buildPerkRow(localdata, index)
local label = nil
local row = { type = 'text' } --fake
if(localdata['aptitude' .. index]) then
label = '[[' .. localdata['aptitude' .. index] .. ']]'
local perkLink = localdata['aptitude' .. index]
local perkEffect = localdata['effets aptitude' .. index]
if localdata['aptitude'..index] then
row = { type = 'row', label = perkLink, value = perkEffect }
end
end
return label
end
return row
 
function buildPerkValue(localdata, index)
local value = nil
if(localdata['effets aptitude' .. index]) then
value = localdata['effets aptitude' .. index]
end
return value
end
end


Ligne 46 : Ligne 43 :
{ type = 'table', title = 'Effets des aptitudes', collapseparameters = { collapsible = true, collapsed = true }, rows = {
{ type = 'table', title = 'Effets des aptitudes', collapseparameters = { collapsible = true, collapsed = true }, rows = {
{ type = 'row', label = 'Mutation', value = 'mutation' },
{ type = 'row', label = 'Mutation', value = 'mutation' },
{ type = 'row', label = function(localdata) return buildPerkLabel(localdata, '') end,  value = function(localdata) return buildPerkValue(localdata, '') end },
buildPerkRow(localdata, 1),
{ type = 'row', label = function(localdata) return buildPerkLabel(localdata, '2') end, value = function(localdata) return buildPerkValue(localdata, '2') end },
buildPerkRow(localdata, 2),
{ type = 'row', label = function(localdata) return buildPerkLabel(localdata, '3') end, value = function(localdata) return buildPerkValue(localdata, '3') end },
buildPerkRow(localdata, 3),
{ type = 'row', label = function(localdata) return buildPerkLabel(localdata, '4') end, value = function(localdata) return buildPerkValue(localdata, '4') end },
buildPerkRow(localdata, 4),
{ type = 'row', label = function(localdata) return buildPerkLabel(localdata, '5') end, value = function(localdata) return buildPerkValue(localdata, '5') end }
buildPerkRow(localdata, 5)
}},
}},
{ type = 'table', title = 'Technique', rows = {
{ type = 'table', title = 'Technique', rows = {