« Module:Infobox/Armure gamebryo » : différence entre les versions
Page créée avec « local localdata = require( 'Module:Infobox/Localdata' ) -------------------------------------------------------- ----- Calcul des champs à afficher -----… » |
(Aucune différence)
|
Version du 31 juillet 2021 à 19:05
Ce module contient le paramétrage de l'infobox {{Infobox armure gamebryo}}.
local localdata = require( 'Module:Infobox/Localdata' )
--------------------------------------------------------
----- Calcul des champs à afficher -----
--------------------------------------------------------
local games = (localdata['jeux'] or ''):lower()
local isFo3 = games:find('fo3') ~= nil
local isFnv = games:find('fnv') ~= nil
local objectName2 = localdata['nom objet2']
-- Résistance et seuil de dégâts
local rd, sd, rd2, sd2
if isFo3 then
rd = localdata['rd'] or '?'
if objectName2 then
rd2 = localdata['rd2'] or '?'
sd2 = nil
end
end
if isFnv then
rd = localdata['rd'] or nil
sd = localdata['sd'] or '?'
if objectName2 then
rd2 = localdata['rd2'] or nil
sd2 = localdata['sd2'] or '?'
end
end
-- Type d'armure ou vêtement
local armorType = (localdata['type'] or 'armure'):lower()
local isUnique = armorType:find('unique')
local armorType = armorType:gsub(' unique', '')
local ibSubject
if objectName2 then
local cases = {
['armure'] = 'd\'armure',
['vêtement'] = 'de vêtement'
}
ibSubject = 'Ensemble ' .. (cases[armorType] or 'd\'armure')
else
local cases = {
['armure'] = 'Armure',
['casque'] = 'Casque',
['couvre-chef'] = 'Couvre-chef',
['vêtement'] = 'Vêtement'
}
ibSubject = cases[armorType] or 'Armure'
end
-- Gestion de l'affichage en fonction du type d'armure
local objectTableLabel1, objectTable2
if objectName2 then
objectTableLabel1 = require( 'Module:Outils' ).simpletitle(mw.getCurrentFrame())
objectTable2 = { type = 'table', title = objectName2, rows = {
{ type = 'row', label = 'Résistance aux dégâts', value = function() return rd2 end },
{ type = 'row', label = 'Seuil de dégâts', value = function() return sd2 end },
{ type = 'row', label = 'Points de vie', value = 'pv2' },
{ type = 'row', label = 'Poids', value = 'poids2' },
{ type = 'row', label = 'Valeur', value = 'valeur2' },
{ type = 'row', label = 'Classe', value = 'classe2' },
{ type = 'row', label = 'Effets', value = 'effets2' },
{ type = 'row', label = 'Réparation', value = { 'réparation2', 'reparation2' }},
{ type = 'row', label = '[[Form ID|Base ID]]', value = 'baseid2' },
}}
else
objectTable2 = { type = 'text' }
end
local objectTable1 = { type = 'table', title = objectTableLabel1, separator = objectTableLabel1 == nil, rows = {
{ type = 'row', label = 'Résistance aux dégâts', value = function() return rd end },
{ type = 'row', label = 'Seuil de dégâts', value = function() return sd end },
{ type = 'row', label = 'Points de vie', value = 'pv' },
{ type = 'row', label = 'Poids', value = 'poids' },
{ type = 'row', label = 'Valeur', value = 'valeur' },
{ type = 'row', label = 'Classe', value = 'classe' },
{ type = 'row', label = 'Effets', value = 'effets' },
{ type = 'row', label = 'Réparation', value = { 'réparation', 'reparation' }},
{ type = 'row', label = '[[Form ID|Base ID]]', value = 'baseid' },
}}
--------------------------------------------------------
----- Construction de l'infobox -----
--------------------------------------------------------
return {
parts = {
{ type = 'title', value = 'nom', subtitle = 'sous-titre', icon = 'icône', subhead = { games = 'jeux', subject = ibSubject, link = 'Armures et vêtements' }},
{ type = 'images', imageparameters = { 'image', 'image2', 'image3', 'image4', 'image5' }, captionparameter = { 'légende', 'image desc' }},
objectTable1,
objectTable2,
{ type = 'text', value = 'pied' }
}
}