Module:Inventory slot/Aliases

require('Module:MultiRequire') local table = require('Module:Table') local string = require('Module:String') local uiText = require('Module:UIText')._main

local minionData, petData, textData, rarityData, statData, ench_data, colorData = loadDataMulti(	'Module:Minion/Data',	'Module:Pet/Data',	'Module:UIText/Data',	'Module:RarityTier/Data',	'Module:Statname/Data',	"Module:Link/enchantmentsLink/Data",	"Module:Color/Data")

local petModule = require("Module:Pet") local rarityAliases = require('Module:RarityTier/Aliases') local statAliases = require('Module:Statname/aliases')

local tooltips = require('Module:Inventory slot/Tooltips') local templates = require('Module:Inventory_slot/Templates') local itemVariants = require("Module:Item/Variants")

-- Initial values from https://minecraft.gamepedia.com/Module:Inventory_slot/Aliases -- This should not be visible, malicious users might do something

local mainTable = {}

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

local function getTooltips(keys) local ret = {} if type(keys) == "table" then for i, key in ipairs(keys) do			ret[i] = tooltips[key] or mainTable[key] or key end return ret else return tooltips[keys] or mainTable[keys] or 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

-- Apply templates from Module:Inventory slot/Templates for key,values in pairs(templates) do	local default = getTooltips(key) local g_id, g_name, g_title, g_text = values.id, default.name, default.title, default.text for _,item in ipairs(values) do -- ipairs: won't read global settings local repLs = {} local function repl(str) local function _repl(args) for _,sym in ipairs(args) do					if repLs[sym] then str = str:gsub('%$'..sym, repLs[sym]) end end return str end -- Apply all replacements local allrepl = 'os0123456789' local ret = _repl(string.split(allrepl, '')) return ret end local raw, id, name, title, text, vars if type(item) == 'table' then raw = item.id or item[1] id, name, title, text = item.id or g_id or item[1], item.name or g_name, item.title or g_title, item.text or g_text vars = item.vars or table.slice(item, 2) else raw, id, name, title, text = item, g_id or item, g_name, g_title, g_text end for i,v in ipairs(type(vars) == 'table' and vars or { vars }) do			repLs[tostring(i-1)] = v		end repLs['o'], repLs['s'] = raw, raw id = repl(id) repLs['s'] = id		name, title, text = repl(name), repl(title), repl(text) -- Directly insert to tooltips tooltips[id] = {name=name, title=title, text=text} end end

-- Processed Data from Module:Inventory slot/Tooltips and Module:Inventory slot/Templates table.merge(mainTable, tooltips)

-- Wood Planks table.each({	'Oak Wood Plank','Spruce Wood Plank',	'Birch Wood Plank','Jungle Wood Plank',	'Acacia Wood Plank','Dark Oak Wood Plank'	}, function(n)		mainTable[n..'s'] = getTooltips(n)	end)

-- -- Hypixel Skyblock stuff -- table.merge(mainTable, {	-- Display names --	['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 = table.keys(minionData)

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' mainTable[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 for name, ench in pairs(ench_data) do   for tier = 1, ench.max, 1 do    	local tier_display = string._toRoman(tier) local key = "Enchanted Book ("..name.." "..tier_display..")" mainTable[key] = { title = "Enchanted Book", text=(ench.isUltimate and "&d&l" or "&9")..name.." "..tier_display, name = "Enchantments#".. mw.uri.anchorEncode(name), image = "Enchanted Book" } end end

-- Other colored items -- local colors = colorData.MCColors -- UI Blank (Any Specific Color) -- for _, color in ipairs(colors) do	mainTable['Blank ('..color..')'] = { image = color..' Stained Glass Pane', name = 'none', title = 'none', link='none', text='none' } end

-- Data from Module:Item/Variants local allItemVariants = itemVariants.getVariants table.eachNamed(allItemVariants, function(v, k)	mainTable[k] = getTooltips(v)	end)

return mainTable