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

Commit

Permalink
Fix evolve all inaccurately unequipping pets
Browse files Browse the repository at this point in the history
  • Loading branch information
Pluviolithic committed Dec 15, 2023
1 parent 59027ef commit bd328e6
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/server/Combat/Perks/Pets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,13 @@ local function evolvePet(player, petName)

if unlockedPetCount < 5 then
local countToUnlock = 5 - unlockedPetCount
if equippedPets[petName] or countToUnlock > (petOwnedCount - equippedPets[petName]) then
if countToUnlock == equippedPets[petName] then
store:dispatch(actions.unequipPlayerPets(player.Name, { [petName] = countToUnlock }))
else
store:dispatch(
actions.unequipPlayerPets(
player.Name,
{ [petName] = countToUnlock - (petOwnedCount - equippedPets[petName]) }
)
)
end
end
local lockedButNotEquipedCount = (selectors.getPetLockedCount(store:getState(), player.Name, petName) or 0)
- (equippedPets[petName] or 0)
local countToUnequip = countToUnlock - lockedButNotEquipedCount
store:dispatch(actions.unlockPlayerPets(player.Name, { [petName] = countToUnlock }, true))
if countToUnequip > 0 then
store:dispatch(actions.unequipPlayerPets(player.Name, { [petName] = countToUnequip }))
end
end

store:dispatch(actions.deletePlayerPets(player.Name, { [petName] = 5 }, true))
Expand Down

0 comments on commit bd328e6

Please sign in to comment.