43 006
modifications
mAucun résumé des modifications |
(Ajout de la couleur qui manquait pour les articles de Pokémon spéciaux (Kyurem Blanc, Sylveroy, le Cavalier du Froid...)) |
||
Ligne 11 : | Ligne 11 : | ||
local result = {} | local result = {} | ||
local result_header = {} | local result_header = {} | ||
local | local full_tablge = {} | ||
local pokemon = frame.args[1] | local pokemon = frame.args[1] | ||
Ligne 31 : | Ligne 31 : | ||
else pokemon_ids = {pokemon} | else pokemon_ids = {pokemon} | ||
end | end | ||
local special_replacement_ids = { | |||
["Kyurem Blanc"] = {"Kyurem", "Blanc"}, | |||
["Kyurem Noir"] = {"Kyurem", "Noir"}, | |||
["Necrozma Crinière du Couchant"] = {"Necrozma", "Crinière du Couchant"}, | |||
["Necrozma Ailes de l'Aurore"] = {"Necrozma", "Ailes de l'Aurore"}, | |||
["Ultra%-Necrozma"] = {"Necrozma", "Ultra"}, | |||
["Sylveroy, le Cavalier du Froid"] = {"Sylveroy", "Cavalier du Froid"}, | |||
["Sylveroy, le Cavalier d'Effroi"] = {"Sylveroy", "Cavalier d'Effroi"} | |||
} | |||
local replacement_ids = { | local replacement_ids = { | ||
[" d'Alola"] = "Alola", | [" d'Alola"] = "Alola", | ||
Ligne 37 : | Ligne 48 : | ||
[" de Paldea"] = "Paldea", | [" de Paldea"] = "Paldea", | ||
["Méga%-"] = "Méga", | ["Méga%-"] = "Méga", | ||
[" Gigamax"] = "Gigamax" | [" Gigamax"] = "Gigamax", | ||
[" Infinimax"] = "Infinimax" | |||
} | } | ||
for i, id in pairs(pokemon_ids) do | for i, id in pairs(pokemon_ids) do | ||
Ligne 53 : | Ligne 65 : | ||
if not pokemon_type | if not pokemon_type | ||
then local data_types = require("Module:Data/TypesPokémon") | then local data_types = require("Module:Data/TypesPokémon") | ||
for replacing, replaced in pairs( | local skip = false | ||
if | for replacing, replaced in pairs(special_replacement_ids) do | ||
then | if pokemon == replacing | ||
then pokemon_types = data_types[replacing[0]] | |||
if pokemon_types | if pokemon_types | ||
then local pokemon_types_form = pokemon_types[replacing[1]] | |||
if pokemon_types_form | |||
then pokemon_type = pokemon_types_form[1] | |||
else pokemon_type = pokemon_types[1][1] | |||
end | |||
skip = true | |||
else pokemon_type = "" | |||
end | end | ||
else pokemon_type = "" | break | ||
end | |||
end | |||
if not skip | |||
then | |||
for replacing, replaced in pairs(replacement_ids) do | |||
if mw.ustring.find(pokemon, replacing) | |||
then local pokemon_without_form = mw.ustring.gsub(pokemon, replacing, "") | |||
local form = replaced | |||
local pokemon_types = data_types[pokemon_without_form] | |||
if pokemon_types | |||
then local pokemon_types_form = pokemon_types[form] | |||
if pokemon_types_form | |||
then pokemon_type = pokemon_types_form[1] | |||
else pokemon_type = pokemon_types[1][1] | |||
end | |||
else pokemon_type = "" | |||
end | |||
break | |||
end | end | ||
end | end | ||
end | end |