(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 |
+ | 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 |
+ | 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 |
+ | 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 |
+ | 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 |
|
+ | 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. |
+ | 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. |
+ | 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 |
+ | _i = '[[Image:Recharge_1.png' .. imgParam .. '|Recharge à 1 cran]]' |
elseif args[1] == '2' then |
elseif args[1] == '2' then |
||
− | _i = '[[Image:Recharge_2.png |
+ | _i = '[[Image:Recharge_2.png' .. imgParam .. '|Recharge à 2 crans]]' |
elseif args[1] == '3' then |
elseif args[1] == '3' then |
||
− | _i = '[[Image:Recharge_3.png |
+ | _i = '[[Image:Recharge_3.png' .. imgParam .. '|Recharge à 3 crans]]' |
elseif args[1] == '4' then |
elseif args[1] == '4' then |
||
− | _i = '[[Image:Recharge_4.png |
+ | _i = '[[Image:Recharge_4.png' .. imgParam .. '|Recharge à 4 crans]]' |
elseif args[1] == '6' then |
elseif args[1] == '6' then |
||
− | _i = '[[Image:Recharge_6.png |
+ | _i = '[[Image:Recharge_6.png' .. imgParam .. '|Recharge à 6 crans]]' |
elseif args[1] == '12' then |
elseif args[1] == '12' then |
||
− | _i = '[[Image:Recharge_12.png |
+ | _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 |
+ | _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 |
+ | _i = '[[Image:Recharge_time.png' .. imgParam .. '|Recharge en ' .. mw.text.trim( args[1], 's' ) .. ' secondes]]' |
end |
end |
||
+ | if mode == 1 then |
||
− | return _i .. ' ' .. recharge |
||
+ | return _i |
||
+ | else |
||
+ | return _i .. ' ' .. ( 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 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 |
||
− | + | 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
Fonction
| |
---|---|
Cette fonction met en place la structure d'un module fiche. | |
Arguments | Renvois |
|
|
Fonction
| |
---|---|
Cette fonction gère l'affichage du titre d'une fiche. | |
Arguments | Renvois |
|
|
La documentation ci-haut est transcluse de Module:Fiche/doc. (modifier | historique)
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 .. ' ' .. ( 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