Binding of Isaac: Rebirth Wiki
(Sauts de ligne)
Aucun résumé des modifications
 
(157 versions intermédiaires par le même utilisateur non affichées)
Ligne 2 : Ligne 2 :
 
local Tableau
 
local Tableau
   
local modDlc = require( 'Module:Dlc' )
 
 
local modElements = require( 'Module:Elements' )
 
local modElements = require( 'Module:Elements' )
local modIcone = require( 'Module:Icone' )
+
local police = require( 'Module:Police' )
local modSucces = require( 'Module:Succes' )
 
   
   
  +
function p.mode( f, listeModes )
--[[ FONCTIONS ARGUMENTS INITIAUX : DEBUT ]]
 
  +
local moduleFiche = require( f:getTitle() )
--[[ FONCTION ARGUMENTS MONSTRE ]]
 
  +
local args = moduleFiche.args( f )
 
  +
local disp = mw.text.split( args.disp, '-')
function p.argsMonstre( f )
 
return {
 
description = f:getParent().args['description'],
 
disp = f:getParent().args['disp'],
 
dlc = f:getParent().args['dlc'],
 
environnement = f:getParent().args['environnement'],
 
imageCase = f:getParent().args['image-case'],
 
imageNom = f:getParent().args['image-nom'],
 
imageTableau = f:getParent().args['image-tableau'],
 
miniBoss = f:getParent().args['miniboss'],
 
nom = f:getParent().args['nom'],
 
remplaceImage = f:getParent().args['remplaceimage'],
 
remplaceNom = f:getParent().args['remplacenom'],
 
santeBase = f:getParent().args['santébase'],
 
santeEtage = f:getParent().args['santéétage'],
 
Type = f:getParent().args['type'],
 
visible = f:getParent().args['visible']
 
}
 
end
 
 
--[[ FONCTION ARGUMENTS OBJET ]]
 
 
function p.argsObjet( f )
 
return {
 
animation = f:getParent().args['animation'],
 
citation = f:getParent().args['citation'],
 
deblocage = f:getParent().args['déblocage'],
 
description = f:getParent().args['description'],
 
disp = f:getParent().args['disp'],
 
dlc = f:getParent().args['dlc'],
 
grille = f:getParent().args['grille'],
 
grilleold = f:getParent().args['grilleold'],
 
id = f:getParent().args['id'],
 
imageCase = f:getParent().args['image-case'],
 
imageNom = f:getParent().args['image-nom'],
 
imageTableau = f:getParent().args['image-tableau'],
 
larmes = f:getParent().args['larmes'],
 
liste = f:getParent().args['liste'],
 
nom = f:getParent().args['nom'],
 
personnage = f:getParent().args['personnage'],
 
recharge = f:getParent().args['recharge'],
 
remplaceImage = f:getParent().args['remplaceimage'],
 
remplaceNom = f:getParent().args['remplacenom'],
 
temp = f:getParent().args['temp'],
 
Type = f:getParent().args['type'],
 
visible = f:getParent().args['visible']
 
}
 
end
 
 
--[[ FONCTION ARGUMENTS PERSONNAGE ]]
 
 
function p.argsPersonnage( f )
 
return {
 
cadenceTir = f:getParent().args['cadencetir'],
 
chance = f:getParent().args['chance'],
 
consommable = f:getParent().args['consommable'],
 
deblocage = f:getParent().args['déblocage'],
 
degats = f:getParent().args['dégâts'],
 
nom = f:getParent().args['nom'],
 
objet = f:getParent().args['objet'],
 
portee = f:getParent().args['portée'],
 
remplaceNom = f:getParent().args['remplacenom'],
 
remplaceImage = f:getParent().args['remplaceimage'],
 
sante = f:getParent().args['santé'],
 
vitesse = f:getParent().args['vitesse'],
 
vitesseLarmes = f:getParent().args['vitesselarmes'],
 
visible = f:getParent().args['visible']
 
}
 
end
 
 
--[[ FONCTIONS ARGUMENTS INITIAUX : FIN ]]
 
 
--[[ FONCTIONS MODES : DEBUT ]]
 
--[[ FONCTION MODE OBJET ]]
 
 
function p.modeObjet( f )
 
local args = p.argsObjet( f )
 
 
local page = modElements.page( args.nom )
 
local page = modElements.page( args.nom )
local blocage = mw.text.split( args.disp, '-')
+
local modes = {}
 
 
  +
for index, objet in pairs( args ) do
if blocage[2] == 'dlc' then
 
  +
if objet == '' then
page.valeur.dlc = args.dlc
 
  +
args[index] = nil
elseif blocage[2] == 'nodlc' then
 
  +
end
page.valeur.dlc = 'Booster Pack 10'
 
 
end
 
end
 
 
if args.temp == args.nom or args.temp == '{{{1}}}' then
+
if not page.valeur.dlc then
  +
page.valeur.dlc = ''
if args.disp == '{{{2}}}' then
 
return p.ficheObjet( f )
 
elseif args.disp == 'case' then
 
return p.modeObjetCase( f )
 
elseif args.disp == 'nom' then
 
return p.modeObjetNom( f, page.valeur.dlc )
 
elseif args.disp == 'tableau' then
 
return p.modeObjetTableau( f, page.valeur.dlc, true )
 
else
 
return "''Mode d'affichage inconnu <sup>[<nowiki/>[" .. args.nom .. "]<nowiki/>]</sup>'' [[Catégorie:Mode de modèle manquant]]"
 
end
 
end
 
end
 
 
--[[ FONCTION MODE OBJET CASE ]]
 
 
function p.modeObjetCase( f )
 
local args = p.argsObjet( f )
 
 
Tableau = p.image( args.nom, args.remplaceNom, args.imageCase, '40x40px', true, '', '_Icon' )
 
 
return Tableau
 
end
 
 
--[[ FONCTION MODE OBJET NOM ]]
 
 
function p.modeObjetNom( f, iconeDlc )
 
local args = p.argsObjet( f )
 
 
if args.dlc ~= nil and iconeDlc then
 
Tableau = modDlc.icon( args.dlc )
 
 
end
 
end
 
 
  +
if disp[2] == 'dlc' then
Tableau = Tableau .. p.image( args.nom, args.remplaceNom, args.imageNom, '20x20px', true, '', '_Icon' )
 
  +
page.valeur.dlc = args.dlc
 
  +
elseif disp[2] == 'nodlc' then
Tableau = Tableau .. p.nom( args.nom, args.remplaceNom, 2 )
 
  +
page.valeur.dlc = 'Booster Pack 10'
 
return Tableau
 
end
 
 
--[[ FONCTION MODE OBJET TABLEAU ]]
 
 
function p.modeObjetTableau( f, iconeDlc, tComplet )
 
local args = p.argsObjet( f )
 
 
Tableau = '|-\n|'
 
 
if args.Type == 'carte' or args.Type == 'rune' then
 
Tableau = Tableau .. p.nom( args.nom, args.remplaceNom, 1 )
 
else
 
Tableau = Tableau .. p.nom( args.nom, args.remplaceNom, 2 )
 
 
end
 
end
 
 
if args.dlc ~= nil and iconeDlc then
+
if listeModes then
  +
local tableauModes = mw.text.split( listeModes, '%s/%s' )
Tableau = Tableau .. modDlc.icon( args.dlc )
 
  +
local i = 1
  +
  +
repeat
  +
modes[tableauModes[i]] = true
  +
i = i + 1
  +
until not tableauModes[i]
 
end
 
end
 
 
  +
if args.temp == args.nom or args.temp == '{{{1}}}' then
if tComplet then
 
  +
if args.disp == '{{{2}}}' then
Tableau = Tableau .. '\n| style="text-align:center" | ' .. args.id
 
  +
return moduleFiche.fiche( args, page )
end
 
  +
elseif disp[1] == 'case' and modes.case then
 
  +
return moduleFiche.case( args, page )
Tableau = Tableau .. '\n| style="text-align:center" | ' .. p.image( args.nom, args.remplaceNom, args.remplaceImage, '45x45px', true, '', '_Icon' )
 
  +
elseif disp[1] == 'nom' and modes.nom then
 
  +
return moduleFiche.nom( args, page )
if args.Type == 'rune' then
 
  +
elseif disp[1] == 'tableau' and modes.tableau then
Tableau = Tableau .. '\n|' .. modSucces.deblocage( args.deblocage, false )
 
  +
if disp[2] == 'simple' and modes.tableauSimple or disp[3] == 'simple' and modes.tableauSimple then
end
 
  +
return moduleFiche.tableauSimple( args, page )
 
  +
else
if tComplet and args.citation ~= nil and args.citation ~= '' then
 
  +
return moduleFiche.tableau( args, page )
Tableau = Tableau .. '\n|' .. p.citation( args.citation, true )
 
end
+
end
  +
elseif disp[1] == 'phraseIntro' and modes.phraseIntro then
 
  +
return moduleFiche.intro( args )
Tableau = Tableau .. '\n|' .. args.description
 
  +
else
 
  +
return "''Mode d'affichage inconnu <sup>[<nowiki/>[" .. args.nom .. "]<nowiki/>]</sup>'' [[Catégorie:Mode de fiche inconnu]]"
if args.Type == 'objet actif' then
 
Tableau = Tableau .. '\n|' .. p.recharge( args.recharge )
 
end
 
 
return Tableau
 
end
 
 
--[[ FONCTION FICHE OBJET ]]
 
 
function p.ficheObjet( f )
 
local args = p.argsObjet( f )
 
local affichage = mw.text.split( args.disp, ', ' )
 
 
if args.visible ~= 0 then
 
local nom = p.nom( args.nom, args.remplaceNom, 0 )
 
Tableau = '{| class="wikitable" style="border:solid #45264D; float:right; max-width:400px"' .. '\n! style="background:#45264D; width:300px; font-size:10pt; color:#FFFFFF; font-weight:bold" |' .. nom
 
 
local dlc = modDlc.icon( args.dlc )
 
if dlc ~= nil then
 
Tableau = Tableau .. '<br>' .. dlc
 
 
end
 
end
 
Tableau = Tableau .. '\n|-\n| style="text-align:center; font-size:9pt" |' .. p.image( args.nom, args.remplaceNom, args.remplaceImage, '70px', false, '', '_Icon' )
 
 
if args.Type == 'objet actif' or args.Type == 'objet passif' then
 
Tableau = Tableau .. '\n[[Fichier:Item_altar.png|100px|centre|lien=]]'
 
end
 
 
if args.personnage ~= nil and args.personnage ~= '' then
 
Tableau = Tableau .. '\n|-\n! Apparence du personnage\n|-\n| style="text-align:center; font-weight:normal" |' .. p.image( args.nom, args.remplaceNom, args.personnage, '100px', false, '', '_App' )
 
end
 
 
if args.larmes ~= nil and args.larmes ~= '' then
 
Tableau = Tableau .. '\n|-\n! Apparence des larmes\n|-\n| style="text-align:center; font-weight:normal" |' .. p.image( args.nom, args.remplaceNom, args.larmes, '100px', false, '', '_Tears' )
 
end
 
 
Tableau = Tableau .. '\n|-\n! Type d\'objet\n|-\n| style="text-align:center; font-weight:normal" |' .. p.type( args.Type )
 
 
Tableau = Tableau .. '\n|-\n! ID de l\'objet\n|-\n| style="text-align:center; font-weight:normal" |' .. args.id
 
 
if args.citation ~= nil and args.citation ~= '' then
 
Tableau = Tableau .. '\n|-\n! Citation\n|-\n| style="text-align:center; font-weight:normal" |' .. p.citation( args.citation, true )
 
end
 
 
if args.animation ~= nil and args.animation ~= '' then
 
Tableau = Tableau .. '\n|-\n! Animation\n|-\n| style="text-align:center; font-weight:normal" |' .. args.animation
 
end
 
 
if args.recharge ~= nil and args.recharge ~= '' then
 
Tableau = Tableau .. '\n|-\n! Temps de rechargement\n|-\n| style="text-align:center; font-weight:normal" |' .. p.recharge( args.recharge )
 
end
 
 
if args.liste ~= nil and args.liste ~= '' then
 
Tableau = Tableau .. '\n|-\n! Liste de génération\n|-\n| style="text-align:center; font-weight:normal" |' .. p.liste( args.liste )
 
end
 
 
if args.deblocage ~= nil and args.deblocage ~= '' then
 
Tableau = Tableau .. '\n|-\n! Méthode de déblocage\n|-\n| style="text-align:center; font-weight:normal" |' .. modSucces.deblocage( args.deblocage, false )
 
end
 
 
if args.grille ~= nil and args.grille ~= '' then
 
Tableau = Tableau .. '\n|-\n! Grille de collection\n|-\n| style="text-align:center; font-weight:normal" |'
 
if args.grilleold ~= nil and args.grilleold ~= '' then
 
Tableau = Tableau .. modDlc.icon( 'Afterbirth' ) .. ' <u>Afterbirth</u>\n' .. p.grilleCollection( args.grille, 20, 6, true ) .. '<u>Rebirth</u>\n' .. p.grilleCollection( args.grilleold, 10, 10, true )
 
else
 
Tableau = Tableau .. p.grilleCollection( args.grille, 20, 6, true )
 
end
 
end
 
 
Tableau = Tableau .. '\n|}'
 
 
end
 
end
 
return Tableau
 
 
end
 
end
   
--[[ FONCTIONS D'OBJETS : FIN ]]
 
 
--[[ FONCTIONS GENERALES : DEBUT ]]
 
--[[ FONCTION NOM ]]
 
   
 
function p.nom( nom, remplaceNom, mode )
 
function p.nom( nom, remplaceNom, mode )
local nomFinal = nom
+
local nomFinal = remplaceNom or nom
 
 
 
if remplaceNom ~= nil and remplaceNom ~= '' then
 
if remplaceNom ~= nil and remplaceNom ~= '' then
Ligne 261 : Ligne 71 :
 
elseif mode == 2 then
 
elseif mode == 2 then
 
return '[[' .. nom .. '|' .. nomFinal .. ']]'
 
return '[[' .. nom .. '|' .. nomFinal .. ']]'
  +
elseif mode == 3 then
else
 
 
return nomFinal
 
return nomFinal
  +
else
  +
return police.titre( 'TeamMeat', nomFinal, 2 )
 
end
 
end
 
end
 
end
   
--[[ FONCTION IMAGE ]]
 
   
function p.image( nom, remplaceNom, remplaceImage, _t, lien, _sD, _sF )
+
function p.image( nom, remplaceNom, remplaceImage, _t, lien, _sD, _sF, _e )
 
local n = 1
 
local n = 1
 
local _i = nom
 
local _i = nom
local _e = '.png'
 
 
local _l = ''
 
local _l = ''
 
local autres = false
 
local autres = false
 
 
  +
_e = _e or '.png'
if remplaceImage then
 
  +
if remplaceImage ~= nil and remplaceImage ~= '' then
 
local image = mw.text.split( remplaceImage, '%s' )
 
local image = mw.text.split( remplaceImage, '%s' )
 
 
 
if image[1] then
 
if image[1] then
 
repeat
 
repeat
if image[n]:find( '%.' ) then
+
if image[n]:reverse():find( '%.', image[n]:len()-2 ) then
 
_e = image[n]
 
_e = image[n]
elseif image[n]:find( 'px' ) or image[n]:find( '%%' ) then
+
elseif image[n]:find( 'px', image[n]:len()-3 ) or image[n]:find( '%%', image[n]:len()-2 ) then
 
_t = image[n]
 
_t = image[n]
 
elseif not autres then
 
elseif not autres then
Ligne 303 : Ligne 114 :
 
end
 
end
   
--[[ FONCTION TYPE ]]
 
   
function p.type( Type )
+
function p.citation( citation, italique )
  +
local phrase
if Type == 'objet actif' then
 
  +
local _c = ''
return '[[Objets#Objets Actifs|Objet Actif]]'
 
  +
elseif Type == 'objet passif' then
 
  +
if citation:find( 'vf' ) then
return '[[Objets#Objets Passifs|Objet Passif]]'
 
  +
phrase = mw.text.split( citation, '%)%s' )
elseif Type == 'babiole' then
 
  +
phrase[1] = mw.text.trim( phrase[1], 'vo%(' )
return '[[Babioles|Babiole]]'
 
  +
phrase[2] = mw.text.trim( phrase[2], 'vf%(' )
elseif Type == 'carte' then
 
  +
phrase[2] = mw.text.trim( phrase[2], '%)' )
return '[[Cartes et Runes#Cartes|Carte]]'
 
  +
if italique then
elseif Type == 'carte spéciale' then
 
  +
_c = "[[Fichier:Drapeau_EN.png|18px|lien=|Texte original]] ''\"" .. phrase[1] .. "\"''<br/>[[Fichier:Drapeau_FR.png|18px|lien=|Traduction française]] ''\"" .. phrase[2] .. "\"''"
return '[[Cartes et Runes#Cartes Spéciales|Carte Spéciale]]'
 
  +
else
elseif Type == 'rune' then
 
  +
_c = '[[Fichier:Drapeau_EN.png|18px|lien=|Texte original]] "' .. phrase[1] .. '"<br/>[[Fichier:Drapeau_FR.png|18px|lien=|Traduction française]] "' .. phrase[2] .. '"'
return '[[Cartes et Runes#Runes|Rune]]'
 
  +
end
elseif Type == 'consommable' then
 
return '[[Cartes et Runes#Autres|Consommable]]'
 
 
else
 
else
  +
phrase = mw.text.trim( citation, 'vo%(' )
return Type
 
  +
phrase = mw.text.trim( citation, '%)' )
  +
if italique then
  +
_c = "''\"" .. phrase .. "\"''"
  +
else
  +
_c = '"' .. phrase .. '"'
  +
end
 
end
 
end
  +
  +
return _c
 
end
 
end
   
--[[ FONCTION CITATION ]]
 
   
function p.citation( citation, italique )
+
function p.recharge( recharge, mode )
local phrase
 
local _c = ''
 
 
if citation:find( 'vf' ) then
 
phrase = mw.text.split( citation, '%)%s' )
 
phrase[1] = mw.text.trim( phrase[1], 'vo%(' )
 
phrase[2] = mw.text.trim( phrase[2], 'vf%(' )
 
phrase[2] = mw.text.trim( phrase[2], '%)' )
 
_c = "[[Fichier:Drapeau_EN.png|18px|lien=|Texte original]] ''\"" .. phrase[1] .. "\"''\n[[Fichier:Drapeau_FR.png|18px|lien=|Traduction française]] ''\"" .. phrase[2] .. "\"''"
 
else
 
phrase = mw.text.trim( citation, 'vo%(' )
 
phrase = mw.text.trim( citation, '%)' )
 
_c = "''\"" .. phrase .. "\"''"
 
end
 
 
return _c
 
end
 
 
--[[ FONCTION RECHARGE ]]
 
 
function p.recharge( recharge )
 
 
local args = mw.text.split( recharge, ',%s' )
 
local args = mw.text.split( recharge, ',%s' )
 
local _i = ''
 
local _i = ''
  +
local imgParam
 
 
  +
if mode == 1 then
  +
imgParam = '|15px|lien='
  +
else
  +
imgParam = '|6px|lien='
  +
end
 
if args[1] == '1' then
 
if args[1] == '1' then
_i = '[[Image:Recharge_1.png|lien=|Recharge à 1 cran]]'
+
_i = '[[Image:Recharge_1.png' .. imgParam .. '|Recharge à 1 cran]]'
 
elseif args[1] == '2' then
 
elseif args[1] == '2' then
_i = '[[Image:Recharge_2.png|lien=|Recharge à 2 crans]]'
+
_i = '[[Image:Recharge_2.png' .. imgParam .. '|Recharge à 2 crans]]'
 
elseif args[1] == '3' then
 
elseif args[1] == '3' then
_i = '[[Image:Recharge_3.png|lien=|Recharge à 3 crans]]'
+
_i = '[[Image:Recharge_3.png' .. imgParam .. '|Recharge à 3 crans]]'
 
elseif args[1] == '4' then
 
elseif args[1] == '4' then
_i = '[[Image:Recharge_4.png|lien=|Recharge à 4 crans]]'
+
_i = '[[Image:Recharge_4.png' .. imgParam .. '|Recharge à 4 crans]]'
 
elseif args[1] == '6' then
 
elseif args[1] == '6' then
_i = '[[Image:Recharge_6.png|lien=|Recharge à 6 crans]]'
+
_i = '[[Image:Recharge_6.png' .. imgParam .. '|Recharge à 6 crans]]'
 
elseif args[1] == '12' then
 
elseif args[1] == '12' then
_i = '[[Image:Recharge_12.png|lien=|Recharge à 12 crans]]'
+
_i = '[[Image:Recharge_12.png' .. imgParam .. '|Recharge à 12 crans]]'
 
elseif args[1] == 'utilisation unique' then
 
elseif args[1] == 'utilisation unique' then
_i = '[[Image:Recharge_one_time.png|lien=|Utilisation unique]]'
+
_i = '[[Image:Recharge_one_time.png' .. imgParam .. '|Utilisation unique]]'
  +
elseif args[1] == 'infinie' then
  +
_i = '[[Image:Recharge_unlimited.png' .. imgParam .. '|Infinie]]'
 
elseif string.find( args[1], 's' ) then
 
elseif string.find( args[1], 's' ) then
_i = '[[Image:Recharge_time.png|lien=|Recharge en ' .. mw.text.trim( args[1], 's' ) .. ' secondes]]'
+
_i = '[[Image:Recharge_time.png' .. imgParam .. '|Recharge en ' .. mw.text.trim( args[1], 's' ) .. ' secondes]]'
 
end
 
end
 
 
  +
if mode == 1 then
return _i .. ' &nbsp;' .. recharge
 
  +
return _i
  +
else
  +
return _i .. ' &nbsp;' .. ( args[1] == 'utilisation unique' and 'Utilisation unique' or args[1] == 'infinie' and 'Infinie' or string.find( args[1], 's' ) and mw.text.trim( args[1], 's' ) .. ' secondes' or args[1] )
  +
end
 
end
 
end
   
--[[ FONCTION LISTE ]]
 
 
function p.liste( liste )
 
local args = mw.text.split( liste, ',%s' )
 
 
return modIcone.liste( args, 'm' )
 
end
 
 
--[[ FONCTIONS GRILLE COLLECTION ]]
 
   
 
function p.grilleCollection( grille, maxColonne, maxLigne, texte )
 
function p.grilleCollection( grille, maxColonne, maxLigne, texte )
 
local args = mw.text.split( grille, '%s' )
 
local args = mw.text.split( grille, '%s' )
local colonne = tonumber( args[2] )
+
local colonne = tonumber( args[2] )
local ligne = tonumber( args[3] )
+
local ligne = tonumber( args[3] )
local _t = ''
+
local _t = ''
local _g = ''
+
local _g = ''
  +
 
if texte then
+
if texte then
_t = '(page ' .. args[1] .. ', colonne ' .. args[2] .. ', ligne ' .. args[3] .. ')'
+
_t = '(page ' .. args[1] .. ', colonne ' .. args[2] .. ', ligne ' .. args[3] .. ')'
end
+
end
  +
 
_g = '\n{| class="wikitable" style="margin:1em auto 1em auto; line-height:0"\n|-'
+
_g = '\n<table class="wikitable" style="margin:1em auto 1em auto; line-height:0">'
  +
 
for i=1, maxLigne, 1 do
+
for i=1, maxLigne, 1 do
if ligne == i then
+
if ligne == i then
_g = _g .. '\n|- style="background-color:#CCC"'
+
_g = _g .. '<tr style="background-color:#CCC">'
else
+
else
_g = _g .. '\n|-'
+
_g = _g .. '<tr>'
end
+
end
for j=1, maxColonne, 1 do
+
for j=1, maxColonne, 1 do
if colonne == j and ligne == i then
+
if colonne == j and ligne == i then
_g = _g .. '\n| style="background-color:#888" |'
+
_g = _g .. '<td style="background-color:#888"></td>'
elseif colonne == j then
+
elseif colonne == j then
_g = _g .. '\n| style="background-color:#CCC" |'
+
_g = _g .. '<td style="background-color:#CCC"></td>'
else
+
else
_g = _g .. '\n|'
+
_g = _g .. '<td></td>'
  +
end
end
 
end
+
end
  +
_g = _g .. '</tr>'
end
 
  +
end
 
  +
_g = _g .. '\n|}'
 
  +
_g = _g .. '</table>'
 
  +
 
return _t .. _g
 
return _t .. _g
 
end
 
end
 
--[[ FONCTIONS GENERALES : FIN ]]
 
   
 
return p
 
return p

Dernière version du 25 novembre 2017 à 21:23

Template-info Documentation

Fonction mode( f, listeModes ) []

Cette fonction met en place la structure d'un module fiche.
ArgumentsRenvois
f (frame)
  • Frame de la page utilisée.
  • Nécessite trois paramètres, en plus de ceux spécifiques à chaque fiche :
    disp (string)
    • Mode d'affichage, utilisé lors d'une transclusion. Doit avoir pour valeur {{{2}}}.
    temp (string)
    • Nom de l'élément auquel la fiche est dédiée, utilisé lors d'une transclusion. Doit avoir pour valeur {{{1}}}.
    nom (string)
    • Nom de l'élément auquel la fiche est dédiée.
  • Toute valeur nulle sur ou syntaxe non respectée sur l'un de ces trois paramètres nuira directement au bon fonctionnement des Fiches.
listeModes (string)
  • Liste des modes utilisés par la fiche, séparés par  /  :
    • case
    • nom
    • tableau
    • tableauSimple (nécessite tableau)
    • phraseIntro
    • Le mode fiche est présent par défaut et n'a pas besoin d'être ajouté.
  • Type : (function)
  • Fonction correspondant au mode demandée de la fiche correspondante.
  • Renvoie deux arguments :
    args (table)
    • Renvoyé par la fonction args( f ) de la fiche correspondante.
    page (table)
  • Renvoie une valeur (string) si le mode demandé dans disp n'existe pas.

Fonction nom( nom, remplaceNom, mode ) []

Cette fonction gère l'affichage du titre d'une fiche.
ArgumentsRenvois
nom (string)
  • Valeur de l'argument nom contenu dans le tableau args de la fonction mode( f, listeModes ).
remplaceNom (string)
  • Texte à afficher, s'il est différent de la valeur de nom.
  • Peut prendre une valeur nulle.
mode (int)
  • Apparence du titre à renvoyer :
    • 0 ou nil renvoie le texte avec la police TeamMeat de la fonction titre( police, texte, taille ) du Module:Police.
    • 1 renvoie le contenu du paramètre |lien= d'une image MediaWiki.
    • 2 renvoie le titre avec un lien vers la page correspondante. À utiliser sur des transclusions.
    • 3 renvoie le titre sans autre modification.
  • Type : (string)
  • Dépend de la valeur de l'argument mode.

Fonction image( nom, remplaceNom, remplaceImage, _t, lien, _sD, _sF, _e ) []

Cette fonction renvoie un fichier selon les paramètres entrés par l'utilisateur.
ArgumentsRenvois
nom (string)
  • Valeur de l'argument nom contenu dans le tableau args de la fonction mode( f, listeModes ).
remplaceNom (string)
  • Texte à afficher sur le fichier, s'il est différent de la valeur de nom.
  • Peut prendre une valeur nulle.
remplaceImage (string)
  • Nom du fichier, sans l'espace de nom, l'extension et les chaînes de caractères supplémentaires s'il est différent de la valeur de nom.
  • Peut prendre une valeur nulle.
_t (string)
  • Taille initiale du fichier en pixels (ex. : 60x60px).
lien (boolean)
  • Indique si le fichier doit avoir un lien.
_sD (string)
  • Caractères à ajouter avant le nom du fichier (ex. : Boss_).
_sF (string)
  • Caractères à ajouter après le nom du fichier, avant l'extension (ex. : _App).
_e (string)
  • Optionnel. Extension initiale du fichier (ex. : .gif).
  • Prend pour valeur .png si sa valeur est nulle.
  • Type : (string)
  • Fichier au format MediaWiki.

Fonction citation( citation, italique ) []

Cette fonction affiche la citation d'un élément.
ArgumentsRenvois
citation (string)
  • Citation en anglais.
  • Pour la citation traduite en français, entrer : vo(CitationEN) vf(CitationFR).
italique (boolean)
  • Optionnel. Indique si le texte doit être en italique.
  • Type : (string)

Fonction recharge( recharge, mode ) []

Cette fonction affiche la recharge d'un objet activable.
ArgumentsRenvois
recharge (string)
  • Type de recharge :
    • 1, 2, 3, 4, 6 ou 12.
    • utilisation unique pour un objet disparaissant après utilisation.
    • infinie pour un objet sans recharge.
    • 6s pour un objet se rechargeant au fil du temps.
mode (int)
  • Apparence de la recharge à renvoyer :
    • 0 ou nil renvoie l'image de la recharge et le texte associé.
    • 1 renvoie l'image de la recharge de grande taille.
  • Type : (string)

Fonction grilleCollection( grille, maxColonne, maxLigne, texte ) []

Cette fonction renvoie une grille de collection, la case demandée sélectionnée.
ArgumentsRenvois
grille (string)
  • Position de la case à sélectionner.
  • Entrer la page, la colonne puis la ligne, en séparant les valeurs par un espace.
maxColonne (int)
  • Nombre de colonnes à afficher dans la grille.
maxLigne (int)
  • Nombre de lignes à afficher dans la grille.
texte (boolean)
  • Optionnel. Indique si l'emplacement de la case sélectionné doit être écrit au-dessus de la fiche.
  • Type : (string)

local p = {}
local Tableau

local modElements = require( 'Module:Elements' )
local police = require( 'Module:Police' )


function p.mode( f, listeModes )
	local moduleFiche = require( f:getTitle() )
	local args = moduleFiche.args( f )
	local disp = mw.text.split( args.disp, '-')
	local page = modElements.page( args.nom )
	local modes = {}
	
	for index, objet in pairs( args ) do
		if objet == '' then
			args[index] = nil
		end
	end
	
	if not page.valeur.dlc then
		page.valeur.dlc = ''
	end
	
	if disp[2] == 'dlc' then
		page.valeur.dlc = args.dlc
	elseif disp[2] == 'nodlc' then
		page.valeur.dlc = 'Booster Pack 10'
	end
	
	if listeModes then
		local tableauModes = mw.text.split( listeModes, '%s/%s' )
		local i = 1
		
		repeat
			modes[tableauModes[i]] = true
			i = i + 1
		until not tableauModes[i]
	end
	
	if args.temp == args.nom or args.temp == '{{{1}}}' then
		if args.disp == '{{{2}}}' then
			return moduleFiche.fiche( args, page )
		elseif disp[1] == 'case' and modes.case then
			return moduleFiche.case( args, page )
		elseif disp[1] == 'nom' and modes.nom then
			return moduleFiche.nom( args, page )
		elseif disp[1] == 'tableau' and modes.tableau then
			if disp[2] == 'simple' and modes.tableauSimple or disp[3] == 'simple' and modes.tableauSimple then
				return moduleFiche.tableauSimple( args, page )
			else
				return moduleFiche.tableau( args, page )
			end
		elseif disp[1] == 'phraseIntro' and modes.phraseIntro then
			return moduleFiche.intro( args )
		else
			return "''Mode d'affichage inconnu <sup>[<nowiki/>[" .. args.nom .. "]<nowiki/>]</sup>'' [[Catégorie:Mode de fiche inconnu]]"
		end
	end
end


function p.nom( nom, remplaceNom, mode )
	local nomFinal = remplaceNom or nom
	
	if remplaceNom ~= nil and remplaceNom ~= '' then
		nomFinal = remplaceNom
	end
	if mode == 1 then
		return nom .. '|' .. nomFinal
	elseif mode == 2 then
		return '[[' .. nom .. '|' .. nomFinal .. ']]'
	elseif mode == 3 then
		return nomFinal
	else
		return police.titre( 'TeamMeat', nomFinal, 2 )
	end
end


function p.image( nom, remplaceNom, remplaceImage, _t, lien, _sD, _sF, _e )
	local n = 1
	local _i = nom
	local _l = ''
	local autres = false
	
	_e = _e or '.png'
	if remplaceImage ~= nil and remplaceImage ~= '' then
		local image = mw.text.split( remplaceImage, '%s' )
		
		if image[1] then
			repeat
				if image[n]:reverse():find( '%.', image[n]:len()-2 ) then
					_e = image[n]
				elseif image[n]:find( 'px', image[n]:len()-3 ) or image[n]:find( '%%', image[n]:len()-2 ) then
					_t = image[n]
				elseif not autres then
					_i = image[n]
					autres = true
				else
					_c = '[[Catégorie:Paramètres d\'image inconnus]]'
				end
				n = n + 1
			until not image[n]
		end
	end
	if lien then
		_l = p.nom( nom, remplaceNom, 1 )
	else
		_l = ''
	end
	
	return '[[Image:' .. _sD .. _i .. _sF .. _e .. '|' .. _t .. '|lien=' .. _l .. ']]'
end


function p.citation( citation, italique )
	local phrase
	local _c = ''
	
	if citation:find( 'vf' ) then
		phrase = mw.text.split( citation, '%)%s' )
		phrase[1] = mw.text.trim( phrase[1], 'vo%(' )
		phrase[2] = mw.text.trim( phrase[2], 'vf%(' )
		phrase[2] = mw.text.trim( phrase[2], '%)' )
		if italique then
			_c = "[[Fichier:Drapeau_EN.png|18px|lien=|Texte original]] ''\"" .. phrase[1] .. "\"''<br/>[[Fichier:Drapeau_FR.png|18px|lien=|Traduction française]] ''\"" .. phrase[2] .. "\"''"
		else
			_c = '[[Fichier:Drapeau_EN.png|18px|lien=|Texte original]] "' .. phrase[1] .. '"<br/>[[Fichier:Drapeau_FR.png|18px|lien=|Traduction française]] "' .. phrase[2] .. '"'
		end
	else
		phrase = mw.text.trim( citation, 'vo%(' )
		phrase = mw.text.trim( citation, '%)' )
		if italique then
			_c = "''\"" .. phrase .. "\"''"
		else
			_c = '"' .. phrase .. '"'
		end
	end
	
	return _c
end


function p.recharge( recharge, mode )
	local args = mw.text.split( recharge, ',%s' )
	local _i = ''
	local imgParam
	
	if mode == 1 then
		imgParam = '|15px|lien='
	else
		imgParam = '|6px|lien='
	end
	if args[1] == '1' then
		_i = '[[Image:Recharge_1.png' .. imgParam .. '|Recharge à 1 cran]]'
	elseif args[1] == '2' then
		_i = '[[Image:Recharge_2.png' .. imgParam .. '|Recharge à 2 crans]]'
	elseif args[1] == '3' then
		_i = '[[Image:Recharge_3.png' .. imgParam .. '|Recharge à 3 crans]]'
	elseif args[1] == '4' then
		_i = '[[Image:Recharge_4.png' .. imgParam .. '|Recharge à 4 crans]]'
	elseif args[1] == '6' then
		_i = '[[Image:Recharge_6.png' .. imgParam .. '|Recharge à 6 crans]]'
	elseif args[1] == '12' then
		_i = '[[Image:Recharge_12.png' .. imgParam .. '|Recharge à 12 crans]]'
	elseif args[1] == 'utilisation unique' then
		_i = '[[Image:Recharge_one_time.png' .. imgParam .. '|Utilisation unique]]'
	elseif args[1] == 'infinie' then
		_i = '[[Image:Recharge_unlimited.png' .. imgParam .. '|Infinie]]'
	elseif string.find( args[1], 's' ) then
		_i = '[[Image:Recharge_time.png' .. imgParam .. '|Recharge en ' .. mw.text.trim( args[1], 's' ) .. ' secondes]]'
	end
	
	if mode == 1 then
		return _i
	else
		return _i .. ' &nbsp;' .. ( args[1] == 'utilisation unique' and 'Utilisation unique' or args[1] == 'infinie' and 'Infinie' or string.find( args[1], 's' ) and mw.text.trim( args[1], 's' ) .. ' secondes' or args[1] )
	end
end


function p.grilleCollection( grille, maxColonne, maxLigne, texte )
	local args = mw.text.split( grille, '%s' )
	local colonne = tonumber( args[2] )
	local ligne = tonumber( args[3] )
	local _t = ''
	local _g = ''
	
	if texte then
		_t = '(page ' .. args[1] .. ', colonne ' .. args[2] .. ', ligne ' .. args[3] .. ')'
	end
	
	_g = '\n<table class="wikitable" style="margin:1em auto 1em auto; line-height:0">'
	
	for i=1, maxLigne, 1 do
		if ligne == i then
			_g = _g .. '<tr style="background-color:#CCC">'
		else
			_g = _g .. '<tr>'
		end
		for j=1, maxColonne, 1 do
			if colonne == j and ligne == i then
				_g = _g .. '<td style="background-color:#888"></td>'
			elseif colonne == j then
				_g = _g .. '<td style="background-color:#CCC"></td>'
			else
				_g = _g .. '<td></td>'
			end
		end
		_g = _g .. '</tr>'
	end
	
	_g = _g .. '</table>'
	
	return _t .. _g
end

return p