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

De Les Archives de Vault-Tec
Kharmitch (discussion | contributions)
Page créée avec « local localdata = require( 'Module:Infobox/Localdata' ) function buildResistance(localdata, type) local rd = 0 local sd = 0 if localdata['rd '..type] then rd = loc… »
 
Kharmitch (discussion | contributions)
mAucun résumé des modifications
 
(6 versions intermédiaires par le même utilisateur non affichées)
Ligne 12 : Ligne 12 :
sd = localdata['sd '..type]
sd = localdata['sd '..type]
end
end
 
return rd..' [[Résistance aux dégâts|RD]] / '..sd..' [[Seuil de dégâts|SD]]'
return '<span class="avt-infobox-armor-rdsd">' ..  sd ..  
'</span> · <span class="avt-infobox-armor-rdsd">' ..
rd .. ' %</span>'
end
end


Ligne 19 : Ligne 21 :
parts = {
parts = {
{ type = 'title', value = 'nom', subtitle = 'sous-titre', subhead = { games = 'jeux', subject = 'Armure', link = 'Armures et vêtements' }},
{ type = 'title', value = 'nom', subtitle = 'sous-titre', subhead = { games = 'jeux', subject = 'Armure', link = 'Armures et vêtements' }},
{ type = 'images', imageparameters = { 'image', 'image2', 'image3', 'image4', 'image5' }, captionparameter = 'légende' },
{ type = 'images', imageparameters = { 'image', 'image2', 'image3', 'image4', 'image5' }, captionparameter = { 'légende', 'image desc' }},
{ type = 'text', value = 'test' },
{ type = 'text', value = 'test' },
{ type = 'table', title = 'Statistiques', rows = {
{ type = 'table', title = 'Statistiques', rows = {
{ type = 'row', label = 'Bonus de [[Classe d\'armure|CA]]', value = 'bonus ca' },
{ type = 'row', label = '[[Classe d\'armure]]', value = 'bonus ca' },
{ type = 'row', label = 'Effets', value = 'effets' },
{ type = 'row', label = 'Effets', value = 'effets' },
{ type = 'row', label = 'Poids', value = 'poids' },
{ type = 'row', label = 'Poids', value = 'poids' },
{ type = 'row', label = 'Valeur', value = 'valeur' }
{ type = 'row', label = 'Valeur', value = 'valeur' }
}},
}},
{ type = 'table', title = 'Résistances', rows = {
{ type = 'table', title = 'Résistances ([[Seuil de dégâts|SD]] · [[Résistance aux dégâts|RD]])', rows = {
{ type = 'row', label = 'Normal', value = function (localdata) return buildResistance(localdata, 'normal') end },
{ type = 'row', label = 'Normal', value = function (localdata) return buildResistance(localdata, 'normal') end },
{ type = 'row', label = 'Laser',  value = function (localdata) return buildResistance(localdata, 'laser') end },
{ type = 'row', label = 'Laser',  value = function (localdata) return buildResistance(localdata, 'laser') end },
{ type = 'row', label = 'Feu',    value = function (localdata) return buildResistance(localdata, 'feu') end },
{ type = 'row', label = 'Feu',    value = function (localdata) return buildResistance(localdata, 'feu') end },
{ type = 'row', label = 'Énergie',    value = function (localdata) return buildResistance(localdata, 'énergie') end },
{ type = 'row', label = 'Plasma', value = function (localdata) return buildResistance(localdata, 'plasma') end },
{ type = 'row', label = 'Plasma',   value = function (localdata) return buildResistance(localdata, 'plasma') end },
{ type = 'row', label = 'Électricité', value = function (localdata) return buildResistance(localdata, 'élec') end },
{ type = 'row', label = 'Électricité',   value = function (localdata) return buildResistance(localdata, 'élec') end },
{ type = 'row', label = 'Explosif', value = function (localdata) return buildResistance(localdata, 'expl') end },
{ type = 'row', label = 'Explosif',   value = function (localdata) return buildResistance(localdata, 'expl') end },
{ type = 'row', label = 'IEM', value = function (localdata) return buildResistance(localdata, 'iem') end }
{ type = 'row', label = 'IEM',   value = function (localdata) return buildResistance(localdata, 'iem') end }
}},
}},
{ type = 'table', title = 'Technique', rows = {
{ type = 'table', title = 'Technique', rows = {
{ type = 'row', label = 'Prototype ID', value = 'proto' },
{ type = 'row', label = 'Prototype ID', value = 'proto' },
{ type = 'row', label = 'Fichier dialogue',  value ='dialogue' }
{ type = 'row', label = 'Fichier dialogue',  value ='dialogue' }
}}
}},
{ type = 'text', value = 'pied' }
}
}
}
}

Dernière version du 11 août 2021 à 15:52

Documentation du module

Ce module contient le paramétrage de l'infobox {{Infobox armure}}.

Documentation transclues de Module:Infobox/Armure/doc.
local localdata = require( 'Module:Infobox/Localdata' )

function buildResistance(localdata, type)
	local rd = 0
	local sd = 0
	
	if localdata['rd '..type] then
		rd = localdata['rd '..type]
	end
	
	if localdata['sd '..type] then
		sd = localdata['sd '..type]
	end

	return '<span class="avt-infobox-armor-rdsd">' ..  sd .. 
		'</span> · <span class="avt-infobox-armor-rdsd">' ..
		rd .. ' %</span>'
end

return {
	parts = {
		{ type = 'title', value = 'nom', subtitle = 'sous-titre', subhead = { games = 'jeux', subject = 'Armure', link = 'Armures et vêtements' }},
		{ type = 'images', imageparameters = { 'image', 'image2', 'image3', 'image4', 'image5' }, captionparameter = { 'légende', 'image desc' }},
		{ type = 'text', value = 'test' },
		{ type = 'table', title = 'Statistiques', rows = {
			{ type = 'row', label = '[[Classe d\'armure]]', value = 'bonus ca' },
			{ type = 'row', label = 'Effets', value = 'effets' },
			{ type = 'row', label = 'Poids', value = 'poids' },
			{ type = 'row', label = 'Valeur', value = 'valeur' }
		}},
		{ type = 'table', title = 'Résistances ([[Seuil de dégâts|SD]] · [[Résistance aux dégâts|RD]])', rows = {
			{ type = 'row', label = 'Normal', value = function (localdata) return buildResistance(localdata, 'normal') end },
			{ type = 'row', label = 'Laser',  value = function (localdata) return buildResistance(localdata, 'laser') end },
			{ type = 'row', label = 'Feu',    value = function (localdata) return buildResistance(localdata, 'feu') end },
			{ type = 'row', label = 'Plasma', value = function (localdata) return buildResistance(localdata, 'plasma') end },
			{ type = 'row', label = 'Électricité', value = function (localdata) return buildResistance(localdata, 'élec') end },
			{ type = 'row', label = 'Explosif', value = function (localdata) return buildResistance(localdata, 'expl') end },
			{ type = 'row', label = 'IEM', value = function (localdata) return buildResistance(localdata, 'iem') end }
		}},
		{ type = 'table', title = 'Technique', rows = {
			{ type = 'row', label = 'Prototype ID', value = 'proto' },
			{ type = 'row', label = 'Fichier dialogue',  value ='dialogue' }
		}},
		{ type = 'text', value = 'pied' }
	}
}