Anonymous user
Module:Inventory slot: Difference between revisions
m
no edit summary
imported>Ttv pedro270707 m (Made it so that parseString() returns a nil name now, allowing "Any Wool" or "Any Planks" to be an item name) |
imported>Ttv pedro270707 mNo edit summary |
||
Line 74: | Line 74: | ||
local name = value.name | local name = value.name | ||
local item = value.item | local item = value.item | ||
local count = value.count | |||
if p.itemSets[item] then | if p.itemSets[item] then | ||
for j, subvalue in ipairs(p.itemSets[item]) do | for j, subvalue in ipairs(p.itemSets[item]) do | ||
Line 85: | Line 86: | ||
if item ~= pageName and subvalue then | if item ~= pageName and subvalue then | ||
link = subvalue | link = subvalue | ||
end | |||
if count then | |||
local itemCount = mw.html.create( "span" ) | |||
itemCount:cssText( "position: absolute; right: -2px; bottom: -5px; pointer-events: none;" ) | |||
:addClass( "c-f" ) | |||
:addClass( "shadow" ) | |||
:wikitext( count ) | |||
end | end | ||
Line 125: | Line 134: | ||
for _, str in ipairs(strings) do | for _, str in ipairs(strings) do | ||
local name, item, count = str:match("^%[(.-)%](.-),(%d+)$") | |||
if not name then | |||
name, item = str:match("^%[(.-)%](.-)$") | |||
end | |||
if name then | |||
table.insert(result, { name = name:gsub("^%s*(.-)%s*$", "%1"), item = item:gsub("^%s*(.-)%s*$", "%1"), count = tonumber(count) }) | |||
else | |||
table.insert(result, { name = nil, item = str:gsub("^%s*(.-)%s*$", "%1"), count = nil }) | |||
end | |||
end | end | ||