Module:Inventory slot/Aliases: Difference between revisions
No edit summary |
Merged colored items |
||
| Line 1: | Line 1: | ||
local aliases = { | local aliases = { | ||
-- Common fuel types for furnace -- | -- Common fuel types for furnace -- | ||
| Line 63: | Line 58: | ||
['Sparkler'] = { 'Orange Sparkler', 'Blue Sparkler', 'Red Sparkler', 'Purple Sparkler', 'Green Sparkler' }, | ['Sparkler'] = { 'Orange Sparkler', 'Blue Sparkler', 'Red Sparkler', 'Purple Sparkler', 'Green Sparkler' }, | ||
['Matching Chloride'] = { 'Cerium Chloride', 'Mercuric Chloride', 'Potassium Chloride', 'Tungsten Chloride' }, | ['Matching Chloride'] = { 'Cerium Chloride', 'Mercuric Chloride', 'Potassium Chloride', 'Tungsten Chloride' }, | ||
['Matching Colored Torch'] = { 'Blue Torch', 'Red Torch', 'Purple Torch', 'Green Torch' } | ['Matching Colored Torch'] = { 'Blue Torch', 'Red Torch', 'Purple Torch', 'Green Torch' } | ||
} | } | ||
| Line 317: | Line 309: | ||
-- Lists of item variants -- | -- Lists of item variants -- | ||
local itemVariants = { | local itemVariants = { | ||
['Flower'] = { 'Oxeye Daisy', 'Cornflower', 'Lily of the Valley', 'Wither Rose', 'Red Tulip', 'Orange Tulip', 'White Tulip', 'Pink Tulip', 'Azure Bluet', 'Allium', 'Blue Orchid', 'Poppy', 'Dandelion', 'Torchflower' }, | ['Flower'] = { 'Oxeye Daisy', 'Cornflower', 'Lily of the Valley', 'Wither Rose', 'Red Tulip', 'Orange Tulip', 'White Tulip', 'Pink Tulip', 'Azure Bluet', 'Allium', 'Blue Orchid', 'Poppy', 'Dandelion', 'Torchflower' }, | ||
['Mushroom'] = { 'Red Mushroom', 'Brown Mushroom' }, | ['Mushroom'] = { 'Red Mushroom', 'Brown Mushroom' }, | ||
| Line 388: | Line 351: | ||
['Stone Button'] = { 'Stone Button', 'Polished Blackstone Button' }, | ['Stone Button'] = { 'Stone Button', 'Polished Blackstone Button' }, | ||
['Stone Pressure Plate'] = { 'Stone Pressure Plate', 'Polished Blackstone Pressure Plate' }, | ['Stone Pressure Plate'] = { 'Stone Pressure Plate', 'Polished Blackstone Pressure Plate' }, | ||
} | } | ||
-- Copper -- | -- Copper -- | ||
local copperstuff = { | local copperstuff = { | ||
| Line 592: | Line 553: | ||
-- Items that use the sixteen colors -- | -- Items that use the sixteen colors -- | ||
local coloredItems = { | local coloredItems = { | ||
'Balloon', | withWhite = { | ||
'Balloon', | |||
'Banner', | |||
'Bed', | |||
'Carpet', | |||
'Concrete', | |||
'Concrete Powder', | |||
'Glazed Terracotta', | |||
'Glow Stick', | |||
'Hardened $1 Stained Glass', | |||
'Hardened $1 Stained Glass Pane', | |||
'Shield', | |||
'Shulker Box', | |||
'Wool' | 'Stained Glass', | ||
'Stained Glass Pane', | |||
'Wool', | |||
'$Dyed Terracotta', | |||
'$Dyed Candle', | |||
}, | |||
noWhite = { | |||
'$Dyed Wool', | |||
'$Dyed Bed', | |||
'$Dyed Carpet', | |||
'$Colored Dye', | |||
} | |||
} | |||
local coloredBadItems = { | |||
['Light Gray Glow Stick'] = 1, | |||
['Gray Glow Stick'] = 1, | |||
['Black Glow Stick'] = 1, | |||
} | } | ||
for _, item in ipairs( | |||
for type, items in pairs( coloredItems ) do | |||
for _, item in ipairs( items ) do | |||
local coloredItemAliases = {} | |||
local defaultItemAliases | |||
if item:find( '%$[^1]' ) then | |||
defaultItemAliases = {} | |||
local itemName | |||
if type == 'noWhite' then | |||
itemName = item:gsub( '%$%w+', 'White' ) | |||
else | |||
itemName = item:gsub( '%$%w+ ', '' ) | |||
end | |||
table.insert( defaultItemAliases, itemName ) | |||
end | |||
for _, color in ipairs( colors ) do | |||
local itemName | |||
if type ~= 'noWhite' or color ~= 'White' then | |||
if item:find( '%$1' ) then | |||
itemName = item:gsub( '%$1', color ) | |||
elseif item:find( '%$' ) then | |||
itemName = item:gsub( '%$%w+', color ) | |||
else | |||
itemName = color .. ' ' .. item | |||
end | |||
end | |||
if not coloredBadItems[itemName] then | |||
if defaultItemAliases then | |||
table.insert( defaultItemAliases, itemName ) | |||
end | |||
table.insert( coloredItemAliases, itemName ) | |||
end | |||
end | |||
if defaultItemAliases then | |||
local defaultItem = item:gsub( '%$%w+', '' ) | |||
aliases['Any ' .. defaultItem] = defaultItemAliases | |||
aliases['Matching ' .. defaultItem] = defaultItemAliases | |||
end | end | ||
item = item:gsub( '%$1 ', '' ) | |||
item = item:gsub( '%$', '' ) | |||
aliases['Any ' .. item] = coloredItemAliases | |||
aliases['Matching ' .. item] = coloredItemAliases | |||
end | end | ||
end | end | ||
-- list of all potions with no effects | -- list of all potions with no effects | ||