Jump to content

Module:Inventory slot: Difference between revisions

m
Added the in-game item which is air
imported>Ttv pedro270707
mNo edit summary
imported>Ttv pedro270707
m (Added the in-game item which is air)
Line 131: Line 131:
local display = i == 1 and "display: inline-block" or "display: none"
local display = i == 1 and "display: inline-block" or "display: none"
local slot = mw.html.create( "div" )
if item ~= 'Air' then
slot:addClass( "minecraft-item" )
local slot = mw.html.create( "div" )
:cssText( table.concat( slotCss, ";" ) )
slot:addClass( "minecraft-item" )
:attr( "data-mctitle", (name or item) )
:cssText( table.concat( slotCss, ";" ) )
if descriptions[item] then
:attr( "data-mctitle", (name or item) )
slot:attr( "data-mcdesc", p.formatDescription(descriptions[item], 16) )
if descriptions[item] then
end
slot:attr( "data-mcdesc", p.formatDescription(descriptions[item], 16) )
slot:wikitext( sprite( { data = "InvSprite", id = item } ) )
end
slot:wikitext( sprite( { data = "InvSprite", id = item } ) )
local link = nil
if args.link and args.link ~= "y" then
local link = nil
if args.link ~= "n" then
if args.link and args.link ~= "y" then
link = args.link
if args.link ~= "n" then
link = args.link
end
elseif (require("Module:Inventory slot/links").links[item] ~= pageName and item) or args.link == "y" then
link = require("Module:Inventory slot/links").links[item]
end
if count then
local itemCount = mw.html.create( "span" )
itemCount:cssText( "position: absolute; right: 0; bottom: -2px; pointer-events: none;" )
:addClass( "c-0" )
:addClass( "shadow" )
:wikitext( count )
slot:node( itemCount )
end
if link or (args.link and args.link ~= "y" and args.link ~= "n") then
slotContainer:wikitext( "<span style='" .. display .. "' class='no-external-icon'>" .. "[https://bta.miraheze.org/wiki/" .. link:gsub(" ", "_") .. " " .. tostring( slot ) .. "]" .. "</span>" )
else
slotContainer:wikitext( "<span style='" .. display .. "'>" .. tostring( slot ) .. "</span>" )
end
end
elseif (require("Module:Inventory slot/links").links[item] ~= pageName and item) or args.link == "y" then
link = require("Module:Inventory slot/links").links[item]
end
if count then
local itemCount = mw.html.create( "span" )
itemCount:cssText( "position: absolute; right: 0; bottom: -2px; pointer-events: none;" )
:addClass( "c-0" )
:addClass( "shadow" )
:wikitext( count )
slot:node( itemCount )
end
if link or (args.link and args.link ~= "y" and args.link ~= "n") then
slotContainer:wikitext( "<span style='" .. display .. "' class='no-external-icon'>" .. "[https://bta.miraheze.org/wiki/" .. link:gsub(" ", "_") .. " " .. tostring( slot ) .. "]" .. "</span>" )
else
else
slotContainer:wikitext( "<span style='" .. display .. "'>" .. tostring( slot ) .. "</span>" )
slotContainer:wikitext( "<span style='" .. display .. "'><!-- Air --></span>")
end
end
end
end