Module:Infobox/Arme

De Les Archives de Vault-Tec
Documentation du module

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

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

-- Liste des modes d'attaque autorisés
local attackModes = {
	['simple'] = 'Tir simple',
	['précis'] = 'Tir précis',
	['rafale'] = 'Rafale'
}

-- Génère une liste des modes d'attaque en
-- précisant la portée et les points d'action
function buildAttackModes(localdata)
	local items = ''
	for i = 1, 3 do
		local attmode = localdata['attmode' .. i] or ''
		attmode = attackModes[attmode:lower()]
		if attmode then
			local ap = localdata['attmode' .. i .. ' pa'] or '?'
			local range = localdata['attmode' .. i .. ' portée'] or '?'
			items = items .. '<li>' .. attmode ..
				'<span style="float:right;">(' .. ap ..
				' [[Fichier:Icon action.png|x14px|link=Points d\'action|alt=Points d\'action]], ' ..
				range .. ' [[Fichier:Icon range.png|x14px|link=Portée|alt=Portée]])</span></li>'
		else
			break
		end
	end
	
	if #items > 0 then
		return '<ul class="avt-simple-list">' .. items .. '</ul>'
	else
		return
	end
end

return {
	parts = {
		{ type = 'title', value = 'nom', subtitle = 'sous-titre', icon = 'icône', subhead = { games = 'jeux', subject = 'Arme', link = 'Armes' }},
		{ type = 'images', imageparameters = { 'image', 'image2', 'image3', 'image4', 'image5' }, captionparameter = { 'légende', 'image desc' }},
		{ type = 'table', title = 'Dégâts et attaques', rows = {
			{ type = 'row', label = 'Dégâts', value = 'dégâts' },
			{ type = 'row', label = 'Type de dégâts', value = 'type dégâts' },
			{ type = 'row', label = 'Modes d\'attaque', value = function(localdata) return buildAttackModes(localdata) end }
		}},
		{ type = 'table', title = 'Munitions', rows = {
			{ type = 'row', label = 'Type de munition', value = 'type mun' },
			{ type = 'row', label = 'Capacité du chargeur', value = 'capacité' },
			{ type = 'row', label = 'Coups en rafale', value = 'coups raf' }
		}},
		{ type = 'table', title = 'Exigences d\'utilisation', rows = {
			{ type = 'row', label = 'Compétence', value = 'compétence' },
			{ type = 'row', label = '[[Force]] requise', value = 'force req' },
			{ type = 'row', label = 'Mains requises', value = 'mains req' }
		}},
		{ type = 'table', title = 'Autre', rows = {
			{ type = 'row', label = 'Poids', value = 'poids' },
			{ type = 'row', label = 'Valeur', value = 'valeur' },
			{ type = 'row', label = '[[Aptitude d\'arme]]', value = 'aptitude' }
		}},
		{ type = 'table', title = 'Technique', rows = {
			{ type = 'row', label = 'Proto ID', value = 'proto' },
			{ type = 'row', label = 'Fichier message', value = 'dialogue' },
			{ type = 'row', label = 'Rareté', value = 'rareté' }
		}},
		{ type = 'text', value = 'pied' }
	}
}