(Majuscules) |
(Amélioration documentation et mode objet "nom") |
||
Ligne 2 : | Ligne 2 : | ||
local Tableau |
local Tableau |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
− | + | local modIcone = require( 'Module:Icone' ) |
|
⚫ | |||
+ | |||
+ | |||
+ | --[[ FONCTIONS ARGUMENTS INITIAUX : DEBUT ]] |
||
+ | --[[ FONCTIONS ARGUMENTS OBJET ]] |
||
+ | |||
⚫ | |||
+ | return 'aaa' |
||
+ | end |
||
+ | |||
+ | --[[ FONCTIONS ARGUMENTS INITIAUX : FIN ]] |
||
+ | |||
+ | --[[ FONCTIONS D'OBJETS : DEBUT ]] |
||
+ | --[[ FONCTION MODE OBJET ]] |
||
+ | |||
⚫ | |||
+ | local page = modElements.page( f:getParent().args['nom'] ) |
||
⚫ | |||
+ | local blocage = mw.text.split( mode, '-') |
||
+ | if blocage[2] == 'dlc' then |
||
+ | page.valeur.dlc = f:getParent().args['dlc'] |
||
+ | end |
||
+ | |||
+ | if mode == 'nom' then |
||
+ | return p.modeObjetNom( f, page.valeur.dlc ) |
||
+ | else |
||
+ | return "''Mode d'affichage inconnu <sup>[<nowiki/>[" .. f:getParent().args['nom'] .. "]<nowiki/>]</sup>'' [[Catégorie:Mode de modèle manquant]]" |
||
+ | end |
||
+ | end |
||
+ | |||
+ | --[[ FONCTION MODE OBJET NOM ]] |
||
+ | |||
+ | function p.modeObjetNom( f, icone ) |
||
+ | local dlc = p.dlc( f ) |
||
+ | if dlc ~= nil and icone then |
||
+ | Tableau = dlc |
||
+ | end |
||
+ | |||
+ | local lien = p.lien( f, true ) |
||
+ | Tableau = Tableau .. lien |
||
+ | |||
+ | return Tableau |
||
+ | end |
||
+ | |||
+ | --[[ FONCTION FICHE OBJET ]] |
||
+ | |||
+ | function p.ficheObjet( f ) |
||
+ | local affichage = mw.text.split( f:getParent().args['disp'], ', ' ) |
||
if f:getParent().args['visible'] ~= 0 then |
if f:getParent().args['visible'] ~= 0 then |
||
Ligne 59 : | Ligne 107 : | ||
Tableau = Tableau .. '\n|-\n! Méthode de déblocage\n|-\n| style="text-align:center; font-weight:normal" | ' .. deblocage |
Tableau = Tableau .. '\n|-\n! Méthode de déblocage\n|-\n| style="text-align:center; font-weight:normal" | ' .. deblocage |
||
end |
end |
||
− | |||
− | |||
Tableau = Tableau .. '\n|}' |
Tableau = Tableau .. '\n|}' |
||
Ligne 68 : | Ligne 114 : | ||
end |
end |
||
+ | --[[ FONCTIONS D'OBJETS : FIN ]] |
||
+ | --[[ FONCTIONS GENERALES : DEBUT ]] |
||
− | -- NOM |
||
+ | --[[ FONCTION NOM ]] |
||
function p.nom( f ) |
function p.nom( f ) |
||
Ligne 83 : | Ligne 131 : | ||
end |
end |
||
+ | --[[ FONCTION LIEN ]] |
||
+ | function p.lien( f, mode ) |
||
− | -- LIEN |
||
− | |||
⚫ | |||
local nom = p.nom( f ) |
local nom = p.nom( f ) |
||
+ | if mode then |
||
⚫ | |||
+ | return '[[' .. f:getParent().args['nom'] .. '|' .. nom .. ']]' |
||
+ | else |
||
⚫ | |||
+ | end |
||
end |
end |
||
+ | --[[ FONCTION DLC ]] |
||
− | |||
− | -- DLC |
||
function p.dlc( f ) |
function p.dlc( f ) |
||
⚫ | |||
local args = f:getParent().args['dlc'] |
local args = f:getParent().args['dlc'] |
||
− | local dlc = |
+ | local dlc = modDlc.icon( args ) |
return dlc |
return dlc |
||
end |
end |
||
+ | --[[ FONCTION IMAGE ]] |
||
− | |||
− | -- IMAGE |
||
function p.image( f , lien ) |
function p.image( f , lien ) |
||
Ligne 137 : | Ligne 185 : | ||
end |
end |
||
⚫ | |||
− | |||
⚫ | |||
function p.images( f , arg ) |
function p.images( f , arg ) |
||
Ligne 160 : | Ligne 207 : | ||
end |
end |
||
+ | --[[ FONCTION TYPE ]] |
||
− | |||
− | -- TYPE |
||
function p.type( f ) |
function p.type( f ) |
||
Ligne 185 : | Ligne 231 : | ||
end |
end |
||
− | -- RECHARGE |
+ | --[[ FONCTION RECHARGE ]] |
function p.recharge( f ) |
function p.recharge( f ) |
||
Ligne 212 : | Ligne 258 : | ||
end |
end |
||
+ | --[[ FONCTION LISTE ]] |
||
− | |||
− | -- LISTE |
||
function p.liste( f ) |
function p.liste( f ) |
||
⚫ | |||
local args = f:getParent().args['liste'] |
local args = f:getParent().args['liste'] |
||
local listes = mw.text.split( args, ', ' ) |
local listes = mw.text.split( args, ', ' ) |
||
− | local icones = |
+ | local icones = modIcone.liste( listes, 'm' ) |
return icones |
return icones |
||
end |
end |
||
⚫ | |||
− | |||
⚫ | |||
function p.deblocage( f ) |
function p.deblocage( f ) |
||
⚫ | |||
local args = f:getParent().args['déblocage'] |
local args = f:getParent().args['déblocage'] |
||
− | local deblocage = |
+ | local deblocage = modSucces.deblocage( args ) |
return deblocage |
return deblocage |
||
end |
end |
||
⚫ | |||
− | |||
⚫ | |||
function p.grillecollection( f ) |
function p.grillecollection( f ) |
||
Ligne 253 : | Ligne 294 : | ||
return '{{GrilleCollectionOld |' .. arg[1] .. '|' .. arg[2] .. '|' .. arg[3] .. '}}' |
return '{{GrilleCollectionOld |' .. arg[1] .. '|' .. arg[2] .. '|' .. arg[3] .. '}}' |
||
end |
end |
||
+ | |||
+ | --[[ FONCTIONS GENERALES : FIN ]] |
||
return p |
return p |
Version du 19 mai 2017 à 15:32
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 ]]
--[[ FONCTIONS ARGUMENTS OBJET ]]
function p.argsObjet( f )
return 'aaa'
end
--[[ FONCTIONS ARGUMENTS INITIAUX : FIN ]]
--[[ FONCTIONS D'OBJETS : DEBUT ]]
--[[ FONCTION MODE OBJET ]]
function p.modeObjet( f )
local page = modElements.page( f:getParent().args['nom'] )
local mode = f:getParent().args['disp']
local blocage = mw.text.split( mode, '-')
if blocage[2] == 'dlc' then
page.valeur.dlc = f:getParent().args['dlc']
end
if mode == 'nom' then
return p.modeObjetNom( f, page.valeur.dlc )
else
return "''Mode d'affichage inconnu <sup>[<nowiki/>[" .. f:getParent().args['nom'] .. "]<nowiki/>]</sup>'' [[Catégorie:Mode de modèle manquant]]"
end
end
--[[ FONCTION MODE OBJET NOM ]]
function p.modeObjetNom( f, icone )
local dlc = p.dlc( f )
if dlc ~= nil and icone then
Tableau = dlc
end
local lien = p.lien( f, true )
Tableau = Tableau .. lien
return Tableau
end
--[[ FONCTION FICHE OBJET ]]
function p.ficheObjet( f )
local affichage = mw.text.split( f:getParent().args['disp'], ', ' )
if f:getParent().args['visible'] ~= 0 then
local nom = p.nom( f )
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 = p.dlc( f )
if dlc ~= nil then
Tableau = Tableau .. '<br>' .. dlc
end
local image = p.image( f , false )
Tableau = Tableau .. '\n|-\n| style="text-align:center; font-size:9pt" | ' .. image
if f:getParent().args['personnage'] ~= nil and f:getParent().args['personnage'] ~= '' then
local personnage = p.images( f , 'personnage' )
Tableau = Tableau .. '\n|-\n! Apparence du personnage\n|-\n| style="text-align:center; font-weight:normal" | ' .. personnage
end
if f:getParent().args['personnage'] ~= nil and f:getParent().args['personnage'] ~= '' then
local larmes = p.images( f , 'larmes' )
Tableau = Tableau .. '\n|-\n! Apparence des larmes\n|-\n| style="text-align:center; font-weight:normal" | ' .. larmes
end
local Type = p.type( f )
Tableau = Tableau .. '\n|-\n! Type d\'objet\n|-\n| style="text-align:center;font-weight:normal" | ' .. Type
local ID = f:getParent().args['id']
Tableau = Tableau .. '\n|-\n! ID de l\'objet\n|-\n| style="text-align:center;font-weight:normal" | ' .. ID
local citation = f:getParent().args['citation']
Tableau = Tableau .. '\n|-\n! Citation\n|-\n| style="text-align:center;font-weight:normal" | ' .. citation
local animation = f:getParent().args['animation']
if animation == nil and animation == '' then
Tableau = Tableau .. '\n|-\n! Animation\n|-\n| style="text-align:center; font-weight:normal" | ' .. animation
end
local recharge = f:getParent().args['recharge']
if recharge ~= nil and recharge ~= '' then
recharge = p.recharge( recharge )
Tableau = Tableau .. '\n|-\n! Temps de rechargement\n|-\n| style="text-align:center; font-weight:normal" | ' .. recharge
end
local liste = f:getParent().args['liste']
if liste ~= nil and liste ~= '' then
liste = p.liste( f )
Tableau = Tableau .. '\n|-\n! Liste de génération\n|-\n| style="text-align:center; font-weight:normal" | ' .. liste
end
if f:getParent().args['déblocage'] ~= nil and f:getParent().args['déblocage'] ~= '' then
local deblocage = p.deblocage( f )
Tableau = Tableau .. '\n|-\n! Méthode de déblocage\n|-\n| style="text-align:center; font-weight:normal" | ' .. deblocage
end
Tableau = Tableau .. '\n|}'
end
return Tableau
end
--[[ FONCTIONS D'OBJETS : FIN ]]
--[[ FONCTIONS GENERALES : DEBUT ]]
--[[ FONCTION NOM ]]
function p.nom( f )
local nom = f:getParent().args['nom']
local remplacenom = f:getParent().args['remplacenom']
if remplacenom == nil or remplacenom == '' then
return nom
else
return remplacenom
end
end
--[[ FONCTION LIEN ]]
function p.lien( f, mode )
local nom = p.nom( f )
if mode then
return '[[' .. f:getParent().args['nom'] .. '|' .. nom .. ']]'
else
return f:getParent().args['nom'] .. '|' .. nom
end
end
--[[ FONCTION DLC ]]
function p.dlc( f )
local args = f:getParent().args['dlc']
local dlc = modDlc.icon( args )
return dlc
end
--[[ FONCTION IMAGE ]]
function p.image( f , lien )
local image = f:getParent().args['nom']
local remplaceimage = f:getParent().args['remplaceimage']
local typeimage = f:getParent().args['typeimage']
local taillepcpl = f:getParent().args['taille-pcpl']
if remplaceimage == nil or remplaceimage == '' then
image = '[[Image:' .. image .. '_Icon.'
if typeimage == nil or typeimage == '' then
image = image .. 'png'
else
image = image .. typeimage
end
else
image = '[[Image:' .. remplaceimage
end
if lien then
else
if taillepcpl == nil or taillepcpl == '' then
image = image .. '|70px]]'
else
image = image .. '|' .. taillepcpl .. 'px]]'
end
end
return image
end
--[[ FONCTION AUTRES IMAGES ]]
function p.images( f , arg )
local image = mw.text.split( f:getParent().args[arg], '%s' )
local nom = mw.text.split( image[1], '%.' )
local ext = ''
if nom[1] == nil or nom[1] == '' then
nom[1] = f:getParent().args['nom']
end
if nom[2] == nil or nom[2] == '' then
nom[2] = 'png'
end
if arg == 'personnage' then
ext = '_App'
elseif arg == 'larmes' then
ext = '_Tears'
end
return '[[Image:' .. nom[1] .. ext .. '.' .. nom[2] .. '|' .. image[2] .. ']]'
end
--[[ FONCTION TYPE ]]
function p.type( f )
local Type = f:getParent().args['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 RECHARGE ]]
function p.recharge( f )
local args = mw.text.split( f, ', ' )
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 .. ' ' .. f
end
--[[ FONCTION LISTE ]]
function p.liste( f )
local args = f:getParent().args['liste']
local listes = mw.text.split( args, ', ' )
local icones = modIcone.liste( listes, 'm' )
return icones
end
--[[ FONCTION DÉBLOCAGE ]]
function p.deblocage( f )
local args = f:getParent().args['déblocage']
local deblocage = modSucces.deblocage( args )
return deblocage
end
--[[ FONCTIONS GRILLE COLLECTION ]]
function p.grillecollection( f )
local args = f:getParent().args['grille']
local arg = mw.text.split( args, '%s' )
return '{{GrilleCollection |' .. arg[1] .. '|' .. arg[2] .. '|' .. arg[3] .. '}}'
end
function p.grillecollectionold( f )
local args = f:getParent().args['grilleold']
local arg = mw.text.split( args, '%s' )
return '{{GrilleCollectionOld |' .. arg[1] .. '|' .. arg[2] .. '|' .. arg[3] .. '}}'
end
--[[ FONCTIONS GENERALES : FIN ]]
return p