Feed The Beast Wiki
m (Spacing fix)
m (take 2)
Line 33: Line 33:
 
num = num + 1
 
num = num + 1
 
end
 
end
local start = 158 - (num * 16)
+
local start = 158 - (num * 17)
 
local page = ""
 
local page = ""
 
if #stuff > 0 then
 
if #stuff > 0 then
Line 51: Line 51:
 
end
 
end
 
 
return "<span>" .. 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 "", 158, 40}} .. space(args, f) .. "</div></span>"
+
return "<span>" .. 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) .. "</div></span>"
 
end
 
end
 
return infuse
 
return infuse

Revision as of 23:52, 23 March 2016

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

local infuse = {}
--No I don't know [expletive] about Lua, but [expletive] it we'll do it live
--Largely based on Module:Endless Petals
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 "<span>" .. 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) .. "</div></span>"  
end
return infuse