-- ALEX WAS HERE LOL


local v1 = {};
local u1 = nil;
coroutine.wrap(function()
	u1 = require(game.ReplicatedStorage:WaitForChild("Resources"));
end)();
function v1.Reward(p1)
	local v2 = u1.Saving.Get(p1);
	if not v2 then
		return;
	end;
	local v3 = u1.Directory.Ranks[v2.Rank];
	if #v3.rewards == 0 or os.time() - v2.RankTimer < v3.rewardCooldown then
		return;
	end;
	v2.RankTimer = os.time();
	for  v8, v9 in ipairs(v3.rewards) do
		local v7 = nil;
		local v10 = nil;
		v10, v7 = unpack(v9);
		if v10 == "Triple Coins Boost" then
			u1.Boosts.Give(p1, "Triple Coins", v7);
		elseif v10 == "Super Lucky Boost" then
			u1.Boosts.Give(p1, "Super Lucky", v7);
		elseif v10 == "Ultra Lucky Boost" then
			u1.Boosts.Give(p1, "Ultra Lucky", v7);
		elseif v10 == "Triple Damage Boost" then
			u1.Boosts.Give(p1, "Triple Damage", v7);
		else
			u1.Give.Currency(p1, v7, v10, false);
		end;	
	end;
	coroutine.wrap(function()
		u1.Network.Fire("Rewards Redeemed", p1, v3.rewards);
	end)();
	return true;
end;
function v1.Give(p2, p3)
	local v11 = u1.Saving.Get(p2);
	if not v11 then
		return;
	end;
	if v11.Rank ~= p3 then
		v11.Rank = p3;
		v11.RankProgress = 0;
		v11.RankTimer = 0;
		coroutine.wrap(function()
			u1.Network.FireAll("Rank Changed", p2, p3);
			u1.Signal.Fire("Rank Changed", p2, p3)
		end)();
		v1.Reward(p2);
	end;
end;