Module:Inventory slot/Aliases

-- Initially taken from https://minecraft.gamepedia.com/Module:Inventory_slot/Aliases

local loader = require('Module:Loader')

local string, table, utils, tooltipsTable, templates, itemVariants = loader.require('String', 'Table', 'Inventory slot/Utils', 'Inventory slot/Tooltips', 'Inventory_slot/Templates', 'Item/Variants')

local minionData, colorData = loader.loadData('Minion/Data', 'Color/Data')

local aliasesTable, templatesTable, itemVariantsTable = {}, {}, {}

local function getTooltips(keys) if type(keys) == "table" then local ret = {} for i, key in ipairs(keys) do			ret[i] = tooltipsTable[key] or aliasesTable[key] or templatesTable[key] or itemVariantsTable[key] end return ret else return tooltipsTable[keys] or aliasesTable[keys] or templatesTable[keys] or itemVariantsTable[keys] end end

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

local function main --	-- Hypixel Skyblock stuff --	table.merge(aliasesTable, {		-- 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 = table.keys(minionData)	table.each(minions, function(name) local stats = minionData[name].stats local description = minionData[name].description or 'No Description' for i,v in ipairs(stats) do			local tier = string._toRoman(i) local key = name.." Minion "..tier aliasesTable[key] = { title = '&9'..key, name = name.." Minion#"..tier, image = key, text = description..'//&7Time Between Action: &a'..v.tba..'s/&7Max Storage: &e'..v.storage } end end)	-- Other colored items --	local colors = colorData.MCColors	-- UI Blank (Any Specific Color) --	for _, color in ipairs(colors) do		aliasesTable['Blank ('..color..')'] = { image = color..' Stained Glass Pane', name = 'none', title = 'none', link='none', text='none' }	end	-- Process Data from Inventory slot/Templates --	local MAX_RUNS = 20	local allow_continue, made_change, currentProcess, templateStorage, installed, runs = true, false, 1, {}, {}, 0	while allow_continue and ((currentProcess == 1) or (table.length(templateStorage) > 0)) do		if (currentProcess > 1) and (not made_change) then allow_continue = false end		runs, made_change = runs + 1, false		if runs > MAX_RUNS then error('Too many iterations in processing templates') end		for key, values in pairs(currentProcess == 1 and templates or templateStorage) do			local default = getTooltips(key)			if not default then				if allow_continue then templateStorage[key] = values else error('Key '..key..' no default') end else made_change = true table.push(installed, key) table.merge(templatesTable, utils._templateReplacements(values, default)) end end for _, key in ipairs(installed) do			templateStorage[key] = nil end currentProcess, installed = currentProcess + 1, {} end for k,v in pairs(itemVariants) do		itemVariantsTable[k] = getTooltips(v) end return table.merge( {}, tooltipsTable, aliasesTable, templatesTable, itemVariantsTable ) end

-- For Debugging -- local p = { main = main } -- return p

-- Actual Usage return main