Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:BlueprintRecipes

From MCC Island Wiki

Documentation for this module may be created at Module:BlueprintRecipes/doc

local getArgs = require('Module:Arguments').getArgs
local expand = require("Module:Utils").expand

local p = {}

local themedCollections = {
	["Mechanical"] = true,
	["Natural"] = true,
	["Oceanic"] = true,
	["Magical"] = true,
}

local data = {}

for collection in pairs(themedCollections) do
	data[collection] = {
		Common = {
			{"Common", 5}
		},
		Uncommon = {
			{"Common", 6},
			{"Uncommon", 3}
		},
		Rare = {
			{"Common", 8},
			{"Uncommon", 4},
			{"Rare", 2}
		},
		Epic = {
			{"Common", 10},
			{"Uncommon", 5},
			{"Rare", 3},
			{"Epic", 2}
		},
		Legendary = {
			{"Common", 15},
			{"Uncommon", 7},
			{"Rare", 5},
			{"Epic", 3},
			{"Legendary", 2}
		},
	}
end

data["Mythic"] = {
	Any = {
		{"Rare Material Cluster", 3},
		{"Epic Material Cluster", 2},
		{"Legendary Material Cluster", 1},
		{"Epic Power Shard", 1},
		{"Legendary Power Shard", 1}
	}
}

data["Arcane Gate"] = {
	Any = {
		{"Material Singularity", 3},
		{"Mythic Power Shard", 5},
		{"Style Soul", 5}
	}
}

function p.get(frame, collection, rarity)
	local args = getArgs(frame)
	
	local recipe = data[collection]
	if not recipe then return "No recipe found" end
	
	local output = {}
	
	if recipe.Any then
		for _, item in ipairs(recipe.Any) do
			local name, quantity = item[1], item[2]
			table.insert(output, expand(frame, "Material", name, quantity))
		end
		return table.concat(output, "<br />")
	end
	
	if themedCollections[collection] and recipe[rarity] then
		for _, pair in ipairs(recipe[rarity]) do
			local matRarity, quantity = pair[1], pair[2]
			table.insert(output, expand(frame, "Material", expand(frame, "MaterialLookup", "rarity=" .. matRarity, "theme=" .. collection), quantity))
		end
		return table.concat(output, "<br />")
	end
	
	return "Recipe not found! Add more recipes to Module:BlueprintRecipes"
end

return p