Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
Closes #155
Browse files Browse the repository at this point in the history
  • Loading branch information
Pluviolithic committed Feb 4, 2024
1 parent 60f26c6 commit 7125b4e
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/client/UI/BillboardShops/EggShop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ CollectionService:GetInstanceAddedSignal("EggShop"):Connect(handleShop)

local function updateFoundsDisplay(foundPets): ()
for petName in foundPets do
if petName:match "Evolved" then
if petName:match "Evolved" or petName:match "Shiny" then
continue
end

Expand Down
34 changes: 26 additions & 8 deletions src/client/UI/Inventories/PetInventory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ local rarityTemplates = ReplicatedStorage.RarityTemplates
local gamepassIDs = ReplicatedStorage.Config.GamepassData.IDs
local globalMaxPetEquipCount = ReplicatedStorage.Config.Pets.GlobalMaxPetEquipCount.Value

local evolvedColor = Color3.fromRGB(255, 255, 0)
local evolvedColor = Color3.fromRGB(70, 255, 57)
local shinyColor = Color3.fromRGB(255, 233, 64)
local ableToEvolveColor = Color3.fromRGB(0, 229, 255)
local unableToEvolveColor = Color3.fromRGB(255, 255, 255)

Expand Down Expand Up @@ -63,6 +64,12 @@ function PetInventory:_initialize(): ()
end
end

for _, petFolder in ReplicatedStorage.ShinyPets:GetChildren() do
for _, pet in petFolder:GetChildren() do
table.insert(pets, pet)
end
end

table.sort(pets, multiplierComparator)

for index, pet in pets do
Expand Down Expand Up @@ -233,6 +240,8 @@ function PetInventory:Refresh()

if petName:match "Evolved" then
petTemplate.PetName.TextColor3 = evolvedColor
elseif petName:match "Shiny" then
petTemplate.PetName.TextColor3 = shinyColor
end

petTemplate.Parent = self._ui.Background.ScrollingFrame
Expand Down Expand Up @@ -348,7 +357,7 @@ function PetInventory:_setFocusedDisplay()
PetName = self._focusedTemplate.PetName.Text,
PetImage = self._focusedTemplate.PetImage.Image,
Multiplier = pet.Multiplier.Value,
Evolved = pet.Name:match "Evolved",
Shiny = pet.Name:match "Shiny",
Quantity = selectors.getOwnedPets(store:getState(), player.Name)[pet.Name],
Equipped = self._focusedTemplate.Equipped.Visible,
Locked = self._focusedTemplate.Lock.Visible,
Expand All @@ -370,17 +379,23 @@ function PetInventory:_setFocusedDisplay()
self._ui.RightBackground.Multiplier.Text = "x"
.. string.format("%.2f", (if details.Multiplier < 1 then details.Multiplier + 1 else details.Multiplier))

if details.Evolved then
self._ui.RightBackground.PetName.TextColor3 = evolvedColor
self._ui.RightBackground.Evolve.ImageColor3 = evolvedColor
self._ui.RightBackground.Evolve.EvolveText.Text = "Evolved"
if details.Shiny then
self._ui.RightBackground.PetName.TextColor3 = shinyColor
self._ui.RightBackground.Evolve.ImageColor3 = shinyColor
self._ui.RightBackground.Evolve.EvolveText.Text = "Max Evolved"
else
local amountToEvolve = 5
if selectors.getRebirthUpgradeLevel(store:getState(), player.Name, "Evolver") > 0 then
amountToEvolve = 4
end
if details.PetName:match "Evolved" then
self._ui.RightBackground.PetName.TextColor3 = evolvedColor
self._ui.RightBackground.Evolve.ImageColor3 = evolvedColor
amountToEvolve = 3
else
self._ui.RightBackground.PetName.TextColor3 = unableToEvolveColor
end
self._ui.RightBackground.Evolve.EvolveText.Text = `Evolve ({details.Quantity}/{amountToEvolve})`
self._ui.RightBackground.PetName.TextColor3 = unableToEvolveColor
if details.Quantity >= amountToEvolve then
self._ui.RightBackground.Evolve.ImageColor3 = ableToEvolveColor
else
Expand Down Expand Up @@ -443,7 +458,7 @@ function PetInventory:_setFocusedDisplay()
end
end))

if details.Evolved then
if details.Shiny then
return
end

Expand All @@ -453,6 +468,9 @@ function PetInventory:_setFocusedDisplay()
if selectors.getRebirthUpgradeLevel(store:getState(), player.Name, "Evolver") > 0 then
amountToEvolve = 4
end
if details.PetName:match "Evolved" then
amountToEvolve = 3
end
if details.Quantity >= amountToEvolve then
Remotes.Client:Get("EvolvePet"):SendToServer(details.PetName)
self:_clearFocusedDisplay()
Expand Down
18 changes: 15 additions & 3 deletions src/server/Combat/Perks/Pets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ local function evolvePet(player, petName)
amountToDeduct = 4
end

if not petOwnedCount or petOwnedCount < amountToDeduct or petName:match "Evolved" then
if petName:match "Evolved" then
amountToDeduct = 3
end

if not petOwnedCount or petOwnedCount < amountToDeduct or petName:match "Shiny" then
return 1
end

Expand All @@ -38,10 +42,18 @@ local function evolvePet(player, petName)
end

store:dispatch(actions.deletePlayerPets(player.Name, { [petName] = amountToDeduct }, true))
store:dispatch(actions.givePlayerPets(player.Name, { ["Evolved " .. petName] = 1 }))

local newPetName = petName
if petName:match "Evolved" then
newPetName = petName:gsub("Evolved", "Shiny")
else
newPetName = "Evolved " .. petName
end

store:dispatch(actions.givePlayerPets(player.Name, { [newPetName] = 1 }))

if petUtils.getPet(petName):FindFirstChild "PermaLock" then
store:dispatch(actions.lockPlayerPets(player.Name, { ["Evolved " .. petName] = 1 }))
store:dispatch(actions.lockPlayerPets(player.Name, { [newPetName] = 1 }))
end

return 0
Expand Down
9 changes: 8 additions & 1 deletion src/shared/Utils/Player/PetUtils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ end
local petUtils
petUtils = {
getPet = function(petName: string): Instance?
local pets = if petName:match "Evolved" then ReplicatedStorage.EvolvedPets else ReplicatedStorage.Pets
local pets
if petName:match "Evolved" then
pets = ReplicatedStorage.EvolvedPets
elseif petName:match "Shiny" then
pets = ReplicatedStorage.ShinyPets
else
pets = ReplicatedStorage.Pets
end
for _, area in pets:GetChildren() do
local pet = area:FindFirstChild(petName)
if pet then
Expand Down

0 comments on commit 7125b4e

Please sign in to comment.