From ac3b3fa456f77ce49b4f2861cd96b50089d7a1fd Mon Sep 17 00:00:00 2001 From: pluviolithic Date: Tue, 16 Jan 2024 13:02:56 -0500 Subject: [PATCH 1/2] Minor bug fixes found from error log --- src/client/UI/Combat/PetAnimator.lua | 2 +- src/client/UI/Combat/WorkoutUI.lua | 2 +- src/client/UI/Inventories/PetInventory.lua | 4 +++- src/client/UI/TutorialUI.lua | 1 + .../Combat/Enemies/ApplyPlayerAnimations.lua | 2 +- src/server/Exchange/init.lua | 19 +++++++++++-------- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/client/UI/Combat/PetAnimator.lua b/src/client/UI/Combat/PetAnimator.lua index 9b20d8f..315b48d 100644 --- a/src/client/UI/Combat/PetAnimator.lua +++ b/src/client/UI/Combat/PetAnimator.lua @@ -31,7 +31,7 @@ end):andThen(function(petsModel) for i, petModel in petsModel:GetChildren() do local position, look = petUtils.calculatePosition(rootPart, numPets, i) - if not petModel.PrimaryPart then + if not petModel.PrimaryPart or not petModel:FindFirstChild "BodyPosition" then continue end diff --git a/src/client/UI/Combat/WorkoutUI.lua b/src/client/UI/Combat/WorkoutUI.lua index 9286f4a..41f36b6 100644 --- a/src/client/UI/Combat/WorkoutUI.lua +++ b/src/client/UI/Combat/WorkoutUI.lua @@ -46,7 +46,7 @@ playerStatePromise:andThen(function() local currentRequiredFear = selectors.getStat(newState, player.Name, "RequiredFear") local requiredFearChanged = currentRequiredFear ~= selectors.getStat(oldState, player.Name, "RequiredFear") - if requiredFearChanged then + if requiredFearChanged and WorkoutUI:FindFirstChild "Background" then formatter.tweenFormattedTextNumber(WorkoutUI.Background.FearCost, { previousRequiredFear, currentRequiredFear, diff --git a/src/client/UI/Inventories/PetInventory.lua b/src/client/UI/Inventories/PetInventory.lua index 44b7244..923578b 100644 --- a/src/client/UI/Inventories/PetInventory.lua +++ b/src/client/UI/Inventories/PetInventory.lua @@ -299,7 +299,9 @@ function PetInventory:Refresh() --PopupUI "You Can Not Unlock This Pet!" return end - self._focusedTemplateDetails.Locked = false + if self._focusedTemplateDetails then + self._focusedTemplateDetails.Locked = false + end Remotes.Client:Get("UnlockPet"):SendToServer(petName) end) diff --git a/src/client/UI/TutorialUI.lua b/src/client/UI/TutorialUI.lua index 59b964a..bdef7b6 100644 --- a/src/client/UI/TutorialUI.lua +++ b/src/client/UI/TutorialUI.lua @@ -52,6 +52,7 @@ tutorialFunctions = { function() -- step 1 local kills = selectors.getStat(store:getState(), player.Name, "Kills") if kills < 2 then + TutorialUI:WaitForChild "TutorialText" rolloutTutorialText(`Defeat enemies to gain Fear! ({kills}/2)`) if not workspace.Beams.TutorialEnemy.Beam.Attachment1 and not deletedEnemyBeam then diff --git a/src/server/Combat/Enemies/ApplyPlayerAnimations.lua b/src/server/Combat/Enemies/ApplyPlayerAnimations.lua index 7baa3f7..15cf05f 100644 --- a/src/server/Combat/Enemies/ApplyPlayerAnimations.lua +++ b/src/server/Combat/Enemies/ApplyPlayerAnimations.lua @@ -113,7 +113,7 @@ return function(player, enemy, info, janitor) end task.delay(1, function() weaponAccessory:Destroy() - if not findFirstChildWithTag(player.Character, "WeaponAccessory") then + if player.Character and not findFirstChildWithTag(player.Character, "WeaponAccessory") then player.Character.Humanoid:AddAccessory(equippedWeaponAccessory:Clone()) end end) diff --git a/src/server/Exchange/init.lua b/src/server/Exchange/init.lua index ad7baa6..4408f6c 100644 --- a/src/server/Exchange/init.lua +++ b/src/server/Exchange/init.lua @@ -131,17 +131,20 @@ local function handlePunchingBag(bag: any) loadedIdleAnimation:Play() local newWorkoutSpeed = workoutSpeed - local rebirthBuff = selectors.getRebirthUpgradeLevel(store:getState(), player.Name, "WorkoutSpeed") - * 0.05 - newWorkoutSpeed *= (1 - rebirthBuff) + if selectors.isPlayerLoaded(store:getState(), player.Name) then + local rebirthBuff = selectors.getRebirthUpgradeLevel(store:getState(), player.Name, "WorkoutSpeed") + * 0.05 - if selectors.hasGamepass(store:getState(), player.Name, tripleWorkoutSpeedPassID) then - newWorkoutSpeed /= 3 - end + newWorkoutSpeed *= (1 - rebirthBuff) + + if selectors.hasGamepass(store:getState(), player.Name, tripleWorkoutSpeedPassID) then + newWorkoutSpeed /= 3 + end - if selectors.getActiveBoosts(store:getState(), player.Name)["WorkoutBoost"] then - newWorkoutSpeed /= 3 + if selectors.getActiveBoosts(store:getState(), player.Name)["WorkoutBoost"] then + newWorkoutSpeed /= 3 + end end task.wait(newWorkoutSpeed) From d929a588edbb600508abb264f5fc523cb96ca207 Mon Sep 17 00:00:00 2001 From: pluviolithic Date: Wed, 17 Jan 2024 11:58:02 -0500 Subject: [PATCH 2/2] Closes #153 --- src/client/UI/Combat/PetAnimator.lua | 2 +- src/server/Leveling/Rebirths.lua | 18 +++++++++++++++++- src/server/PlayerManager/ProfileTemplate.lua | 1 + .../Middleware/ApplyMultipliersMiddleware.lua | 13 +++++++++++++ src/shared/State/DefaultStates.lua | 1 + 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/client/UI/Combat/PetAnimator.lua b/src/client/UI/Combat/PetAnimator.lua index 315b48d..9b20d8f 100644 --- a/src/client/UI/Combat/PetAnimator.lua +++ b/src/client/UI/Combat/PetAnimator.lua @@ -31,7 +31,7 @@ end):andThen(function(petsModel) for i, petModel in petsModel:GetChildren() do local position, look = petUtils.calculatePosition(rootPart, numPets, i) - if not petModel.PrimaryPart or not petModel:FindFirstChild "BodyPosition" then + if not petModel.PrimaryPart then continue end diff --git a/src/server/Leveling/Rebirths.lua b/src/server/Leveling/Rebirths.lua index 139bd28..5d1f35e 100644 --- a/src/server/Leveling/Rebirths.lua +++ b/src/server/Leveling/Rebirths.lua @@ -5,6 +5,7 @@ local Remotes = require(ReplicatedStorage.Common.Remotes) local store = require(ServerScriptService.Server.State.Store) local actions = require(ServerScriptService.Server.State.Actions) local selectors = require(ReplicatedStorage.Common.State.selectors) +local petUtils = require(ReplicatedStorage.Common.Utils.Player.PetUtils) local defaultStates = require(ReplicatedStorage.Common.State.DefaultStates) local upgrades = ReplicatedStorage.Config.Rebirth.Upgrades @@ -24,7 +25,22 @@ Remotes.Server:Get("Rebirth"):Connect(function(player) store:dispatch(actions.unequipPlayerPets(player.Name, selectors.getEquippedPets(store:getState(), player.Name))) local ownedPets = table.clone(selectors.getOwnedPets(store:getState(), player.Name)) - local lockedPets = selectors.getLockedPets(store:getState(), player.Name) + local lockedPets = table.clone(selectors.getLockedPets(store:getState(), player.Name)) + + local bestPets = petUtils.getBestPetNames(ownedPets, math.huge) + local legendaryKeepLimit = selectors.getRebirthUpgradeLevel(store:getState(), player.Name, "KeepLegendaries") + + for _, petName in bestPets do + if legendaryKeepLimit < 1 then + break + end + local pet = petUtils.getPet(petName) + if pet.RarityName.Value == "Legendary" and not pet:FindFirstChild "PermaLock" then + legendaryKeepLimit -= 1 + lockedPets[petName] = (lockedPets[petName] or 0) + 1 + end + end + for petName, count in ownedPets do ownedPets[petName] = count - (lockedPets[petName] or 0) end diff --git a/src/server/PlayerManager/ProfileTemplate.lua b/src/server/PlayerManager/ProfileTemplate.lua index 004a9bb..1fffbfb 100644 --- a/src/server/PlayerManager/ProfileTemplate.lua +++ b/src/server/PlayerManager/ProfileTemplate.lua @@ -59,6 +59,7 @@ return { MoreStrength = 0, Sprint = 0, WorkoutSpeed = 0, + KeepLegendaries = 0, }, }, diff --git a/src/server/State/Middleware/ApplyMultipliersMiddleware.lua b/src/server/State/Middleware/ApplyMultipliersMiddleware.lua index 3748b1f..6ec36f1 100644 --- a/src/server/State/Middleware/ApplyMultipliersMiddleware.lua +++ b/src/server/State/Middleware/ApplyMultipliersMiddleware.lua @@ -69,6 +69,19 @@ return function(nextDispatch, store) local multiplierData = selectors.getMultiplierData(store:getState(), action.playerName) if not multiplierData or action.skipMultipliers then nextDispatch(action) + local endMaxFearMeter = nil + if action.playerName and selectors.isPlayerLoaded(store:getState(), action.playerName) then + endMaxFearMeter = rankUtils.getMaxFearMeterFromRank( + selectors.getStat(store:getState(), action.playerName, "Rank") + ) + end + if endMaxFearMeter and initialMaxFearMeter ~= endMaxFearMeter then + local multiplier = selectors.getMultiplierData(store:getState(), action.playerName).MaxFearMeterMultiplier + or 1 + store:dispatch( + actions.setPlayerStat(action.playerName, "MaxFearMeter", endMaxFearMeter * multiplier) + ) + end return end local multiplier = multiplierData[action.statName .. "Multiplier"] or 0 diff --git a/src/shared/State/DefaultStates.lua b/src/shared/State/DefaultStates.lua index 3f4fe4f..881edd6 100644 --- a/src/shared/State/DefaultStates.lua +++ b/src/shared/State/DefaultStates.lua @@ -80,6 +80,7 @@ return { MoreStrength = 0, Sprint = 0, WorkoutSpeed = 0, + KeepLegendaries = 0, }, },