Binding of Isaac: Rebirth Wiki
S'inscrire
(Toujours la même erreur...)
mAucun résumé des modifications
(20 versions intermédiaires par 2 utilisateurs non affichées)
Ligne 1 : Ligne 1 :
 
local p = {}
 
local p = {}
  +
  +
local w_frame = require( 'module:frame' )
  +
  +
  +
function p.analyser( f )
  +
return mw.loadData( 'module:dlc/données' ).valeurs[w_frame.args( f )[1] or ''] or 0
 
end
  +
  +
  +
function p.tester( f )
  +
local args = w_frame.args( f )
  +
return ( mw.loadData( 'module:dlc/données' ).test[tonumber( args[1] )] or {} )[tonumber( args[2] ) or 15] or 0
  +
end
  +
   
 
local modElements = require( 'Module:Elements' )
 
local modElements = require( 'Module:Elements' )
   
function p.main( f, categories )
+
function p.main( f )
 
local args = f:getParent().args
 
local args = f:getParent().args
 
local dlc = mw.text.split( args[1], '%s' )
 
local dlc = mw.text.split( args[1], '%s' )
Ligne 15 : Ligne 29 :
 
 
 
if page.existe and not mw.title.namespace then
 
if page.existe and not mw.title.namespace then
if page.valeur.dlc == 'a' then
+
if page.valeur.dlc == 'Afterbirth' then
 
if dlc[1] == 'a' or dlc[1] == 'no-a' then
 
if dlc[1] == 'a' or dlc[1] == 'no-a' then
 
_c = '[[Catégorie:Modèle dlc mal utilisé|' .. nompage .. ']]'
 
_c = '[[Catégorie:Modèle dlc mal utilisé|' .. nompage .. ']]'
Ligne 29 : Ligne 43 :
 
_c = '[[Catégorie:Dlc inconnu]]'
 
_c = '[[Catégorie:Dlc inconnu]]'
 
end
 
end
elseif page.valeur.dlc == 'a+' then
+
elseif page.valeur.dlc == 'Afterbirth+' then
 
if dlc[1] == 'a' or dlc[1] == 'no-a' or dlc[1] == 'a+' or dlc[1] == 'no-a+' or dlc[1] == 'a-no-a+' then
 
if dlc[1] == 'a' or dlc[1] == 'no-a' or dlc[1] == 'a+' or dlc[1] == 'no-a+' or dlc[1] == 'a-no-a+' then
 
_c = '[[Catégorie:Modèle dlc mal utilisé|' .. nompage .. ']]'
 
_c = '[[Catégorie:Modèle dlc mal utilisé|' .. nompage .. ']]'
Ligne 37 : Ligne 51 :
 
_c = '[[Catégorie:Dlc inconnu]]'
 
_c = '[[Catégorie:Dlc inconnu]]'
 
end
 
end
elseif page.valeur.dlc == 'bp' then
+
elseif page.valeur.dlc == 'Booster Pack' then
 
if dlc[1] == 'a' or dlc[1] == 'no-a' or dlc[1] == 'a+' or dlc[1] == 'no-a+' or dlc[1] == 'a-no-a+' or dlc[1] == 'bp' then
 
if dlc[1] == 'a' or dlc[1] == 'no-a' or dlc[1] == 'a+' or dlc[1] == 'no-a+' or dlc[1] == 'a-no-a+' or dlc[1] == 'bp' then
 
_c = '[[Catégorie:Modèle dlc mal utilisé|' .. nompage .. ']]'
 
_c = '[[Catégorie:Modèle dlc mal utilisé|' .. nompage .. ']]'
Ligne 76 : Ligne 90 :
 
_c = '[[Catégorie:Dlc inconnu]]'
 
_c = '[[Catégorie:Dlc inconnu]]'
 
end
 
end
end
+
end
  +
 
 
return _i .. _c .. page.autres
if categories then
 
return _i .. _c .. page.autres
 
else
 
return _i .. page.autres
 
end
 
 
end
 
end
   
function p.icon( f )
+
function p.icone( f )
 
if f ~= nil and f ~= '' then
 
if f ~= nil and f ~= '' then
local args = mw.text.split( f, '%s' )
+
local args
  +
if type( f ) == 'string' then
 
if args[1] == 'Afterbirth' then
+
args = mw.text.split( f, '%s' )
 
else
return '<span title="Afterbirth-contenu exclusif" style="cursor:help">[[Fichier:DLC.png|lien=]]</span>'
 
  +
local arg = f:getParent().args[1]
elseif args[1] == 'Afterbirth+' then
 
  +
args = mw.text.split( arg, '%s' )
return '<span title="Afterbirth †-contenu exclusif" style="cursor:help">[[Fichier:Afterbirth†_Indicator.png|lien=]]</span>'
 
  +
end
  +
  +
if args[1] == 'Afterbirth' or args[1] == 'a' then
 
return ' <span title="Afterbirth-contenu exclusif" style="cursor:help">[[Fichier:DLC.png|lien=]]</span> '
  +
elseif args[1] == 'Afterbirth+' or args[1] == 'a+' then
 
return ' <span title="Afterbirth †-contenu exclusif" style="cursor:help">[[Fichier:Afterbirth†_Indicator.png|lien=]]</span> '
 
elseif args[1] == 'Booster' then
 
elseif args[1] == 'Booster' then
return '<span title="Booster Pack ' .. args[3] .. '-contenu exclusif" style="cursor:help">[[Fichier:Afterbirth†_Booster_Pack_Indicator.png|lien=]]</span>'
+
return ' <span title="Booster Pack ' .. args[3] .. '-contenu exclusif" style="cursor:help">[[Fichier:Afterbirth†_Booster_Pack_Indicator.png|lien=]]</span> '
 
--[[ args[3] car args[1]=="Booster" et args[2]=="Pack" (lié au mw.text.split) ]]
 
--[[ args[3] car args[1]=="Booster" et args[2]=="Pack" (lié au mw.text.split) ]]
 
elseif args[1] == 'bp' then
  +
return ' <span title="Booster Pack ' .. args[2] .. '-contenu exclusif" style="cursor:help">[[Fichier:Afterbirth†_Booster_Pack_Indicator.png|lien=]]</span> '
 
else
 
else
 
return '[[Catégorie:Dlc inconnu]]'
 
return '[[Catégorie:Dlc inconnu]]'

Version du 2 novembre 2020 à 09:57

Template-info Documentation

Fonction main( f )

Utilisée par le Modèle:Dlc. Cette fonction renvoie un icône de DLC et vérifie sa cohérence avec la page utilisée.
ArgumentsRenvois
f (frame)
  • Frame de la page utilisée.
  • Nécessite un paramètre non nommé :
    • Type : (string)
    • Abréviation du DLC demandé :
      • a pour Afterbirth
      • a+ pour Afterbirth†
      • bp 1 pour le Booster Pack 1.
  • Type : (string)
  • Icône de DLC correspondant à celle demandée et catégories supplémentaires.

Fonction icone( f )

Cette fonction renvoie une icône de DLC et est destinée à être utilisée dans des modules ou modèles.
ArgumentsRenvois
f (string)
  • Nom du DLC demandé.
  • Type : (string)
  • Icône du DLC correspondant ou catégorie d'erreur.
  • Renvoie une valeur nulle s'il ne possède aucun argument.

local p = {}

local w_frame = require( 'module:frame' )


function p.analyser( f )
	return mw.loadData( 'module:dlc/données' ).valeurs[w_frame.args( f )[1] or ''] or 0
end


function p.tester( f )
	local args = w_frame.args( f )
	return ( mw.loadData( 'module:dlc/données' ).test[tonumber( args[1] )] or {} )[tonumber( args[2] ) or 15] or 0
end


local modElements = require( 'Module:Elements' )

function p.main( f )
	local args = f:getParent().args
	local dlc = mw.text.split( args[1], '%s' )
	local _i = ''
	local _c = ''
	local nompage = mw.title.getCurrentTitle()
	local page = {}
	
	nompage = nompage.text
	page = modElements.page( nompage )
	
	if page.existe and not mw.title.namespace then
		if page.valeur.dlc == 'Afterbirth' then
			if dlc[1] == 'a' or dlc[1] == 'no-a' then
				_c = '[[Catégorie:Modèle dlc mal utilisé|' .. nompage .. ']]'
			elseif dlc[1] == 'a+' then
				_i = '<span title="Afterbirth †-contenu exclusif" style="cursor:help">[[Fichier:Afterbirth†_Indicator.png|lien=]]</span>'
			elseif dlc[1] == 'no-a+' then
				_i = '<span title="Rebirth-contenu exclusif" style="cursor:help">[[Fichier:NoDLC†_Indicator.png|lien=]]</span>'
			elseif dlc[1] == 'a-no-a+' then
				_i = '<span title="Rebirth-contenu exclusif" style="cursor:help">[[Fichier:NoDLC†_Indicator.png|lien=]]</span>[[Catégorie:Modèle dlc mal utilisé|' .. nompage .. ']]'
			elseif dlc[1] == 'bp' then
				_i = '<span title="Booster Pack ' .. dlc[2] .. '-contenu exclusif" style="cursor:help">[[Fichier:Afterbirth†_Booster_Pack_Indicator.png|lien=]]</span>'
			else
				_c = '[[Catégorie:Dlc inconnu]]'
			end
		elseif page.valeur.dlc == 'Afterbirth+' then
			if dlc[1] == 'a' or dlc[1] == 'no-a' or dlc[1] == 'a+' or dlc[1] == 'no-a+' or dlc[1] == 'a-no-a+' then
				_c = '[[Catégorie:Modèle dlc mal utilisé|' .. nompage .. ']]'
			elseif dlc[1] == 'bp' then
				_i = '<span title="Booster Pack ' .. dlc[2] .. '-contenu exclusif" style="cursor:help">[[Fichier:Booster_Pack_Indicator.png|lien=]]</span>'
			else
				_c = '[[Catégorie:Dlc inconnu]]'
			end
		elseif page.valeur.dlc == 'Booster Pack' then
			if dlc[1] == 'a' or dlc[1] == 'no-a' or dlc[1] == 'a+' or dlc[1] == 'no-a+' or dlc[1] == 'a-no-a+' or dlc[1] == 'bp' then
				_c = '[[Catégorie:Modèle dlc mal utilisé|' .. nompage .. ']]'
			else
				_c = '[[Catégorie:Dlc inconnu]]'
			end
		else
			if dlc[1] == 'a' then
				_i = '<span title="Afterbirth-contenu exclusif" style="cursor:help">[[Fichier:DLC.png|lien=]]</span>'
			elseif dlc[1] == 'no-a' then
				_i = '<span title="Rebirth-contenu exclusif" style="cursor:help">[[Fichier:NoDLC_Indicator.png|lien=]]</span>'
			elseif dlc[1] == 'a+' then
				_i = '<span title="Afterbirth †-contenu exclusif" style="cursor:help">[[Fichier:Afterbirth†_Indicator.png|lien=]]</span>'
			elseif dlc[1] == 'no-a+' then
				_i = '<span title="Rebirth-contenu exclusif" style="cursor:help">[[Fichier:NoDLC†_Indicator.png|lien=]]</span>'
			elseif dlc[1] == 'a-no-a+' then
				_i = '<span title="Afterbirth-contenu exclusif" style="cursor:help">[[Fichier:DLC.png|lien=]]</span><span title="Afterbirth-contenu exclusif" style="cursor:help">[[Fichier:NoDLC†_Indicator.png|lien=]]</span>'
			elseif dlc[1] == 'bp' then
				_i = '<span title="Booster Pack ' .. dlc[2] .. '-contenu exclusif" style="cursor:help">[[Fichier:Afterbirth†_Booster_Pack_Indicator.png|lien=]]</span>'
			else
				_c = '[[Catégorie:Dlc inconnu]]'
			end
		end
	else
		if dlc[1] == 'a' then
			_i = '<span title="Afterbirth-contenu exclusif" style="cursor:help">[[Fichier:DLC.png|lien=]]</span>'
		elseif dlc[1] == 'no-a' then
			_i = '<span title="Rebirth-contenu exclusif" style="cursor:help">[[Fichier:NoDLC_Indicator.png|lien=]]</span>'
		elseif dlc[1] == 'a+' then
			_i = '<span title="Afterbirth †-contenu exclusif" style="cursor:help">[[Fichier:Afterbirth†_Indicator.png|lien=]]</span>'
		elseif dlc[1] == 'no-a+' then
			_i = '<span title="Rebirth-contenu exclusif" style="cursor:help">[[Fichier:NoDLC†_Indicator.png|lien=]]</span>'
		elseif dlc[1] == 'a-no-a+' then
			_i = '<span title="Afterbirth-contenu exclusif" style="cursor:help">[[Fichier:DLC.png|lien=]]</span><span title="Afterbirth-contenu exclusif" style="cursor:help">[[Fichier:NoDLC†_Indicator.png|lien=]]</span>'
		elseif dlc[1] == 'bp' then
			_i = '<span title="Booster Pack ' .. dlc[2] .. '-contenu exclusif" style="cursor:help">[[Fichier:Afterbirth†_Booster_Pack_Indicator.png|lien=]]</span>'
		else
			_c = '[[Catégorie:Dlc inconnu]]'
		end
    end
    
    return _i .. _c .. page.autres
end

function p.icone( f )
	if f ~= nil and f ~= '' then
	    local args
	    if type( f ) == 'string' then
	        args = mw.text.split( f, '%s' )
	    else
	        local arg = f:getParent().args[1]
	        args = mw.text.split( arg, '%s' )
	    end
	    
		if args[1] == 'Afterbirth' or args[1] == 'a' then
			return ' <span title="Afterbirth-contenu exclusif" style="cursor:help">[[Fichier:DLC.png|lien=]]</span> '
		elseif args[1] == 'Afterbirth+' or args[1] == 'a+' then
			return ' <span title="Afterbirth †-contenu exclusif" style="cursor:help">[[Fichier:Afterbirth†_Indicator.png|lien=]]</span> '
		elseif args[1] == 'Booster' then
			return ' <span title="Booster Pack ' .. args[3] .. '-contenu exclusif" style="cursor:help">[[Fichier:Afterbirth†_Booster_Pack_Indicator.png|lien=]]</span> '
			 --[[ args[3] car args[1]=="Booster" et args[2]=="Pack" (lié au mw.text.split) ]]
		elseif args[1] == 'bp' then
			return ' <span title="Booster Pack ' .. args[2] .. '-contenu exclusif" style="cursor:help">[[Fichier:Afterbirth†_Booster_Pack_Indicator.png|lien=]]</span> '
		else
			return '[[Catégorie:Dlc inconnu]]'
		end
	else
		return nil
	end
end

return p