« Module:Infobox/Munition gamebryo » : différence entre les versions
mAucun résumé des modifications |
Harmonisation des identifiants techniques |
||
(Une version intermédiaire par le même utilisateur non affichée) | |||
Ligne 20 : | Ligne 20 : | ||
weight = weight or '?' | weight = weight or '?' | ||
if isFnv then | if isFnv then | ||
weight = weight .. '(' .. weightHm .. ' en [[mode Hardcore]])' | weight = weight .. ' (' .. weightHm .. ' en [[mode Hardcore]])' | ||
else | else | ||
weight = weight .. '(' .. weightHm .. ' en [[mode Survie]])' | weight = weight .. ' (' .. weightHm .. ' en [[mode Survie]])' | ||
end | end | ||
end | end | ||
Ligne 29 : | Ligne 29 : | ||
{ type = 'row', label = 'Poids', value = function() return weight end }, | { type = 'row', label = 'Poids', value = function() return weight end }, | ||
{ type = 'row', label = 'Valeur', value = 'valeur' .. index }, | { type = 'row', label = 'Valeur', value = 'valeur' .. index }, | ||
{ type = 'row', label = ' | { type = 'row', label = 'Form ID', value = 'formid' .. index } | ||
}} | }} | ||
else | else |
Dernière version du 21 janvier 2023 à 16:29
Ce module contient le paramétrage de l'infobox {{Infobox munition gamebryo}}.
local localdata = require( 'Module:Infobox/Localdata' )
local tooltip = require( 'Module:Infobulle' )
local games = (localdata['jeux'] or ''):lower()
local isFnv = games:find('fnv') ~= nil
local isFo4 = games:find('fo4') ~= nil
--------------------------------------------------------
----- Fonction communes -----
--------------------------------------------------------
function buildObjectTable(index, objectName, hasSeparator)
local objectTable
if objectName or index == '' then
local weight = localdata['poids' .. index]
local weightHm = localdata['poids hardcore' .. index]
if isFo4 or isFnv then
weightHm = weightHm or '?'
weight = weight or '?'
if isFnv then
weight = weight .. ' (' .. weightHm .. ' en [[mode Hardcore]])'
else
weight = weight .. ' (' .. weightHm .. ' en [[mode Survie]])'
end
end
objectTable = { type = 'table', title = objectName, separator = hasSeparator, rows = {
{ type = 'row', label = 'Poids', value = function() return weight end },
{ type = 'row', label = 'Valeur', value = 'valeur' .. index },
{ type = 'row', label = 'Form ID', value = 'formid' .. index }
}}
else
objectTable = { type = 'text' }
end
return objectTable
end
--------------------------------------------------------
----- Calcul des champs à afficher -----
--------------------------------------------------------
local objectName2 = localdata['nom mun2']
local objectName3 = localdata['nom mun3']
local objectName4 = localdata['nom mun4']
local objectName5 = localdata['nom mun5']
local objectName6 = localdata['nom mun6']
local objectName7 = localdata['nom mun7']
local objectName8 = localdata['nom mun8']
local objectName9 = localdata['nom mun9']
local objectTableLabel1
if objectName2 or objectName3 or objectName4 or objectName5 or
objectName6 or objectName7 or objectName8 or objectName9 then
objectTableLabel1 = localdata['nom mun']
or localdata['nom']
or require( 'Module:Outils' ).simpletitle(mw.getCurrentFrame())
end
local objectTable1 = buildObjectTable('', objectTableLabel1, objectTableLabel1 == nil)
local objectTable2 = buildObjectTable('2', objectName2, false)
local objectTable3 = buildObjectTable('3', objectName3, false)
local objectTable4 = buildObjectTable('4', objectName4, false)
local objectTable5 = buildObjectTable('5', objectName5, false)
local objectTable6 = buildObjectTable('6', objectName6, false)
local objectTable7 = buildObjectTable('7', objectName7, false)
local objectTable8 = buildObjectTable('8', objectName8, false)
local objectTable9 = buildObjectTable('9', objectName9, false)
--------------------------------------------------------
----- Construction de l'infobox -----
--------------------------------------------------------
return {
parts = {
{ type = 'title', value = 'nom', subtitle = 'sous-titre', icon = 'icône', subhead = { games = 'jeux', subject = 'Munition', link = 'Munitions' }},
{ type = 'images', imageparameters = { 'image', 'image2', 'image3', 'image4', 'image5' }, captionparameter = { 'légende', 'image desc' }},
objectTable1,
objectTable2,
objectTable3,
objectTable4,
objectTable5,
objectTable6,
objectTable7,
objectTable8,
objectTable9,
{ type = 'text', value = 'pied' }
}
}