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

De Les Archives de Vault-Tec
Kharmitch (discussion | contributions)
Page créée avec « local localdata = require('Module:Infobox/Localdata') local games = require('Module:Jeux') local keyWords = { ['dérivée'] = { subject = 'Statistique dérivée', li… »
 
Kharmitch (discussion | contributions)
Aucun résumé des modifications
 
(4 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
local localdata = require('Module:Infobox/Localdata')
local localdata = require('Module:Infobox/Localdata')
local games = require('Module:Jeux')
local abb = require('Module:Abréviation')


local keyWords = {
local keyWords = {
['dérivée']     = { subject = 'Statistique dérivée', link = 'Statistiques dérivées' },
['caractéristique'] = { subject = 'Caractéristique', link = 'Caractéristiques' },
['primaire']   = { subject = 'Statistique primaire', link = 'Statistiques primaires' },
['dérivée']         = { subject = 'Caractéristique dérivée', link = 'Caractéristiques dérivées' },
['compétence'] = { subject = 'Compétence', link = 'Compétence' }
['compétence']     = { subject = 'Compétence', link = 'Compétences' },
-- déprécié
['primaire']       = { subject = 'Caractéristique', link = 'Caractéristiques' },
}
}


Ligne 12 : Ligne 14 :
if localdata['jeux'..index] then
if localdata['jeux'..index] then
local game = games.buildLinksList({ localdata['jeux'..index] })
if abb.links({ localdata['jeux'..index] }) then
local keyWord = keyWords[localdata['type']] or {}
if game then
local link    = keyWord.link
row = { type = 'table', title = game, rows = {
{ type = 'row', label = 'SPECIAL', value = 'special'..index },
row = { type = 'table', title = abb.links({ localdata['jeux'..index], link }), rows = {
{ type = 'row', label = 'Exigences', value = 'requiert'..index },
{ type = 'row', label = 'Modifie', value = 'modifie'..index },
{ type = 'row', label = 'Rangs', value = 'rangs'..index },
{ type = 'row', label = 'Gouvernée par', value = 'gouvernée par'..index },
{ type = 'row', label = 'Effets', value = 'effets'..index },
{ type = 'row', label = 'Valeur initiale', value = 'valeur initiale'..index },
{ type = 'row', label = '[[Form ID|Base ID]]', value = 'baseid'..index }
{ type = 'row', label = 'Aptitudes associées', value = 'aptitudes asso'..index },
{ type = 'row', label = 'Traits associés', value = 'traits asso'..index }
}}
}}
end
end

Dernière version du 28 février 2022 à 16:00

Documentation du module

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

Documentation transclues de Module:Infobox/Caractéristique/doc.
local localdata = require('Module:Infobox/Localdata')
local abb = require('Module:Abréviation')

local keyWords = {
	['caractéristique'] = { subject = 'Caractéristique', link = 'Caractéristiques' },
	['dérivée']         = { subject = 'Caractéristique dérivée', link = 'Caractéristiques dérivées' },
	['compétence']      = { subject = 'Compétence', link = 'Compétences' },
	-- déprécié
	['primaire']        = { subject = 'Caractéristique', link = 'Caractéristiques' },
}

function buildGamesTable(localdata, index)
	local row = { type = 'text' } --fake
	
	if localdata['jeux'..index] then
		if abb.links({ localdata['jeux'..index] }) then
			local keyWord = keyWords[localdata['type']] or {}
			local link    = keyWord.link
			
			row = { type = 'table', title = abb.links({ localdata['jeux'..index], link }), rows = {
				{ type = 'row', label = 'Modifie', value = 'modifie'..index },
				{ type = 'row', label = 'Gouvernée par', value = 'gouvernée par'..index },
				{ type = 'row', label = 'Valeur initiale', value = 'valeur initiale'..index },
				{ type = 'row', label = 'Aptitudes associées', value = 'aptitudes asso'..index },
				{ type = 'row', label = 'Traits associés', value = 'traits asso'..index }
			}}
		end
	end
	
	return row
end

function buildSubHead(localdata, keyWordType, default)
	local subhead = default
	if localdata['type'] and keyWords[localdata['type']:lower()] then
		local keyWord = keyWords[localdata['type']:lower()]
		if keyWord then
			subhead = keyWord[keyWordType]
		end
	end
	return subhead
end

return {
	parts = {
		{ type = 'title', value = 'nom', subtitle = 'sous-titre', icon = 'icône', subhead = { games = 'jeux', subject = buildSubHead(localdata, 'subject', 'Statistique'), link = buildSubHead(localdata, 'link', 'Statistique') }},
		{ type = 'images', imageparameters = { 'image', 'image2', 'image3', 'image4', 'image5' }, captionparameter = { 'légende', 'image desc' }},
		buildGamesTable(localdata, '1'),
		buildGamesTable(localdata, '2'),
		buildGamesTable(localdata, '3'),
		buildGamesTable(localdata, '4'),
		buildGamesTable(localdata, '5'),
		buildGamesTable(localdata, '6'),
		buildGamesTable(localdata, '7'),
		buildGamesTable(localdata, '8'),
		{ type = 'text', value = 'pied' }
	}
}