(Devrait mieux fonctionner) |
(Mauvais caractères) |
||
Ligne 327 : | Ligne 327 : | ||
if citation:find( 'vf' ) then |
if citation:find( 'vf' ) then |
||
− | phrase = mw.text.split( citation, ')%s' ) |
+ | phrase = mw.text.split( citation, '%)%s' ) |
− | phrase[1] = mw.text.trim( phrase[1], 'vo(' ) |
+ | phrase[1] = mw.text.trim( phrase[1], 'vo%(' ) |
− | phrase[2] = mw.text.trim( phrase[2], 'vf(' ) |
+ | phrase[2] = mw.text.trim( phrase[2], 'vf%(' ) |
− | phrase[2] = mw.text.trim( phrase[2], ')' ) |
+ | phrase[2] = mw.text.trim( phrase[2], '%)' ) |
_c = "[[Fichier:Drapeau_EN.png|18px|link=|Texte original]]: ''" .. phrase[1] .. "''\n[[Fichier:Drapeau_FR.png|18px|link=|Traduction française]]: ''" .. phrase[2] .. "''" |
_c = "[[Fichier:Drapeau_EN.png|18px|link=|Texte original]]: ''" .. phrase[1] .. "''\n[[Fichier:Drapeau_FR.png|18px|link=|Traduction française]]: ''" .. phrase[2] .. "''" |
||
else |
else |
||
− | phrase = mw.text.trim( citation, 'vo(' ) |
+ | phrase = mw.text.trim( citation, 'vo%(' ) |
− | phrase = mw.text.trim( citation, ')' ) |
+ | phrase = mw.text.trim( citation, '%)' ) |
_c = "''" .. phrase .. "''" |
_c = "''" .. phrase .. "''" |
||
end |
end |
||
Ligne 344 : | Ligne 344 : | ||
function p.recharge( recharge ) |
function p.recharge( recharge ) |
||
− | local args = mw.text.split( recharge, ', |
+ | local args = mw.text.split( recharge, ',%s' ) |
local _i = '' |
local _i = '' |
||
Ligne 371 : | Ligne 371 : | ||
function p.liste( liste ) |
function p.liste( liste ) |
||
− | local args = mw.text.split( liste, ', |
+ | local args = mw.text.split( liste, ',%s' ) |
return modIcone.liste( args, 'm' ) |
return modIcone.liste( args, 'm' ) |
Version du 24 mai 2017 à 15:30
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 |
|
|
Fonction
| |
---|---|
Cette fonction renvoie un fichier selon les paramètres entrés par l'utilisateur. | |
Arguments | Renvois |
|
|
Fonction
| |
---|---|
Cette fonction affiche la citation d'un élément. | |
Arguments | Renvois |
|
|
Fonction
| |
---|---|
Cette fonction affiche la recharge d'un objet activable. | |
Arguments | Renvois |
|
|
Fonction
| |
---|---|
Cette fonction renvoie une grille de collection, la case demandée sélectionnée. | |
Arguments | Renvois |
|
|
La documentation ci-haut est transcluse de Module:Fiche/doc. (modifier | historique)
local p = {}
local Tableau
local modDlc = require( 'Module:Dlc' )
local modElements = require( 'Module:Elements' )
local modIcone = require( 'Module:Icone' )
local modSucces = require( 'Module:Succes' )
--[[ FONCTIONS ARGUMENTS INITIAUX : DEBUT ]]
--[[ FONCTION ARGUMENTS MONSTRE ]]
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['gerilleold'],
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 blocage = mw.text.split( args.disp, '-')
if blocage[2] == 'dlc' then
page.valeur.dlc = args.dlc
elseif blocage[2] == 'nodlc' then
page.valeur.dlc = 'Booster Pack 10'
end
if args.temp == args.nom or args.temp == '{{{1}}}' then
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
Tableau = Tableau .. p.image( args.nom, args.remplaceNom, args.imageNom, '20x20px', true, '', '_Icon' )
Tableau = Tableau .. p.nom( args.nom, args.remplaceNom, 2 )
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
if args.dlc ~= nil and iconeDlc then
Tableau = Tableau .. modDlc.icon( args.dlc )
end
if tComplet then
Tableau = Tableau .. '\n| style="text-align:center" | ' .. args.id
end
Tableau = Tableau .. '\n| style="text-align:center" | ' .. p.image( args.nom, args.remplaceNom, args.remplaceImage, '45x45px', true, '', '_Icon' )
if args.Type == 'rune' then
Tableau = Tableau .. '\n|' .. modSucces.deblocage( args.deblocage, false )
end
if tComplet then
Tableau = Tableau .. '\n|' .. args.citation
end
Tableau = Tableau .. '\n|' .. args.description
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
Tableau = Tableau .. '\n|-\n| style="text-align:center; font-size:9pt" |' .. p.image( args.nom, args.remplaceNom, args.remplaceImage, '70px', false, '', '_Icon' )
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>' .. p.grilleCollection( args.grille, 20, 6, true ) .. '<u>Rebirth</u>' .. p.grilleCollection( args.grilleold, 10, 10, true )
else
Tableau = Tableau .. p.grilleCollection( args.grille, 20, 6, true )
end
end
Tableau = Tableau .. '\n|}'
end
return Tableau
end
--[[ FONCTIONS D'OBJETS : FIN ]]
--[[ FONCTIONS GENERALES : DEBUT ]]
--[[ FONCTION NOM ]]
function p.nom( nom, remplaceNom, mode )
local nomFinal = nom
if remplaceNom ~= nil and remplaceNom ~= '' then
nomFinal = remplaceNom
end
if mode == 1 then
return nom .. '|' .. nomFinal
elseif mode == 2 then
return '[[' .. nom .. '|' .. nomFinal .. ']]'
else
return nomFinal
end
end
--[[ FONCTION IMAGE ]]
function p.image( nom, remplaceNom, remplaceImage, _t, lien, _sD, _sF )
local n = 1
local _i = nom
local _e = '.png'
local _l = ''
local autres = false
if remplaceImage then
local image = mw.text.split( remplaceImage, '%s' )
if image[1] then
repeat
if image[n]:find( '%.' ) then
_e = image[n]
elseif image[n]:find( 'px' ) or image[n]:find( '%%' ) 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
--[[ FONCTION TYPE ]]
function p.type( Type )
if Type == 'objet actif' then
return '[[Objets#Objets Actifs|Objet Actif]]'
elseif Type == 'objet passif' then
return '[[Objets#Objets Passifs|Objet Passif]]'
elseif Type == 'babiole' then
return '[[Babioles|Babiole]]'
elseif Type == 'carte' then
return '[[Cartes et Runes#Cartes|Carte]]'
elseif Type == 'carte spéciale' then
return '[[Cartes et Runes#Cartes Spéciales|Carte Spéciale]]'
elseif Type == 'rune' then
return '[[Cartes et Runes#Runes|Rune]]'
elseif Type == 'consommable' then
return '[[Cartes et Runes#Autres|Consommable]]'
else
return Type
end
end
--[[ FONCTION CITATION ]]
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], '%)' )
_c = "[[Fichier:Drapeau_EN.png|18px|link=|Texte original]]: ''" .. phrase[1] .. "''\n[[Fichier:Drapeau_FR.png|18px|link=|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 _i = ''
if args[1] == '1' then
_i = '[[Image:Recharge_1.png]]'
elseif args[1] == '2' then
_i = '[[Image:Recharge_2.png]]'
elseif args[1] == '3' then
_i = '[[Image:Recharge_3.png]]'
elseif args[1] == '4' then
_i = '[[Image:Recharge_4.png]]'
elseif args[1] == '6' then
_i = '[[Image:Recharge_6.png]]'
elseif args[1] == '12' then
_i = '[[Image:Recharge_12.png]]'
elseif args[1] == 'utilisation unique' then
_i = '[[Image:Recharge_one_time.png]]'
elseif string.find( args[1], 's' ) then
_i = '[[Image:Recharge_time.png]]'
end
return _i .. ' ' .. recharge
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 )
local args = mw.text.split( grille, '%s' )
local _t = ''
local _g = ''
if texte then
_t = '(page ' .. args[1] .. ', colonne ' .. args[2] .. ', ligne ' .. args[3] .. ')'
end
_g = '\n{| class="wikitable" style="margin:1em auto 1em auto; line-height:0"'
for i=1, maxLigne, 1 do
if args[3] == i then
_g = _g .. '\n|- style="background-color:#CCC"'
else
_g = _g .. '\n|-'
end
for j=1, maxColonne, 1 do
if args[2] == j and args[3] == i then
_g = _g .. '\n| style="background-color:#888" |'
elseif args[2] == j then
_g = _g .. '\n| style="background-color:#CCC" |'
else
_g = _g .. '\n|'
end
end
end
_g = '\n|}'
return _t .. _g
end
--[[ FONCTIONS GENERALES : FIN ]]
return p