This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
344bac2
commit 4e552cb
Showing
13 changed files
with
220 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
local Players = game:GetService "Players" | ||
local StarterPlayer = game:GetService "StarterPlayer" | ||
local ReplicatedStorage = game:GetService "ReplicatedStorage" | ||
local CollectionService = game:GetService "CollectionService" | ||
|
||
local selectors = require(ReplicatedStorage.Common.State.selectors) | ||
local clockUtils = require(ReplicatedStorage.Common.Utils.ClockUtils) | ||
local store = require(StarterPlayer.StarterPlayerScripts.Client.State.Store) | ||
local playerStatePromise = require(StarterPlayer.StarterPlayerScripts.Client.State.PlayerStatePromise) | ||
|
||
local player = Players.LocalPlayer | ||
|
||
playerStatePromise:andThen(function() | ||
while true do | ||
local chestTimers = selectors.getChestTimers(store:getState(), player.Name) | ||
for _, VIPChestTimer in CollectionService:GetTagged "VIPChestTimer" do | ||
VIPChestTimer.Text = clockUtils.getFormattedChestTimer(chestTimers.VIPChest) | ||
end | ||
for _, groupChestTimer in CollectionService:GetTagged "GroupChestTimer" do | ||
groupChestTimer.Text = clockUtils.getFormattedChestTimer(chestTimers.GroupChest) | ||
end | ||
task.wait(1) | ||
end | ||
end) | ||
|
||
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
local ReplicatedStorage = game:GetService "ReplicatedStorage" | ||
local ServerScriptService = game:GetService "ServerScriptService" | ||
|
||
local Remotes = require(ReplicatedStorage.Common.Remotes) | ||
local Zone = require(ReplicatedStorage.Common.lib.ZonePlus) | ||
local store = require(ServerScriptService.Server.State.Store) | ||
local actions = require(ServerScriptService.Server.State.Actions) | ||
local selectors = require(ReplicatedStorage.Common.State.selectors) | ||
local zoneUtils = require(ReplicatedStorage.Common.Utils.ZoneUtils) | ||
local clockUtils = require(ReplicatedStorage.Common.Utils.ClockUtils) | ||
local productRewarders = require(ServerScriptService.Server.PurchaseManager.DeveloperProducts.Products.Rewarders) | ||
|
||
local packIDs = ReplicatedStorage.Config.DevProductData.Packs | ||
local chestTimerLength = ReplicatedStorage.Config.DevProductData.Chests.ChestTimerLength.Value | ||
local VIPChestZone = Zone.new(zoneUtils.getTaggedForZone "VIPChestHitbox") | ||
local groupChestZone = Zone.new(zoneUtils.getTaggedForZone "GroupChestHitbox") | ||
|
||
VIPChestZone:relocate() | ||
groupChestZone:relocate() | ||
|
||
-- Award order for group chests: GemBoost > TinyFearPack > DamageBoost > FearBoost > SmallGemPack > FearlessBoost | ||
-- Award order for vip chests: FearBoost > SmallGemPack > DamageBoost > GemBoost > TinyFearPack > FearlessBoost | ||
|
||
local vipChestAwards = { | ||
function(player) | ||
Remotes.Server:Get("OpenRobuxShopOnClient"):SendToPlayer(player, "Boosts") | ||
store:dispatch(actions.incrementPlayerBoostCount(player.Name, "FearBoost15")) | ||
end, | ||
function(player) | ||
productRewarders[packIDs.Gems["SmallGemPack"].Value](player) | ||
end, | ||
function(player) | ||
Remotes.Server:Get("OpenRobuxShopOnClient"):SendToPlayer(player, "Boosts") | ||
store:dispatch(actions.incrementPlayerBoostCount(player.Name, "DamageBoost15")) | ||
end, | ||
function(player) | ||
Remotes.Server:Get("OpenRobuxShopOnClient"):SendToPlayer(player, "Boosts") | ||
store:dispatch(actions.incrementPlayerBoostCount(player.Name, "GemsBoost15")) | ||
end, | ||
function(player) | ||
productRewarders[packIDs.Fear["TinyFearPack"].Value](player) | ||
end, | ||
function(player) | ||
Remotes.Server:Get("OpenRobuxShopOnClient"):SendToPlayer(player, "Boosts") | ||
store:dispatch(actions.incrementPlayerBoostCount(player.Name, "FearlessBoost15")) | ||
end, | ||
} | ||
|
||
local groupChestAwards = { | ||
function(player) | ||
Remotes.Server:Get("OpenRobuxShopOnClient"):SendToPlayer(player, "Boosts") | ||
store:dispatch(actions.incrementPlayerBoostCount(player.Name, "GemsBoost15")) | ||
end, | ||
function(player) | ||
productRewarders[packIDs.Fear["TinyFearPack"].Value](player) | ||
end, | ||
function(player) | ||
Remotes.Server:Get("OpenRobuxShopOnClient"):SendToPlayer(player, "Boosts") | ||
store:dispatch(actions.incrementPlayerBoostCount(player.Name, "DamageBoost15")) | ||
end, | ||
function(player) | ||
Remotes.Server:Get("OpenRobuxShopOnClient"):SendToPlayer(player, "Boosts") | ||
store:dispatch(actions.incrementPlayerBoostCount(player.Name, "FearBoost15")) | ||
end, | ||
function(player) | ||
productRewarders[packIDs.Gems["SmallGemPack"].Value](player) | ||
end, | ||
function(player) | ||
Remotes.Server:Get("OpenRobuxShopOnClient"):SendToPlayer(player, "Boosts") | ||
store:dispatch(actions.incrementPlayerBoostCount(player.Name, "FearlessBoost15")) | ||
end, | ||
} | ||
|
||
VIPChestZone.playerEntered:Connect(function(player) | ||
if not selectors.hasGamepass(store:getState(), player.Name, "VIP") then | ||
return | ||
end | ||
local chestTimers = selectors.getChestTimers(store:getState(), player.Name) | ||
if not clockUtils.hasTimeLeft(chestTimers.VIPChest, chestTimerLength) then | ||
local currentAwardIndex = selectors.getStat(store:getState(), player.Name, "VIPChestAwardIndex") | ||
store:dispatch(actions.startChestTimer(player.Name, "VIPChest")) | ||
vipChestAwards[currentAwardIndex](player) | ||
store:dispatch( | ||
actions.setPlayerStat(player.Name, "VIPChestAwardIndex", (currentAwardIndex % #vipChestAwards) + 1) | ||
) | ||
end | ||
end) | ||
|
||
groupChestZone.playerEntered:Connect(function(player) | ||
if not player:IsInGroup(2855772) then | ||
return | ||
end | ||
local chestTimers = selectors.getChestTimers(store:getState(), player.Name) | ||
if not clockUtils.hasTimeLeft(chestTimers.GroupChest, chestTimerLength) then | ||
store:dispatch(actions.startChestTimer(player.Name, "GroupChest")) | ||
local currentAwardIndex = selectors.getStat(store:getState(), player.Name, "GroupChestAwardIndex") | ||
groupChestAwards[currentAwardIndex](player) | ||
store:dispatch( | ||
actions.setPlayerStat(player.Name, "GroupChestAwardIndex", (currentAwardIndex % #groupChestAwards) + 1) | ||
) | ||
end | ||
end) | ||
|
||
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
local ReplicatedStorage = game:GetService "ReplicatedStorage" | ||
local Rodux = require(ReplicatedStorage.Common.lib.Rodux) | ||
local makeActionCreator = Rodux.makeActionCreator | ||
|
||
return { | ||
startChestTimer = makeActionCreator("startChestTimer", function(playerName: string, chestName: string) | ||
return { | ||
playerName = playerName, | ||
chestName = chestName, | ||
shouldSave = true, | ||
} | ||
end), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,4 +103,9 @@ return { | |
ShowOtherPets = true, | ||
Jumpscares = true, | ||
}, | ||
|
||
ChestTimers = { | ||
VIPChest = -1, | ||
GroupChest = -1, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
local ReplicatedStorage = game:GetService "ReplicatedStorage" | ||
|
||
local Immut = require(ReplicatedStorage.Common.lib.Immut) | ||
local Rodux = require(ReplicatedStorage.Common.lib.Rodux) | ||
local Dict = require(ReplicatedStorage.Common.lib.Sift).Dictionary | ||
local defaultStates = require(ReplicatedStorage.Common.State.DefaultStates) | ||
|
||
local produce = Immut.produce | ||
|
||
return Rodux.createReducer({}, { | ||
addPlayer = function(state, action) | ||
return produce(state, function(draft) | ||
draft[action.playerName] = Dict.mergeDeep(defaultStates.ChestTimers, action.profileData.ChestTimers) | ||
end) | ||
end, | ||
removePlayer = function(state, action) | ||
return produce(state, function(draft) | ||
draft[action.playerName] = nil | ||
end) | ||
end, | ||
resetPlayerData = function(state, action) | ||
return produce(state, function(draft) | ||
draft[action.playerName] = table.clone(defaultStates.ChestTimers) | ||
end) | ||
end, | ||
startChestTimer = function(state, action) | ||
return produce(state, function(draft) | ||
draft[action.playerName][action.chestName] = os.time() | ||
end) | ||
end, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters