-- Decompiled with the Synapse X Luau decompiler.


local l__ReplicatedStorage__1 = game.ReplicatedStorage;
local l__CurrentTarget__2 = script.Parent.CurrentTarget;
local l__PetsFrame__1 = script.Parent.PetsFrame;
function resetFrame()
	for v6, v7 in pairs(l__PetsFrame__1.Frame:GetChildren())do
		if v7.Name ~= "UICorner" then
			for v11, v12 in pairs(v7.PetView:GetChildren()) do
				v12:Destroy();			
			end;
			v7.Percentage.Text = "";
			v7.Rarity.Text = "";
			v7.ImageColor3 = Color3.fromRGB(25, 25, 25);
		end;	
	end;
end;
local u2 = require(l__ReplicatedStorage__1.Pets.Eggs);
local l__CostLabel__3 = script.Parent.CostLabel;
local l__Models__4 = l__ReplicatedStorage__1.Pets.Models;
l__CurrentTarget__2:GetPropertyChangedSignal("Value"):Connect(function()
	if l__CurrentTarget__2.Value == "None" then
		resetFrame();
		return;
	end;
	local v13 = u2[l__CurrentTarget__2.Value];
	local l__Currency__14 = v13.Currency;
	local v15 = 0;
	local v16 = {};
	for v17, v18 in pairs(v13.Pets) do
		v16[#v16 + 1] = {
			Name = v18.Name, 
			Type = v18.Type, 
			Rarity = v18.Rarity, 
			Secret = v18.Secret
		};
		v15 = v15 + v18.Rarity;
	end;
	l__CostLabel__3.CurrencyImage.Image = l__ReplicatedStorage__1.Pets.Settings:FindFirstChild(l__Currency__14 .. "Image").Value;
	l__CostLabel__3.TextLabel.Text = v13.Cost;
	table.sort(v16, function(p1, p2)
		return p2.Rarity < p1.Rarity;
	end);
	if l__Currency__14 ~= "R$" then
		script.Parent.BuyButtonR.Visible = true;
		script.Parent.BuyButtonT.Visible = true;
		script.Parent.BuyButtonE.Size = script.Parent.BuyButtonR.Size;
	else
		script.Parent.BuyButtonR.Visible = false;
		script.Parent.BuyButtonT.Visible = false;
		script.Parent.BuyButtonE.Size = script.Parent.CostLabel.Size;
	end;
	resetFrame();
	for v19, v20 in pairs(v16) do
		if v20.Secret == false then
			local l__Name__21 = v20.Name;
			local v22 = l__Models__4:FindFirstChild(l__Name__21):FindFirstChild(v20.Type):Clone();
			local v23 = l__PetsFrame__1.Frame:FindFirstChild("Slot" .. v19);
			local l__PetView__24 = v23.PetView;
			local v25 = math.floor(v20.Rarity / v15 * 10000) / 100;
			local l__Value__26 = l__Models__4:FindFirstChild(l__Name__21).Settings.Rarity.Value;
			local l__Value__27 = l__ReplicatedStorage__1.Pets.Rarities:FindFirstChild(l__Value__26).Color.Value;
			local v28 = Instance.new("Camera", l__PetView__24);
			local v29 = Vector3.new(0, 0, 0);
			l__PetView__24.CurrentCamera = v28;
			v22:SetPrimaryPartCFrame(CFrame.new(v29));
			v22.Parent = l__PetView__24;
			v23.Percentage.Text = v25 .. "%";
			v23.Rarity.Text = l__Value__26;
			v23.Rarity.TextColor3 = l__Value__27;
			v23.ImageColor3 = Color3.fromRGB(55, 55, 55);
			spawn(function()
				local v30 = 180;
				while wait() and v22.Parent ~= nil do
					v28.CFrame = CFrame.Angles(0, math.rad(v30), 0) * CFrame.new(v29 + Vector3.new(0, 0, 3), v29 + Vector3.new(0, 0, 0));
					v30 = v30 + 1;				
				end;
			end);
		end;
	end;
end);
