Module:Inventory slot: Difference between revisions

m
no edit summary
imported>Ttv pedro270707
m (Image now does not link to its page)
imported>Ttv pedro270707
mNo edit summary
Line 57: Line 57:
:attr( "data-mctitle", (name or subname or subitem) )
:attr( "data-mctitle", (name or subname or subitem) )
if subitem:match( '\.gif$' ) or subitem:match( '\.png$' ) then
if not subitem:match( '\.gif$' ) and not subitem:match( '\.png$' ) then
slot:wikitext( "[[File:" .. subitem .. "|32px|link=]]" )
else
slot:wikitext( sprite( { data = "InvSprite", id = subvalue } ) )
slot:wikitext( sprite( { data = "InvSprite", id = subvalue } ) )
end
end
Line 77: Line 75:
end
end
if link and mw.title.new( link ).exists then
if subitem:match( '\.gif$' ) or subitem:match( '\.png$' ) then
slotContainer:wikitext( "<span style='" .. display .. "'>" .. "[[" .. link .. "|" .. tostring( slot ) .. "]]" .. "</span>" )
if link and mw.title.new( link ).exists then
slot:wikitext( "<span class=\"sprite pixelated\">[[File:" .. subitem .. "|160px|link=" .. link .. "]]</span>" )
else
slot:wikitext( "<span class=\"sprite pixelated\">[[File:" .. subitem .. "|160px|link=]]</span>" )
end
slotContainer:wikitext( tostring( slot ) )
else
else
slotContainer:wikitext( "<span style='" .. display .. "'>" .. tostring( slot ) .. "</span>" )
if link and mw.title.new( link ).exists then
slotContainer:wikitext( "<span style='" .. display .. "'>" .. "[[" .. link .. "|" .. tostring( slot ) .. "]]" .. "</span>" )
else
slotContainer:wikitext( "<span style='" .. display .. "'>" .. tostring( slot ) .. "</span>" )
end
end
end
end
end