Module:Endless Petals

From Feed The Beast Wiki
Jump to: navigation, search

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

local petal = {}

petal.apothecary = 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, 209, 218}} .. f:expandTemplate{title="Cg", args={"bg-image", "GUI Petal Apothecary.png"}} .. f:expandTemplate{title="Cg", args={"text", require("Module:Language").link({"Petal Apothecary", --[[]]"Petal Apothecary"--[[]]}), nil, nil, 0, 4, class="craftingGridText craftingGridLink craftingGridTitle"}} .. rotate(args, f) .. f:expandTemplate{title="Cg", args={"cell", args.O or "", 143, 45}} .. "</div></span>"
end

function rotate(args, f)
	local function ring(number, offset)
		return "transform: rotate(" .. ((number or 0) * (offset or 0)) .. "deg) translate(64px) 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, 67, 116, style=ring(num, i)}}
		end
	end
	return page
end

petal.altar = function(f)
	local args = f.args or f
	if f == mw.getCurrentFrame() then
		args = f:getParent().args
	else
		f = mw.getCurrentFrame()
	end
	
	page = "<span>" .. f:expandTemplate{title="Cg", args={nil, 222, 237}} .. f:expandTemplate{title="Cg", args={"bg-image", "GUI Runic Altar.png"}} .. f:expandTemplate{title="Cg", args={"text", require("Module:Language").link({"Runic Altar", --[[]]"Runic Altar"--[[]]}), nil, nil, 0, 4, class="craftingGridText craftingGridLink craftingGridTitle"}} .. rotate(args, f)
	local mana = string.match(args.mana or args.M or "", "data%-tank%-usage=\"(%d+)\"")
	if mana ~= nil and tonumber(mana) < 10000 then
		mana = 10000
		page = page .. f:expandTemplate{title="Cg", args={"text", f:expandTemplate{title="color", args={444, --[[]]"Zoom: x10"--[[]]}}, nil, nil, 140, 197}}
	else
		mana = 100000
	end
	return page .. f:expandTemplate{title="Cg", args={"tank", args.mana or args.M or "", 4, 23, mana, height=200, width=6, nooverlay=true, style="transform:rotate(90deg); transform-origin: bottom right;"}} .. f:expandTemplate{title="Cg", args={"cell", args.O or "", 148, 45}} .. "</div></span>"
end

return petal