FANDOM


local Jeu = {}
 -- Ce module contient des informations concernant le formatage des liens vers les différents jeux, via des liens texte ou via des icônes. Utilisé par le [[Modèle:Jeu]] et le [[Modèle:Titre]]
 
 -- Contient les titres de jeux formatés en lien
local titres = { 
 ["KH1"] = "''[[Kingdom Hearts (Jeu)|Kingdom Hearts]]''", 
 ["FM1"] = "''[[Kingdom Hearts: Final Mix]]''", 
 ["COM"] = "''[[Kingdom Hearts: Chain of Memories]]''", 
 ["REC"] = "''[[Kingdom Hearts: Re:Chain of Memories]]''", 
 ["KH2"] = "''[[Kingdom Hearts II]]''", 
 ["FM2"] = "''[[Kingdom Hearts II: Final Mix]]''", 
 ["358"] = "''[[Kingdom Hearts: 358/2 Days]]''", 
 ["BBS"] = "''[[Kingdom Hearts: Birth by Sleep]]''", 
 ["FMB"] = "''[[Kingdom Hearts: Birth by Sleep Final Mix]]''",
 ["KHC"] = "''[[Kingdom Hearts: coded]]''", 
 ["KHR"] = "''[[Kingdom Hearts: Re:coded]]''",  
 ["DDD"] = "''[[Kingdom Hearts 3D: Dream Drop Distance]]''", 
 ["1.5"] = "''[[Kingdom Hearts -HD 1.5 ReMIX-]]''", 
 ["2.5"] = "''[[Kingdom Hearts -HD 2.5 ReMIX-]]''", 
 ["CHI"] = "''[[Kingdom Hearts: χ|Kingdom Hearts: χ [chi]]]''", 
 ["UCH"] = "''[[Kingdom Hearts: Unchained χ]]''",  
 ["UCR"] = "''[[Kingdom Hearts: Union χ|Kingdom Hearts: Union χ [Cross]]]''",
 ["2.8"] = "''[[Kingdom Hearts: HD 2.8 Final Chapter Prologue]]''",
 ["DHD"] = "''[[Kingdom Hearts: Dream Drop Distance HD]]''",
 ["0.2"] = "''[[Kingdom Hearts: 0.2 Birth by Sleep -A Fragmentary Passage-]]''",
 ["XBC"] = "''[[Kingdom Hearts: χ Back Cover]]''",
 ["1+2"] = "''[[Kingdom Hearts: HD 1.5 + 2.5 ReMIX]]''",
 ["VRE"] = "''[[Kingdom Hearts: VR Experience]]''",
 ["KH3"] = "''[[Kingdom Hearts III]]''",
 ["XSG"] = "[[Saga du Chercheur des Ténèbres]]",
 ["REM"] = "''[[Kingdom Hearts III Re Mind]]''",
 ["UXD"] = "''[[Kingdom Hearts: Union χ Dark Road]]''",
 ["KDR"] = "''[[Kingdom Hearts: Dark Road]]''",
 ["MOM"] = "''[[Kingdom Hearts: Melody of Memory]]''",
 ["2ND"] = "[[2nd Phase|2<sup>nd</sup> Phase]]"
}
 
local titresCourts = { 
 ["KH1"] = "''[[Kingdom Hearts (Jeu)|Kingdom Hearts]]''", 
 ["FM1"] = "''[[Kingdom Hearts: Final Mix|Final Mix]]''", 
 ["COM"] = "''[[Kingdom Hearts: Chain of Memories|Chain of Memories]]''", 
 ["REC"] = "''[[Kingdom Hearts: Re:Chain of Memories|Re:Chain of Memories]]''", 
 ["KH2"] = "''[[Kingdom Hearts II]]''", 
 ["FM2"] = "''[[Kingdom Hearts II: Final Mix|Final Mix II]]''", 
 ["358"] = "''[[Kingdom Hearts: 358/2 Days|358/2 Days]]''", 
 ["BBS"] = "''[[Kingdom Hearts: Birth by Sleep|Birth by Sleep]]''", 
 ["FMB"] = "''[[Kingdom Hearts: Birth by Sleep Final Mix|Birth by Sleep Final Mix]]''",
 ["KHC"] = "''[[Kingdom Hearts: coded|coded]]''", 
 ["KHR"] = "''[[Kingdom Hearts: Re:coded|Re:coded]]''",  
 ["DDD"] = "''[[Kingdom Hearts 3D: Dream Drop Distance|Dream Drop Distance]]''", 
 ["1.5"] = "''[[Kingdom Hearts -HD 1.5 ReMIX-|-HD 1.5 ReMIX-]]''", 
 ["2.5"] = "''[[Kingdom Hearts -HD 2.5 ReMIX-|-HD 2.5 ReMIX-]]''", 
 ["CHI"] = "''[[Kingdom Hearts: χ|χ [chi]]]''", 
 ["UCH"] = "''[[Kingdom Hearts: Unchained χ|Unchained χ]]''",  
 ["UCR"] = "''[[Kingdom Hearts: Union χ|Union χ]]''",
 ["2.8"] = "''[[Kingdom Hearts: HD 2.8 Final Chapter Prologue|HD 2.8 Final Chapter Prologue]]''",
 ["DHD"] = "''[[Kingdom Hearts: Dream Drop Distance HD|Dream Drop Distance HD]]''",
 ["0.2"] = "''[[Kingdom Hearts: 0.2 Birth by Sleep -A Fragmentary Passage-|0.2 BbS -A&nbsp;Fragmentary&nbsp;Passage-]]''",
 ["XBC"] = "''[[Kingdom Hearts: χ Back Cover|χ Back Cover]]''",
 ["1+2"] = "''[[Kingdom Hearts: HD 1.5 + 2.5 ReMIX|HD 1.5 + 2.5 ReMIX]]''",
 ["VRE"] = "''[[Kingdom Hearts: VR Experience|VR Experience]]''",
 ["KH3"] = "''[[Kingdom Hearts III]]''",
 ["XSG"] = "[[Saga du Chercheur des Ténèbres]]",
 ["REM"] = "''[[Kingdom Hearts III Re Mind|Re Mind]]''",
 ["UXD"] = "''[[Kingdom Hearts: Union χ Dark Road|Union χ Dark Road]]''",
 ["KDR"] = "''[[Kingdom Hearts: Dark Road|Dark Road]]''",
 ["MOM"] = "''[[Kingdom Hearts: Melody of Memory|Melody of Memory]]''",
 ["2ND"] = "[[2nd Phase|2<sup>nd</sup> Phase]]"
}
 
 -- Contient les codes de jeux dans l'ordre désiré
local codejeux = {"KH1", "FM1", "COM", "REC", "KH2", "FM2", "358", "BBS", "FMB", "KHC", "KHR", "DDD", "1.5", "2.5", "CHI", "UCH", "UCR", "2.8", "0.2", "KH3", "REM", "KDR", "MOM", "SE", "SEL", "COL", "10A", "drammatica", "memorià!"}
 
 -- Contient les images associées à chaque jeu
local images = { 
 ["KH1"] = "[[File:KH1_icon.png|30px|link=Kingdom Hearts (Jeu)]]", 
 ["FM1"] = "[[File:FM1_icon.png|30px|link=Kingdom Hearts: Final Mix]]", 
 ["COM"] = "[[File:COM_image.png|30px|link=Kingdom Hearts: Chain of Memories]]", 
 ["REC"] = "[[File:REC_icon.png|30px|link=Kingdom Hearts: Re:Chain of Memories]]", 
 ["KH2"] = "[[File:KH2_icon.png|30px|link=Kingdom Hearts II]]", 
 ["FM2"] = "[[File:FM2_icon.png|30px|link=Kingdom Hearts II: Final Mix]]", 
 ["358"] = "[[File:358_icon.png|30px|link=Kingdom Hearts: 358/2 Days]]", 
 ["BBS"] = "[[File:BBS_icon.png|30px|link=Kingdom Hearts: Birth by Sleep]]", 
 ["FMB"] = "[[File:BBSFM_icon.png|30px|link=Kingdom Hearts: Birth by Sleep Final Mix]]",
 ["KHC"] = "[[File:KHC_icon.png|30px|link=Kingdom Hearts: coded]]", 
 ["KHR"] = "[[File:KHREC_icon.png|30px|link=Kingdom Hearts: Re:coded]]",  
 ["DDD"] = "[[File:KH3D_icon.png|30px|link=Kingdom Hearts 3D: Dream Drop Distance]]", 
 ["1.5"] = "[[File:KH-1.5-icon.png|30px|link=Kingdom Hearts -HD 1.5 ReMIX-]]", 
 ["2.5"] = "[[Image:KH2.5 icon.png|30px|link=Kingdom Hearts -HD 2.5 ReMIX-]]", 
 ["CHI"] = "[[File:KHχ-icon.png|30px|link=Kingdom Hearts: χ]]", 
 ["UCH"] = "[[Image:KHUNCχ-icon.png|30px|link=Kingdom Hearts: Unchained χ]]", 
 ["UCR"] = "[[Image:UCR icon.png|30px|link=Kingdom Hearts: Union χ]]",
 ["2.8"] = "[[Image:KH2.8 icon.png|30px|link=Kingdom Hearts: HD 2.8 Final Chapter Prologue]]",
 ["0.2"] = "[[Image:KH0.2 icon.png|30px|link=Kingdom Hearts: 0.2 Birth by Sleep -A Fragmentary Passage-]]",
 ["KH3"] = "[[File:KH3_icon.png|30px|link=Kingdom Hearts III]]", 
 ["REM"] = "[[File:KH3REM_icon.png|30px|link=Kingdom Hearts III Re Mind]]",
 ["KDR"] = "[[File:KHDR_icon.png|30px|link=Kingdom Hearts: Dark Road]]",
 ["MOM"] = "[[File:KHMOM_icon.png|30px|link=Kingdom Hearts: Melody of Memory]]",
 ["SE"] = "[[File:SE_icon.png|x30px|link=Square Enix]]", 
 ["SEL"] = "[[File:Articlesélectionné.png|30px|link=Wiki Kingdom Hearts:Archives des Articles du Mois]]", 
 ["COL"] = "[[File:VainqueurColiséeWikia.png|30px|Vainqueur du Colisée du Wikia]]", 
 ["10A"] = "[[Image:Anniv_icon.png|35px|link=Kingdom Hearts 10th Anniversary Fan Selection -Melodies & Memories-]]", 
 ["drammatica"] = "[[Image:Drammatica icone.png|x30px|Drammatica - The Very Best of Yoko Shimomura|link=Yoko Shimomura]]", 
 ["memorià!"] = "[[Image:Memoria icone.png|x30px|memorià! ~ The Very Best of Yoko Shimomura|link=Yoko Shimomura]]" 
}
 -- Contient les jeux pour lesquels on peut automatiquement ajouter un remake
local overrides = {
 ["FM1"] = { "KH1" },
 ["FM2"] = { "KH2" },
 ["FMB"] = { "BBS" },
 ["1.5"] = { "KH1", "FM1" },
 ["2.5"] = { "KH2", "FM2", "BBS", "FMB" },
 ["2.8"] = { "DDD" },
 ["UCR"] = { "UCH" }
}
 
 
 -- Affichage d'un lien
function Jeu.afficheTitre(frame)
 return titres[frame.args[1]]
end
 
 -- Affichage d'un lien avec texte court
function Jeu.afficheTitreCourt(frame)
 return titresCourts[frame.args[1]]
end
 
 -- Vérifie si on peut ajouter automatiquement un jeu "test" car il est le remake d'un jeu "code"
function Jeu.testOverride(test, code)
 if overrides[test] then
  for _, override in ipairs(overrides[test]) do
   if code == override then
    return true
   end
  end
 end
 return false
end
 
 -- Fonction d'affichage des icônes à appeler
function Jeu.afficheIcone(frame)
 local stringBuilder = ""
 for _, test in ipairs(codejeux) do
  for _, code in ipairs(frame.args) do
   if code==test then -- Si le code est présent dans le modèle
    stringBuilder = stringBuilder .. images[test]
    break
   elseif Jeu.testOverride(test,code) then -- Si un jeu dont celui-ci est un remake est dans le modèle
    stringBuilder = stringBuilder .. images[test]
    break
   end
  end
 end
 
 return stringBuilder
end
 
 -- Fonction d'affichage des icônes sans overrides
function Jeu.afficheExact(frame)
 local stringBuilder = ""
 for _, test in ipairs(codejeux) do
  for _, code in ipairs(frame.args) do
   if code==test then -- Si le code est présent dans le modèle
    stringBuilder = stringBuilder .. images[test]
    break
   end
  end
 end
 
 return stringBuilder
end
 
return Jeu
Sauf mention contraire, le contenu de la communauté est disponible sous licence CC-BY-SA .