Module:Inventory slot/Aliases

require('Module:MultiRequire') -- --Initial values from https://minecraft.gamepedia.com/Module:Inventory_slot/Aliases local aliases = {} local table = require('Module:Table') local uiText = require('Module:UIText')._main local string = require('Module:String') local tooltips = require('Module:Inventory slot/Tooltips') local minionData, petData, textData = loadDataMulti('Module:Minion/Data', 'Module:Pet/Data', 'Module:UIText/Data')

local rarityAliases = require('Module:RarityTier/Aliases') local rarityData = require('Module:RarityTier/Data') local statAliases = require('Module:Statname/aliases') local statData = require('Module:Statname/Data')

local function mergeTables(target, merger) for k, v in pairs(merger) do		target[k] = v	end return target end

local function getRarity(name_, rarity) -- If no rarity input, tooltip will be returned if tooltips[name_] then return tooltips[name_] end if rarity then rarity = rarityData[rarity:lower] local title_ = "&"..rarity.tooltipColor..name_ local text_ = "&l&"..rarity.tooltipColor..rarity.name:upper return {name=name_, title=title_, text=text_} else return name_ end end

local function getTooltips(keys) local ret = {} local defaultRarity = keys.rarity for i, key in ipairs(keys) do		if type(key) == "table" then ret[i] = getRarity(key[1], key.rarity or key[2]) else ret[i] = defaultRarity and getRarity(key, defaultRarity) or key end end return ret end

-- Item Tool tips -- -- See https://hypixel.net/threads/guide-minecraft-color-codes.1741307/ -- for information on the color syntax. -- -- Other syntax: -- *\ - New line

-- Data from Module:Inventory slot/Tooltips table.merge(aliases, tooltips)

table.merge(aliases, {	['Oak Wood Planks'] = aliases['Oak Wood Plank'],	['Spruce Wood Planks'] = aliases['Spruce Wood Plank'],	['Birch Wood Planks'] = aliases['Birch Wood Plank'],	['Jungle Wood Planks'] = aliases['Jungle Wood Plank'],	['Acacia Wood Planks'] = aliases['Acacia Wood Plank'],	['Dark Oak Wood Planks'] = aliases['Dark Oak Wood Plank'], }) -- -- Hypixel Skyblock stuff -- table.merge(aliases, {	-- Display names --	['Melon'] = { title = 'Melon', name = 'Melon Slice' },	['Melon Slice'] = { title = 'Melon', name = 'Melon Slice' },	['Melon (block)'] = { title = 'Melon', name = 'Melon (block)' },	['Mushroom'] = getTooltips{ 'Red Mushroom', 'Brown Mushroom' },	['Enchanted Mushroom'] = getTooltips{ 'Enchanted Red Mushroom', 'Enchanted Brown Mushroom' },	-- Fake items	['Air (minion)'] = { title = 'Air', name = 'Minions', image = 'Air (minion)', text = '&7Air should be 1 layer/underneath where the minion/is standing.', link = 'none' },	['Blank'] = { image = 'Black Stained Glass Pane', name = 'none', title = 'none', link='none', text='none' },	['Sell Item'] = { name = 'Hopper', title = '&aSell Item', link='none', text='&7Click items in your inventory to/sell them to the shop!' },	['Close'] = { name = 'Barrier', title = '&cClose', link='none', text='none' },	['Cancel'] = { name = 'Barrier', title = '&cCancel', link='none', text='none' }, ['Go Back'] = { name = 'Arrow', title = '&aGo Back', link='none'}, ['Next Page'] = { name = 'Arrow', title = '&aNext Page', link='none'}, ['Previous Page'] = { name = 'Arrow', title = '&aPrevious Page', link='none'}, ['SkyBlock Menu'] = { name = 'SkyBlock Menu', title = '&aSkyBlock Menu &7(Right Click)', text = '&7View all of your SkyBlock/&7progress, including your Skills,/&7Collections, Recipes, and more!//&eClick to open!', }, })

-- Make it so minions tiers use the image, but link to actual page local minions = { -- Farming 'Wheat', 'Carrot', 'Potato', 'Pumpkin', 'Melon', 'Mushroom', 'Cocoa Beans', 'Cactus', 'Sugar Cane', 'Cow', 'Pig', 'Chicken', 'Sheep', 'Rabbit', 'Nether Wart', -- Mining 'Cobblestone', 'Coal', 'Iron', 'Gold', 'Diamond', 'Lapis', 'Emerald', 'Redstone', 'Quartz', 'Obsidian', 'Glowstone', 'Gravel', 'Ice', 'Sand', 'End Stone', 'Clay', 'Mithril', -- Combat 'Zombie', 'Skeleton', 'Spider', 'Cave Spider', 'Creeper', 'Enderman', 'Ghast', 'Slime', 'Blaze', 'Magma Cube', -- Slayer 'Revenant', 'Tarantula', 'Voidling', -- Woodcutting 'Oak', 'Spruce', 'Birch', 'Dark Oak', 'Acacia', 'Jungle', -- Misc 'Fishing', 'Flower', 'Snow', }

local minionsTiers = { "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII" }; for _, name in ipairs(minions) do   for i, tier in ipairs(minionsTiers) do    	if minionData[name].stats[i] then local key = name.." Minion "..tier local description = minionData[name].description or 'No Description' aliases[key] = { title = '&9'..key, name = name.." Minion#"..tier, image = key, text = description..'//&7Time Between Action: &a'..minionData[name].stats[i].tba..'s/&7Max Storage: &e'..minionData[name].stats[i].storage } end end end

-- Make it so enchanted books link to enchantments with href to enchant local enchantments = { 'Aiming', 'Angler', 'Aqua Affinity', 'Bane of Arthropods', 'Blast Protection', 'Blessing', 'Caster', 'Cleave', 'Critical', 'Cubism', 'Delicate', 'Depth Strider', 'Dragon Hunter', 'Efficiency', 'Ender Slayer', 'Execute', 'Experience', 'Feather Falling', 'Fire Aspect', 'Fire Protection', 'First Strike', 'Flame', 'Fortune', 'Frail', 'Frost Walker', 'Giant Killer', 'Growth', 'Harvesting', 'Impaling', 'Infinite Quiver', 'Knockback', 'Lethality', 'Life Steal', 'Looting', 'Luck', 'Luck of the Sea', 'Lure', 'Magnet', 'Mana Steal', 'Piercing', 'Power', 'Projectile Protection', 'Protection', 'Punch', 'Rainbow', 'Replenish', 'Respiration', 'Scavenger', 'Sharpness', 'Silk Touch', 'Smelting Touch', 'True Protection', 'Smarty Pants', 'Smite', 'Snipe', 'Spiked Hook', 'Sugar Rush', 'Telekinesis', 'Thorns', 'Thunderlord', 'Vampirism', 'Venomous' } local enchantmentTiers = { "I", "II", "III", "IV", "V", "VI", "VII" }; for _, name in ipairs(enchantments) do   for _, tier in ipairs(enchantmentTiers) do        local key = "Enchanted Book ("..name.." "..tier..")" aliases[key] = { title = "Enchanted Book", text="&9"..name.." "..tier, name = "Enchantments#".. mw.uri.anchorEncode(name), image = "Enchanted Book" } end end

-- Pet Tooltips do local seenPets = {} for _, petName in pairs(table.keys(petData)) do 		local data = petData[petName]; local rarities = table.map(string.split(data.rarities:gsub('%-', ), ), function(v)			return v:lower		end) for i = 1, 6 do			local rarityColor = rarities[i] and rarityData[rarityAliases[rarities[i]:lower]].tooltipColor or nil if rarityColor and not seenPets[petName] then seenPets[petName] = 1 local stats = {} for stat, value in pairs(data.stats) do					value = tonumber(value[1]) if value = 1 then table.push(stats, ('%s: %s'):format(string.ucfirst(statAliases[stat]), value < 0 and value or '+'..value)) end end aliases['Mystery '..petName..' Pet'] = { title = '&9Mystery '..petName..' Pet', text = uiText(string.dedent					%s					&6Perks:&r					&f&l???&r					&7Progress to level 2: &e0%%&r					 &e0&6/&e100&r					&6Quality:					&f&l???:format(table.concat(stats, '\n')), ''), name = petName..' Pet', }			end end end end

-- -- Vanilla Minecraft stuff (may have some edits) -- 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 Sack', } -- Lists of item variants -- local itemVariants = { ['Dye'] = mw.clone(coloredDyes), ['Colored Dye'] = coloredDyes, ['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', },	['Dyed Carpet'] = { 'Orange Carpet', 'Magenta Carpet', 'Light Blue Carpet', 'Yellow Carpet', 'Lime Carpet', 'Pink Carpet', 'Gray Carpet', 'Light Gray Carpet', 'Cyan Carpet', 'Purple Carpet', 'Blue Carpet', 'Brown Carpet', 'Green Carpet', 'Red Carpet', 'Black Carpet', },	['Dyed Stained Clay'] = { 'White Stained Clay', 'Orange Stained Clay', 'Magenta Stained Clay', 'Light Blue Stained Clay', 'Yellow Stained Clay', 'Lime Stained Clay', 'Pink Stained Clay', 'Gray Stained Clay', 'Light Gray Stained Clay', 'Cyan Stained Clay', 'Purple Stained Clay', 'Blue Stained Clay', 'Brown Stained Clay', 'Green Stained Clay', 'Red Stained Clay', 'Black Stained Clay', },	['Dyed Small Backpack'] = { 'Small Backpack (white)', 'Small Backpack (orange)', 'Small Backpack (magenta)', 'Small Backpack (light blue)', 'Small Backpack (yellow)', 'Small Backpack (lime)', 'Small Backpack (pink)', 'Small Backpack (gray)', 'Small Backpack (light gray)', 'Small Backpack (cyan)', 'Small Backpack (purple)', 'Small Backpack (blue)', 'Small Backpack (brown)', 'Small Backpack (green)', 'Small Backpack (red)', 'Small Backpack (black)', },	['Dyed Medium Backpack'] = { 'Medium Backpack (white)', 'Medium Backpack (orange)', 'Medium Backpack (magenta)', 'Medium Backpack (light blue)', 'Medium Backpack (yellow)', 'Medium Backpack (lime)', 'Medium Backpack (pink)', 'Medium Backpack (gray)', 'Medium Backpack (light gray)', 'Medium Backpack (cyan)', 'Medium Backpack (purple)', 'Medium Backpack (blue)', 'Medium Backpack (brown)', 'Medium Backpack (green)', 'Medium Backpack (red)', 'Medium Backpack (black)', },	['Dyed Large Backpack'] = { 'Large Backpack (white)', 'Large Backpack (orange)', 'Large Backpack (magenta)', 'Large Backpack (light blue)', 'Large Backpack (yellow)', 'Large Backpack (lime)', 'Large Backpack (pink)', 'Large Backpack (gray)', 'Large Backpack (light gray)', 'Large Backpack (cyan)', 'Large Backpack (purple)', 'Large Backpack (blue)', 'Large Backpack (brown)', 'Large Backpack (green)', 'Large Backpack (red)', 'Large Backpack (black)', },	['Dyed Greater Backpack'] = { 'Greater Backpack (white)', 'Greater Backpack (orange)', 'Greater Backpack (magenta)', 'Greater Backpack (light blue)', 'Greater Backpack (yellow)', 'Greater Backpack (lime)', 'Greater Backpack (pink)', 'Greater Backpack (gray)', 'Greater Backpack (light gray)', 'Greater Backpack (cyan)', 'Greater Backpack (purple)', 'Greater Backpack (blue)', 'Greater Backpack (brown)', 'Greater Backpack (green)', 'Greater Backpack (red)', 'Greater Backpack (black)', },	['Dyed Jumbo Backpack'] = { 'Jumbo Backpack (white)', 'Jumbo Backpack (orange)', 'Jumbo Backpack (magenta)', 'Jumbo Backpack (light blue)', 'Jumbo Backpack (yellow)', 'Jumbo Backpack (lime)', 'Jumbo Backpack (pink)', 'Jumbo Backpack (gray)', 'Jumbo Backpack (light gray)', 'Jumbo Backpack (cyan)', 'Jumbo Backpack (purple)', 'Jumbo Backpack (blue)', 'Jumbo Backpack (brown)', 'Jumbo Backpack (green)', 'Jumbo Backpack (red)', 'Jumbo Backpack (black)', },	['Flower'] = { 'Oxeye Daisy', 'Red Tulip', 'Orange Tulip', 'White Tulip', 'Pink Tulip', 'Azure Bluet', 'Allium', 'Blue Orchid', 'Poppy', 'Dandelion' }, ['Mushroom'] = { 'Red Mushroom', 'Brown Mushroom' }, ['Quartz Block'] = { 'Block of Quartz', 'Chiseled Quartz Block', 'Quartz Pillar' }, ['Red Sandstone'] = { 'Red Sandstone', 'Chiseled Red Sandstone', 'Smooth Red Sandstone' }, ['Sandstone'] = { 'Sandstone', 'Chiseled Sandstone', 'Smooth Sandstone' }, ['Stone Bricks'] = { 'Stone Bricks', 'Mossy Stone Bricks', 'Cracked Stone Bricks', 'Chiseled Stone Bricks' }, ['Stone Slab'] = { 'Sandstone Slab', 'Cobblestone Slab', 'Brick Slab', 'Stone Brick Slab', 'Nether Brick Slab', 'Quartz Slab' }, ['Stone'] = { 'Stone', 'Andesite', 'Granite', 'Diorite', 'Polished Andesite', 'Polished Granite', 'Polished Diorite' }, ['Tulip'] = { 'Red Tulip', 'Orange Tulip', 'White Tulip', 'Pink Tulip' }, } table.unshift(itemVariants['Dye'], 'Bone Meal') for aliasName, aliasItems in pairs(itemVariants) do aliases['Any ' .. aliasName] = getTooltips(aliasItems) aliases['Matching ' .. aliasName] = getTooltips(aliasItems) end

-- Discs -- --local discs = { '13', 'Cat', 'Blocks', 'Chirp', 'Far', 'Mall', 'Mellohi', 'Stal', 'Strad', 'Ward', '11', 'Wait' } --for _, disc in ipairs(discs) do --	local name = 'Music Disc ' .. disc --	aliases[name] = { title = '&bMusic Disc', name = name, text = '&7C418 - ' .. disc } --end

-- Banners and colored items -- local colors = { 'White', 'Orange', 'Magenta', 'Light Blue', 'Yellow', 'Lime', 'Pink', 'Gray', 'Light Gray', 'Cyan', 'Purple', 'Blue', 'Brown', 'Green', 'Red', 'Black' } -- Items that use the sixteen colors -- local coloredItems = { 'Carpet', 'Wool', 'Stained Glass', 'Stained Glass Pane', rarity="common" }

for i, item in ipairs(coloredItems) do	local coloredItemAliases = table.deepCopy(coloredItems) local itemName = "" for j, color in ipairs(colors) do		if item:find('%$1') then itemName = item:gsub('%$1', color) else itemName = color .. ' ' .. item end coloredItemAliases[j] = itemName end item = item:gsub('%$1%s*', '') aliases['Any ' .. item] = getTooltips(coloredItemAliases) aliases['Matching ' .. item] = getTooltips(coloredItemAliases) end

-- UI Blank (A Specific Color) -- for _, color in ipairs(colors) do	aliases['Blank ('..color..')'] = { image = color..' Stained Glass Pane', name = 'none', title = 'none', link='none', text='none' } end

-- Wood -- local woods = { 'Oak', 'Spruce', 'Birch', 'Dark Oak', 'Acacia', 'Jungle' } local woodItems = { 'Wood', 'Wood Plank', -- Skyblock specific 'Wood Slab', 'Wood Stairs', 'Fence', 'Fence Gate', 'Sapling', 'Leaves', }

for _, item in ipairs(woodItems) do	local itemName = '' local woodAliases = {} for _, wood in ipairs(woods) do		if item:find('wood') then itemName = string.gsub(item, 'wood', wood) elseif item:find('%$1') then itemName = string.gsub(item, '%$1', wood) else itemName = wood .. ' ' .. item end table.insert(woodAliases, aliases[itemName] or itemName) end item = string.gsub(item, '%$1 ', '') aliases['Any ' .. item] = getTooltips(woodAliases) end

return aliases