-- ALEX WAS HERE LOL


local u1 = nil;
coroutine.wrap(function()
	u1 = require(game.ReplicatedStorage:WaitForChild("Resources"));
end)();
local u2 = {}
 u2 = {
	Add = function(p1, p2, p3)
		local v1 = u1.Saving.Get(p1);
		if not v1 then
			return;
		end;
		local v2 = u1.Directory.Achievements[p2];
		if not v2 then
			return;
		end;
		local v3 = v1.Achievements[p2];
		if not v3 then
			v1.Achievements[p2] = {
				stage = 1, 
				progress = 0
			};
			v3 = v1.Achievements[p2];
		end;
		v3.progress = v3.progress + p3;
		local l__stage__4 = v3.stage;
		if v2[l__stage__4] and v2[l__stage__4].amount <= v3.progress then
			u2.Advance(p1, p2);
		end;
	end, 
	Advance = function(p4, p5)
		local v5 = u1.Saving.Get(p4);
		if not v5 then
			return;
		end;
		local v6 = u1.Directory.Achievements[p5];
		local v7 = v5.Achievements[p5];
		v7.stage = v7.stage + 1;
		v7.progress = 0;
		u2.Reward(p4, p5, v7.stage - 1);
		coroutine.wrap(function()
			u1.Signal.Fire("Achievement Completed", p4, p5, v7.stage);
			u1.Network.Fire("Achievement Completed", p4, p5, v7.stage);
			u1.Network.FireAll("Fireworks Animation", p4);
		end)();
	end
};
local u3 = Random.new();
function u2.Reward(p6, p7, p8)
	if not u1.Saving.Get(p6) then
		return;
	end;
	local v8 = u1.Directory.Achievements[p7][p8];
	local l__rewardType__9 = v8.rewardType;
	local l__reward__10 = v8.reward;
	if l__rewardType__9 ~= "Diamonds" and l__rewardType__9 ~= "Coins" then
		if l__rewardType__9 == "Pet" then
			u1.Pets.Create(p6, l__reward__10, nil, true);
			return;
		elseif l__rewardType__9 == "GoldenPet" then
			local v11 = u1.Directory.Pets[l__reward__10];
			u1.Pets.Create(p6, l__reward__10, {
				g = true, 
				s = u3:NextInteger(v11.strengthMin, v11.strengthMax) * u1.Settings.GoldPetsMult
			}, true, nil, true);
			return;
		elseif l__rewardType__9 == "RainbowPet" then
			local v12 = u1.Directory.Pets[l__reward__10];
			u1.Pets.Create(p6, l__reward__10, {
				r = true, 
				s = u3:NextInteger(v12.strengthMin, v12.strengthMax) * u1.Settings.RainbowPetsMult
			}, true, nil, true);
			if v12.rarity == 'Exclusive' then
				
			end
			return;
		elseif l__rewardType__9 == "DarkMatterPet" then
			local v13 = u1.Directory.Pets[l__reward__10];
			u1.Pets.Create(p6, l__reward__10, {
				dm = true, 
				s = u3:NextInteger(v13.strengthMin, v13.strengthMax) * u1.Settings.DarkMatterPetsMult
			}, true, nil, true);
			return;
		else
			if l__rewardType__9 == "Slots" then
				u1.Give.Slots(p6, l__reward__10);
			end;
			return;
		end;
	end;
	u1.Give.Currency(p6, l__reward__10, l__rewardType__9);
end;
return u2;
