Module:InventorySlot/Aliases: Difference between revisions

Jump to navigation Jump to search
m
Forgot some things that could be used eventually.
(Setup for lore tooltips)
 
m (Forgot some things that could be used eventually.)
(One intermediate revision by the same user not shown)
Line 1: Line 1:
local aliases = {
['Clay (block)'] = { title = 'Clay', name = 'Clay (block)' },
['Clay (ball)'] = { title = 'Clay', name = 'Clay (ball)' }
}
-- Tooltip colors --
local yellowTooltips = {
'Creeper Head',
'Damaged Elytra',
'Dragon Head',
'Dragon\'s Breath',
'Elytra',
'Head',
'Heart of the Sea',
'Player Head',
'Skeleton Skull',
'Totem of Undying',
'Wither Skeleton Skull',
'Zombie Head',
}
for _, name in ipairs( yellowTooltips ) do
aliases[name] = { title = '&e', name = name }
end


local aquaTooltips = {
'Beacon',
'Conduit',
'Golden Apple',
}
for _, name in ipairs( aquaTooltips ) do
aliases[name] = { title = '&b', name = name }
end
local lightPurpleTooltips = {
'Dragon Egg',
'Structure Block',
}
for _, name in ipairs( lightPurpleTooltips ) do
aliases[name] = { title = '&d', name = name }
end
-- Discs --
local discs = {
{ '13',      'C418',                },
{ 'Cat',    'C418',      'cat'    },
{ 'Blocks',  'C418',      'blocks'  },
{ 'Chirp',  'C418',      'chirp'  },
{ 'Far',    'C418',      'far'    },
{ 'Mall',    'C418',      'mall'    },
{ 'Mellohi', 'C418',      'mellohi' },
{ 'Stal',    'C418',      'stal'    },
{ 'Strad',  'C418',      'strad'  },
{ 'Ward',    'C418',      'ward'    },
{ '11',      'C418',                },
{ 'Wait',    'C418',      'wait'    },
{ 'Pigstep', 'Lena Raine',          },
}
for _, disc in ipairs( discs ) do
local name = 'Music Disc ' .. disc[1]
local artist = disc[2]
local trackname = disc[1]
if disc[3] ~= nil then
trackname = disc[3]
end
aliases[name] = { title = '&bMusic Disc', name = name, text = '&7' .. artist .. ' - ' .. trackname }
end
-- list of all potions with no effects
local noEffects = {
'Water Bottle',
'Awkward Potion',
'Thick Potion',
'Mundane Potion',
'Uncraftable Potion',
'Splash Water Bottle',
'Awkward Splash Potion',
'Thick Splash Potion',
'Mundane Splash Potion',
'Uncraftable Splash Potion',
'Lingering Water Bottle',
'Awkward Lingering Potion',
'Thick Lingering Potion',
'Mundane Lingering Potion',
'Uncraftable Lingering Potion',
'Tipped Arrow',
'Arrow of Splashing',
'Uncraftable Tipped Arrow',
}
for _, name in ipairs(noEffects) do
aliases[name] = { name = name, text = '&7No effects' }
end
-- start these lists with the no effect items as names are not normal
local potionItems = {
['Potion'] = {
aliases['Water Bottle'],
aliases['Awkward Potion'],
aliases['Thick Potion'],
aliases['Mundane Potion'],
},
['Splash Potion'] = {
aliases['Splash Water Bottle'],
aliases['Awkward Splash Potion'],
aliases['Thick Splash Potion'],
aliases['Mundane Splash Potion'],
},
['Lingering Potion'] = {
aliases['Lingering Water Bottle'],
aliases['Awkward Lingering Potion'],
aliases['Thick Lingering Potion'],
aliases['Mundane Lingering Potion'],
},
['Tipped Arrow'] = {
aliases['Arrow of Splashing'],
aliases['Tipped Arrow'],
aliases['Tipped Arrow'],
aliases['Tipped Arrow'],
},
}


-- Potions --
-- Potions --
Line 29: Line 150:
durations = { normal = { '0:20', '0:40', '0:20' }, lingering = { '0:15', '0:45', '0:15' }, arrow = {  '0:07', '0:22', '0:07' }}}
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 = 'Lingering 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
local potionName = {}
if type.name == 'Tipped Arrow' then
potionName = type.text .. effect.name
else
potionName = type.text .. effect.name .. '.gif'
end
-- 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 = potionName, text = effect.text:gsub( '%$1', durations[1] ) }
aliases[name .. ' Extended'] = { name = potionName, text = effect.text:gsub( '%$1', durations[2] ) }
aliases[name .. ' Enhanced'] = { name = potionName, text = effect.enhanced:gsub( '%$1', durations[3] ) }
else
-- we always have normal
aliases[name] = { name = potionName, text = string.format( '%s (%s)', effect.effect, durations[1] ) }
-- ensure we have extended
if durations[2] then
aliases[name .. ' Extended'] = { name = potionName, text = 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 = potionName, text = 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 = potionName, text = effect.effect}
aliases[name .. ' Enhanced'] = { name = potionName, text = effect.effect .. ' ' .. effect.enhanced }
end
-- add the base potion to the any list
table.insert(potionItems[type.name], aliases[name])
end
end
-- build the any lists
for item, potionAliases in pairs( potionItems ) do
aliases['Any ' .. item] = potionAliases
aliases['Matching ' .. item] = potionAliases
end
return aliases
Bureaucrats, Check users, emailconfirmed, Interface administrators, staff, Administrators, translation-admin, Widget editors
1,633

edits

Navigation menu