Module:Inventory slot/Aliases: Difference between revisions
m added "Any Shield" |
batch process wood and colored items. I am using a separate loop from the previous colored items since I want to be able to add a new item simply by adding its name to a list, plus only the firework stars needs all the display name stuff |
||
| Line 1: | Line 1: | ||
local coloredDyes = 'Orange Dye; Magenta Dye; Light Blue Dye; Dandelion Yellow; Lime Dye; Pink Dye; Gray Dye; Light Gray Dye; Cyan Dye; Purple Dye; Lapis Lazuli; Cocoa Beans; Cactus Green; Rose Red; Ink Sac' | local coloredDyes = 'Orange Dye; Magenta Dye; Light Blue Dye; Dandelion Yellow; Lime Dye; Pink Dye; Gray Dye; Light Gray Dye; Cyan Dye; Purple Dye; Lapis Lazuli; Cocoa Beans; Cactus Green; Rose Red; Ink Sac' | ||
local aliases = { | local aliases = { | ||
-- Lists -- | -- Lists -- | ||
['Any Dye'] = 'Bone Meal;' .. coloredDyes, | ['Any Dye'] = 'Bone Meal;' .. coloredDyes, | ||
['Any Colored Dye'] = coloredDyes, | ['Any Colored Dye'] = coloredDyes, | ||
['Any | ['Any Dyed Wool'] = 'Orange Wool; Magenta Wool; Light Blue Wool; Yellow Wool; Lime Wool; Pink Wool; Gray Wool; Light Gray Wool; Cyan Wool; Purple Wool; Blue Wool; Brown Wool; Green Wool; Red Wool; Black Wool', | ||
['Any fuel'] = 'Coal; Charcoal; Oak Wood; Oak Wood Planks', | ['Any fuel'] = 'Coal; Charcoal; Oak Wood; Oak Wood Planks', | ||
['Any Mushroom'] = '[Mushroom]Red Mushroom; [Mushroom]Brown Mushroom', | ['Any Mushroom'] = '[Mushroom]Red Mushroom; [Mushroom]Brown Mushroom', | ||
| Line 13: | Line 10: | ||
['Any Red Sandstone'] = 'Red Sandstone; Chiseled Red Sandstone; Smooth Red Sandstone', | ['Any Red Sandstone'] = 'Red Sandstone; Chiseled Red Sandstone; Smooth Red Sandstone', | ||
['Any Sandstone'] = 'Sandstone; Chiseled Sandstone; Smooth Sandstone', | ['Any Sandstone'] = 'Sandstone; Chiseled Sandstone; Smooth Sandstone', | ||
['Any Stone Bricks'] = 'Stone Bricks; Mossy Stone Bricks; Cracked Stone Bricks; Chiseled Stone Bricks', | ['Any Stone Bricks'] = 'Stone Bricks; Mossy Stone Bricks; Cracked Stone Bricks; Chiseled Stone Bricks', | ||
['Any Stone Slab'] = 'Stone Slab; Sandstone Slab; Cobblestone Slab; Bricks Slab; Stone Bricks Slab; Nether Brick Slab; Quartz Slab' | ['Any Stone Slab'] = 'Stone Slab; Sandstone Slab; Cobblestone Slab; Bricks Slab; Stone Bricks Slab; Nether Brick Slab; Quartz Slab', | ||
-- Display names -- | -- Display names -- | ||
| Line 115: | Line 100: | ||
end | end | ||
-- | -- Banners and colored items -- | ||
local patterns = { | local patterns = { | ||
'Base Dexter Canton', | 'Base Dexter Canton', | ||
| Line 186: | Line 171: | ||
end | end | ||
aliases['Any Firework Star'] = table.concat( aliases['Any Firework Star'], ';' ) | aliases['Any Firework Star'] = table.concat( aliases['Any Firework Star'], ';' ) | ||
-- Items that use the sixteen colors -- | |||
local coloredItems = { | |||
'Banner', | |||
'Carpet', | |||
'Shield', | |||
'Stained Clay', | |||
'Stained Glass', | |||
'Stained Glass Pane', | |||
'Wool' | |||
} | |||
for _, item in ipairs( coloredItems ) do | |||
local name = 'Any ' .. item | |||
aliases[name] = {} | |||
for _, color in ipairs( colors ) do | |||
table.insert( aliases[name], color .. ' ' .. item ) | |||
end | |||
aliases[name] = table.concat( aliases[name], ';' ) | |||
end | |||
-- Potions -- | -- Potions -- | ||
| Line 229: | Line 233: | ||
aliases['Any Splash Potion'] = table.concat( aliases['Any Splash Potion'], ';' ) | aliases['Any Splash Potion'] = table.concat( aliases['Any Splash Potion'], ';' ) | ||
aliases['Any Lingering Potion'] = table.concat( aliases['Any Lingering Potion'], ';' ) | aliases['Any Lingering Potion'] = table.concat( aliases['Any Lingering Potion'], ';' ) | ||
-- Wood -- | |||
local woods = { | |||
'Oak', | |||
'Spruce', | |||
'Birch', | |||
'Jungle', | |||
'Acacia', | |||
'Dark Oak' | |||
} | |||
local woodItems = { | |||
'Fence Gate', | |||
'Wood', | |||
'wood Door', | |||
'wood Fence', | |||
'Wood Planks', | |||
'Wood Slabs', | |||
'Wood Stairs', | |||
} | |||
-- used if the items use a different name than the alias | |||
local woodNames = { | |||
['wood Door'] = 'Door', | |||
['wood Fence'] = 'Fence' | |||
} | |||
for _, item in ipairs( woodItems ) do | |||
local name = 'Any ' .. item | |||
item = woodNames[item] or item | |||
aliases[name] = {} | |||
for _, wood in ipairs( woods ) do | |||
table.insert( aliases[name], wood .. ' ' .. item ) | |||
end | |||
aliases[name] = table.concat( aliases[name], ';' ) | |||
end | |||
return aliases | return aliases | ||