Module:Minion/Templates

local string, table, minion = require('Module:String'), require('Module:Table'), require('Module:Minion') local minionData = mw.loadData('Module:Minion/Data')

local function to(a, b)	local arrow = '➜' return ('%s%s%s'):format(a, arrow, b) end

local function minions -- used on Module:Inventory slot/Templates local ret = {} table.each(table.keys(minionData), function(name)		local stats = minionData[name].stats		local description = 		table.merge(description, table.deepCopy(minionData[name].abilities or {}, true))		local max = table.length(stats)		local max_ = string._toRoman(max)		for i, v in ipairs(stats) do			local desc = table.concat(table.map(description, function (d)				if (i >= d.req) then return d[1] end			end), '//')			if (v.tba and v.storage) then				table.push(ret, { name, string._toRoman(i), desc, v.tba, v.storage, id = '{o} Minion {0}' })			end		end		local f, l = stats[1], stats[max]		if (f.tba and f.storage and l.tba and l.storage) then			local desc = table.concat(table.map(description, function (d)				return d[1]			end), '//')			table.push(ret, { name, to('I', max_), desc, to(f.tba, l.tba), to(f.storage, l.storage), id = '{o} Minion', name = '{o} Minion', image = '{o} Minion ' .. max_ })		end	end) return ret end

local function skins -- used on Module:Inventory slot/Templates return { {'Happy Emoji Minion Skin', '&7a &eHappy/&eEmoji'}, {'Fish Minion Skin', '&ea/&eFish'}, {'Pufferfish Minion Skin', '&ea/&ePufferfish'}, {'Tropical Bird 2 Minion Skin', '&ea/&eTropical Bird 2'}, {'Tropical Bird 1 Minion Skin', '&ea/&eTropical Bird 1'}, {'White Tiger Minion Skin', '&ea White/&eTiger'}, {'Festive Jerry Minion Skin', '&ea/&eFestive Jerry'}, {'Festive Zombie Minion Skin', '&ea/&eFestive Zombie'}, {'Festive Skeleton Minion Skin', '&ea/&eFestive Skeleton'}, {'Cyclops Minion Skin', '&ea/&eCyclops'}, {'Scarecrow Minion Skin', '&ea/&eScarecrow'}, {'Shark Minion Skin', '&ea/&eShark'}, {'Basketball Minion Skin', '&ea/&eBasketball'}, {'Ghost Minion Skin', '&ea/&eGhost'}, {'Pumpkin Minion Skin', '&ea/&ePumpkin'}, {'Mummy Minion Skin', '&ea/&eMummy'}, {'Penguin Minion Skin', '&ea/&ePenguin'}, {'Pink Bunny Personality', '&ea &ePink/&eBunny'}, {'Easter Egg Minion Skin', '&ean/&eEaster Egg'}, {'Present Minion Skin', '&ea/&ePresent'}, {'Reindeer Minion Skin', '&ea/&eReindeer'}, {'Hermit Crab Minion Skin', '&ea/&eHermit Crab'}, {'Pink Donut Minion Skin', '&ea &ePink/&eFrosted Donut'}, {'Beach Ball Minion Skin', '&ea Beach/Ball'}, {'Bee Minion Skin', '&ea/&eBee'}, {'Bunny Minion Skin', '&ea/&eBunny'}, {'Clownfish Minion Skin', '&ea &eClownfish'}, {'Gingerbread Man Minion Skin', '&ea/&eGingerbread Man'}, {'Grinch Minion Skin', '&ea/&eGrinch'}, {'Ice Cream Minion Skin', '&ean Ice/&eCream'}, {'Ice Lolly Minion Skin', '&ean Ice/&eLolly'}, {'Killer Minion Skin', '&ea/&eKiller'}, {'Lady Bug Minion Skin', '&ea &eLady/&eBug'}, {'Melon Minion Skin', '&ea/&eMelon'}, {'Sandcastle Minion Skin', '&ea/&eSandcastle'}, {'Santa Minion Skin', '&ea/&eSanta'}, {'Skull Minion Skin', '&ea/&eSkull'}, {'Sun Minion Skin', '&ea/&eSun'}, {'Undead Minion Skin', '&ean/&eUndead'}, } end

local function expandMinionAll -- return a table with all minions -- used on Module:Item/Variants local names = {} for name, _ in pairs(minionData) do names[#names + 1] = name .. ' Minion' end return names end

local function expandMinionType -- return a table with keys "... Minion" and values of all tiers of that minion -- used on Module:Item/Variants local perType = {} for name, _ in pairs(minionData) do		local stats = minionData[name].stats perType[name .. ' Minion'] = table.map(stats, function(v,i)	   	return name .. ' Minion ' .. string._toRoman(i)		end) end return perType end

return { minions = minions, skins = skins, expandMinionAll = expandMinionAll, expandMinionType = expandMinionType }