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

Commit

Permalink
Minor Changes and Fixes (Closes #152)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pluviolithic committed Jan 15, 2024
1 parent 3caf1d3 commit da48d4d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/client/UI/BuffsUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ playerStatePromise:andThen(function()
end
end)

buffTray:WaitForChild "Frame"
updateBuffTray(store:getState())
store.changed:connect(updateBuffTray)
while true do
Expand Down
2 changes: 1 addition & 1 deletion src/client/UI/Combat/BossUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Remotes.Client:Get("SendFightInfo"):Connect(function(info)
gemsToDisplay = getMultiplierAdjustedStat(player, "Gems", gemsToDisplay)
fearToDisplay = getMultiplierAdjustedStat(player, "Fear", fearToDisplay)

BossUI.Background.Frame.Health:TweenSize(
BossUI:WaitForChild("Background").Frame.Health:TweenSize(
UDim2.fromScale(1.013 * info.Health / info.MaxHealth, 1.104),
Enum.EasingDirection.Out,
Enum.EasingStyle.Quad,
Expand Down
3 changes: 3 additions & 0 deletions src/client/UI/GiftUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ function GiftUI:_initialize(): ()
end)

playerStatePromise:andThen(function()
store.changed:connect(function()
self:Refresh()
end)
while true do
self._counter = (self._counter + 1) % 2
self:Refresh(true)
Expand Down
14 changes: 13 additions & 1 deletion src/server/Combat/Perks/Pets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ end)

Remotes.Server:Get("EquipBestPets"):Connect(function(player: Player)
local equippedPets = selectors.getEquippedPets(store:getState(), player.Name)
local lockedPets = selectors.getLockedPets(store:getState(), player.Name)
local ownedPets = selectors.getOwnedPets(store:getState(), player.Name)
local bestPets = petUtils.getBestPetNames(
selectors.getOwnedPets(store:getState(), player.Name),
selectors.getStat(store:getState(), player.Name, "MaxPetEquipCount")
Expand All @@ -164,11 +166,21 @@ Remotes.Server:Get("EquipBestPets"):Connect(function(player: Player)
end

local bestPetsDict = {}
local petsToUnlock = table.clone(equippedPets)
for _, bestPetName in bestPets do
bestPetsDict[bestPetName] = (bestPetsDict[bestPetName] or 0) + 1
end

store:dispatch(actions.unlockPlayerPets(player.Name, equippedPets))
for petName, count in bestPetsDict do
local lockCount = lockedPets[petName] or 0
local equipCount = equippedPets[petName] or 0
if ownedPets[petName] - (lockCount - equipCount) < count then
local countToUnlock = count - (ownedPets[petName] - (lockCount - equipCount))
petsToUnlock[petName] = (petsToUnlock[petName] or 0) + countToUnlock
end
end

store:dispatch(actions.unlockPlayerPets(player.Name, petsToUnlock))
store:dispatch(actions.unequipPlayerPets(player.Name, equippedPets))
store:dispatch(actions.equipPlayerPets(player.Name, bestPetsDict))
store:dispatch(actions.lockPlayerPets(player.Name, bestPetsDict, true))
Expand Down
5 changes: 4 additions & 1 deletion src/server/Exchange/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ local function handlePunchingBag(bag: any)
prompt.ActionText = "Start Training"
inUse = false

if selectors.getStat(store:getState(), player.Name, "Strength") >= initialStrength then
if
selectors.isPlayerLoaded(store:getState(), player.Name)
and selectors.getStat(store:getState(), player.Name, "Strength") >= initialStrength
then
humanoid.RootPart.CFrame = teleportPart.CFrame
+ Vector3.new(0, 1, 0) * (humanoid.RootPart.Size.Y + 3)
end
Expand Down
15 changes: 5 additions & 10 deletions src/server/PlayerManager/GlobalLeaderboards.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,19 @@ end

local function updateGlobalLeaderboardStores(): ()
for _, player in Players:GetPlayers() do
if
not profiles[player.Name]
or permissionList.Admins[player.UserId]
or not selectors.isPlayerLoaded(store:getState(), player.Name)
or player.UserId < 0
then
if not profiles[player.Name] or permissionList.Admins[player.UserId] or player.UserId < 0 then
continue
end
for statName, globalLeaderboard in globalLeaderboardStores do
if not selectors.isPlayerLoaded(store:getState(), player.Name) then
continue
end
pcall(
globalLeaderboard.SetAsync,
globalLeaderboard,
tostring(player.UserId),
math.floor(selectors.getStat(store:getState(), player.Name, statName))
)
if not selectors.isPlayerLoaded(store:getState(), player.Name) then
continue
end
end
end
end
Expand All @@ -76,7 +71,7 @@ task.delay(10, function()
while true do
task.spawn(updateGlobalLeaderboardDisplays)
task.spawn(updateGlobalLeaderboardStores)
task.wait(100)
task.wait(120)
end
end)

Expand Down

0 comments on commit da48d4d

Please sign in to comment.