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 key end return ret else return tooltips[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(...) local args = { ... }				for _,sym in ipairs(args) do if type(repLs[sym]) ~= 'string' then error('Expected string for symbol substitute, got '..type(repLs[sym])..' instead. Symbol was '..sym) end str = str:gsub('%$'..sym, repLs[sym]) end return str end -- Apply all replacements local ret = _repl('o','s') 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 else raw, id, name, title, text = item, g_id or item, g_name, g_title, g_text end if type(vars) == 'table' then for i,v in ipairs(vars) do				repLs[i] = v			end 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)

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

-- 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 --	['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 = 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

-- Mystery XX Pet 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) local stats = {} for stat, value in pairs(data.stats) do			if not value.req then value = tonumber(value[1]) table.push(stats, ('&r%s: &a%s'):format(string.ucfirst(statAliases[stat]), value < 0 and value or '+'..value)) end end mainTable['Mystery '..petName..' Pet'] = { title = '&9Mystery '..petName..' Pet', text = uiText(string.dedent			&8%s Pet			%s			&6Perks:&r			&f&l???&r			&7Progress to level 2: &e0%%&r			&f &e0&6/&e100&r			&6Quality:			&f&l???:format(data.petType or , table.concat(stats, '\n')), ), name = petName..' Pet', }		mainTable[petName..' Pet'] = petModule._petTooltip(petName) 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

return mainTable