Module:Inventory slot/Aliases: Difference between revisions

m Normalize edition specific textures
Make potion code readable and have it fill the any/matching aliases, move another set of BE names to the new loop
Line 30: Line 30:
'&7Cyan Lozenge/&7Light Gray Base/&7Gray Pale/&7Light Gray Bordure/&7Black Fess/&7Light Gray Per Fess'},
'&7Cyan Lozenge/&7Light Gray Base/&7Gray Pale/&7Light Gray Bordure/&7Black Fess/&7Light Gray Per Fess'},
['Jigsaw block'] = { title = '&dJigsaw block', name = 'Jigsaw block' },
['Jigsaw block'] = { title = '&dJigsaw block', name = 'Jigsaw block' },
 
-- Edition specific images --
['Bow BE'] = { title = 'Bow', name = 'Bow BE' },
['Cat Spawn Egg BE'] = { title = 'Cat Spawn Egg', name = 'Cat Spawn Egg BE' },
['Spawn Cat BE'] = { title = 'Spawn Cat', name = 'Spawn Cat BE' },
['Panda Spawn Egg BE'] = { title = 'Panda Spawn Egg', name = 'Panda Spawn Egg BE' },
['Spawn Panda BE'] = { title = 'Spawn Panda', name = 'Spawn Panda BE' },
['Scaffolding BE'] = { title = 'Scaffolding', name = 'Scaffolding BE' },
['Bucket of Pufferfish BE'] = { title = 'Bucket of Pufferfish', name = 'Bucket of Pufferfish BE' },
['Bucket of Tropical Fish BE'] = { title = 'Bucket of Tropical Fish', name = 'Bucket of Tropical Fish BE' },
-- Weapons --
-- Weapons --
['Trident'] = { name = 'Trident', text = '/&7 When in main hand:/ &2 1.1 Attack Speed/ &2 9 Attack Damage'},
['Trident'] = { name = 'Trident', text = '/&7 When in main hand:/ &2 1.1 Attack Speed/ &2 9 Attack Damage'},
Line 62: Line 52:
'Yellow Glow Stick', 'Lime Glow Stick', 'Pink Glow Stick', 'Gray Glow Stick', 'Cyan Glow Stick',
'Yellow Glow Stick', 'Lime Glow Stick', 'Pink Glow Stick', 'Gray Glow Stick', 'Cyan Glow Stick',
'Purple Glow Stick', 'Blue Glow Stick', 'Brown Glow Stick', 'Green Glow Stick', 'Red Glow Stick' },
'Purple Glow Stick', 'Blue Glow Stick', 'Brown Glow Stick', 'Green Glow Stick', 'Red Glow Stick' },
-- Potions --
['Awkward Potion'] = { name = 'Awkward Potion', text = '&7No effects' },
['Water Bottle'] = { name = 'Water Bottle', text = '&7No effects' },
['Thick Potion'] = { name = 'Thick Potion', text = '&7No effects' },
['Mundane Potion'] = { name = 'Mundane Potion', text = '&7No effects' },
['Uncraftable Potion'] = { name = 'Uncraftable Potion', text = '&7No effects' },
['Awkward Splash Potion'] = { name = 'Awkward Splash Potion', text = '&7No effects' },
['Splash Water Bottle'] = { name = 'Splash Water Bottle', text = '&7No effects' },
['Thick Splash Potion'] = { name = 'Thick Splash Potion', text = '&7No effects' },
['Mundane Splash Potion'] = { name = 'Mundane Splash Potion', text = '&7No effects' },
['Uncraftable Splash Potion'] = { name = 'Uncraftable Splash Potion', text = '&7No effects' },
['Awkward Lingering Potion'] = { name = 'Awkward Lingering Potion', text = '&7No effects' },
['Lingering Water Bottle'] = { name = 'Lingering Water Bottle', text = '&7No effects' },
['Thick Lingering Potion'] = { name = 'Thick Lingering Potion', text = '&7No effects' },
['Mundane Lingering Potion'] = { name = 'Mundane Lingering Potion', text = '&7No effects' },
['Uncraftable Lingering Potion'] = { name = 'Uncraftable Lingering Potion', text = '&7No effects' },
['Tipped Arrow'] = { name = 'Tipped Arrow', text = '&7No effects' },
['Arrow of Splashing'] = { name = 'Arrow of Splashing', text = '&7No effects' },
['Uncraftable Tipped Arrow'] = { name = 'Uncraftable Tipped Arrow', text = '&7No effects' },
['Potion of the Turtle Master'] = { name = 'Potion of the Turtle Master', text = '&cSlowness IV (1:00)/&9Resistance III (1:00)' },
['Potion of the Turtle Master Extended'] = { name = 'Potion of the Turtle Master', text = '&cSlowness IV (3:00)/&9Resistance III (3:00)' },
['Potion of the Turtle Master Enhanced'] = { name = 'Potion of the Turtle Master', text = '&cSlowness VI (1:00)/&9Resistance IV (1:00)' },
['Splash Potion of the Turtle Master'] = { name = 'Splash Potion of the Turtle Master', text = '&cSlowness IV (1:00)/&9Resistance IIIV (1:00)' },
['Splash Potion of the Turtle Master Extended'] = { name = 'Splash Potion of the Turtle Master', text = '&cSlowness IV (3:00)/&9Resistance III (3:00)' },
['Splash Potion of the Turtle Master Enhanced'] = { name = 'Splash Potion of the Turtle Master', text = '&cSlowness VI (1:00)/&9Resistance IV (1:00)' },
['Lingering Potion of the Turtle Master'] = { name = 'Lingering Potion of the Turtle Master', text = '&cSlowness IV (0:15)/&9Resistance III (0:15)' },
['Lingering Potion of the Turtle Master Extended'] = { name = 'Lingering Potion of the Turtle Master', text = '&cSlowness IV (0:45)/&9Resistance III (0:45)' },
['Lingering Potion of the Turtle Master Enhanced'] = { name = 'Lingering Potion of the Turtle Master', text = '&cSlowness VI (45:15)/&9Resistance IV (0:15)' },
['Arrow of the Turtle Master'] = { name = 'Arrow of the Turtle Master', text = '&cSlowness IV (0:07)/&9Resistance III (0:07)' },
['Arrow of the Turtle Master Extended'] = { name = 'Arrow of the Turtle Master', text = '&cSlowness IV (0:22)/&9Resistance III (0:22)' },
['Arrow of the Turtle Master Enhanced'] = { name = 'Arrow of the Turtle Master', text = '&cSlowness VI (0:07)/&9Resistance IV (0:07)' },
}
}


Line 445: Line 402:
aliases['Matching ' .. item] = coloredItemAliases
aliases['Matching ' .. item] = coloredItemAliases
end
end
 
-- list of all potions with no effects
-- Potions --
local noEffects = {
local status = {
'Water Bottle',
{'Regeneration', '&9Regeneration', 'II', '0:45', '1:30', '0:22', '0:11', '0:22', '0:05', '0:05', '0:11', '0:02' },
'Awkward Potion',
{'Swiftness', '&9Speed', 'II', '3:00', '8:00', '1:30', '0:45', '2:00', '0:22', '0:22', '1:00', '0:11' },
'Thick Potion',
{'Fire Resistance', '&9Fire Resistance', '', '3:00', '8:00', '', '0:45', '2:00', '', '0:22', '1:00', '' },
'Mundane Potion',
{'Poison', '&cPoison', 'II', '0:45', '1:30', '0:21', '0:11', '0:22', '0:05', '0:05', '0:11', '0:02' },
'Uncraftable Potion',
{'Healing', '&9Instant Health', 'II', '', '', '', '', '', '', '', '', '' },
'Splash Water Bottle',
{'Night Vision', '&9Night Vision', '', '3:00', '8:00', '', '0:45', '2:00', '', '0:22', '1:00', '' },
'Awkward Splash Potion',
{'Weakness', '&cWeakness', '', '1:30', '4:00', '', '0:22', '1:00', '', '0:11', '0:30', '' },
'Thick Splash Potion',
{'Strength', '&9Strength', 'II', '3:00', '8:00', '1:30', '0:45', '2:00', '0:22', '0:22', '1:00', '0:11' },
'Mundane Splash Potion',
{'Slowness', '&cSlowness', 'IV', '1:30', '4:00', '0:20', '0:22', '1:00', '0:05', '0:11', '0:30', '0:02' },
'Uncraftable Splash Potion',
{'Leaping', '&9Jump Boost', 'II', '3:00', '8:00', '1:30', '0:45', '2:00', '0:22', '0:22', '1:00', '0:11' },
'Lingering Water Bottle',
{'Harming', '&cInstant Damage', 'II', '', '', '', '', '', '', '', '', '' },
'Awkward Lingering Potion',
{'Water Breathing', '&9Water Breathing', '', '3:00', '8:00', '', '0:45', '2:00', '', '0:22', '1:00', '' },
'Thick Lingering Potion',
{'Invisibility', '&9Invisibility', '', '3:00', '8:00', '', '0:45', '2:00', '', '0:22', '1:00', '' },
'Mundane Lingering Potion',
{'Slow Falling', '&9Slow Falling', '', '1:30', '4:00', '', '0:22', '1:00', '', '0:11', '0:30', '' },
'Uncraftable Lingering Potion',
{'Luck', '&9Luck', '', '5:00', '', '', '1:15', '', '', '0:37', '', '' },
'Tipped Arrow',
{'Decay', '&cWither', '', '0:40', '', '', '0:10', '', '', '0:05', '', '' },
'Arrow of Splashing',
  --{'potionName', 'potionStatus', 'enhancedLevel', 'duration', 'durationExtended', 'durationEnhanced', 'durationLingering',
'Uncraftable Tipped Arrow',
  -- 'durationLingerExtended', 'durationLingerEnhanced', 'durationArrow', 'durationArrowExtended', 'durationArrowEnhanced' },
}
}
 
for _, name in ipairs(noEffects) do
for _, statusProps in ipairs( status ) do
aliases[name] = { name = name, text = '&7No effects' }
if statusProps[4] ~= '' then
local aliasName = 'Potion of ' .. statusProps[1]
aliases[aliasName] = { title = aliasName, name = aliasName, text = statusProps[2] .. ' (' .. statusProps[4] .. ')'}
local aliasName = 'Potion of ' .. statusProps[1] .. ' Extended'
aliases[aliasName] = { title = 'Potion of ' .. statusProps[1], name = 'Potion of ' .. statusProps[1], text = statusProps[2] .. ' (' .. statusProps[5] .. ')'}
local aliasName = 'Potion of ' .. statusProps[1] .. ' Enhanced'
aliases[aliasName] = { title = 'Potion of ' .. statusProps[1], name = 'Potion of ' .. statusProps[1], text = statusProps[2] .. ' ' .. statusProps[3] .. ' (' .. statusProps[6] .. ')'}
local aliasName = 'Splash Potion of ' .. statusProps[1]
aliases[aliasName] = { title = aliasName, name = aliasName, text = statusProps[2] .. ' (' .. statusProps[4] .. ')'}
local aliasName = 'Splash Potion of ' .. statusProps[1] .. ' Extended'
aliases[aliasName] = { title = 'Splash Potion of ' .. statusProps[1], name = 'Splash Potion of ' .. statusProps[1], text = statusProps[2] .. ' (' .. statusProps[5] .. ')'}
local aliasName = 'Splash Potion of ' .. statusProps[1] .. ' Enhanced'
aliases[aliasName] = { title = 'Splash Potion of ' .. statusProps[1], name = 'Splash Potion of ' .. statusProps[1], text = statusProps[2] .. ' ' .. statusProps[3] .. ' (' .. statusProps[6] .. ')'}
local aliasName = 'Lingering Potion of ' .. statusProps[1]
aliases[aliasName] = { title = aliasName, name = aliasName, text = statusProps[2] .. ' (' .. statusProps[7] .. ')'}
local aliasName = 'Lingering Potion of ' .. statusProps[1] .. ' Extended'
aliases[aliasName] = { title = 'Lingering Potion of ' .. statusProps[1], name = 'Lingering Potion of ' .. statusProps[1], text = statusProps[2] .. ' (' .. statusProps[8] .. ')'}
local aliasName = 'Lingering Potion of ' .. statusProps[1] .. ' Enhanced'
aliases[aliasName] = { title = 'Lingering Potion of ' .. statusProps[1], name = 'Lingering Potion of ' .. statusProps[1], text = statusProps[2] .. ' ' .. statusProps[3] .. ' (' .. statusProps[9] .. ')'}
local aliasName = 'Arrow of ' .. statusProps[1]
aliases[aliasName] = { title = aliasName, name = aliasName, text = statusProps[2] .. ' (' .. statusProps[10] .. ')'}
local aliasName = 'Arrow of ' .. statusProps[1] .. ' Extended'
aliases[aliasName] = { title = 'Arrow of ' .. statusProps[1], name = 'Arrow of ' .. statusProps[1], text = statusProps[2] .. ' (' .. statusProps[11] .. ')'}
local aliasName = 'Arrow of ' .. statusProps[1] .. ' Enhanced'
aliases[aliasName] = { title = 'Arrow of ' .. statusProps[1], name = 'Arrow of ' .. statusProps[1], text = statusProps[2] .. ' ' .. statusProps[3] .. ' (' .. statusProps[12] .. ')'}
else
local aliasName = 'Potion of ' .. statusProps[1]
aliases[aliasName] = { title = aliasName, name = aliasName, text = statusProps[2] }
local aliasName = 'Potion of ' .. statusProps[1] .. ' Enhanced'
aliases[aliasName] = { title = 'Potion of ' .. statusProps[1], name = 'Potion of ' .. statusProps[1], text = statusProps[2] .. ' ' .. statusProps[3] }
local aliasName = 'Splash Potion of ' .. statusProps[1]
aliases[aliasName] = { title = aliasName, name = aliasName, text = statusProps[2] }
local aliasName = 'Splash Potion of ' .. statusProps[1] .. ' Enhanced'
aliases[aliasName] = { title = 'Splash Potion of ' .. statusProps[1], name = 'Splash Potion of ' .. statusProps[1], text = statusProps[2] .. ' ' .. statusProps[3] }
local aliasName = 'Lingering Potion of ' .. statusProps[1]
aliases[aliasName] = { title = aliasName, name = aliasName, text = statusProps[2] }
local aliasName = 'Lingering Potion of ' .. statusProps[1] .. ' Enhanced'
aliases[aliasName] = { title = 'Lingering Potion of ' .. statusProps[1], name = 'Lingering Potion of ' .. statusProps[1], text = statusProps[2] .. ' ' .. statusProps[3] }
local aliasName = 'Arrow of ' .. statusProps[1]
aliases[aliasName] = { title = aliasName, name = aliasName, text = statusProps[2] }
local aliasName = 'Arrow of ' .. statusProps[1] .. ' Enhanced'
aliases[aliasName] = { title = 'Arrow of ' .. statusProps[1], name = 'Arrow of ' .. statusProps[1], text = statusProps[2] .. ' ' .. statusProps[3] }
end
end
end


local effects = {
-- start these lists with the no effect items as names are not normal
'Regeneration',
'Swiftness',
'Fire Resistance',
'Poison',
'Healing',
'Night Vision',
'Weakness',
'Strength',
'Slowness',
'Leaping',
'Harming',
'Water Breathing',
'Invisibility',
'Luck',
'Decay',
'the Turtle Master',
}
local potionItems = {
local potionItems = {
['Potion'] = {
['Potion'] = {
'Water Bottle',
aliases['Water Bottle'],
'Awkward Potion',
aliases['Awkward Potion'],
'Thick Potion',
aliases['Thick Potion'],
'Mundane Potion',
aliases['Mundane Potion'],
},
},
['Splash Potion'] = {
['Splash Potion'] = {
'Splash Water Bottle',
aliases['Splash Water Bottle'],
'Awkward Splash Potion',
aliases['Awkward Splash Potion'],
'Thick Splash Potion',
aliases['Thick Splash Potion'],
'Mundane Splash Potion',
aliases['Mundane Splash Potion'],
},
},
['Lingering Potion'] = {
['Lingering Potion'] = {
'Lingering Water Bottle',
aliases['Lingering Water Bottle'],
'Awkward Lingering Potion',
aliases['Awkward Lingering Potion'],
'Thick Lingering Potion',
aliases['Thick Lingering Potion'],
'Mundane Lingering Potion',
aliases['Mundane Lingering Potion'],
},
},
['Tipped Arrow'] = {
['Tipped Arrow'] = {
'Arrow of Splashing',
aliases['Arrow of Splashing'],
'Tipped Arrow',
'Tipped Arrow',
'Tipped Arrow',
},
},
}
}
for _, effect in ipairs( effects ) do
 
table.insert( potionItems['Splash Potion'], 'Splash Potion of ' .. effect )
-- Potions --
table.insert( potionItems['Lingering Potion'], 'Lingering Potion of ' .. effect )
local effects = {
table.insert( potionItems['Tipped Arrow'], 'Arrow of ' .. effect )
-- durations are in the order normal, extended, enhanced
{name = 'Regeneration', effect = '&9Regeneration', enhanced = 'II',
durations = { normal = { '0:45', '1:30', '0:22' }, lingering = { '0:11', '0:22', '0:05' }, arrow = { '0:05', '0:11', '0:02' }}},
{ name = 'Swiftness', effect = '&9Speed', enhanced = 'II',
durations = { normal = { '3:00', '8:00', '1:30' }, lingering = { '0:45', '2:00', '0:22' }, arrow = { '0:22', '1:00', '0:11' }}},
{ name = 'Fire Resistance', effect = '&9Fire Resistance', durations = { normal = { '3:00', '8:00' }, lingering = { '0:45', '2:00' }, arrow = { '0:22', '1:00' }}},
{ name = 'Poison', effect = '&cPoison', enhanced = 'II',
durations = { normal = { '0:45', '1:30', '0:21' }, lingering = { '0:11', '0:22', '0:05' }, arrow = { '0:05', '0:11', '0:02' }}},
{ name = 'Healing', effect = '&9Instant Health', enhanced = 'II' },
{ name = 'Night Vision',    effect = '&9Night Vision',    durations = { normal = { '3:00', '8:00' }, lingering = { '0:45', '2:00' }, arrow = { '0:22', '1:00' }}},
{ name = 'Weakness',        effect = '&cWeakness',        durations = { normal = { '1:30', '4:00' }, lingering = { '0:22', '1:00' }, arrow = { '0:11', '0:30' }}},
{ name = 'Strength', effect = '&9Strength', enhanced = 'II',
durations = { normal = { '3:00', '8:00', '1:30'}, lingering = {'0:45', '2:00', '0:22'}, arrow = { '0:22', '1:00', '0:11' }}},
{ name = 'Slowness', effect = '&cSlowness', enhanced = 'IV',
durations = { normal = { '1:30', '4:00', '0:20'}, lingering = {'0:22', '1:00', '0:05'}, arrow = { '0:11', '0:30', '0:02' }}},
{ name = 'Leaping', effect = '&9Jump Boost', enhanced = 'II',
durations = { normal = { '3:00', '8:00', '1:30' }, lingering = {'0:45', '2:00', '0:22'}, arrow = { '0:22', '1:00', '0:11' }}},
{ name = 'Harming', effect = '&cInstant Damage', enhanced = 'II' },
{ name = 'Water Breathing', effect = '&9Water Breathing', durations = { normal = { '3:00', '8:00' }, lingering = { '0:45', '2:00' }, arrow = { '0:22', '1:00' }}},
{ name = 'Invisibility',    effect = '&9Invisibility',    durations = { normal = { '3:00', '8:00' }, lingering = { '0:45', '2:00' }, arrow = { '0:22', '1:00' }}},
{ name = 'Slow Falling',    effect = '&9Slow Falling',    durations = { normal = { '1:30', '4:00' }, lingering = { '0:22', '1:00' }, arrow = { '0:11', '0:30' }}},
{ name = 'Luck',  effect = '&9Luck',  durations = { normal = { '5:00' }, lingering = { '1:15' }, arrow = { '0:37' }}},
{ name = 'Decay', effect = '&cWither', durations = { normal = { '0:40' }, lingering = { '0:10' }, arrow = { '0:05' }}},
{ name = 'the Turtle Master', text = '&cSlowness IV ($1)/&9Resistance III ($1)', enhanced = '&cSlowness VI ($1)/&9Resistance IV ($1)',
durations = { normal = { '0:20', '0:40', '0:20' }, lingering = { '0:15', '0:45', '0:15' }, arrow = {  '0:07', '0:22', '0:07' }}}
}
local types = {
{name = 'Potion',          durations = 'normal',    text = 'Potion of '},
{name = 'Splash Potion',    durations = 'normal',    text = 'Splash Potion of '},
{name = 'Lingering Potion', durations = 'lingering', text = 'Potion of '},
{name = 'Tipped Arrow',    durations = 'arrow',    text = 'Arrow of '},
}
 
for _, effect in ipairs(effects) do
for _, type in ipairs(types) do
-- form name, it will be reused
local name = type.text .. effect.name
-- if we have durations, add times
if effect.durations then
local durations = effect.durations[type.durations]
-- turtle master is weird, so just do a fancy string replacement
if effect.text then
aliases[name] = { name = name, text = string.gsub( effect.text, '%$1', durations[1] ) }
aliases[name .. ' Extended'] = { name = name, text = string.gsub( effect.text, '%$1', durations[2] ) }
aliases[name .. ' Enhanced'] = { name = name, text = string.gsub( effect.enhanced, '%$1', durations[3] ) }
else
-- we always have normal
aliases[name] = { name = name, text = string.format( '%s (%s)', effect.effect, durations[1] ) }
-- ensure we have extended
if durations[2] then
aliases[name .. ' Extended'] = { name = name, string.format( '%s (%s)', effect.effect, durations[2] ) }
-- and enhanced, currently there is nothing with a duration that can be extended but not enhanced
if effect.enhanced then
aliases[name .. ' Enhanced'] = { name = name, string.format( '%s %s (%s)', effect.effect, effect.enhanced, durations[3] ) }
end
end
end
else
-- otherwise its just effect, currently every potion with no duration can be enhanced
aliases[name] = { name = name, text = effect.effect}
aliases[name .. ' Enhanced'] = { name = name, text = effect.effect .. ' ' .. effect.enhanced }
end
-- add the base potion to the any list
table.insert(potionItems[type.name], aliases[name])
end
end
end
-- build the any lists
for item, potionAliases in pairs( potionItems ) do
for item, potionAliases in pairs( potionItems ) do
aliases['Any ' .. item] = potionAliases
aliases['Any ' .. item] = potionAliases
Line 616: Line 580:
aliases['Matching ' .. item] = woodAliases
aliases['Matching ' .. item] = woodAliases
end
end


-- Bedrock Edition Items --
-- Bedrock Edition Items --
Line 621: Line 586:
BE = {
BE = {
'Bow',
'Bow',
'Lava',
'Bucket of Pufferfish',
'Flowing Lava',
'Bucket of Tropical Fish',
'Cat Spawn Egg', 'Spawn Cat',
'Chest',
'Cobblestone Wall',
'Cobblestone Wall',
'Mossy Cobblestone Wall',
'Ender Chest',
'Glass Pane',
'Glass Pane',
'Horn Coral Block',
'Iron Bars',
'Iron Bars',
'Lava',
'Lava', 'Flowing Lava',
'Minecart with Command Block',
'Mossy Cobblestone Wall',
'Oak Fence Gate',
'Oak Fence Gate',
'Observer',
'Observer',
'Horn Coral Block',
'Panda Spawn Egg', 'Spawn Panda',
'Peony',
'Peony',
'Rose Bush',
'Rose Bush',
'Scaffolding',
'Stonecutter',
'Stonecutter',
'Chest',
'Ender Chest',
'Minecart with Command Block'
},
},
LCE = {
LCE = {