Anonymous user
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 | ||
local slot = mw.html.create( "div" ) | |||
slot:addClass( "minecraft-item" ) | |||
:cssText( table.concat( slotCss, ";" ) ) | |||
:attr( "data-mctitle", (name or item) ) | |||
if descriptions[item] then | |||
slot:attr( "data-mcdesc", p.formatDescription(descriptions[item], 16) ) | |||
end | |||
slot:wikitext( sprite( { data = "InvSprite", id = item } ) ) | |||
local link = nil | |||
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 | ||
else | else | ||
slotContainer:wikitext( "<span style='" .. display .. "'> | slotContainer:wikitext( "<span style='" .. display .. "'><!-- Air --></span>") | ||
end | end | ||
end | end |