Aller au contenu

Module:Capsule

De Poképédia

Fonction « tableau »

[modifier]

Paramètres

[modifier]
Légende des icônes
Certains paramètres sont accompagnés d'une ou plusieurs icône indiquant leur(s) caractéristique(s) :
 : Ce paramètre est facultatif, et n'a donc pas besoin d'être systématiquement défini.
 : Ce paramètre classe automatiquement l'article dans une catégorie.
 : Ce paramètre influe sur les données sémantiques présentes en pied de page.
  • génération : numéro de la génération en chiffres arabes (1, 2, 3…)
  • jeu  : si la capacité présente dans une Capsule varie dans les jeux d'une même génération, il faut utiliser plusieurs fois le module. Dans ce cas, on utilise ce paramètre pour préciser à quel jeu de la génération le tableau se rapporte.
  • capacité : nom de la capacité.
  • jeux : liste des abréviations des jeux dans lesquels la capsule est présente tels que définies dans le Modèle:Jeu. Chaque jeu est séparé par un « / ».
    • abréviation_du_jeu-emplacement  : emplacement de la capsule. À répéter pour chaque jeu.
    • abréviation_du_jeu-achat  : prix d'achat de la capsule. À répéter pour chaque jeu.
    • abréviation_du_jeu-achat-unité  : unité du prix d'achat de la capsule, par exemple « jetons ». Par défaut, le module considère qu'il s'agit de Pokédollars (Poké Dollar). À répéter pour chaque jeu.
    • abréviation_du_jeu-vente  : prix de vente de la capsule. À répéter pour chaque jeu.
  • imagenuméro  : nom de l'image représentant la localisation de la capsule. La première image a « 1 » comme numéro, puis la suivante 2, puis 3…
  • imagenuméro-description  : decription de l'image représentant la localisation de la capsule. La première image a « 1 » comme numéro, puis la suivante 2, puis 3…
  • pokémon : liste des Pokémon pouvant apprendre la capsule séparés par des « / ». Incompatible avec le paramètre tous.
  • tous : si tous les Pokémon ou presque pouvant apprendre une capsule peuvent apprendre cette capacité, remplir ce paramètre avec oui. Si ce n'est le cas que pour les Pokémon sexués, indiquer tous=sexués. Incompatible avec le paramètre pokémon.
  • exceptions  : seulement dans les cas où tous=oui ou tous=sexués, il est possible de renseigner ce paramètre pour définir les exceptions, les Pokémon qui ne peuvent pas apprendre la capacité même s'ils peuvent une capsule. Par exemple, si les exceptions sont Tarsal, Kirlia et Méios, il faut taper « exceptions = [[Tarsal]], [[Kirlia]] et [[Méios]] ».

Trois paramètres spécifiques ont été introduits pour mieux gérer la Machine à CT de Pokémon Écarlate et Violet : ev-recette-pl pour indiquer le nombre de Points de Ligue nécessaires à la création de la CT, ev-recette-échantillons pour indiquer les échantillons nécessaires à la création de la CT et ev-recette-condition (facultatif) si un événement du jeu débloque l'apparition de cette recette. Les informations sont disposées sur une ligne à part - voir le dernier exemple pour bien comprendre le fonctionnement prévu de ces paramètres.

Exemples

[modifier]

Données venant de la page CT01

{{#invoke:Capsule|tableau
| génération = 1
| capacité = Ultimapoing
| jeux = rbj
| rbj-emplacement = [[Mont Sélénite]], [[Centre commercial de Céladopole]]
| rbj-achat = 3 000
| rbj-vente = 1 500
| image1 = Cap ecran obtention ct01 sélénite rbj.png
| image1-description = CT01 au Mont Sélénite
| image2 = Cap ecran obtention ct01 céladopole rbj.png
| image2-description = Au Centre Commercial
| pokémon = Salamèche/Reptincel/Dracaufeu/Carapuce/Carabaffe/Tortank/Pikachu/Raichu/Nidoqueen/Nidoking/Mélofée/Mélodelfe/Rondoudou/Grodoudou/Psykokwak/Akwakwak/Férosinge/Colossinge/Têtarte/Tartard/Abra/Kadabra/Alakazam/Machoc/Machopeur/Mackogneur/Racaillou/Gravalanch/Grolem/Flagadoss/Ectoplasma/Soporifik/Hypnomade/Osselait/Ossatueur/Kicklee/Tygnon/Excelangue/Rhinoféros/Leveinard/Kangourex/M. Mime/Lippoutou/Élektek/Magmar/Ronflex/Mewtwo/Mew
}}

donne :

Première génération

CapacitéTypeCatégoriePuissancePrécisionPP
UltimapoingNormalPhysique8085 %20
JeuEmplacementAchatVente
RBJMont Sélénite, Centre commercial de Céladopole3 000 Pokédollar1 500 Pokédollar
Pokémon aptes
0004 0005 0006 0007 0008 0009
0025 0026 0031 0034 0035 0036
0039 0040 0054 0055 0056 0057
0061 0062 0063 0064 0065 0066
0067 0068 0074 0075 0076 0080
0094 0096 0097 0104 0105 0106
0107 0108 0112 0113 0115 0122
0124 0125 0126 0143 0150 0151




Données venant de la page CT89

{{#invoke:Capsule|tableau
| génération = 4
| capacité = Demi-Tour
| jeux = dpp/hgss/pbr
| dpp-emplacement = [[Joliberges]], [[Casino de Voilaroc]]
| dpp-achat = 6 000
| dpp-achat-unité = jetons
| dpp-vente = 2 500
| hgss-emplacement = Prix pour avoir battu [[Hector]], [[Zone de Combat (Quatrième génération)|Zone de Combat]]
| hgss-achat = 40
| hgss-achat-unité = PCo
| hgss-vente = 1 500
| pbr-emplacement = Boutique
| pokémon = Papilusion/Dardargnan/Roucool/Roucoups/Roucarnage/Rattata/Rattatac/Piafabec/Rapasdepic/Nosferapti/Nosferalto/Aéromite/Miaouss/Persian/Férosinge/Colossinge/Canarticho/Insécateur/Artikodin/Électhor/Sulfura/Mew/Fouinette/Fouinar/Coxy/Coxyclaque/Nostenfer/Natu/Xatu/Granivol/Floravol/Cotovol/Capumain/Yanma/Scorplane/Cizayox/Celebi/Charmillon/Papinox/Nirondelle/Hélédelle/Goélise/Bekipan/Maskadra/Ninjask/Muciole/Lumivole/Vibraninf/Libégon/Jirachi/Ouisticram/Chimpenfeu/Simiabraz/Étourmi/Étourvol/Étouraptor/Papilord/Apireine/Pachirisu/Capidextre/Chaglam/Chaffreux/Pijako/Écayon/Luminéon/Yanmega/Scorvol/Créhelf/Créfollet/Créfadet/Phione/Manaphy
}}

donne :

Quatrième génération

CapacitéTypeCatégoriePuissancePrécisionPPType concoursCharme
Demi-TourInsectePhysique70100 %20Grâce
JeuEmplacementAchatVente
DPPJoliberges, Casino de Voilaroc6 000 jetons2 500 Pokédollar
HGSSPrix pour avoir battu Hector, Zone de Combat40 PCo1 500 Pokédollar
PBRBoutique
Pokémon aptes
0012 0015 0016 0017 0018 0019
0020 0021 0022 0041 0042 0049
0052 0053 0056 0057 0083 0123
0144 0145 0146 0151 0161 0162
0165 0166 0169 0177 0178 0187
0188 0189 0190 0193 0207 0212
0251 0267 0269 0276 0277 0278
0279 0284 0291 0313 0314 0329
0330 0385 0390 0391 0392 0396
0397 0398 0414 0416 0417 0424
0431 0432 0441 0456 0457 0469
0472 0480 0481 0482 0489 0490




Données venant de la page CT94

{{#invoke:Capsule|tableau
| génération = 6
| jeu = Rubis Oméga et Saphir Alpha
| capacité = Force Cachée
| jeux = rosa
| rosa-emplacement = Offerte par [[Millepertuis]] sur la [[Route 111]]
| tous = oui
| exceptions = [[Zarbi]], [[Qulbutoké]], [[Okéoké]], [[Crikzik]], [[Cheniti]], [[Anchwatt]] et [[Pérégrain]]
}}

donne :

Sixième génération - Rubis Oméga et Saphir Alpha

CapacitéTypeCatégoriePuissancePrécisionPPType concoursCharmeBlocage
Force CachéeNormalPhysique70100 %20Intelligence
JeuEmplacementAchatVente
ROSAOfferte par Millepertuis sur la Route 111
Pokémon aptes
Tout Pokémon pouvant apprendre une capacité par capsule peut apprendre Force Cachée sauf Zarbi, Qulbutoké, Okéoké, Crikzik, Cheniti, Anchwatt et Pérégrain.




{{#invoke:Capsule|tableau
| génération = 9
| capacité = Croco Larme
| jeux = ev
| ev-emplacement = [[Zone Est n° 1]], [[Mont Nappé]], [[Zone Sud n° 2]], [[Zone Sud n° 5]]
| ev-vente=400
| ev-recette-condition=avoir vaincu [[Brome]]
| ev-recette-pl=400
| ev-recette-échantillons=Larme de [[Manzaï]] ×3, Griffe de [[Teddiursa]] ×3
| pokémon =Pikachu/Rondoudou/Grodoudou/Miaouss/Miaouss forme(Alola)/Miaouss forme(Galar)/Persian/Persian forme(Alola)/Évoli/Aquali/Voltali/Pyroli/Mew/Toudoudou/Marill/Azumarill/Simularbre/Mentali/Noctali/Feuforêve/Farfuret/Teddiursa/Ursaring/Balignon/Chapignon/Azurill/Stalgamin/Oniglali/Lixy/Luxio/Luxray/Pachirisu/Magirêve/Manzaï/Dimoret/Phyllali/Givrali/Momartik/Zorua/Zorua forme(Hisui)/Zoroark/Zoroark forme(Hisui)/Scrutella/Mesmérella/Sidérella/Vivaldaim/Haydaim/Meloetta/Nymphali/Diancie/Malamandre/Minisange/Bleuseille/Corvaillus/Grimalin/Fourbelin/Angoliath/Berserkatt/Ursaking/Poussacha/Matourgeon/Miascarade/Compagnol/Famignol/Tapatoès/Grondogue/Dogrino/Forgerette/Forgella/Forgelina/Hurle-Queue/Flotte-Mèche
}}

donne :

Neuvième génération

VignetteCapacitéTypeCatégoriePuissancePrécisionPP
Fichier:Vignette Module:Capsule/doc EV.pngCroco LarmeTénèbresStatut100 %20
JeuEmplacementAchatVente
EVZone Est n° 1, Mont Nappé, Zone Sud n° 2, Zone Sud n° 5400 Pokédollar
Fabricable à la Machine à CT après avoir vaincu Brome pour 400 PL et avec les échantillons suivants :
Larme de Manzaï ×3, Griffe de Teddiursa ×3
Pokémon aptes
0025 0039 0040 0052 0052
Miaouss
Forme d'Alola
0052
Miaouss
Forme de Galar
0053 0053
Persian
Forme d'Alola
0133 0134 0135 0136
0151 0174 0183 0184 0185 0196
0197 0200 0215 0216 0217 0285
0286 0298 0361 0362 0403 0404
0405 0417 0429 0438 0461 0470
0471 0478 0570 0570
Zorua
Forme de Hisui
0571 0571
Zoroark
Forme de Hisui
0574 0575 0576 0585 0586 0648
0700 0719 0758 0821 0822 0823
0859 0860 0861 0863 0901 0906
0907 0908 0924 0925 0931 0942
0943 0957 0958 0959 0985 0987

local p = {}
local ressources = {
	["infosPokemon"] = require("Module:Ressources/infosPokemon"),
	["donneesCapacite"] = require("Module:Ressources/donneesCapacite"),
	["indexTableau"] = require("Module:Ressources/indexTableau")
}

function p.tableau( frame )
	local generation = tonumber( mw.text.trim( frame.args['génération'] ) )
	local capacite = mw.text.trim( frame.args['capacité'] )
	local jeux = frame.args['jeux']
	local poke_aptes = frame.args['pokémon']
	if generation == nil then generation = "" end
	if capacite == nil then return "Pas de nom de capacité renseigné" end
	if jeux ~= nil then jeux = mw.text.split( string.lower(jeux), "/" ) else jeux = {} end
	for i,jeu in ipairs(jeux) do
		jeux[i] = mw.text.trim( jeu )
	end
	if poke_aptes ~= nil then poke_aptes = mw.text.split( poke_aptes, "/" ) else poke_aptes = {} end
	local generations = {"Première", "Deuxième", "Troisième", "Quatrième", "Cinquième", "Sixième", "Septième", "Huitième", "Neuvième"}
	local titre
	if generations[generation] then titre = generations[generation] end
	titre = titre .. ' génération'
	if frame.args['jeu'] then titre = titre .. ' - <i>' .. frame.args['jeu'] .. '</i>' end
	
	local colspan = 6
	if generation == 3 or generation == 6 then colspan = 9
	elseif generation == 4 then colspan = 8
	end

	local i = 1
	local infos_jeux = {}
	local emplacement, achat, vente
	while jeux[i] ~= nil do
		jeux[i] = mw.text.trim( jeux[i] )
		if frame.args[jeux[i] .. '-emplacement'] == nil then
			if jeux[i] == "ev" and frame.args["ev-recette-pl"] ~= nil then emplacement = "—"
			else emplacement = "Inconnu"
			end
		else emplacement = mw.text.trim( frame.args[jeux[i] .. '-emplacement'] )
		end
		if frame.args[jeux[i] .. '-achat'] == nil or frame.args[jeux[i] .. '-achat'] == "-" or frame.args[jeux[i] .. '-achat'] == "—" then achat = "—"
		else 
			if frame.args[jeux[i] .. '-achat-unité'] then achat = mw.text.trim( frame.args[jeux[i] .. '-achat'] ) .. " " .. mw.text.trim( frame.args[jeux[i] .. '-achat-unité'] )
			else achat = mw.text.trim( frame.args[jeux[i] .. '-achat'] ) .. " [[Fichier:Miniature Pokédollar EB.png|10px|class=imagenoire|link=Pokédollar|alt=Pokédollar]]"
			end
		end
		if frame.args[jeux[i] .. '-vente'] == nil or frame.args[jeux[i] .. '-vente'] == "-" or frame.args[jeux[i] .. '-vente'] == "—" then vente = "—"
		else vente = mw.text.trim( frame.args[jeux[i] .. '-vente'] ) .. " [[Fichier:Miniature Pokédollar EB.png|10px|class=imagenoire|link=Pokédollar|alt=Pokédollar]]"
		end
		if jeux[i] == "ev" and frame.args["ev-recette-échantillons"] ~= nil and frame.args["ev-recette-pl"] ~= nil then
			if emplacement == "—" then table.insert(infos_jeux, '<tr class="ligne-jeu-recette"><td>' .. frame:expandTemplate{ title = 'Abréviation', args = { jeux[i] } } .. '</td><td colspan="'.. colspan - 2 .. '">Fabricable à la [[Machine à CT]]')
			else table.insert(infos_jeux, '<tr class="ligne-jeu"><td rowspan="2">' .. frame:expandTemplate{ title = 'Abréviation', args = { jeux[i] } } .. '</td><td colspan="' .. colspan - 3 .. '">' .. emplacement .. '</td><td>' .. achat .. '</td><td rowspan="2">' .. vente .. '</td></tr><tr class="ligne-jeu-recette-2"><td colspan="'.. colspan - 2 .. '">Fabricable à la [[Machine à CT]]')
			end
			if frame.args["ev-recette-condition"] ~= nil then table.insert(infos_jeux, ' après ' .. mw.text.trim(frame.args["ev-recette-condition"])) end
			table.insert(infos_jeux, ' pour ' .. mw.text.trim(frame.args["ev-recette-pl"]) .. ' [[PL]] et avec les échantillons suivants :<br />' .. mw.text.trim(frame.args["ev-recette-échantillons"]) .. '</td>')
			if emplacement == "—" then table.insert(infos_jeux, '<td>' .. vente .. '</td>') end
			table.insert(infos_jeux, '</tr>')
		else
			table.insert(infos_jeux, '<tr class="ligne-jeu"><td>' .. frame:expandTemplate{ title = 'Abréviation', args = { jeux[i] } } .. '</td><td colspan="' .. colspan - 3 .. '">' .. emplacement .. '</td><td>' .. achat .. '</td><td>' .. vente .. '</td></tr>')
		end
		i = i + 1
	end

	local poke = {}
	local aucun = "non"
	table.insert(poke, '<tr class="tableau-capsule-pokémon tableau-capsule-generation' .. generation)
	if frame.args['jeu'] then table.insert(poke, '-' .. frame.args['jeu'] .. '') end
	table.insert(poke, '-pokémon">')
	if frame.args['tous'] == "oui" or frame.args['tous'] == "sexués" then
		table.insert(poke, '<td class="cellule-unique" colspan="' .. colspan + 1 .. '">Tout Pokémon')
		if frame.args['tous'] == "sexués" then table.insert(poke, ' sexué') end
		table.insert(poke, ' pouvant apprendre une capacité par capsule peut apprendre ' .. capacite)
		if frame.args['exceptions'] then table.insert(poke, ' sauf ' .. frame.args['exceptions']) end
		table.insert(poke, '.</td>')
	else
		local y = 1
		local z = 1
		local colspan_poke
		if poke_aptes[1] == "" then
			aucun = "oui"
			table.insert(poke, '<td class="cellule-unique" colspan="' .. colspan + 1 .. '">\'\'Incomplet\'\'</td>')
		end
		while poke_aptes[y] and aucun == "non" do
			if generation == 3 and (z == 1 or z == 3 or z == 5) then colspan_poke = 2
			elseif generation == 4 and (z == 3 or z == 4) then colspan_poke = 2
			elseif generation == 9 and z == 6 then colspan_poke = 2
			else colspan_poke = 1
			end
			table.insert(poke, '<td colspan="' .. colspan_poke .. '" style="text-align: left;">' .. ressources.infosPokemon( poke_aptes[y] ) .. '</td>')
			y = y + 1
			 if z == 6 then
			 	table.insert(poke, '</tr><tr class="tableau-capsule-pokémon tableau-capsule-generation' .. generation)
				if frame.args['jeu'] then table.insert(poke, '-' ..frame.args['jeu'] .. '') end
				table.insert(poke, '-pokémon">')
			 	z = 1
			 else z = z + 1 end
		end
	end
	table.insert(poke, '</tr>')

	local donnees = ressources.donneesCapacite(generation, capacite, jeux)
	local resultat = {}
	table.insert(resultat, '<table class="tableaustandard centre ' .. donnees["type"] .. ' tableau-capsule tableau-capsule-generation' .. generation .. '" style="width: 90%;"><caption><h3>' .. titre.. '</h3></caption><tr class="ligne-1">')
	if ressources.indexTableau(jeux, "ev") then table.insert(resultat, '<th>Vignette</th>') end
	table.insert(resultat, '<th>Capacité</th><th>Type</th><th>Catégorie</th><th>Puissance</th><th>Précision</th><th>PP</th>')
	if generation == 3 or generation == 6 then table.insert(resultat, '<th>[[Concours Pokémon|Type concours]]</th><th>[[Charme (concours)|Charme]]</th><th>[[Blocage (concours)|Blocage]]</th>')
	elseif generation == 4 then table.insert(resultat, '<th>[[Concours Pokémon|Type concours]]</th><th>[[Charme (concours)|Charme]]</th>')
	end
	table.insert(resultat, '</tr><tr class="ligne-2">')
	if ressources.indexTableau(jeux, "ev") then
		rowspan = #jeux + 2
		if frame.args["ev-recette-échantillons"] ~= nil and frame.args["ev-recette-pl"] ~= nil then rowspan = rowspan + 1 end
		table.insert(resultat, '<td rowspan="' .. rowspan .. '">[[Fichier:Vignette ' .. frame:getParent():getTitle() .. ' EV.png|150px]]</td>')
	end
	for j = 1, colspan do table.insert(resultat, '<td>' .. donnees[j] .. '</td>') end
	table.insert(resultat, '</tr><tr class="ligne-3"><th>Jeu</th><th colspan="' .. colspan - 3 .. '">Emplacement</th><th>Achat</th><th>Vente</th></tr>' .. table.concat(infos_jeux, ""))
	
	local j = 1
	local galerie = {}
	if frame.args['image1'] then table.insert(galerie, '<gallery widths="180px" heights="120px">') end
	while frame.args['image' .. j] do
		if frame.args['image' .. j .. '-description'] == nil then frame.args['image' .. j .. '-description'] = "" end
		table.insert(galerie, frame.args['image' .. j] .. '|' .. frame.args['image' .. j .. '-description'] .. '\n')
		j = j + 1
	end
	if frame.args['image1'] then
		table.insert(galerie, '</gallery>')
		table.insert(resultat, '<tr><td colspan="' .. colspan .. '">' .. frame:preprocess( table.concat(galerie, "") .. '</td></tr>' ) )
	end
	
	table.insert(resultat, '<tr><th colspan=' .. colspan + 1 .. '>Pokémon aptes</th></tr>')
	if frame.args['tous'] ~= "oui" and frame.args['tous'] ~= "sexués" and aucun ~= "oui" then 
		table.insert(resultat, '<tr><td colspan="' .. colspan + 1 .. '"><button type="button" name="tableau-capsule-generation' .. generation .. '')
		if frame.args['jeu'] then table.insert(resultat, '-' .. frame.args['jeu']) end
		table.insert(resultat, '-pokémon" value="afficher" style="font-size:80%" title="[-] Masquer les Pokémon aptes">[+] Afficher les Pokémon aptes</button></td></tr>')
	end
	table.insert(resultat, table.concat(poke, "") .. '</table>')

	return table.concat(resultat, "")
end

return p