Module:Infusion

local infuse = {}

local ipairs = ipairs

function rotate(args, f)	local function ring(number, offset) return "transform: rotate(" .. ((number or 0) * (offset or 0)) .. "deg) translate(80px) rotate(" .. ((-number or 0) * (offset or 0)) .. "deg);" end local num = 1 local stuff = {} while args["I" .. num] ~= nil do table.insert(stuff, args["I" .. num]) num = num + 1 end local page = "" if #stuff > 0 then num = 360 / (num-1) for i, gc in ipairs(stuff) do page = page .. f:expandTemplate{title="Cg", args={"cell", gc, 159, 175, style=ring(num, i)}} end end return page end

function space(args, f)	local function line (number) return ((number or 0) * 34) end local num = 1 local stuff = {} while args["A" .. num] ~= nil do table.insert(stuff, args["A" .. num]) num = num + 1 end local start = 158 - (num * 17) local page = "" if #stuff > 0 then for i, gc in ipairs(stuff) do page = page .. f:expandTemplate{title="Cg", args={"cell", gc, start + line(i), 297 }} end end return page end

infuse.infusion = function(f) local args = f.args or f	if f == mw.getCurrentFrame then args = f:getParent.args else f = mw.getCurrentFrame end return " " .. f:expandTemplate{title="Cg", args={nil, 362, 340}} .. f:expandTemplate{title="Cg", args={"bg-image", "GUI Arcane Infusion.png"}} .. f:expandTemplate{title="Cg", args={"text", require("Module:Language").link({"Infusion Altar", --"Infusion Altar"--}), nil, nil, 0, 4, class="craftingGridText craftingGridLink craftingGridTitle"}} .. rotate(args, f) .. f:expandTemplate{title="Cg", args={"cell", args.C or "", 159, 175}} .. f:expandTemplate{title="Cg", args={"cell", args.O or "", 157, 39}} .. space(args, f) .. " "  end return infuse