Module:Icône inventaire

De Minecraft Wiki
Aller à : navigation, rechercher
[créer | historique | purger]Documentation
Ce module n'a pas de documentation. Si vous savez comment l'utiliser, merci de la créer.
local sprite = require( [[Module:Sprite]] ).sprite
local ids = mw.loadData( [[Module:InvSprite]] ).ids
local p = {}

p.icon = function( f )
	local args = f
	if f == mw.getCurrentFrame() then
		args = f:getParent().args
	end
	
	local idData = ids[args[1]]
	local icon, category
	local link = args.link
	local title = args.title
	
	if idData then
		icon, category = sprite{
			iddata = idData, link = link, title = title,
			data = 'InvSprite'
		}
	else
		local file = args[1]
		if file:match( '\.gif$' ) or file:match( '\.png$' ) then
			file = 'Icôneinv ' .. file
		else
			file = 'Grille ' .. file .. '.png'
		end
		icon = '[[Fichier:' .. file .. '|32x32px|link=' .. ( link or '' ) .. '|' .. ( title or '' ) .. ']]'
	end
	
	return icon .. ( category or '' )
end

return p