From 897cc79348488b94a4a5b58e12a6aec55d19106c Mon Sep 17 00:00:00 2001 From: Pluviolithic <94190216+Pluviolithic@users.noreply.github.com> Date: Sat, 14 Oct 2023 01:36:16 -0400 Subject: [PATCH 01/11] Initial backend for missions --- src/server/Combat/Enemy.luau | 1 + src/server/Combat/Missions.luau | 33 +++++ src/server/Combat/Perks/Weapons.luau | 1 + src/server/PlayerManager/ProfileTemplate.luau | 23 ++++ src/server/Random/EggHatcher/init.luau | 2 + src/server/State/Actions/MissionActions.luau | 51 ++++++++ src/server/State/Middleware.luau | 45 +++---- src/shared/Remotes.luau | 12 ++ src/shared/State/DefaultStates.luau | 23 ++++ src/shared/State/Reducer/MissionData.luau | 117 ++++++++++++++++++ src/shared/State/Reducer/Stats.luau | 5 + src/shared/State/selectors.luau | 4 +- src/shared/Utils/Player/PetUtils.luau | 7 ++ src/shared/Utils/Player/RegionUtils.luau | 26 ++++ 14 files changed, 327 insertions(+), 23 deletions(-) create mode 100644 src/server/Combat/Missions.luau create mode 100644 src/server/State/Actions/MissionActions.luau create mode 100644 src/shared/State/Reducer/MissionData.luau create mode 100644 src/shared/Utils/Player/RegionUtils.luau diff --git a/src/server/Combat/Enemy.luau b/src/server/Combat/Enemy.luau index 12b3a05..28c7e91 100644 --- a/src/server/Combat/Enemy.luau +++ b/src/server/Combat/Enemy.luau @@ -348,6 +348,7 @@ local function handleEnemy(enemy) ) ) store:dispatch(actions.incrementPlayerStat(otherPlayer.Name, "Kills")) + store:dispatch(actions.logKilledEnemyType(otherPlayer.Name, enemy.Name)) if damage >= maxHealth * gemRewardPercentage then store:dispatch(actions.incrementPlayerStat(otherPlayer.Name, "Gems", gemAmountToDrop)) diff --git a/src/server/Combat/Missions.luau b/src/server/Combat/Missions.luau new file mode 100644 index 0000000..00ee4ac --- /dev/null +++ b/src/server/Combat/Missions.luau @@ -0,0 +1,33 @@ +local ReplicatedStorage = game:GetService "ReplicatedStorage" +local ServerScriptService = game:GetService "ServerScriptService" + +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 missionRequirements = ReplicatedStorage.Missions + +Remotes.Server:Get("StartMission"):Connect(function(player: Player, areaName: string) + if not missionRequirements:FindFirstChild(areaName) then + return + end + if not selectors.getMissionData(store:getState(), player.Name)[areaName].Active then + store:dispatch(actions.startMission(player.Name, areaName)) + end +end) + +Remotes.Server:Get("CompleteMission"):Connect(function(player: Player, areaName: string) + if not missionRequirements:FindFirstChild(areaName) then + return + end + local currentMissionData = selectors.getMissionData(store:getState(), player.Name)[areaName] + local currentMissionRequirements = missionRequirements[areaName][tostring(currentMissionData.CurrentMissionNumber)] + if currentMissionRequirements.Requirements.Value ~= currentMissionData.CurrentMissionProgress then + return + end + + store:dispatch(actions.completeMission(player.Name, areaName, currentMissionRequirements.Gems.Value)) +end) + +return 0 diff --git a/src/server/Combat/Perks/Weapons.luau b/src/server/Combat/Perks/Weapons.luau index 30b39a1..f1e7402 100644 --- a/src/server/Combat/Perks/Weapons.luau +++ b/src/server/Combat/Perks/Weapons.luau @@ -28,6 +28,7 @@ Remotes.Server:Get("PurchaseWeapon"):SetCallback(function(player: Player, weapon store:dispatch(actions.incrementPlayerStat(player.Name, "Gems", -price.Value)) store:dispatch(actions.givePlayerWeapon(player.Name, weaponName)) store:dispatch(actions.equipWeapon(player.Name, weaponName)) + store:dispatch(actions.logPurchasedWeaponType(player.Name, weaponName)) return 0 end diff --git a/src/server/PlayerManager/ProfileTemplate.luau b/src/server/PlayerManager/ProfileTemplate.luau index d09840b..07e2fa1 100644 --- a/src/server/PlayerManager/ProfileTemplate.luau +++ b/src/server/PlayerManager/ProfileTemplate.luau @@ -43,4 +43,27 @@ return { }, EquippedWeapon = "Fists", }, + + MissionData = { + ["Clown Town"] = { + CurrentMissionNumber = 1, + CurrentMissionProgress = 0, + Active = false, + }, + ["Spider Cave"] = { + CurrentMissionNumber = 1, + CurrentMissionProgress = 0, + Active = false, + }, + ["Howling Woods"] = { + CurrentMissionNumber = 1, + CurrentMissionProgress = 0, + Active = false, + }, + ["Zombie City"] = { + CurrentMissionNumber = 1, + CurrentMissionProgress = 0, + Active = false, + }, + }, } diff --git a/src/server/Random/EggHatcher/init.luau b/src/server/Random/EggHatcher/init.luau index f4f5900..e11a119 100644 --- a/src/server/Random/EggHatcher/init.luau +++ b/src/server/Random/EggHatcher/init.luau @@ -8,6 +8,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 eggGemPricesConfig = ReplicatedStorage.Config.Pets.Prices local areaRequirements = ReplicatedStorage.Config.AreaRequirements @@ -77,6 +78,7 @@ local function awardPetsToPlayer(player: Player, pets: { string }, eggGemPrice): end store:dispatch(actions.incrementPlayerStat(player.Name, "Gems", -eggGemPrice * #pets)) store:dispatch(actions.givePlayerPets(player.Name, petsDict)) + store:dispatch(actions.logHatchedPetRarities(petUtils.getPetRarities(pets))) end Remotes.Server:Get("HatchEggs"):SetCallback(function(player: Player, count: number, areaName: string) diff --git a/src/server/State/Actions/MissionActions.luau b/src/server/State/Actions/MissionActions.luau new file mode 100644 index 0000000..0f1d4c7 --- /dev/null +++ b/src/server/State/Actions/MissionActions.luau @@ -0,0 +1,51 @@ +local ReplicatedStorage = game:GetService "ReplicatedStorage" +local Rodux = require(ReplicatedStorage.Common.lib.Rodux) +local makeActionCreator = Rodux.makeActionCreator + +return { + startMission = makeActionCreator("startMission", function(playerName: string, areaName: string) + return { + areaName = areaName, + playerName = playerName, + shouldSave = true, + } + end), + completeMission = makeActionCreator( + "startMission", + function(playerName: string, areaName: string, gemReward: number) + return { + areaName = areaName, + playerName = playerName, + gemReward = gemReward, + shouldSave = true, + } + end + ), + logKilledEnemyType = makeActionCreator("logKilledEnemyType", function(playerName: string, enemyType: string) + return { + enemyType = enemyType, + playerName = playerName, + shouldSave = true, + } + end), + logPurchasedWeaponType = makeActionCreator( + "logPurchasedWeaponType", + function(playerName: string, weaponType: string) + return { + weaponType = weaponType, + playerName = playerName, + shouldSave = true, + } + end + ), + logHatchedPetRarities = makeActionCreator( + "logHatchedPetRarities", + function(playerName: string, petRarities: { string }) + return { + petRarities = petRarities, + playerName = playerName, + shouldSave = true, + } + end + ), +} diff --git a/src/server/State/Middleware.luau b/src/server/State/Middleware.luau index b7b4d44..a32da6e 100644 --- a/src/server/State/Middleware.luau +++ b/src/server/State/Middleware.luau @@ -2,6 +2,9 @@ local Players = game:GetService "Players" local ReplicatedStorage = game:GetService "ReplicatedStorage" local ServerScriptService = game:GetService "ServerScriptService" +local server = ServerScriptService.Server + +local actions = require(server.State.Actions) --local Sift = require(ReplicatedStorage.Common.lib.Sift) local Enum = require(ReplicatedStorage.Common.Utils.Enum) local Remotes = require(ReplicatedStorage.Common.Remotes) @@ -10,9 +13,11 @@ local selectors = require(ReplicatedStorage.Common.State.selectors) local formatter = require(ReplicatedStorage.Common.Utils.Formatter) --local petUtils = require(ReplicatedStorage.Common.Utils.Player.PetUtils) local profiles = require(ServerScriptService.Server.PlayerManager.Profiles) -local profileTemplate = require(ServerScriptService.Server.PlayerManager.ProfileTemplate) +local regionUtils = require(ReplicatedStorage.Common.Utils.Player.RegionUtils) local replicationRules = require(ServerScriptService.Server.State.ReplicationRules) +local profileTemplate = require(ServerScriptService.Server.PlayerManager.ProfileTemplate) +local missionRequirements = ReplicatedStorage.Missions local displayServerLogs = ReplicatedStorage.Config.Output.DisplayServerLogs.Value local function getFilteredState(playerName, state) @@ -91,34 +96,30 @@ local function updateLeaderstatsMiddleware(nextDispatch, store) end end ---[[ -local function instantiatePetsMiddleware(nextDispatch, store) +local function giveMissionRewards(nextDispatch, store) return function(action) local oldState = store:getState() nextDispatch(action) - task.spawn(function() - if not action.playerName or not selectors.isPlayerLoaded(store:getState(), action.playerName) then - if action.playerName and workspace.PetModels:FindFirstChild(action.playerName) then - workspace.PetModels[action.playerName]:Destroy() - end - return - end - if - not selectors.isPlayerLoaded(oldState, action.playerName) - or Sift.Dictionary.equalsDeep( - selectors.getEquippedPets(oldState, action.playerName), - selectors.getEquippedPets(store:getState(), action.playerName) - ) - then - return - end - petUtils.instantiatePets(action.playerName, selectors.getEquippedPets(store:getState(), action.playerName)) - end) + if action.type ~= "logKilledEnemyType" then + return + end + local oldMissionData = selectors.getMissionData(oldState, action.playerName) + local newMissionData = selectors.getMissionData(store:getState(), action.playerName) + + if oldMissionData == newMissionData then + return + end + + if oldMissionData.CurrentMissionNumber ~= newMissionData.CurrentMissionNumber then + local missionReward = + missionRequirements[regionUtils.getPlayerLocationName(action.playerName)][oldMissionData.CurrentMissionNumber].Gems.Value + store:dispatch(actions.incrementPlayerStat(action.playerName, "Gems", missionReward)) + end end end ---]] return { + giveMissionRewards, updateClientMiddleware, savePlayerDataMiddleware, updateLeaderstatsMiddleware, diff --git a/src/shared/Remotes.luau b/src/shared/Remotes.luau index b85812a..69e51c9 100644 --- a/src/shared/Remotes.luau +++ b/src/shared/Remotes.luau @@ -89,6 +89,18 @@ local Remotes = Net.CreateDefinitions { }, Net.Middleware.TypeChecking(t.string), }, + StartMission = Net.Definitions.ClientToServerEvent { + Net.Middleware.RateLimit { + MaxRequestsPerMinute = 60, + }, + Net.Middleware.TypeChecking(t.string), + }, + CompleteMission = Net.Definitions.ClientToServerEvent { + Net.Middleware.RateLimit { + MaxRequestsPerMinute = 60, + }, + Net.Middleware.TypeChecking(t.string), + }, SendRoduxAction = Net.Definitions.ServerToClientEvent(), --SendNPCHealthBar = Net.Definitions.ServerToClientEvent(), diff --git a/src/shared/State/DefaultStates.luau b/src/shared/State/DefaultStates.luau index b2d36b7..fcf2810 100644 --- a/src/shared/State/DefaultStates.luau +++ b/src/shared/State/DefaultStates.luau @@ -48,4 +48,27 @@ return { AwardedGamepasses = {}, PurchasedTeleporters = {}, }, + + MissionData = { + ["Clown Town"] = { + CurrentMissionNumber = 1, + CurrentMissionProgress = 0, + Active = false, + }, + ["Spider Cave"] = { + CurrentMissionNumber = 1, + CurrentMissionProgress = 0, + Active = false, + }, + ["Howling Woods"] = { + CurrentMissionNumber = 1, + CurrentMissionProgress = 0, + Active = false, + }, + ["Zombie City"] = { + CurrentMissionNumber = 1, + CurrentMissionProgress = 0, + Active = false, + }, + }, } diff --git a/src/shared/State/Reducer/MissionData.luau b/src/shared/State/Reducer/MissionData.luau new file mode 100644 index 0000000..e3c9bd0 --- /dev/null +++ b/src/shared/State/Reducer/MissionData.luau @@ -0,0 +1,117 @@ +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 regionUtils = require(ReplicatedStorage.Common.Utils.Player.RegionUtils) + +local produce = Immut.produce +local missionRequirements = ReplicatedStorage.Missions + +return Rodux.createReducer({}, { + addPlayer = function(state, action) + return produce(state, function(draft) + draft[action.playerName] = Dict.mergeDeep(defaultStates.MissionData, action.profileData.MissionData) + 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] = defaultStates.MissionData + end) + end, + startMission = function(state, action) + return produce(state, function(draft) + draft[action.playerName][action.areaName].Active = true + end) + end, + completeMission = function(state, action) + return produce(state, function(draft) + draft[action.playerName][action.areaName].Active = false + draft[action.playerName][action.areaName].CurrentMissionNumber += 1 + end) + end, + + logKilledEnemyType = function(state, action) + return produce(state, function(draft) + local playerRegion = regionUtils.getPlayerLocationName(action.playerName) + if not playerRegion or not state[action.playerName][playerRegion].Active then + return + end + local currentMissionRequirements = + missionRequirements[playerRegion][tostring(state[action.playerName][playerRegion].CurrentMissionNumber)] + + if not currentMissionRequirements:FindFirstChild "Enemy" then + return + end + + if + currentMissionRequirements.Enemy.Value == action.enemyType + and draft[action.playerName][playerRegion].CurrentMissionProgress + ~= currentMissionRequirements.Requirements.Value + then + draft[action.playerName][playerRegion].CurrentMissionProgress += 1 + end + end) + end, + + logPurchasedWeaponType = function(state, action) + return produce(state, function(draft) + local playerRegion = regionUtils.getPlayerLocationName(action.playerName) + if not playerRegion or not state[action.playerName][playerRegion].Active then + return + end + local currentMissionRequirements = + missionRequirements[playerRegion][tostring(state[action.playerName][playerRegion].CurrentMissionNumber)] + + if not currentMissionRequirements:FindFirstChild "Weapon" then + return + end + + if + draft[action.playerName][playerRegion].CurrentMissionProgress + ~= currentMissionRequirements.Requirements.Value + then + draft[action.playerName][playerRegion].CurrentMissionProgress += 1 + end + end) + end, + + logHatchedPetRarities = function(state, action) + return produce(state, function(draft) + local playerRegion = regionUtils.getPlayerLocationName(action.playerName) + if not playerRegion or not state[action.playerName][playerRegion].Active then + return + end + local currentMissionRequirements = + missionRequirements[playerRegion][tostring(state[action.playerName][playerRegion].CurrentMissionNumber)] + + if currentMissionRequirements:FindFirstChild "AnyPet" then + if + draft[action.playerName][playerRegion].CurrentMissionProgress + ~= currentMissionRequirements.Requirements.Value + then + draft[action.playerName][playerRegion].CurrentMissionProgress += 1 + end + elseif currentMissionRequirements:FindFirstChild "PetRarity" then + for _, rarity in action.petRarities do + if rarity ~= currentMissionRequirements.PetRarity.Value then + continue + end + + if + draft[action.playerName][playerRegion].CurrentMissionProgress + ~= currentMissionRequirements.Requirements.Value + then + draft[action.playerName][playerRegion].CurrentMissionProgress += 1 + end + end + end + end) + end, +}) diff --git a/src/shared/State/Reducer/Stats.luau b/src/shared/State/Reducer/Stats.luau index 0212b2c..165bec5 100644 --- a/src/shared/State/Reducer/Stats.luau +++ b/src/shared/State/Reducer/Stats.luau @@ -104,4 +104,9 @@ return Rodux.createReducer({}, { draft[action.playerName].PetFearMultiplier += removedPetFearMultiplier end) end, + completeMission = function(state, action) + return produce(state, function(draft) + draft[action.playerName].Gems += action.gemReward + end) + end, }) diff --git a/src/shared/State/selectors.luau b/src/shared/State/selectors.luau index f5100fa..529b0fa 100644 --- a/src/shared/State/selectors.luau +++ b/src/shared/State/selectors.luau @@ -45,7 +45,6 @@ return { getOwnedWeapons = function(state, playerName) return state.WeaponData[playerName].OwnedWeapons end, - getStats = function(state, playerName) return state.Stats[playerName] end, @@ -61,4 +60,7 @@ return { getWeaponData = function(state, playerName) return state.WeaponData[playerName] end, + getMissionData = function(state, playerName) + return state.MissionData[playerName] + end, } diff --git a/src/shared/Utils/Player/PetUtils.luau b/src/shared/Utils/Player/PetUtils.luau index b1bb38a..4d21feb 100644 --- a/src/shared/Utils/Player/PetUtils.luau +++ b/src/shared/Utils/Player/PetUtils.luau @@ -42,6 +42,13 @@ petUtils = { end return nil end, + getPetRarities = function(petNames: { string }): { string } + local rarities = {} + for _, petName in petNames do + table.insert(rarities, ReplicatedStorage.Pets:FindFirstChild(petName, true).RarityName.Value) + end + return rarities + end, getBestPetNames = function(ownedPets, n): { string } local sortedPets = {} local bestPets = {} diff --git a/src/shared/Utils/Player/RegionUtils.luau b/src/shared/Utils/Player/RegionUtils.luau new file mode 100644 index 0000000..7613786 --- /dev/null +++ b/src/shared/Utils/Player/RegionUtils.luau @@ -0,0 +1,26 @@ +local Players = game:GetService "Players" +local ReplicatedStorage = game:GetService "ReplicatedStorage" + +local Zone = require(ReplicatedStorage.Common.lib.ZonePlus) +local missionZones = {} + +for _, areaZoneModel in workspace.AreaZoneModels:GetChildren() do + missionZones[areaZoneModel.Name] = Zone.new(areaZoneModel) +end + +return { + getPlayerLocationName = function(playerName: string) + local player = Players:FindFirstChild(playerName) + if not player then + return nil + end + + for areaName, zone in missionZones do + if zone:findPlayer(player) then + return areaName + end + end + + return nil + end, +} From db70e58699527c5bd89f8e35fb3ce6f5040f5304 Mon Sep 17 00:00:00 2001 From: Pluviolithic <94190216+Pluviolithic@users.noreply.github.com> Date: Sat, 14 Oct 2023 19:03:52 -0400 Subject: [PATCH 02/11] Add progress ui --- src/client/UI/Missions/ProgressUI.luau | 75 ++++++++++++++++++++++++ src/client/UI/Missions/init.luau | 3 + src/client/UI/init.luau | 1 + src/shared/Utils/Player/RegionUtils.luau | 3 + 4 files changed, 82 insertions(+) create mode 100644 src/client/UI/Missions/ProgressUI.luau create mode 100644 src/client/UI/Missions/init.luau diff --git a/src/client/UI/Missions/ProgressUI.luau b/src/client/UI/Missions/ProgressUI.luau new file mode 100644 index 0000000..8cdfb6d --- /dev/null +++ b/src/client/UI/Missions/ProgressUI.luau @@ -0,0 +1,75 @@ +local Players = game:GetService "Players" +local StarterPlayer = game:GetService "StarterPlayer" +local ReplicatedStorage = game:GetService "ReplicatedStorage" + +local player = Players.LocalPlayer +local Client = StarterPlayer.StarterPlayerScripts.Client + +local store = require(Client.State.Store) +local selectors = require(ReplicatedStorage.Common.State.selectors) +local playerStatePromise = require(Client.State.PlayerStatePromise) +local regionUtils = require(ReplicatedStorage.Common.Utils.Player.RegionUtils) + +local missionRequirements = ReplicatedStorage.Missions + +local progressTextFormats = { + Enemy = "Defeat [enemy] [progress]", + Weapon = "Buy a Weapon", + AnyPet = "Hatch Any Pet in [area] [progress]", + PetRarity = "Hatch rarity Pet in [area] [progress]", +} + +local function enteredRegion(regionName, progressUI) + local currentMissionData = selectors.getMissionData(store:getState(), player.Name)[regionName] + local currentMissionRequirements = + missionRequirements[regionName][tostring(currentMissionData.CurrentMissionNumber)] + + if currentMissionData.Active then + local progressText + for missionType, text in progressTextFormats do + progressText = if currentMissionRequirements:FindFirstChild(missionType) then text else progressText + end + + progressUI.Background.MissionName.Text = currentMissionRequirements.MissionName.Value + + if currentMissionData.Progress == currentMissionRequirements.Requirements.Value then + progressUI.Background.Progress.Visible = false + progressUI.Background.Complete.Visible = true + progressUI.Enabled = true + return + end + + if progressText == progressTextFormats.Enemy then + progressText = progressText:gsub("[enemy]", currentMissionRequirements.Enemy.Value) + elseif progressText == progressTextFormats.PetRarity then + progressText = + progressText:gsub("[rarity]", currentMissionRequirements.PetRarity.Value):gsub("[area]", regionName) + end + + if not progressText:match "Weapon" then + progressText = progressText:gsub( + "[progress]", + "(" .. currentMissionData.Progress .. "/" .. currentMissionRequirements.Requirements.Value .. ")" + ) + end + + progressUI.Background.Progress.Text = progressText + progressUI.Enabled = true + else + progressUI.Enabled = false + end +end + +playerStatePromise:andThen(function() + local progressUI = player.PlayerGui:WaitForChild "ProgressUI" + for regionName, zone in regionUtils.getRegions() do + if zone:findLocalPlayer() then + enteredRegion(regionName, progressUI) + end + zone.localPlayerEntered:Connect(function() + enteredRegion(regionName, progressUI) + end) + end +end) + +return 0 diff --git a/src/client/UI/Missions/init.luau b/src/client/UI/Missions/init.luau new file mode 100644 index 0000000..25b2f42 --- /dev/null +++ b/src/client/UI/Missions/init.luau @@ -0,0 +1,3 @@ +require(script.ProgressUI) + +return 0 diff --git a/src/client/UI/init.luau b/src/client/UI/init.luau index 8ac7cff..39c852d 100644 --- a/src/client/UI/init.luau +++ b/src/client/UI/init.luau @@ -1,6 +1,7 @@ require(script.Shops) require(script.Combat) require(script.Displays) +require(script.Missions) require(script.FixRichText) require(script.Inventories) require(script.BillboardShops) diff --git a/src/shared/Utils/Player/RegionUtils.luau b/src/shared/Utils/Player/RegionUtils.luau index 7613786..6cedce4 100644 --- a/src/shared/Utils/Player/RegionUtils.luau +++ b/src/shared/Utils/Player/RegionUtils.luau @@ -23,4 +23,7 @@ return { return nil end, + getRegions = function() + return missionZones + end, } From ac4fef2accc9ef130eecb6d4cf55418062baf848 Mon Sep 17 00:00:00 2001 From: Pluviolithic <94190216+Pluviolithic@users.noreply.github.com> Date: Sun, 15 Oct 2023 02:36:13 -0400 Subject: [PATCH 03/11] Add mission dialogue --- src/client/UI/CentralUI.luau | 3 + src/client/UI/Missions/ProgressUI.luau | 28 +++-- src/client/UI/Missions/init.luau | 136 ++++++++++++++++++++++ src/server/Combat/Missions.luau | 18 +-- src/server/State/Middleware.luau | 1 + src/shared/Remotes.luau | 4 +- src/shared/State/Reducer/MissionData.luau | 4 +- 7 files changed, 171 insertions(+), 23 deletions(-) diff --git a/src/client/UI/CentralUI.luau b/src/client/UI/CentralUI.luau index 6cf0073..76e351f 100644 --- a/src/client/UI/CentralUI.luau +++ b/src/client/UI/CentralUI.luau @@ -28,6 +28,9 @@ function CentralUI:setEnabled(enable: boolean?): () self._isOpen = enable if not enable then + if self.OnClose then + self:OnClose() + end return end diff --git a/src/client/UI/Missions/ProgressUI.luau b/src/client/UI/Missions/ProgressUI.luau index 8cdfb6d..a0f5228 100644 --- a/src/client/UI/Missions/ProgressUI.luau +++ b/src/client/UI/Missions/ProgressUI.luau @@ -13,10 +13,10 @@ local regionUtils = require(ReplicatedStorage.Common.Utils.Player.RegionUtils) local missionRequirements = ReplicatedStorage.Missions local progressTextFormats = { - Enemy = "Defeat [enemy] [progress]", + Enemy = "Defeat {enemy} {progress}", Weapon = "Buy a Weapon", - AnyPet = "Hatch Any Pet in [area] [progress]", - PetRarity = "Hatch rarity Pet in [area] [progress]", + AnyPet = "Hatch Any Pet in {area} {progress}", + PetRarity = "Hatch rarity Pet in {area} {progress}", } local function enteredRegion(regionName, progressUI) @@ -32,7 +32,7 @@ local function enteredRegion(regionName, progressUI) progressUI.Background.MissionName.Text = currentMissionRequirements.MissionName.Value - if currentMissionData.Progress == currentMissionRequirements.Requirements.Value then + if currentMissionData.CurrentMissionProgress == currentMissionRequirements.Requirements.Value then progressUI.Background.Progress.Visible = false progressUI.Background.Complete.Visible = true progressUI.Enabled = true @@ -40,16 +40,20 @@ local function enteredRegion(regionName, progressUI) end if progressText == progressTextFormats.Enemy then - progressText = progressText:gsub("[enemy]", currentMissionRequirements.Enemy.Value) + progressText = progressText:gsub("{enemy}", currentMissionRequirements.Enemy.Value) elseif progressText == progressTextFormats.PetRarity then progressText = - progressText:gsub("[rarity]", currentMissionRequirements.PetRarity.Value):gsub("[area]", regionName) + progressText:gsub("{rarity}", currentMissionRequirements.PetRarity.Value):gsub("{area}", regionName) end if not progressText:match "Weapon" then progressText = progressText:gsub( - "[progress]", - "(" .. currentMissionData.Progress .. "/" .. currentMissionRequirements.Requirements.Value .. ")" + "{progress}", + "(" + .. currentMissionData.CurrentMissionProgress + .. "/" + .. currentMissionRequirements.Requirements.Value + .. ")" ) end @@ -70,6 +74,14 @@ playerStatePromise:andThen(function() enteredRegion(regionName, progressUI) end) end + store.changed:connect(function(newState, oldState) + local newMissionData = selectors.getMissionData(newState, player.Name) + local oldMissionData = selectors.getMissionData(oldState, player.Name) + if newMissionData == oldMissionData then + return + end + enteredRegion(regionUtils.getPlayerLocationName(player.Name), progressUI) + end) end) return 0 diff --git a/src/client/UI/Missions/init.luau b/src/client/UI/Missions/init.luau index 25b2f42..7fa0c16 100644 --- a/src/client/UI/Missions/init.luau +++ b/src/client/UI/Missions/init.luau @@ -1,3 +1,139 @@ +local Players = game:GetService "Players" +local StarterPlayer = game:GetService "StarterPlayer" +local CollectionService = game:GetService "CollectionService" +local ReplicatedStorage = game:GetService "ReplicatedStorage" + +local player = Players.LocalPlayer +local Client = StarterPlayer.StarterPlayerScripts.Client + +local store = require(Client.State.Store) +local Remotes = require(ReplicatedStorage.Common.Remotes) +local selectors = require(ReplicatedStorage.Common.State.selectors) +local regionUtils = require(ReplicatedStorage.Common.Utils.Player.RegionUtils) +local CentralUI = require(StarterPlayer.StarterPlayerScripts.Client.UI.CentralUI) +local interfaces = require(StarterPlayer.StarterPlayerScripts.Client.UI.CollidableInterfaces) + +local missionRequirements = ReplicatedStorage.Missions +local rolloutSpeed = ReplicatedStorage.Config.Text.MissionTextRolloutSpeed.Value +local MissionsUI = CentralUI.new(player.PlayerGui:WaitForChild "MissionsUI") + +function MissionsUI:_initialize(): () + self._confirmPressed = false + interfaces[self] = true + + self._ui.Dialogue.Cancel.Activated:Connect(function() + self:setEnabled(false) + end) +end + +function MissionsUI:RolloutDialogue(dialogueSegment) + local text = if typeof(dialogueSegment) == "string" then dialogueSegment else dialogueSegment.Value + for j = 1, #text do + self._ui.Dialogue.Background.Dialogue.Text = text:sub(1, j) + task.wait(rolloutSpeed) + if self._confirmPressed then + self._confirmPressed = false + break + end + end + + if typeof(dialogueSegment) ~= "string" then + for _, colorValue in dialogueSegment:GetChildren() do + for _, attributeValue in colorValue:GetAttributes() do + local rgb = { + math.round(colorValue.Value.R * 255), + math.round(colorValue.Value.G * 255), + math.round(colorValue.Value.B * 255), + } + text = text:gsub( + attributeValue, + '' .. attributeValue .. "" + ) + end + end + end + + self._ui.Dialogue.Background.Dialogue.Text = text +end + +function MissionsUI:OnOpen() + local playerRegion = regionUtils.getPlayerLocationName(player.Name) + local currentMissionData = selectors.getMissionData(store:getState(), player.Name)[playerRegion] + local currentMissionRequirements = + missionRequirements[playerRegion][tostring(currentMissionData.CurrentMissionNumber)] + local dialogueSegmentCount = #currentMissionRequirements.Dialogue:GetChildren() + local completedMissionsNumber = if currentMissionData.CurrentMissionProgress + == currentMissionRequirements.Requirements.Value + and not currentMissionData.Active + then currentMissionData.CurrentMissionNumber + else currentMissionData.CurrentMissionNumber - 1 + + self._ui.Dialogue.Area.Text = playerRegion .. " Missions" + self._ui.Dialogue.MissionsCompleted.Text = "(" + .. completedMissionsNumber + .. "/" + .. #missionRequirements[playerRegion]:GetChildren() + .. ")" + + if currentMissionData.Active then + if currentMissionData.CurrentMissionProgress == currentMissionRequirements.Requirements.Value then + self:RolloutDialogue "Good job for completing the quest!" + self._confirmConnection = self._ui.Dialogue.Confirm.Activated:Connect(function() + self._confirmConnection:Disconnect() + Remotes.Client:Get("CompleteMission"):CallServerAsync():andThen(function() + if self._ui.Enabled then + self:OnOpen() + end + end) + end) + else + self:RolloutDialogue "Finish your current quest before starting the next one." + self._confirmConnection = self._ui.Dialogue.Confirm.Activated:Connect(function() + self._confirmConnection:Disconnect() + self:setEnabled(false) + end) + end + else + local i = 1 + local pending = false + local dialogueSegment = currentMissionRequirements.Dialogue:FindFirstChild(tostring(i)) + self:RolloutDialogue(dialogueSegment) + + self._ui.Dialogue.Confirm.Activated:Connect(function() + if pending then + self._confirmPressed = true + end + i += 1 + if i > dialogueSegmentCount then + Remotes.Client:Get("StartMission"):SendToServer() + self:setEnabled(false) + else + pending = true + dialogueSegment = currentMissionRequirements.Dialogue:FindFirstChild(tostring(i)) + self:RolloutDialogue(dialogueSegment) + pending = false + end + end) + end +end + +function MissionsUI:OnClose() + if self._confirmConnection and self._confirmConnection.Connected then + self._confirmConnection:Disconnect() + end + self._confirmConnection = nil +end + +for _, missionPrompt in CollectionService:GetTagged "MissionPrompt" do + missionPrompt.Triggered:Connect(function(source) + if source ~= player then + return + end + MissionsUI:setEnabled(not MissionsUI._isOpen) + end) +end + +task.spawn(MissionsUI._initialize, MissionsUI) require(script.ProgressUI) return 0 diff --git a/src/server/Combat/Missions.luau b/src/server/Combat/Missions.luau index 00ee4ac..fb88f29 100644 --- a/src/server/Combat/Missions.luau +++ b/src/server/Combat/Missions.luau @@ -5,29 +5,29 @@ 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 regionUtils = require(ReplicatedStorage.Common.Utils.Player.RegionUtils) local missionRequirements = ReplicatedStorage.Missions -Remotes.Server:Get("StartMission"):Connect(function(player: Player, areaName: string) - if not missionRequirements:FindFirstChild(areaName) then - return - end +Remotes.Server:Get("StartMission"):Connect(function(player: Player) + local areaName = regionUtils.getPlayerLocationName(player.Name) if not selectors.getMissionData(store:getState(), player.Name)[areaName].Active then store:dispatch(actions.startMission(player.Name, areaName)) end end) -Remotes.Server:Get("CompleteMission"):Connect(function(player: Player, areaName: string) - if not missionRequirements:FindFirstChild(areaName) then - return - end +Remotes.Server:Get("CompleteMission"):SetCallback(function(player: Player) + local areaName = regionUtils.getPlayerLocationName(player.Name) local currentMissionData = selectors.getMissionData(store:getState(), player.Name)[areaName] + local currentMissionRequirements = missionRequirements[areaName][tostring(currentMissionData.CurrentMissionNumber)] if currentMissionRequirements.Requirements.Value ~= currentMissionData.CurrentMissionProgress then - return + return false end store:dispatch(actions.completeMission(player.Name, areaName, currentMissionRequirements.Gems.Value)) + + return true end) return 0 diff --git a/src/server/State/Middleware.luau b/src/server/State/Middleware.luau index a32da6e..2183b06 100644 --- a/src/server/State/Middleware.luau +++ b/src/server/State/Middleware.luau @@ -26,6 +26,7 @@ local function getFilteredState(playerName, state) PetData = selectors.getPetData(state, playerName), WeaponData = selectors.getWeaponData(state, playerName), PurchaseData = selectors.getPurchaseData(state, playerName), + MissionData = selectors.getMissionData(state, playerName), } for field, entry in filteredState do for key in entry do diff --git a/src/shared/Remotes.luau b/src/shared/Remotes.luau index 69e51c9..3b3232d 100644 --- a/src/shared/Remotes.luau +++ b/src/shared/Remotes.luau @@ -93,13 +93,11 @@ local Remotes = Net.CreateDefinitions { Net.Middleware.RateLimit { MaxRequestsPerMinute = 60, }, - Net.Middleware.TypeChecking(t.string), }, - CompleteMission = Net.Definitions.ClientToServerEvent { + CompleteMission = Net.Definitions.ServerFunction { Net.Middleware.RateLimit { MaxRequestsPerMinute = 60, }, - Net.Middleware.TypeChecking(t.string), }, SendRoduxAction = Net.Definitions.ServerToClientEvent(), diff --git a/src/shared/State/Reducer/MissionData.luau b/src/shared/State/Reducer/MissionData.luau index e3c9bd0..a285fed 100644 --- a/src/shared/State/Reducer/MissionData.luau +++ b/src/shared/State/Reducer/MissionData.luau @@ -34,9 +34,9 @@ return Rodux.createReducer({}, { return produce(state, function(draft) draft[action.playerName][action.areaName].Active = false draft[action.playerName][action.areaName].CurrentMissionNumber += 1 + draft[action.playerName][action.areaName].CurrentMissionProgress = 0 end) end, - logKilledEnemyType = function(state, action) return produce(state, function(draft) local playerRegion = regionUtils.getPlayerLocationName(action.playerName) @@ -59,7 +59,6 @@ return Rodux.createReducer({}, { end end) end, - logPurchasedWeaponType = function(state, action) return produce(state, function(draft) local playerRegion = regionUtils.getPlayerLocationName(action.playerName) @@ -81,7 +80,6 @@ return Rodux.createReducer({}, { end end) end, - logHatchedPetRarities = function(state, action) return produce(state, function(draft) local playerRegion = regionUtils.getPlayerLocationName(action.playerName) From 47d959cd74ab1345dc4109610da297c282f6affa Mon Sep 17 00:00:00 2001 From: Pluviolithic <94190216+Pluviolithic@users.noreply.github.com> Date: Mon, 16 Oct 2023 00:55:48 -0400 Subject: [PATCH 04/11] Fix complete mission bug --- src/client/UI/Missions/init.luau | 22 ++++++++++++++++++-- src/server/State/Actions/MissionActions.luau | 2 +- src/server/State/Middleware.luau | 6 ------ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/client/UI/Missions/init.luau b/src/client/UI/Missions/init.luau index 7fa0c16..cda0a9f 100644 --- a/src/client/UI/Missions/init.luau +++ b/src/client/UI/Missions/init.luau @@ -77,8 +77,16 @@ function MissionsUI:OnOpen() if currentMissionData.Active then if currentMissionData.CurrentMissionProgress == currentMissionRequirements.Requirements.Value then - self:RolloutDialogue "Good job for completing the quest!" + local pending = true + task.spawn(function() + self:RolloutDialogue "Good job for completing the quest!" + pending = false + end) self._confirmConnection = self._ui.Dialogue.Confirm.Activated:Connect(function() + if pending then + self._confirmPressed = true + return + end self._confirmConnection:Disconnect() Remotes.Client:Get("CompleteMission"):CallServerAsync():andThen(function() if self._ui.Enabled then @@ -87,8 +95,16 @@ function MissionsUI:OnOpen() end) end) else - self:RolloutDialogue "Finish your current quest before starting the next one." + local pending = true + task.spawn(function() + self:RolloutDialogue "Finish your current quest before starting the next one." + pending = false + end) self._confirmConnection = self._ui.Dialogue.Confirm.Activated:Connect(function() + if pending then + self._confirmPressed = true + return + end self._confirmConnection:Disconnect() self:setEnabled(false) end) @@ -102,6 +118,7 @@ function MissionsUI:OnOpen() self._ui.Dialogue.Confirm.Activated:Connect(function() if pending then self._confirmPressed = true + return end i += 1 if i > dialogueSegmentCount then @@ -121,6 +138,7 @@ function MissionsUI:OnClose() if self._confirmConnection and self._confirmConnection.Connected then self._confirmConnection:Disconnect() end + self._confirmPressed = false self._confirmConnection = nil end diff --git a/src/server/State/Actions/MissionActions.luau b/src/server/State/Actions/MissionActions.luau index 0f1d4c7..c4191a3 100644 --- a/src/server/State/Actions/MissionActions.luau +++ b/src/server/State/Actions/MissionActions.luau @@ -11,7 +11,7 @@ return { } end), completeMission = makeActionCreator( - "startMission", + "completeMission", function(playerName: string, areaName: string, gemReward: number) return { areaName = areaName, diff --git a/src/server/State/Middleware.luau b/src/server/State/Middleware.luau index 2183b06..625bd86 100644 --- a/src/server/State/Middleware.luau +++ b/src/server/State/Middleware.luau @@ -64,14 +64,8 @@ local function savePlayerDataMiddleware(nextDispatch, store) local filteredOldState = getFilteredState(action.playerName, oldState) local filteredNewState = getFilteredState(action.playerName, newState) - --print(action) - --print(filteredOldState) - --print(filteredNewState) - for key, value in filteredNewState do if filteredOldState[key] ~= value then - --print "passing" - --print(key, value) profileData[key] = value end end From b0ac8b680e78a64a47a836fda6968a14656c745c Mon Sep 17 00:00:00 2001 From: pluviolithic Date: Mon, 16 Oct 2023 15:05:21 -0400 Subject: [PATCH 05/11] Switch back to .lua file extension --- .gitattributes | 3 --- src/client/Areas/{Barriers.luau => Barriers.lua} | 0 src/client/Areas/{ConfirmationUI.luau => ConfirmationUI.lua} | 0 src/client/Areas/{TeleportUI.luau => TeleportUI.lua} | 0 src/client/Areas/{init.luau => init.lua} | 0 src/client/{Cmdr.luau => Cmdr.lua} | 0 src/client/Controls/{init.luau => init.lua} | 0 src/client/{Jumpscare.luau => Jumpscare.lua} | 0 src/client/State/{Actions.luau => Actions.lua} | 0 src/client/State/{Middleware.luau => Middleware.lua} | 0 .../State/{PlayerStatePromise.luau => PlayerStatePromise.lua} | 0 src/client/State/Reducer/{init.luau => init.lua} | 0 src/client/State/{Store.luau => Store.lua} | 0 src/client/UI/BillboardShops/{EggShop.luau => EggShop.lua} | 0 src/client/UI/BillboardShops/{init.luau => init.lua} | 0 src/client/UI/{CentralUI.luau => CentralUI.lua} | 0 .../UI/{CollidableInterfaces.luau => CollidableInterfaces.lua} | 0 src/client/UI/Combat/{FearMeter.luau => FearMeter.lua} | 0 src/client/UI/Combat/{PetAnimator.luau => PetAnimator.lua} | 0 src/client/UI/Combat/{RequiredFear.luau => RequiredFear.lua} | 0 src/client/UI/Combat/{ScaredEffects.luau => ScaredEffects.lua} | 0 .../UI/Combat/{StrengthMeters.luau => StrengthMeters.lua} | 0 src/client/UI/Combat/{init.luau => init.lua} | 0 src/client/UI/{ConfirmationUI.luau => ConfirmationUI.lua} | 0 src/client/UI/{Displays.luau => Displays.lua} | 0 src/client/UI/{FixRichText.luau => FixRichText.lua} | 0 .../UI/Inventories/{PetInventory.luau => PetInventory.lua} | 0 src/client/UI/Inventories/{init.luau => init.lua} | 0 src/client/UI/Missions/{ProgressUI.luau => ProgressUI.lua} | 0 src/client/UI/Missions/{init.luau => init.lua} | 0 src/client/UI/Shops/{WeaponShop.luau => WeaponShop.lua} | 0 src/client/UI/Shops/{init.luau => init.lua} | 0 src/client/UI/{init.luau => init.lua} | 0 src/client/{init.client.luau => init.client.lua} | 0 src/server/{Cmdr.luau => Cmdr.lua} | 0 src/server/Combat/{Dummy.luau => Dummy.lua} | 0 src/server/Combat/{Enemy.luau => Enemy.lua} | 0 src/server/Combat/{FearEffects.luau => FearEffects.lua} | 0 src/server/Combat/{Missions.luau => Missions.lua} | 0 src/server/Combat/Perks/{Pets.luau => Pets.lua} | 0 src/server/Combat/Perks/{Weapons.luau => Weapons.lua} | 0 src/server/Combat/Perks/{init.luau => init.lua} | 0 src/server/Combat/{init.luau => init.lua} | 0 .../Commands/Players/{IncrementStat.luau => IncrementStat.lua} | 0 .../{IncrementStatServer.luau => IncrementStatServer.lua} | 0 src/server/Commands/Players/{SetStat.luau => SetStat.lua} | 0 .../Commands/Players/{SetStatServer.luau => SetStatServer.lua} | 0 src/server/Commands/Players/{WipeData.luau => WipeData.lua} | 0 .../Players/{WipeDataServer.luau => WipeDataServer.lua} | 0 src/server/Exchange/{init.luau => init.lua} | 0 src/server/Leveling/{Areas.luau => Areas.lua} | 0 src/server/Leveling/{init.luau => init.lua} | 0 src/server/PlayerManager/{Collisions.luau => Collisions.lua} | 0 .../{GlobalLeaderboards.luau => GlobalLeaderboards.lua} | 0 .../PlayerManager/{PlayerStatusUI.luau => PlayerStatusUI.lua} | 0 .../{ProfileTemplate.luau => ProfileTemplate.lua} | 0 src/server/PlayerManager/{Profiles.luau => Profiles.lua} | 0 src/server/PlayerManager/{init.luau => init.lua} | 0 .../Gamepasses/{Rewarders.luau => Rewarders.lua} | 0 .../DeveloperProducts/Gamepasses/{init.luau => init.lua} | 0 .../Products/{Rewarders.luau => Rewarders.lua} | 0 .../DeveloperProducts/Products/{init.luau => init.lua} | 0 .../PurchaseManager/DeveloperProducts/{init.luau => init.lua} | 0 src/server/PurchaseManager/{init.luau => init.lua} | 0 src/server/Random/EggHatcher/{Rarities.luau => Rarities.lua} | 0 src/server/Random/EggHatcher/{init.luau => init.lua} | 0 .../State/Actions/{CombatActions.luau => CombatActions.lua} | 0 .../Actions/{GamepassActions.luau => GamepassActions.lua} | 0 .../State/Actions/{MissionActions.luau => MissionActions.lua} | 0 src/server/State/Actions/{PetActions.luau => PetActions.lua} | 0 .../Actions/{PlayerDataActions.luau => PlayerDataActions.lua} | 0 .../{TransportationActions.luau => TransportationActions.lua} | 0 .../State/Actions/{WeaponActions.luau => WeaponActions.lua} | 0 src/server/State/Actions/{init.luau => init.lua} | 0 src/server/State/{Middleware.luau => Middleware.lua} | 0 .../State/{ReplicationRules.luau => ReplicationRules.lua} | 0 src/server/State/{Store.luau => Store.lua} | 0 src/server/{init.server.luau => init.server.lua} | 0 src/shared/CommandHooks/{Admin.luau => Admin.lua} | 0 src/shared/{PermissionList.luau => PermissionList.lua} | 0 src/shared/{Remotes.luau => Remotes.lua} | 0 src/shared/State/{DefaultStates.luau => DefaultStates.lua} | 0 src/shared/State/Reducer/{CombatData.luau => CombatData.lua} | 0 src/shared/State/Reducer/{MissionData.luau => MissionData.lua} | 0 src/shared/State/Reducer/{PetData.luau => PetData.lua} | 0 .../State/Reducer/{PurchaseData.luau => PurchaseData.lua} | 0 src/shared/State/Reducer/{Stats.luau => Stats.lua} | 0 src/shared/State/Reducer/{WeaponData.luau => WeaponData.lua} | 0 src/shared/State/Reducer/{init.luau => init.lua} | 0 src/shared/State/{selectors.luau => selectors.lua} | 0 src/shared/Utils/{Enum.luau => Enum.lua} | 0 src/shared/Utils/Formatter/{Suffixes.luau => Suffixes.lua} | 0 src/shared/Utils/Formatter/{init.luau => init.lua} | 0 src/shared/Utils/{HealthBar.luau => HealthBar.lua} | 0 src/shared/Utils/Player/{PetUtils.luau => PetUtils.lua} | 0 src/shared/Utils/Player/{RegionUtils.luau => RegionUtils.lua} | 0 src/shared/Utils/{RankUtils.luau => RankUtils.lua} | 0 src/shared/Utils/{Table.luau => Table.lua} | 0 src/shared/Utils/{ZoneUtils.luau => ZoneUtils.lua} | 0 99 files changed, 3 deletions(-) delete mode 100644 .gitattributes rename src/client/Areas/{Barriers.luau => Barriers.lua} (100%) rename src/client/Areas/{ConfirmationUI.luau => ConfirmationUI.lua} (100%) rename src/client/Areas/{TeleportUI.luau => TeleportUI.lua} (100%) rename src/client/Areas/{init.luau => init.lua} (100%) rename src/client/{Cmdr.luau => Cmdr.lua} (100%) rename src/client/Controls/{init.luau => init.lua} (100%) rename src/client/{Jumpscare.luau => Jumpscare.lua} (100%) rename src/client/State/{Actions.luau => Actions.lua} (100%) rename src/client/State/{Middleware.luau => Middleware.lua} (100%) rename src/client/State/{PlayerStatePromise.luau => PlayerStatePromise.lua} (100%) rename src/client/State/Reducer/{init.luau => init.lua} (100%) rename src/client/State/{Store.luau => Store.lua} (100%) rename src/client/UI/BillboardShops/{EggShop.luau => EggShop.lua} (100%) rename src/client/UI/BillboardShops/{init.luau => init.lua} (100%) rename src/client/UI/{CentralUI.luau => CentralUI.lua} (100%) rename src/client/UI/{CollidableInterfaces.luau => CollidableInterfaces.lua} (100%) rename src/client/UI/Combat/{FearMeter.luau => FearMeter.lua} (100%) rename src/client/UI/Combat/{PetAnimator.luau => PetAnimator.lua} (100%) rename src/client/UI/Combat/{RequiredFear.luau => RequiredFear.lua} (100%) rename src/client/UI/Combat/{ScaredEffects.luau => ScaredEffects.lua} (100%) rename src/client/UI/Combat/{StrengthMeters.luau => StrengthMeters.lua} (100%) rename src/client/UI/Combat/{init.luau => init.lua} (100%) rename src/client/UI/{ConfirmationUI.luau => ConfirmationUI.lua} (100%) rename src/client/UI/{Displays.luau => Displays.lua} (100%) rename src/client/UI/{FixRichText.luau => FixRichText.lua} (100%) rename src/client/UI/Inventories/{PetInventory.luau => PetInventory.lua} (100%) rename src/client/UI/Inventories/{init.luau => init.lua} (100%) rename src/client/UI/Missions/{ProgressUI.luau => ProgressUI.lua} (100%) rename src/client/UI/Missions/{init.luau => init.lua} (100%) rename src/client/UI/Shops/{WeaponShop.luau => WeaponShop.lua} (100%) rename src/client/UI/Shops/{init.luau => init.lua} (100%) rename src/client/UI/{init.luau => init.lua} (100%) rename src/client/{init.client.luau => init.client.lua} (100%) rename src/server/{Cmdr.luau => Cmdr.lua} (100%) rename src/server/Combat/{Dummy.luau => Dummy.lua} (100%) rename src/server/Combat/{Enemy.luau => Enemy.lua} (100%) rename src/server/Combat/{FearEffects.luau => FearEffects.lua} (100%) rename src/server/Combat/{Missions.luau => Missions.lua} (100%) rename src/server/Combat/Perks/{Pets.luau => Pets.lua} (100%) rename src/server/Combat/Perks/{Weapons.luau => Weapons.lua} (100%) rename src/server/Combat/Perks/{init.luau => init.lua} (100%) rename src/server/Combat/{init.luau => init.lua} (100%) rename src/server/Commands/Players/{IncrementStat.luau => IncrementStat.lua} (100%) rename src/server/Commands/Players/{IncrementStatServer.luau => IncrementStatServer.lua} (100%) rename src/server/Commands/Players/{SetStat.luau => SetStat.lua} (100%) rename src/server/Commands/Players/{SetStatServer.luau => SetStatServer.lua} (100%) rename src/server/Commands/Players/{WipeData.luau => WipeData.lua} (100%) rename src/server/Commands/Players/{WipeDataServer.luau => WipeDataServer.lua} (100%) rename src/server/Exchange/{init.luau => init.lua} (100%) rename src/server/Leveling/{Areas.luau => Areas.lua} (100%) rename src/server/Leveling/{init.luau => init.lua} (100%) rename src/server/PlayerManager/{Collisions.luau => Collisions.lua} (100%) rename src/server/PlayerManager/{GlobalLeaderboards.luau => GlobalLeaderboards.lua} (100%) rename src/server/PlayerManager/{PlayerStatusUI.luau => PlayerStatusUI.lua} (100%) rename src/server/PlayerManager/{ProfileTemplate.luau => ProfileTemplate.lua} (100%) rename src/server/PlayerManager/{Profiles.luau => Profiles.lua} (100%) rename src/server/PlayerManager/{init.luau => init.lua} (100%) rename src/server/PurchaseManager/DeveloperProducts/Gamepasses/{Rewarders.luau => Rewarders.lua} (100%) rename src/server/PurchaseManager/DeveloperProducts/Gamepasses/{init.luau => init.lua} (100%) rename src/server/PurchaseManager/DeveloperProducts/Products/{Rewarders.luau => Rewarders.lua} (100%) rename src/server/PurchaseManager/DeveloperProducts/Products/{init.luau => init.lua} (100%) rename src/server/PurchaseManager/DeveloperProducts/{init.luau => init.lua} (100%) rename src/server/PurchaseManager/{init.luau => init.lua} (100%) rename src/server/Random/EggHatcher/{Rarities.luau => Rarities.lua} (100%) rename src/server/Random/EggHatcher/{init.luau => init.lua} (100%) rename src/server/State/Actions/{CombatActions.luau => CombatActions.lua} (100%) rename src/server/State/Actions/{GamepassActions.luau => GamepassActions.lua} (100%) rename src/server/State/Actions/{MissionActions.luau => MissionActions.lua} (100%) rename src/server/State/Actions/{PetActions.luau => PetActions.lua} (100%) rename src/server/State/Actions/{PlayerDataActions.luau => PlayerDataActions.lua} (100%) rename src/server/State/Actions/{TransportationActions.luau => TransportationActions.lua} (100%) rename src/server/State/Actions/{WeaponActions.luau => WeaponActions.lua} (100%) rename src/server/State/Actions/{init.luau => init.lua} (100%) rename src/server/State/{Middleware.luau => Middleware.lua} (100%) rename src/server/State/{ReplicationRules.luau => ReplicationRules.lua} (100%) rename src/server/State/{Store.luau => Store.lua} (100%) rename src/server/{init.server.luau => init.server.lua} (100%) rename src/shared/CommandHooks/{Admin.luau => Admin.lua} (100%) rename src/shared/{PermissionList.luau => PermissionList.lua} (100%) rename src/shared/{Remotes.luau => Remotes.lua} (100%) rename src/shared/State/{DefaultStates.luau => DefaultStates.lua} (100%) rename src/shared/State/Reducer/{CombatData.luau => CombatData.lua} (100%) rename src/shared/State/Reducer/{MissionData.luau => MissionData.lua} (100%) rename src/shared/State/Reducer/{PetData.luau => PetData.lua} (100%) rename src/shared/State/Reducer/{PurchaseData.luau => PurchaseData.lua} (100%) rename src/shared/State/Reducer/{Stats.luau => Stats.lua} (100%) rename src/shared/State/Reducer/{WeaponData.luau => WeaponData.lua} (100%) rename src/shared/State/Reducer/{init.luau => init.lua} (100%) rename src/shared/State/{selectors.luau => selectors.lua} (100%) rename src/shared/Utils/{Enum.luau => Enum.lua} (100%) rename src/shared/Utils/Formatter/{Suffixes.luau => Suffixes.lua} (100%) rename src/shared/Utils/Formatter/{init.luau => init.lua} (100%) rename src/shared/Utils/{HealthBar.luau => HealthBar.lua} (100%) rename src/shared/Utils/Player/{PetUtils.luau => PetUtils.lua} (100%) rename src/shared/Utils/Player/{RegionUtils.luau => RegionUtils.lua} (100%) rename src/shared/Utils/{RankUtils.luau => RankUtils.lua} (100%) rename src/shared/Utils/{Table.luau => Table.lua} (100%) rename src/shared/Utils/{ZoneUtils.luau => ZoneUtils.lua} (100%) diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index fd6e37b..0000000 --- a/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -# temporarily make .luau files have lua highlighting functionality -# until the .luau file extension is officially supported -*.luau linguist-language=Lua \ No newline at end of file diff --git a/src/client/Areas/Barriers.luau b/src/client/Areas/Barriers.lua similarity index 100% rename from src/client/Areas/Barriers.luau rename to src/client/Areas/Barriers.lua diff --git a/src/client/Areas/ConfirmationUI.luau b/src/client/Areas/ConfirmationUI.lua similarity index 100% rename from src/client/Areas/ConfirmationUI.luau rename to src/client/Areas/ConfirmationUI.lua diff --git a/src/client/Areas/TeleportUI.luau b/src/client/Areas/TeleportUI.lua similarity index 100% rename from src/client/Areas/TeleportUI.luau rename to src/client/Areas/TeleportUI.lua diff --git a/src/client/Areas/init.luau b/src/client/Areas/init.lua similarity index 100% rename from src/client/Areas/init.luau rename to src/client/Areas/init.lua diff --git a/src/client/Cmdr.luau b/src/client/Cmdr.lua similarity index 100% rename from src/client/Cmdr.luau rename to src/client/Cmdr.lua diff --git a/src/client/Controls/init.luau b/src/client/Controls/init.lua similarity index 100% rename from src/client/Controls/init.luau rename to src/client/Controls/init.lua diff --git a/src/client/Jumpscare.luau b/src/client/Jumpscare.lua similarity index 100% rename from src/client/Jumpscare.luau rename to src/client/Jumpscare.lua diff --git a/src/client/State/Actions.luau b/src/client/State/Actions.lua similarity index 100% rename from src/client/State/Actions.luau rename to src/client/State/Actions.lua diff --git a/src/client/State/Middleware.luau b/src/client/State/Middleware.lua similarity index 100% rename from src/client/State/Middleware.luau rename to src/client/State/Middleware.lua diff --git a/src/client/State/PlayerStatePromise.luau b/src/client/State/PlayerStatePromise.lua similarity index 100% rename from src/client/State/PlayerStatePromise.luau rename to src/client/State/PlayerStatePromise.lua diff --git a/src/client/State/Reducer/init.luau b/src/client/State/Reducer/init.lua similarity index 100% rename from src/client/State/Reducer/init.luau rename to src/client/State/Reducer/init.lua diff --git a/src/client/State/Store.luau b/src/client/State/Store.lua similarity index 100% rename from src/client/State/Store.luau rename to src/client/State/Store.lua diff --git a/src/client/UI/BillboardShops/EggShop.luau b/src/client/UI/BillboardShops/EggShop.lua similarity index 100% rename from src/client/UI/BillboardShops/EggShop.luau rename to src/client/UI/BillboardShops/EggShop.lua diff --git a/src/client/UI/BillboardShops/init.luau b/src/client/UI/BillboardShops/init.lua similarity index 100% rename from src/client/UI/BillboardShops/init.luau rename to src/client/UI/BillboardShops/init.lua diff --git a/src/client/UI/CentralUI.luau b/src/client/UI/CentralUI.lua similarity index 100% rename from src/client/UI/CentralUI.luau rename to src/client/UI/CentralUI.lua diff --git a/src/client/UI/CollidableInterfaces.luau b/src/client/UI/CollidableInterfaces.lua similarity index 100% rename from src/client/UI/CollidableInterfaces.luau rename to src/client/UI/CollidableInterfaces.lua diff --git a/src/client/UI/Combat/FearMeter.luau b/src/client/UI/Combat/FearMeter.lua similarity index 100% rename from src/client/UI/Combat/FearMeter.luau rename to src/client/UI/Combat/FearMeter.lua diff --git a/src/client/UI/Combat/PetAnimator.luau b/src/client/UI/Combat/PetAnimator.lua similarity index 100% rename from src/client/UI/Combat/PetAnimator.luau rename to src/client/UI/Combat/PetAnimator.lua diff --git a/src/client/UI/Combat/RequiredFear.luau b/src/client/UI/Combat/RequiredFear.lua similarity index 100% rename from src/client/UI/Combat/RequiredFear.luau rename to src/client/UI/Combat/RequiredFear.lua diff --git a/src/client/UI/Combat/ScaredEffects.luau b/src/client/UI/Combat/ScaredEffects.lua similarity index 100% rename from src/client/UI/Combat/ScaredEffects.luau rename to src/client/UI/Combat/ScaredEffects.lua diff --git a/src/client/UI/Combat/StrengthMeters.luau b/src/client/UI/Combat/StrengthMeters.lua similarity index 100% rename from src/client/UI/Combat/StrengthMeters.luau rename to src/client/UI/Combat/StrengthMeters.lua diff --git a/src/client/UI/Combat/init.luau b/src/client/UI/Combat/init.lua similarity index 100% rename from src/client/UI/Combat/init.luau rename to src/client/UI/Combat/init.lua diff --git a/src/client/UI/ConfirmationUI.luau b/src/client/UI/ConfirmationUI.lua similarity index 100% rename from src/client/UI/ConfirmationUI.luau rename to src/client/UI/ConfirmationUI.lua diff --git a/src/client/UI/Displays.luau b/src/client/UI/Displays.lua similarity index 100% rename from src/client/UI/Displays.luau rename to src/client/UI/Displays.lua diff --git a/src/client/UI/FixRichText.luau b/src/client/UI/FixRichText.lua similarity index 100% rename from src/client/UI/FixRichText.luau rename to src/client/UI/FixRichText.lua diff --git a/src/client/UI/Inventories/PetInventory.luau b/src/client/UI/Inventories/PetInventory.lua similarity index 100% rename from src/client/UI/Inventories/PetInventory.luau rename to src/client/UI/Inventories/PetInventory.lua diff --git a/src/client/UI/Inventories/init.luau b/src/client/UI/Inventories/init.lua similarity index 100% rename from src/client/UI/Inventories/init.luau rename to src/client/UI/Inventories/init.lua diff --git a/src/client/UI/Missions/ProgressUI.luau b/src/client/UI/Missions/ProgressUI.lua similarity index 100% rename from src/client/UI/Missions/ProgressUI.luau rename to src/client/UI/Missions/ProgressUI.lua diff --git a/src/client/UI/Missions/init.luau b/src/client/UI/Missions/init.lua similarity index 100% rename from src/client/UI/Missions/init.luau rename to src/client/UI/Missions/init.lua diff --git a/src/client/UI/Shops/WeaponShop.luau b/src/client/UI/Shops/WeaponShop.lua similarity index 100% rename from src/client/UI/Shops/WeaponShop.luau rename to src/client/UI/Shops/WeaponShop.lua diff --git a/src/client/UI/Shops/init.luau b/src/client/UI/Shops/init.lua similarity index 100% rename from src/client/UI/Shops/init.luau rename to src/client/UI/Shops/init.lua diff --git a/src/client/UI/init.luau b/src/client/UI/init.lua similarity index 100% rename from src/client/UI/init.luau rename to src/client/UI/init.lua diff --git a/src/client/init.client.luau b/src/client/init.client.lua similarity index 100% rename from src/client/init.client.luau rename to src/client/init.client.lua diff --git a/src/server/Cmdr.luau b/src/server/Cmdr.lua similarity index 100% rename from src/server/Cmdr.luau rename to src/server/Cmdr.lua diff --git a/src/server/Combat/Dummy.luau b/src/server/Combat/Dummy.lua similarity index 100% rename from src/server/Combat/Dummy.luau rename to src/server/Combat/Dummy.lua diff --git a/src/server/Combat/Enemy.luau b/src/server/Combat/Enemy.lua similarity index 100% rename from src/server/Combat/Enemy.luau rename to src/server/Combat/Enemy.lua diff --git a/src/server/Combat/FearEffects.luau b/src/server/Combat/FearEffects.lua similarity index 100% rename from src/server/Combat/FearEffects.luau rename to src/server/Combat/FearEffects.lua diff --git a/src/server/Combat/Missions.luau b/src/server/Combat/Missions.lua similarity index 100% rename from src/server/Combat/Missions.luau rename to src/server/Combat/Missions.lua diff --git a/src/server/Combat/Perks/Pets.luau b/src/server/Combat/Perks/Pets.lua similarity index 100% rename from src/server/Combat/Perks/Pets.luau rename to src/server/Combat/Perks/Pets.lua diff --git a/src/server/Combat/Perks/Weapons.luau b/src/server/Combat/Perks/Weapons.lua similarity index 100% rename from src/server/Combat/Perks/Weapons.luau rename to src/server/Combat/Perks/Weapons.lua diff --git a/src/server/Combat/Perks/init.luau b/src/server/Combat/Perks/init.lua similarity index 100% rename from src/server/Combat/Perks/init.luau rename to src/server/Combat/Perks/init.lua diff --git a/src/server/Combat/init.luau b/src/server/Combat/init.lua similarity index 100% rename from src/server/Combat/init.luau rename to src/server/Combat/init.lua diff --git a/src/server/Commands/Players/IncrementStat.luau b/src/server/Commands/Players/IncrementStat.lua similarity index 100% rename from src/server/Commands/Players/IncrementStat.luau rename to src/server/Commands/Players/IncrementStat.lua diff --git a/src/server/Commands/Players/IncrementStatServer.luau b/src/server/Commands/Players/IncrementStatServer.lua similarity index 100% rename from src/server/Commands/Players/IncrementStatServer.luau rename to src/server/Commands/Players/IncrementStatServer.lua diff --git a/src/server/Commands/Players/SetStat.luau b/src/server/Commands/Players/SetStat.lua similarity index 100% rename from src/server/Commands/Players/SetStat.luau rename to src/server/Commands/Players/SetStat.lua diff --git a/src/server/Commands/Players/SetStatServer.luau b/src/server/Commands/Players/SetStatServer.lua similarity index 100% rename from src/server/Commands/Players/SetStatServer.luau rename to src/server/Commands/Players/SetStatServer.lua diff --git a/src/server/Commands/Players/WipeData.luau b/src/server/Commands/Players/WipeData.lua similarity index 100% rename from src/server/Commands/Players/WipeData.luau rename to src/server/Commands/Players/WipeData.lua diff --git a/src/server/Commands/Players/WipeDataServer.luau b/src/server/Commands/Players/WipeDataServer.lua similarity index 100% rename from src/server/Commands/Players/WipeDataServer.luau rename to src/server/Commands/Players/WipeDataServer.lua diff --git a/src/server/Exchange/init.luau b/src/server/Exchange/init.lua similarity index 100% rename from src/server/Exchange/init.luau rename to src/server/Exchange/init.lua diff --git a/src/server/Leveling/Areas.luau b/src/server/Leveling/Areas.lua similarity index 100% rename from src/server/Leveling/Areas.luau rename to src/server/Leveling/Areas.lua diff --git a/src/server/Leveling/init.luau b/src/server/Leveling/init.lua similarity index 100% rename from src/server/Leveling/init.luau rename to src/server/Leveling/init.lua diff --git a/src/server/PlayerManager/Collisions.luau b/src/server/PlayerManager/Collisions.lua similarity index 100% rename from src/server/PlayerManager/Collisions.luau rename to src/server/PlayerManager/Collisions.lua diff --git a/src/server/PlayerManager/GlobalLeaderboards.luau b/src/server/PlayerManager/GlobalLeaderboards.lua similarity index 100% rename from src/server/PlayerManager/GlobalLeaderboards.luau rename to src/server/PlayerManager/GlobalLeaderboards.lua diff --git a/src/server/PlayerManager/PlayerStatusUI.luau b/src/server/PlayerManager/PlayerStatusUI.lua similarity index 100% rename from src/server/PlayerManager/PlayerStatusUI.luau rename to src/server/PlayerManager/PlayerStatusUI.lua diff --git a/src/server/PlayerManager/ProfileTemplate.luau b/src/server/PlayerManager/ProfileTemplate.lua similarity index 100% rename from src/server/PlayerManager/ProfileTemplate.luau rename to src/server/PlayerManager/ProfileTemplate.lua diff --git a/src/server/PlayerManager/Profiles.luau b/src/server/PlayerManager/Profiles.lua similarity index 100% rename from src/server/PlayerManager/Profiles.luau rename to src/server/PlayerManager/Profiles.lua diff --git a/src/server/PlayerManager/init.luau b/src/server/PlayerManager/init.lua similarity index 100% rename from src/server/PlayerManager/init.luau rename to src/server/PlayerManager/init.lua diff --git a/src/server/PurchaseManager/DeveloperProducts/Gamepasses/Rewarders.luau b/src/server/PurchaseManager/DeveloperProducts/Gamepasses/Rewarders.lua similarity index 100% rename from src/server/PurchaseManager/DeveloperProducts/Gamepasses/Rewarders.luau rename to src/server/PurchaseManager/DeveloperProducts/Gamepasses/Rewarders.lua diff --git a/src/server/PurchaseManager/DeveloperProducts/Gamepasses/init.luau b/src/server/PurchaseManager/DeveloperProducts/Gamepasses/init.lua similarity index 100% rename from src/server/PurchaseManager/DeveloperProducts/Gamepasses/init.luau rename to src/server/PurchaseManager/DeveloperProducts/Gamepasses/init.lua diff --git a/src/server/PurchaseManager/DeveloperProducts/Products/Rewarders.luau b/src/server/PurchaseManager/DeveloperProducts/Products/Rewarders.lua similarity index 100% rename from src/server/PurchaseManager/DeveloperProducts/Products/Rewarders.luau rename to src/server/PurchaseManager/DeveloperProducts/Products/Rewarders.lua diff --git a/src/server/PurchaseManager/DeveloperProducts/Products/init.luau b/src/server/PurchaseManager/DeveloperProducts/Products/init.lua similarity index 100% rename from src/server/PurchaseManager/DeveloperProducts/Products/init.luau rename to src/server/PurchaseManager/DeveloperProducts/Products/init.lua diff --git a/src/server/PurchaseManager/DeveloperProducts/init.luau b/src/server/PurchaseManager/DeveloperProducts/init.lua similarity index 100% rename from src/server/PurchaseManager/DeveloperProducts/init.luau rename to src/server/PurchaseManager/DeveloperProducts/init.lua diff --git a/src/server/PurchaseManager/init.luau b/src/server/PurchaseManager/init.lua similarity index 100% rename from src/server/PurchaseManager/init.luau rename to src/server/PurchaseManager/init.lua diff --git a/src/server/Random/EggHatcher/Rarities.luau b/src/server/Random/EggHatcher/Rarities.lua similarity index 100% rename from src/server/Random/EggHatcher/Rarities.luau rename to src/server/Random/EggHatcher/Rarities.lua diff --git a/src/server/Random/EggHatcher/init.luau b/src/server/Random/EggHatcher/init.lua similarity index 100% rename from src/server/Random/EggHatcher/init.luau rename to src/server/Random/EggHatcher/init.lua diff --git a/src/server/State/Actions/CombatActions.luau b/src/server/State/Actions/CombatActions.lua similarity index 100% rename from src/server/State/Actions/CombatActions.luau rename to src/server/State/Actions/CombatActions.lua diff --git a/src/server/State/Actions/GamepassActions.luau b/src/server/State/Actions/GamepassActions.lua similarity index 100% rename from src/server/State/Actions/GamepassActions.luau rename to src/server/State/Actions/GamepassActions.lua diff --git a/src/server/State/Actions/MissionActions.luau b/src/server/State/Actions/MissionActions.lua similarity index 100% rename from src/server/State/Actions/MissionActions.luau rename to src/server/State/Actions/MissionActions.lua diff --git a/src/server/State/Actions/PetActions.luau b/src/server/State/Actions/PetActions.lua similarity index 100% rename from src/server/State/Actions/PetActions.luau rename to src/server/State/Actions/PetActions.lua diff --git a/src/server/State/Actions/PlayerDataActions.luau b/src/server/State/Actions/PlayerDataActions.lua similarity index 100% rename from src/server/State/Actions/PlayerDataActions.luau rename to src/server/State/Actions/PlayerDataActions.lua diff --git a/src/server/State/Actions/TransportationActions.luau b/src/server/State/Actions/TransportationActions.lua similarity index 100% rename from src/server/State/Actions/TransportationActions.luau rename to src/server/State/Actions/TransportationActions.lua diff --git a/src/server/State/Actions/WeaponActions.luau b/src/server/State/Actions/WeaponActions.lua similarity index 100% rename from src/server/State/Actions/WeaponActions.luau rename to src/server/State/Actions/WeaponActions.lua diff --git a/src/server/State/Actions/init.luau b/src/server/State/Actions/init.lua similarity index 100% rename from src/server/State/Actions/init.luau rename to src/server/State/Actions/init.lua diff --git a/src/server/State/Middleware.luau b/src/server/State/Middleware.lua similarity index 100% rename from src/server/State/Middleware.luau rename to src/server/State/Middleware.lua diff --git a/src/server/State/ReplicationRules.luau b/src/server/State/ReplicationRules.lua similarity index 100% rename from src/server/State/ReplicationRules.luau rename to src/server/State/ReplicationRules.lua diff --git a/src/server/State/Store.luau b/src/server/State/Store.lua similarity index 100% rename from src/server/State/Store.luau rename to src/server/State/Store.lua diff --git a/src/server/init.server.luau b/src/server/init.server.lua similarity index 100% rename from src/server/init.server.luau rename to src/server/init.server.lua diff --git a/src/shared/CommandHooks/Admin.luau b/src/shared/CommandHooks/Admin.lua similarity index 100% rename from src/shared/CommandHooks/Admin.luau rename to src/shared/CommandHooks/Admin.lua diff --git a/src/shared/PermissionList.luau b/src/shared/PermissionList.lua similarity index 100% rename from src/shared/PermissionList.luau rename to src/shared/PermissionList.lua diff --git a/src/shared/Remotes.luau b/src/shared/Remotes.lua similarity index 100% rename from src/shared/Remotes.luau rename to src/shared/Remotes.lua diff --git a/src/shared/State/DefaultStates.luau b/src/shared/State/DefaultStates.lua similarity index 100% rename from src/shared/State/DefaultStates.luau rename to src/shared/State/DefaultStates.lua diff --git a/src/shared/State/Reducer/CombatData.luau b/src/shared/State/Reducer/CombatData.lua similarity index 100% rename from src/shared/State/Reducer/CombatData.luau rename to src/shared/State/Reducer/CombatData.lua diff --git a/src/shared/State/Reducer/MissionData.luau b/src/shared/State/Reducer/MissionData.lua similarity index 100% rename from src/shared/State/Reducer/MissionData.luau rename to src/shared/State/Reducer/MissionData.lua diff --git a/src/shared/State/Reducer/PetData.luau b/src/shared/State/Reducer/PetData.lua similarity index 100% rename from src/shared/State/Reducer/PetData.luau rename to src/shared/State/Reducer/PetData.lua diff --git a/src/shared/State/Reducer/PurchaseData.luau b/src/shared/State/Reducer/PurchaseData.lua similarity index 100% rename from src/shared/State/Reducer/PurchaseData.luau rename to src/shared/State/Reducer/PurchaseData.lua diff --git a/src/shared/State/Reducer/Stats.luau b/src/shared/State/Reducer/Stats.lua similarity index 100% rename from src/shared/State/Reducer/Stats.luau rename to src/shared/State/Reducer/Stats.lua diff --git a/src/shared/State/Reducer/WeaponData.luau b/src/shared/State/Reducer/WeaponData.lua similarity index 100% rename from src/shared/State/Reducer/WeaponData.luau rename to src/shared/State/Reducer/WeaponData.lua diff --git a/src/shared/State/Reducer/init.luau b/src/shared/State/Reducer/init.lua similarity index 100% rename from src/shared/State/Reducer/init.luau rename to src/shared/State/Reducer/init.lua diff --git a/src/shared/State/selectors.luau b/src/shared/State/selectors.lua similarity index 100% rename from src/shared/State/selectors.luau rename to src/shared/State/selectors.lua diff --git a/src/shared/Utils/Enum.luau b/src/shared/Utils/Enum.lua similarity index 100% rename from src/shared/Utils/Enum.luau rename to src/shared/Utils/Enum.lua diff --git a/src/shared/Utils/Formatter/Suffixes.luau b/src/shared/Utils/Formatter/Suffixes.lua similarity index 100% rename from src/shared/Utils/Formatter/Suffixes.luau rename to src/shared/Utils/Formatter/Suffixes.lua diff --git a/src/shared/Utils/Formatter/init.luau b/src/shared/Utils/Formatter/init.lua similarity index 100% rename from src/shared/Utils/Formatter/init.luau rename to src/shared/Utils/Formatter/init.lua diff --git a/src/shared/Utils/HealthBar.luau b/src/shared/Utils/HealthBar.lua similarity index 100% rename from src/shared/Utils/HealthBar.luau rename to src/shared/Utils/HealthBar.lua diff --git a/src/shared/Utils/Player/PetUtils.luau b/src/shared/Utils/Player/PetUtils.lua similarity index 100% rename from src/shared/Utils/Player/PetUtils.luau rename to src/shared/Utils/Player/PetUtils.lua diff --git a/src/shared/Utils/Player/RegionUtils.luau b/src/shared/Utils/Player/RegionUtils.lua similarity index 100% rename from src/shared/Utils/Player/RegionUtils.luau rename to src/shared/Utils/Player/RegionUtils.lua diff --git a/src/shared/Utils/RankUtils.luau b/src/shared/Utils/RankUtils.lua similarity index 100% rename from src/shared/Utils/RankUtils.luau rename to src/shared/Utils/RankUtils.lua diff --git a/src/shared/Utils/Table.luau b/src/shared/Utils/Table.lua similarity index 100% rename from src/shared/Utils/Table.luau rename to src/shared/Utils/Table.lua diff --git a/src/shared/Utils/ZoneUtils.luau b/src/shared/Utils/ZoneUtils.lua similarity index 100% rename from src/shared/Utils/ZoneUtils.luau rename to src/shared/Utils/ZoneUtils.lua From 6b45af1fd6ad712a68bb7d11ef41c45e49cf1eb4 Mon Sep 17 00:00:00 2001 From: Pluviolithic <94190216+Pluviolithic@users.noreply.github.com> Date: Mon, 16 Oct 2023 21:15:18 -0400 Subject: [PATCH 06/11] Finish fixing mission bugs --- src/client/UI/Missions/ProgressUI.lua | 27 +++++++++-------- src/client/UI/Missions/init.lua | 38 ++++++++++++------------ src/server/Random/EggHatcher/init.lua | 3 +- src/shared/State/Reducer/MissionData.lua | 5 +++- 4 files changed, 39 insertions(+), 34 deletions(-) diff --git a/src/client/UI/Missions/ProgressUI.lua b/src/client/UI/Missions/ProgressUI.lua index a0f5228..bba8842 100644 --- a/src/client/UI/Missions/ProgressUI.lua +++ b/src/client/UI/Missions/ProgressUI.lua @@ -16,7 +16,7 @@ local progressTextFormats = { Enemy = "Defeat {enemy} {progress}", Weapon = "Buy a Weapon", AnyPet = "Hatch Any Pet in {area} {progress}", - PetRarity = "Hatch rarity Pet in {area} {progress}", + PetRarity = "Hatch {rarity} Pet in {area} {progress}", } local function enteredRegion(regionName, progressUI) @@ -39,23 +39,24 @@ local function enteredRegion(regionName, progressUI) return end + progressUI.Background.Complete.Visible = false + progressUI.Background.Progress.Visible = true + if progressText == progressTextFormats.Enemy then progressText = progressText:gsub("{enemy}", currentMissionRequirements.Enemy.Value) elseif progressText == progressTextFormats.PetRarity then - progressText = - progressText:gsub("{rarity}", currentMissionRequirements.PetRarity.Value):gsub("{area}", regionName) + progressText = progressText:gsub("{rarity}", currentMissionRequirements.PetRarity.Value) end - if not progressText:match "Weapon" then - progressText = progressText:gsub( - "{progress}", - "(" - .. currentMissionData.CurrentMissionProgress - .. "/" - .. currentMissionRequirements.Requirements.Value - .. ")" - ) - end + progressText = progressText:gsub("{area}", regionName) + progressText = progressText:gsub( + "{progress}", + "(" + .. currentMissionData.CurrentMissionProgress + .. "/" + .. currentMissionRequirements.Requirements.Value + .. ")" + ) progressUI.Background.Progress.Text = progressText progressUI.Enabled = true diff --git a/src/client/UI/Missions/init.lua b/src/client/UI/Missions/init.lua index cda0a9f..2999698 100644 --- a/src/client/UI/Missions/init.lua +++ b/src/client/UI/Missions/init.lua @@ -8,6 +8,7 @@ local Client = StarterPlayer.StarterPlayerScripts.Client local store = require(Client.State.Store) local Remotes = require(ReplicatedStorage.Common.Remotes) +local Janitor = require(ReplicatedStorage.Common.lib.Janitor) local selectors = require(ReplicatedStorage.Common.State.selectors) local regionUtils = require(ReplicatedStorage.Common.Utils.Player.RegionUtils) local CentralUI = require(StarterPlayer.StarterPlayerScripts.Client.UI.CentralUI) @@ -18,7 +19,7 @@ local rolloutSpeed = ReplicatedStorage.Config.Text.MissionTextRolloutSpeed.Value local MissionsUI = CentralUI.new(player.PlayerGui:WaitForChild "MissionsUI") function MissionsUI:_initialize(): () - self._confirmPressed = false + self._janitor = Janitor.new() interfaces[self] = true self._ui.Dialogue.Cancel.Activated:Connect(function() @@ -75,6 +76,9 @@ function MissionsUI:OnOpen() .. #missionRequirements[playerRegion]:GetChildren() .. ")" + self._confirmPressed = false + self._janitor:Cleanup() + if currentMissionData.Active then if currentMissionData.CurrentMissionProgress == currentMissionRequirements.Requirements.Value then local pending = true @@ -82,40 +86,44 @@ function MissionsUI:OnOpen() self:RolloutDialogue "Good job for completing the quest!" pending = false end) - self._confirmConnection = self._ui.Dialogue.Confirm.Activated:Connect(function() + self._janitor:Add(self._ui.Dialogue.Confirm.Activated:Connect(function() if pending then self._confirmPressed = true return end - self._confirmConnection:Disconnect() + self._janitor:Cleanup() Remotes.Client:Get("CompleteMission"):CallServerAsync():andThen(function() if self._ui.Enabled then self:OnOpen() end end) - end) + end)) else local pending = true task.spawn(function() self:RolloutDialogue "Finish your current quest before starting the next one." pending = false end) - self._confirmConnection = self._ui.Dialogue.Confirm.Activated:Connect(function() + self._janitor:Add(self._ui.Dialogue.Confirm.Activated:Connect(function() if pending then self._confirmPressed = true return end - self._confirmConnection:Disconnect() + self._janitor:Cleanup() self:setEnabled(false) - end) + end)) end else local i = 1 - local pending = false + local pending = true local dialogueSegment = currentMissionRequirements.Dialogue:FindFirstChild(tostring(i)) - self:RolloutDialogue(dialogueSegment) - self._ui.Dialogue.Confirm.Activated:Connect(function() + task.spawn(function() + self:RolloutDialogue(dialogueSegment) + pending = false + end) + + self._janitor:Add(self._ui.Dialogue.Confirm.Activated:Connect(function() if pending then self._confirmPressed = true return @@ -130,16 +138,8 @@ function MissionsUI:OnOpen() self:RolloutDialogue(dialogueSegment) pending = false end - end) - end -end - -function MissionsUI:OnClose() - if self._confirmConnection and self._confirmConnection.Connected then - self._confirmConnection:Disconnect() + end)) end - self._confirmPressed = false - self._confirmConnection = nil end for _, missionPrompt in CollectionService:GetTagged "MissionPrompt" do diff --git a/src/server/Random/EggHatcher/init.lua b/src/server/Random/EggHatcher/init.lua index e11a119..187293f 100644 --- a/src/server/Random/EggHatcher/init.lua +++ b/src/server/Random/EggHatcher/init.lua @@ -78,7 +78,8 @@ local function awardPetsToPlayer(player: Player, pets: { string }, eggGemPrice): end store:dispatch(actions.incrementPlayerStat(player.Name, "Gems", -eggGemPrice * #pets)) store:dispatch(actions.givePlayerPets(player.Name, petsDict)) - store:dispatch(actions.logHatchedPetRarities(petUtils.getPetRarities(pets))) + print "logging hatched pets" + store:dispatch(actions.logHatchedPetRarities(player.Name, petUtils.getPetRarities(pets))) end Remotes.Server:Get("HatchEggs"):SetCallback(function(player: Player, count: number, areaName: string) diff --git a/src/shared/State/Reducer/MissionData.lua b/src/shared/State/Reducer/MissionData.lua index a285fed..27a4e29 100644 --- a/src/shared/State/Reducer/MissionData.lua +++ b/src/shared/State/Reducer/MissionData.lua @@ -83,17 +83,20 @@ return Rodux.createReducer({}, { logHatchedPetRarities = function(state, action) return produce(state, function(draft) local playerRegion = regionUtils.getPlayerLocationName(action.playerName) + print("logging a pet hatching event from the " .. playerRegion .. " area") if not playerRegion or not state[action.playerName][playerRegion].Active then return end local currentMissionRequirements = missionRequirements[playerRegion][tostring(state[action.playerName][playerRegion].CurrentMissionNumber)] - + print "checking current mission type" if currentMissionRequirements:FindFirstChild "AnyPet" then + print "mission is anypet type" if draft[action.playerName][playerRegion].CurrentMissionProgress ~= currentMissionRequirements.Requirements.Value then + print "updating progress" draft[action.playerName][playerRegion].CurrentMissionProgress += 1 end elseif currentMissionRequirements:FindFirstChild "PetRarity" then From 441de34f641782f114eb5bcc9f8620d33e2c8139 Mon Sep 17 00:00:00 2001 From: Pluviolithic <94190216+Pluviolithic@users.noreply.github.com> Date: Mon, 16 Oct 2023 21:15:33 -0400 Subject: [PATCH 07/11] Fix jumpscares failing on enemy death --- src/client/Jumpscare.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/Jumpscare.lua b/src/client/Jumpscare.lua index 5bc8013..5fcdafc 100644 --- a/src/client/Jumpscare.lua +++ b/src/client/Jumpscare.lua @@ -56,13 +56,17 @@ local function jumpscarePlayer(enemyName) end playerStatePromise:andThen(function() + local lastEnemyFought = selectors.getCurrentTarget(store:getState(), player.Name) store.changed:connect(function(newState, oldState) + if selectors.getCurrentTarget(newState, player.Name) then + lastEnemyFought = selectors.getCurrentTarget(newState, player.Name) + end if isScared(player.Name, newState) and not isScared(player.Name, oldState) and (os.time() - lastJumpscared) > jumpscareGap then - jumpscarePlayer(selectors.getCurrentTarget(newState, player.Name).Name) + jumpscarePlayer(lastEnemyFought.Name) end end) end) From e1843a4280f225a8dd89dfd61d8ce8928506e119 Mon Sep 17 00:00:00 2001 From: Pluviolithic <94190216+Pluviolithic@users.noreply.github.com> Date: Mon, 16 Oct 2023 22:48:55 -0400 Subject: [PATCH 08/11] Add richtext support during rollout --- src/client/UI/Missions/init.lua | 51 +++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/src/client/UI/Missions/init.lua b/src/client/UI/Missions/init.lua index 2999698..fba03d7 100644 --- a/src/client/UI/Missions/init.lua +++ b/src/client/UI/Missions/init.lua @@ -28,15 +28,8 @@ function MissionsUI:_initialize(): () end function MissionsUI:RolloutDialogue(dialogueSegment) + local splitText = {} local text = if typeof(dialogueSegment) == "string" then dialogueSegment else dialogueSegment.Value - for j = 1, #text do - self._ui.Dialogue.Background.Dialogue.Text = text:sub(1, j) - task.wait(rolloutSpeed) - if self._confirmPressed then - self._confirmPressed = false - break - end - end if typeof(dialogueSegment) ~= "string" then for _, colorValue in dialogueSegment:GetChildren() do @@ -46,6 +39,7 @@ function MissionsUI:RolloutDialogue(dialogueSegment) math.round(colorValue.Value.G * 255), math.round(colorValue.Value.B * 255), } + text = text:gsub( attributeValue, '' .. attributeValue .. "" @@ -54,6 +48,47 @@ function MissionsUI:RolloutDialogue(dialogueSegment) end end + local bracketStart = nil + for i = 1, #text do + local c = text:sub(i, i) + if c == "<" then + bracketStart = i + elseif c == ">" then + table.insert(splitText, text:sub(bracketStart, i)) + bracketStart = nil + elseif not bracketStart then + table.insert(splitText, c) + end + end + + local runningTotal = "" + local richtextActive = false + for i = 1, #splitText do + local currentSegment = splitText[i] + + if currentSegment:match "color=" then + richtextActive = true + runningTotal = runningTotal .. currentSegment + continue + elseif currentSegment == "" then + richtextActive = false + end + + runningTotal = runningTotal .. currentSegment + + if richtextActive then + self._ui.Dialogue.Background.Dialogue.Text = runningTotal .. "" + else + self._ui.Dialogue.Background.Dialogue.Text = runningTotal + end + + task.wait(rolloutSpeed) + if self._confirmPressed then + self._confirmPressed = false + break + end + end + self._ui.Dialogue.Background.Dialogue.Text = text end From 62cd8b9eaedf068dafe8e250895677fd01737a88 Mon Sep 17 00:00:00 2001 From: Pluviolithic <94190216+Pluviolithic@users.noreply.github.com> Date: Thu, 19 Oct 2023 02:22:41 -0400 Subject: [PATCH 09/11] Complete remaining major mission features --- src/client/UI/BillboardShops/EggShop.lua | 12 ++- src/client/UI/Displays.lua | 4 +- src/client/UI/Inventories/PetInventory.lua | 8 +- .../UI/Missions/MissionFearRewardUI.lua | 7 ++ src/client/UI/Missions/ProgressUI.lua | 8 +- src/client/UI/Missions/init.lua | 95 +++++++++++++++++-- src/server/Combat/Dummy.lua | 2 +- src/server/Combat/Enemy.lua | 2 +- src/server/Combat/Missions.lua | 8 ++ .../Commands/Players/CompleteMission.lua | 18 ++++ .../Players/CompleteMissionServer.lua | 15 +++ src/server/PlayerManager/ProfileTemplate.lua | 6 +- .../Gamepasses/Rewarders.lua | 24 ++--- .../DeveloperProducts/Products/Rewarders.lua | 20 +++- .../DeveloperProducts/Products/init.lua | 6 +- src/server/Random/EggHatcher/init.lua | 3 +- src/server/State/Actions/MissionActions.lua | 10 ++ src/shared/Remotes.lua | 6 +- src/shared/State/DefaultStates.lua | 6 +- src/shared/State/Reducer/MissionData.lua | 20 ++-- src/shared/State/Reducer/Stats.lua | 4 +- 21 files changed, 233 insertions(+), 51 deletions(-) create mode 100644 src/client/UI/Missions/MissionFearRewardUI.lua create mode 100644 src/server/Commands/Players/CompleteMission.lua create mode 100644 src/server/Commands/Players/CompleteMissionServer.lua diff --git a/src/client/UI/BillboardShops/EggShop.lua b/src/client/UI/BillboardShops/EggShop.lua index 54f3f85..a07d4cc 100644 --- a/src/client/UI/BillboardShops/EggShop.lua +++ b/src/client/UI/BillboardShops/EggShop.lua @@ -13,11 +13,11 @@ local store = require(StarterPlayer.StarterPlayerScripts.Client.State.Store) local selectors = require(ReplicatedStorage.Common.State.selectors) local playerStatePromise = require(StarterPlayer.StarterPlayerScripts.Client.State.PlayerStatePromise) -local autoHatchGamepassID = ReplicatedStorage.Config.GamepassData.IDs["Auto"].Value -local tripleHatchGamepassID = ReplicatedStorage.Config.GamepassData.IDs["3X"].Value +local autoHatchGamepassID = ReplicatedStorage.Config.GamepassData.IDs["AutoHatch"].Value +local tripleHatchGamepassID = ReplicatedStorage.Config.GamepassData.IDs["3xHatch"].Value local fasterHatchGamepassID = ReplicatedStorage.Config.GamepassData.IDs["FasterHatch"].Value -local doubleLuckGamepassID = ReplicatedStorage.Config.GamepassData.IDs["2XLuck"].Value -local tripleLuckGamepassID = ReplicatedStorage.Config.GamepassData.IDs["3XLuck"].Value +local doubleLuckGamepassID = ReplicatedStorage.Config.GamepassData.IDs["2xLuck"].Value +local tripleLuckGamepassID = ReplicatedStorage.Config.GamepassData.IDs["3xLuck"].Value local hatchingUI = player.PlayerGui:WaitForChild "Hatching" @@ -320,6 +320,10 @@ CollectionService:GetInstanceAddedSignal("EggShop"):Connect(handleShop) local function updateFoundsDisplay(foundPets): () for petName in foundPets do + if petName:match "Evolved" then + continue + end + local petUI = player.PlayerGui:WaitForChild(petAreas[petName] .. "EggUI").Background.Pets[petName] petUI.PetName.Text = petName petUI.PetImage.ImageColor3 = Color3.fromRGB(255, 255, 255) diff --git a/src/client/UI/Displays.lua b/src/client/UI/Displays.lua index 561d9df..ae74c50 100644 --- a/src/client/UI/Displays.lua +++ b/src/client/UI/Displays.lua @@ -71,9 +71,7 @@ end):andThen(function(interfaces) first = interfaces.PetInventory.Background.Multiplier.Amount, second = function() return "X" - .. formatter.truncateMultiplier( - selectors.getStat(store:getState(), player.Name, "PetFearMultiplier") - ) + .. formatter.truncateMultiplier(selectors.getStat(store:getState(), player.Name, "FearMultiplier")) end, }, { diff --git a/src/client/UI/Inventories/PetInventory.lua b/src/client/UI/Inventories/PetInventory.lua index 5a7415c..001070c 100644 --- a/src/client/UI/Inventories/PetInventory.lua +++ b/src/client/UI/Inventories/PetInventory.lua @@ -55,17 +55,17 @@ function PetInventory:_initialize(): () self._ui.Background.Storage.Buy.Activated:Connect(function() local maxPetCount = selectors.getStat(store:getState(), player.Name, "MaxPetCount") if maxPetCount == 30 or maxPetCount == 130 then - MarketplaceService:PromptGamePassPurchase(player, gamepassIDs["+50"].Value) + MarketplaceService:PromptGamePassPurchase(player, gamepassIDs["50PetStorage"].Value) else - MarketplaceService:PromptGamePassPurchase(player, gamepassIDs["+100"].Value) + MarketplaceService:PromptGamePassPurchase(player, gamepassIDs["100PetStorage"].Value) end end) self._ui.Background.Equipped.Buy.Activated:Connect(function() if selectors.getStat(store:getState(), player.Name, "MaxPetEquipCount") == 3 then - MarketplaceService:PromptGamePassPurchase(player, gamepassIDs["+1PetEquipped"].Value) + MarketplaceService:PromptGamePassPurchase(player, gamepassIDs["1PetEquipped"].Value) else - MarketplaceService:PromptGamePassPurchase(player, gamepassIDs["+2PetEquipped"].Value) + MarketplaceService:PromptGamePassPurchase(player, gamepassIDs["2PetEquipped"].Value) end end) diff --git a/src/client/UI/Missions/MissionFearRewardUI.lua b/src/client/UI/Missions/MissionFearRewardUI.lua new file mode 100644 index 0000000..e295376 --- /dev/null +++ b/src/client/UI/Missions/MissionFearRewardUI.lua @@ -0,0 +1,7 @@ +local Players = game:GetService "Players" +local StarterPlayer = game:GetService "StarterPlayer" + +local CentralUI = require(StarterPlayer.StarterPlayerScripts.Client.UI.CentralUI) +local player = Players.LocalPlayer + +return CentralUI.new(player.PlayerGui:WaitForChild "MissionFearReward") diff --git a/src/client/UI/Missions/ProgressUI.lua b/src/client/UI/Missions/ProgressUI.lua index bba8842..09e6bdf 100644 --- a/src/client/UI/Missions/ProgressUI.lua +++ b/src/client/UI/Missions/ProgressUI.lua @@ -16,7 +16,7 @@ local progressTextFormats = { Enemy = "Defeat {enemy} {progress}", Weapon = "Buy a Weapon", AnyPet = "Hatch Any Pet in {area} {progress}", - PetRarity = "Hatch {rarity} Pet in {area} {progress}", + PetRarity = "Hatch a {rarity} Pet in {area} {progress}", } local function enteredRegion(regionName, progressUI) @@ -45,7 +45,11 @@ local function enteredRegion(regionName, progressUI) if progressText == progressTextFormats.Enemy then progressText = progressText:gsub("{enemy}", currentMissionRequirements.Enemy.Value) elseif progressText == progressTextFormats.PetRarity then - progressText = progressText:gsub("{rarity}", currentMissionRequirements.PetRarity.Value) + if currentMissionRequirements.PetRarity.Value:sub(1, 1):lower():match "[aeiou]" then + progressText = progressText:gsub(" {rarity}", "n " .. currentMissionRequirements.PetRarity.Value) + else + progressText = progressText:gsub("{rarity}", currentMissionRequirements.PetRarity.Value) + end end progressText = progressText:gsub("{area}", regionName) diff --git a/src/client/UI/Missions/init.lua b/src/client/UI/Missions/init.lua index fba03d7..aa73c89 100644 --- a/src/client/UI/Missions/init.lua +++ b/src/client/UI/Missions/init.lua @@ -2,21 +2,26 @@ local Players = game:GetService "Players" local StarterPlayer = game:GetService "StarterPlayer" local CollectionService = game:GetService "CollectionService" local ReplicatedStorage = game:GetService "ReplicatedStorage" +local MarketplaceService = game:GetService "MarketplaceService" local player = Players.LocalPlayer local Client = StarterPlayer.StarterPlayerScripts.Client local store = require(Client.State.Store) local Remotes = require(ReplicatedStorage.Common.Remotes) +local Zone = require(ReplicatedStorage.Common.lib.ZonePlus) local Janitor = require(ReplicatedStorage.Common.lib.Janitor) local selectors = require(ReplicatedStorage.Common.State.selectors) +local formatter = require(ReplicatedStorage.Common.Utils.Formatter) local regionUtils = require(ReplicatedStorage.Common.Utils.Player.RegionUtils) local CentralUI = require(StarterPlayer.StarterPlayerScripts.Client.UI.CentralUI) local interfaces = require(StarterPlayer.StarterPlayerScripts.Client.UI.CollidableInterfaces) local missionRequirements = ReplicatedStorage.Missions +local missionSkipProductID = ReplicatedStorage.Config.DevProductData.IDs.MissionSkip.Value local rolloutSpeed = ReplicatedStorage.Config.Text.MissionTextRolloutSpeed.Value local MissionsUI = CentralUI.new(player.PlayerGui:WaitForChild "MissionsUI") +local MissionFearRewardUI = require(script.MissionFearRewardUI) function MissionsUI:_initialize(): () self._janitor = Janitor.new() @@ -25,11 +30,41 @@ function MissionsUI:_initialize(): () self._ui.Dialogue.Cancel.Activated:Connect(function() self:setEnabled(false) end) + + self._ui.Dialogue.Skip.MouseEnter:Connect(function() + self._ui.Dialogue.Skip.ScrollText.Visible = true + end) + + self._ui.Dialogue.Skip.MouseLeave:Connect(function() + self._ui.Dialogue.Skip.ScrollText.Visible = false + end) + + self._ui.Dialogue.Skip.Visible = false + self._ui.Dialogue.Skip.Activated:Connect(function() + local playerRegion = regionUtils.getPlayerLocationName(player.Name) + local currentMissionData = selectors.getMissionData(store:getState(), player.Name)[playerRegion] + local currentMissionRequirements = + missionRequirements[playerRegion][tostring(currentMissionData.CurrentMissionNumber)] + + if currentMissionData.CurrentMissionProgress == currentMissionRequirements.Requirements.Value then + return + end + + MarketplaceService:PromptProductPurchase(player, missionSkipProductID) + self:setEnabled(false) + end) + + for _, hitbox in CollectionService:GetTagged "NPCHitbox" do + Zone.new(hitbox).localPlayerExited:Connect(function() + self:setEnabled(false) + end) + end end -function MissionsUI:RolloutDialogue(dialogueSegment) +function MissionsUI:RolloutDialogue(dialogueSegment, gemRewardValue) local splitText = {} local text = if typeof(dialogueSegment) == "string" then dialogueSegment else dialogueSegment.Value + local gemRewardText = formatter.formatNumberWithSuffix(gemRewardValue) .. " Gems" if typeof(dialogueSegment) ~= "string" then for _, colorValue in dialogueSegment:GetChildren() do @@ -40,6 +75,15 @@ function MissionsUI:RolloutDialogue(dialogueSegment) math.round(colorValue.Value.B * 255), } + if attributeValue == "{gems}" then + text = text:gsub( + attributeValue, + '' .. gemRewardText .. "" + ) + print(text) + continue + end + text = text:gsub( attributeValue, '' .. attributeValue .. "" @@ -116,9 +160,11 @@ function MissionsUI:OnOpen() if currentMissionData.Active then if currentMissionData.CurrentMissionProgress == currentMissionRequirements.Requirements.Value then + self._ui.Dialogue.Skip.Visible = false + local pending = true task.spawn(function() - self:RolloutDialogue "Good job for completing the quest!" + self:RolloutDialogue("Good job for completing the quest!", currentMissionRequirements.Gems.Value) pending = false end) self._janitor:Add(self._ui.Dialogue.Confirm.Activated:Connect(function() @@ -134,9 +180,14 @@ function MissionsUI:OnOpen() end) end)) else + self._ui.Dialogue.Skip.Visible = true + local pending = true task.spawn(function() - self:RolloutDialogue "Finish your current quest before starting the next one." + self:RolloutDialogue( + "Finish your current quest before starting the next one.", + currentMissionRequirements.Gems.Value + ) pending = false end) self._janitor:Add(self._ui.Dialogue.Confirm.Activated:Connect(function() @@ -148,13 +199,15 @@ function MissionsUI:OnOpen() self:setEnabled(false) end)) end - else + elseif currentMissionData.CurrentMissionProgress ~= currentMissionRequirements.Requirements.Value then + self._ui.Dialogue.Skip.Visible = true + local i = 1 local pending = true local dialogueSegment = currentMissionRequirements.Dialogue:FindFirstChild(tostring(i)) task.spawn(function() - self:RolloutDialogue(dialogueSegment) + self:RolloutDialogue(dialogueSegment, currentMissionRequirements.Gems.Value) pending = false end) @@ -170,19 +223,47 @@ function MissionsUI:OnOpen() else pending = true dialogueSegment = currentMissionRequirements.Dialogue:FindFirstChild(tostring(i)) - self:RolloutDialogue(dialogueSegment) + self:RolloutDialogue(dialogueSegment, currentMissionRequirements.Gems.Value) pending = false end end)) + else + self._ui.Dialogue.Skip.Visible = false + local pending = true + + if not currentMissionData.ViewedRewardPopup then + Remotes.Client:Get("DisableMissionRewardPopup"):SendToServer() + MissionFearRewardUI._ui.Enabled = true + end + + task.spawn(function() + self:RolloutDialogue( + 'You have completed all the missions in Clown Town! You have received a Permanent +10% Fear Boost!', + currentMissionRequirements.Gems.Value + ) + pending = false + end) + + self._janitor:Add(self._ui.Dialogue.Confirm.Activated:Connect(function() + if pending then + self._confirmPressed = true + return + end + self:setEnabled(false) + end)) end end for _, missionPrompt in CollectionService:GetTagged "MissionPrompt" do + local debounce = false missionPrompt.Triggered:Connect(function(source) - if source ~= player then + if source ~= player or debounce then return end + debounce = true MissionsUI:setEnabled(not MissionsUI._isOpen) + task.wait(0.5) + debounce = false end) end diff --git a/src/server/Combat/Dummy.lua b/src/server/Combat/Dummy.lua index 2acc85b..0a93559 100644 --- a/src/server/Combat/Dummy.lua +++ b/src/server/Combat/Dummy.lua @@ -112,7 +112,7 @@ local function handleDummy(dummy) actions.incrementPlayerStat( humanoid.Parent.Name, "Fear", - fear * selectors.getStat(store:getState(), player.Name, "PetFearMultiplier") + fear * selectors.getStat(store:getState(), player.Name, "FearMultiplier") ) ) task.wait(1) diff --git a/src/server/Combat/Enemy.lua b/src/server/Combat/Enemy.lua index 28c7e91..062b3e8 100644 --- a/src/server/Combat/Enemy.lua +++ b/src/server/Combat/Enemy.lua @@ -344,7 +344,7 @@ local function handleEnemy(enemy) actions.incrementPlayerStat( otherPlayer.Name, "Fear", - damage * selectors.getStat(store:getState(), otherPlayer.Name, "PetFearMultiplier") + damage * selectors.getStat(store:getState(), otherPlayer.Name, "FearMultiplier") ) ) store:dispatch(actions.incrementPlayerStat(otherPlayer.Name, "Kills")) diff --git a/src/server/Combat/Missions.lua b/src/server/Combat/Missions.lua index fb88f29..89ae573 100644 --- a/src/server/Combat/Missions.lua +++ b/src/server/Combat/Missions.lua @@ -30,4 +30,12 @@ Remotes.Server:Get("CompleteMission"):SetCallback(function(player: Player) return true end) +Remotes.Server:Get("DisableMissionRewardPopup"):Connect(function(player: Player) + local areaName = regionUtils.getPlayerLocationName(player.Name) + if not selectors.getMissionData(store:getState(), player.Name)[areaName].ViewedRewardPopup then + store:dispatch(actions.disableMissionRewardPopup(player.Name, areaName)) + store:dispatch(actions.incrementPlayerStat(player.Name, "FearMultiplier", 0.1)) + end +end) + return 0 diff --git a/src/server/Commands/Players/CompleteMission.lua b/src/server/Commands/Players/CompleteMission.lua new file mode 100644 index 0000000..0a75076 --- /dev/null +++ b/src/server/Commands/Players/CompleteMission.lua @@ -0,0 +1,18 @@ +return { + Name = "completemission", + Aliases = { "cm" }, + Description = "Completes the current mission of the player for the region they're in.", + Group = "DefaultAdmin", + Args = { + { + Type = "player", + Name = "Player", + Description = "The player whose mission you want to complete.", + }, + { + Type = "number", + Name = "GemReward", + Description = "The reward you want to give in gems.", + }, + }, +} diff --git a/src/server/Commands/Players/CompleteMissionServer.lua b/src/server/Commands/Players/CompleteMissionServer.lua new file mode 100644 index 0000000..5e91da4 --- /dev/null +++ b/src/server/Commands/Players/CompleteMissionServer.lua @@ -0,0 +1,15 @@ +local ReplicatedStorage = game:GetService "ReplicatedStorage" +local ServerScriptService = game:GetService "ServerScriptService" +local server = ServerScriptService.Server + +local store = require(server.State.Store) +local actions = require(server.State.Actions) +local selectors = require(ReplicatedStorage.Common.State.selectors) +local regionUtils = require(ReplicatedStorage.Common.Utils.Player.RegionUtils) + +return function(_, player: Player, gemReward: number) + if not selectors.isPlayerLoaded(store:getState(), player.Name) then + return + end + store:dispatch(actions.completeMission(player.Name, regionUtils.getPlayerLocationName(player.Name), gemReward)) +end diff --git a/src/server/PlayerManager/ProfileTemplate.lua b/src/server/PlayerManager/ProfileTemplate.lua index 07e2fa1..bd6266d 100644 --- a/src/server/PlayerManager/ProfileTemplate.lua +++ b/src/server/PlayerManager/ProfileTemplate.lua @@ -10,6 +10,7 @@ return { Rank = 1, WalkSpeed = 14, + FearMultiplier = 1, RequiredFear = game:GetService("ReplicatedStorage").Config.Workout.RequiredFear.Value, MaxFearMeter = 100, CurrentFearMeter = 0, @@ -21,7 +22,6 @@ return { MaxPetCount = 30, CurrentPetCount = 0, MaxPetEquipCount = 3, - PetFearMultiplier = 1, CurrentPetEquipCount = 0, }, @@ -49,21 +49,25 @@ return { CurrentMissionNumber = 1, CurrentMissionProgress = 0, Active = false, + ViewedRewardPopup = false, }, ["Spider Cave"] = { CurrentMissionNumber = 1, CurrentMissionProgress = 0, Active = false, + ViewedRewardPopup = false, }, ["Howling Woods"] = { CurrentMissionNumber = 1, CurrentMissionProgress = 0, Active = false, + ViewedRewardPopup = false, }, ["Zombie City"] = { CurrentMissionNumber = 1, CurrentMissionProgress = 0, Active = false, + ViewedRewardPopup = false, }, }, } diff --git a/src/server/PurchaseManager/DeveloperProducts/Gamepasses/Rewarders.lua b/src/server/PurchaseManager/DeveloperProducts/Gamepasses/Rewarders.lua index ede9dd2..653e485 100644 --- a/src/server/PurchaseManager/DeveloperProducts/Gamepasses/Rewarders.lua +++ b/src/server/PurchaseManager/DeveloperProducts/Gamepasses/Rewarders.lua @@ -15,30 +15,30 @@ return { store:dispatch(actions.givePlayerWeapon(player.Name, "Hero Blade")) store:dispatch(actions.equipWeapon(player.Name, "Hero Blade")) end, - [tostring(IDs["+50"].Value)] = function(player: Player) + [tostring(IDs["50PetStorage"].Value)] = function(player: Player) store:dispatch(actions.incrementPlayerStat(player.Name, "MaxPetCount", 50)) end, - [tostring(IDs["+100"].Value)] = function(player: Player) + [tostring(IDs["100PetStorage"].Value)] = function(player: Player) store:dispatch(actions.incrementPlayerStat(player.Name, "MaxPetCount", 100)) end, - [tostring(IDs["2XLuck"].Value)] = function(player: Player) + [tostring(IDs["2xLuck"].Value)] = function(player: Player) store:dispatch(actions.incrementPlayerStat(player.Name, "Luck", 2)) end, - [tostring(IDs["3XLuck"].Value)] = function(player: Player) + [tostring(IDs["3xLuck"].Value)] = function(player: Player) store:dispatch(actions.incrementPlayerStat(player.Name, "Luck", 3)) end, - [tostring(IDs["+1PetEquipped"].Value)] = function(player: Player) + [tostring(IDs["1PetEquipped"].Value)] = function(player: Player) store:dispatch(actions.incrementPlayerStat(player.Name, "MaxPetEquipCount", 1)) end, - [tostring(IDs["+2PetEquipped"].Value)] = function(player: Player) + [tostring(IDs["2PetEquipped"].Value)] = function(player: Player) store:dispatch(actions.incrementPlayerStat(player.Name, "MaxPetEquipCount", 2)) end, - [tostring(IDs["2XStrength"].Value)] = true, - [tostring(IDs["2XFear"].Value)] = true, - [tostring(IDs["2XGems"].Value)] = true, - [tostring(IDs["2XSpeed"].Value)] = true, - [tostring(IDs["2XAttackSpeed"].Value)] = true, - [tostring(IDs["3XWorkoutSpeed"].Value)] = true, + [tostring(IDs["2xStrength"].Value)] = true, + [tostring(IDs["2xFear"].Value)] = true, + [tostring(IDs["2xGems"].Value)] = true, + [tostring(IDs["2xSpeed"].Value)] = true, + [tostring(IDs["2xAttackSpeed"].Value)] = true, + [tostring(IDs["3xWorkoutSpeed"].Value)] = true, [tostring(IDs.FreeTeleporter.Value)] = true, } diff --git a/src/server/PurchaseManager/DeveloperProducts/Products/Rewarders.lua b/src/server/PurchaseManager/DeveloperProducts/Products/Rewarders.lua index a564707..c4e9cbc 100644 --- a/src/server/PurchaseManager/DeveloperProducts/Products/Rewarders.lua +++ b/src/server/PurchaseManager/DeveloperProducts/Products/Rewarders.lua @@ -1 +1,19 @@ -return {} +local ReplicatedStorage = game:GetService "ReplicatedStorage" +local ServerScriptService = game:GetService "ServerScriptService" + +local store = require(ServerScriptService.Server.State.Store) +local actions = require(ServerScriptService.Server.State.Actions) +local selectors = require(ReplicatedStorage.Common.State.selectors) +local regionUtils = require(ReplicatedStorage.Common.Utils.Player.RegionUtils) + +local IDs = ReplicatedStorage.Config.DevProductData.IDs + +return { + [tostring(IDs.MissionSkip.Value)] = function(player: Player) + local areaName = regionUtils.getPlayerLocationName(player.Name) + local currentMissionData = selectors.getMissionData(store:getState(), player.Name)[areaName] + local gemReward = + ReplicatedStorage.Missions[areaName][tostring(currentMissionData.CurrentMissionNumber)].Gems.Value + store:dispatch(actions.completeMission(player.Name, areaName, gemReward)) + end, +} diff --git a/src/server/PurchaseManager/DeveloperProducts/Products/init.lua b/src/server/PurchaseManager/DeveloperProducts/Products/init.lua index 3c6902c..13f937f 100644 --- a/src/server/PurchaseManager/DeveloperProducts/Products/init.lua +++ b/src/server/PurchaseManager/DeveloperProducts/Products/init.lua @@ -1,9 +1,9 @@ local rewarders = require(script.Rewarders) -return function(player: Player, gamepassID: number): (boolean, string?) - if not rewarders[gamepassID] then +return function(player: Player, productID: number): (boolean, string?) + if not rewarders[tostring(productID)] then return end - return pcall(rewarders[gamepassID], player) + return pcall(rewarders[tostring(productID)], player) end diff --git a/src/server/Random/EggHatcher/init.lua b/src/server/Random/EggHatcher/init.lua index 187293f..00cf237 100644 --- a/src/server/Random/EggHatcher/init.lua +++ b/src/server/Random/EggHatcher/init.lua @@ -12,7 +12,7 @@ local petUtils = require(ReplicatedStorage.Common.Utils.Player.PetUtils) local eggGemPricesConfig = ReplicatedStorage.Config.Pets.Prices local areaRequirements = ReplicatedStorage.Config.AreaRequirements -local tripleHatchGamepassID = ReplicatedStorage.Config.GamepassData.IDs["3X"].Value +local tripleHatchGamepassID = ReplicatedStorage.Config.GamepassData.IDs["3xHatch"].Value local luckBoostedRarities = { Rare = true, @@ -78,7 +78,6 @@ local function awardPetsToPlayer(player: Player, pets: { string }, eggGemPrice): end store:dispatch(actions.incrementPlayerStat(player.Name, "Gems", -eggGemPrice * #pets)) store:dispatch(actions.givePlayerPets(player.Name, petsDict)) - print "logging hatched pets" store:dispatch(actions.logHatchedPetRarities(player.Name, petUtils.getPetRarities(pets))) end diff --git a/src/server/State/Actions/MissionActions.lua b/src/server/State/Actions/MissionActions.lua index c4191a3..6117485 100644 --- a/src/server/State/Actions/MissionActions.lua +++ b/src/server/State/Actions/MissionActions.lua @@ -21,6 +21,16 @@ return { } end ), + disableMissionRewardPopup = makeActionCreator( + "disableMissionRewardPopup", + function(playerName: string, areaName: string) + return { + areaName = areaName, + playerName = playerName, + shouldSave = true, + } + end + ), logKilledEnemyType = makeActionCreator("logKilledEnemyType", function(playerName: string, enemyType: string) return { enemyType = enemyType, diff --git a/src/shared/Remotes.lua b/src/shared/Remotes.lua index 3b3232d..6b1c986 100644 --- a/src/shared/Remotes.lua +++ b/src/shared/Remotes.lua @@ -99,9 +99,13 @@ local Remotes = Net.CreateDefinitions { MaxRequestsPerMinute = 60, }, }, + DisableMissionRewardPopup = Net.Definitions.ClientToServerEvent { + Net.Middleware.RateLimit { + MaxRequestsPerMinute = 60, + }, + }, SendRoduxAction = Net.Definitions.ServerToClientEvent(), - --SendNPCHealthBar = Net.Definitions.ServerToClientEvent(), SetControlsEnabled = Net.Definitions.ServerToClientEvent(), } diff --git a/src/shared/State/DefaultStates.lua b/src/shared/State/DefaultStates.lua index fcf2810..aa08039 100644 --- a/src/shared/State/DefaultStates.lua +++ b/src/shared/State/DefaultStates.lua @@ -10,6 +10,7 @@ return { Rank = 1, WalkSpeed = 14, + FearMultiplier = 1, RequiredFear = game:GetService("ReplicatedStorage").Config.Workout.RequiredFear.Value, MaxFearMeter = 100, CurrentFearMeter = 0, @@ -21,7 +22,6 @@ return { MaxPetCount = 30, CurrentPetCount = 0, MaxPetEquipCount = 3, - PetFearMultiplier = 1, CurrentPetEquipCount = 0, }, @@ -54,21 +54,25 @@ return { CurrentMissionNumber = 1, CurrentMissionProgress = 0, Active = false, + ViewedRewardPopup = false, }, ["Spider Cave"] = { CurrentMissionNumber = 1, CurrentMissionProgress = 0, Active = false, + ViewedRewardPopup = false, }, ["Howling Woods"] = { CurrentMissionNumber = 1, CurrentMissionProgress = 0, Active = false, + ViewedRewardPopup = false, }, ["Zombie City"] = { CurrentMissionNumber = 1, CurrentMissionProgress = 0, Active = false, + ViewedRewardPopup = false, }, }, } diff --git a/src/shared/State/Reducer/MissionData.lua b/src/shared/State/Reducer/MissionData.lua index 27a4e29..8c05aed 100644 --- a/src/shared/State/Reducer/MissionData.lua +++ b/src/shared/State/Reducer/MissionData.lua @@ -30,11 +30,23 @@ return Rodux.createReducer({}, { draft[action.playerName][action.areaName].Active = true end) end, + disableMissionRewardPopup = function(state, action) + return produce(state, function(draft) + draft[action.playerName][action.areaName].ViewedRewardPopup = true + end) + end, completeMission = function(state, action) return produce(state, function(draft) draft[action.playerName][action.areaName].Active = false - draft[action.playerName][action.areaName].CurrentMissionNumber += 1 - draft[action.playerName][action.areaName].CurrentMissionProgress = 0 + + local playerRegion = regionUtils.getPlayerLocationName(action.playerName) + local nextMissionRequirements = missionRequirements[playerRegion]:FindFirstChild( + tostring(state[action.playerName][playerRegion].CurrentMissionNumber + 1) + ) + if nextMissionRequirements then + draft[action.playerName][action.areaName].CurrentMissionProgress = 0 + draft[action.playerName][action.areaName].CurrentMissionNumber += 1 + end end) end, logKilledEnemyType = function(state, action) @@ -83,20 +95,16 @@ return Rodux.createReducer({}, { logHatchedPetRarities = function(state, action) return produce(state, function(draft) local playerRegion = regionUtils.getPlayerLocationName(action.playerName) - print("logging a pet hatching event from the " .. playerRegion .. " area") if not playerRegion or not state[action.playerName][playerRegion].Active then return end local currentMissionRequirements = missionRequirements[playerRegion][tostring(state[action.playerName][playerRegion].CurrentMissionNumber)] - print "checking current mission type" if currentMissionRequirements:FindFirstChild "AnyPet" then - print "mission is anypet type" if draft[action.playerName][playerRegion].CurrentMissionProgress ~= currentMissionRequirements.Requirements.Value then - print "updating progress" draft[action.playerName][playerRegion].CurrentMissionProgress += 1 end elseif currentMissionRequirements:FindFirstChild "PetRarity" then diff --git a/src/shared/State/Reducer/Stats.lua b/src/shared/State/Reducer/Stats.lua index 165bec5..eefd863 100644 --- a/src/shared/State/Reducer/Stats.lua +++ b/src/shared/State/Reducer/Stats.lua @@ -89,7 +89,7 @@ return Rodux.createReducer({}, { end return produce(state, function(draft) draft[action.playerName].CurrentPetEquipCount += addedPetEquipCount - draft[action.playerName].PetFearMultiplier += addedPetFearMultiplier + draft[action.playerName].FearMultiplier += addedPetFearMultiplier end) end, unequipPlayerPets = function(state, action) @@ -101,7 +101,7 @@ return Rodux.createReducer({}, { end return produce(state, function(draft) draft[action.playerName].CurrentPetEquipCount += removedPetEquipCount - draft[action.playerName].PetFearMultiplier += removedPetFearMultiplier + draft[action.playerName].FearMultiplier += removedPetFearMultiplier end) end, completeMission = function(state, action) From fd835642d530d71d0f750f543ea024ba56fa28b3 Mon Sep 17 00:00:00 2001 From: Pluviolithic <94190216+Pluviolithic@users.noreply.github.com> Date: Thu, 19 Oct 2023 12:10:04 -0400 Subject: [PATCH 10/11] Finish mission status ui and live mission updates --- src/client/UI/Missions/init.lua | 40 ++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/client/UI/Missions/init.lua b/src/client/UI/Missions/init.lua index aa73c89..fa914ea 100644 --- a/src/client/UI/Missions/init.lua +++ b/src/client/UI/Missions/init.lua @@ -13,16 +13,36 @@ local Zone = require(ReplicatedStorage.Common.lib.ZonePlus) local Janitor = require(ReplicatedStorage.Common.lib.Janitor) local selectors = require(ReplicatedStorage.Common.State.selectors) local formatter = require(ReplicatedStorage.Common.Utils.Formatter) +local playerStatePromise = require(Client.State.PlayerStatePromise) local regionUtils = require(ReplicatedStorage.Common.Utils.Player.RegionUtils) local CentralUI = require(StarterPlayer.StarterPlayerScripts.Client.UI.CentralUI) local interfaces = require(StarterPlayer.StarterPlayerScripts.Client.UI.CollidableInterfaces) +local statusUIListeners = {} local missionRequirements = ReplicatedStorage.Missions local missionSkipProductID = ReplicatedStorage.Config.DevProductData.IDs.MissionSkip.Value local rolloutSpeed = ReplicatedStorage.Config.Text.MissionTextRolloutSpeed.Value local MissionsUI = CentralUI.new(player.PlayerGui:WaitForChild "MissionsUI") local MissionFearRewardUI = require(script.MissionFearRewardUI) +local function handleMissionStatusUI(statusUI, areaName) + local frame = statusUI.MissionUI.Frame + statusUIListeners[areaName] = function(missionData) + local currentMissionRequirements = missionRequirements[areaName][tostring(missionData.CurrentMissionNumber)] + if missionData.Active then + if missionData.CurrentMissionProgress == currentMissionRequirements.Requirements.Value then + frame.Mission.Visible = false + frame.Completed.Visible = true + return + end + else + frame.Completed.Visible = false + frame.Mission.Visible = true + return + end + end +end + function MissionsUI:_initialize(): () self._janitor = Janitor.new() interfaces[self] = true @@ -51,7 +71,6 @@ function MissionsUI:_initialize(): () end MarketplaceService:PromptProductPurchase(player, missionSkipProductID) - self:setEnabled(false) end) for _, hitbox in CollectionService:GetTagged "NPCHitbox" do @@ -256,6 +275,7 @@ end for _, missionPrompt in CollectionService:GetTagged "MissionPrompt" do local debounce = false + local areaName = missionPrompt.Parent.Parent.Name:sub(1, -12) missionPrompt.Triggered:Connect(function(source) if source ~= player or debounce then return @@ -265,9 +285,27 @@ for _, missionPrompt in CollectionService:GetTagged "MissionPrompt" do task.wait(0.5) debounce = false end) + handleMissionStatusUI(missionPrompt.Parent.Parent.MissionStatus, areaName) end task.spawn(MissionsUI._initialize, MissionsUI) +playerStatePromise:andThen(function() + for areaName, listener in statusUIListeners do + listener(selectors.getMissionData(store:getState(), player.Name)[areaName]) + end + store.changed:connect(function(newState, oldState) + local newMissionData = selectors.getMissionData(newState, player.Name) + local oldMissionData = selectors.getMissionData(oldState, player.Name) + if newMissionData == oldMissionData then + return + end + MissionsUI:OnOpen() + for areaName, listener in statusUIListeners do + listener(newMissionData[areaName]) + end + end) +end) + require(script.ProgressUI) return 0 From a94c48fe6c3664bf106c66cb34821ca20d5897b7 Mon Sep 17 00:00:00 2001 From: Pluviolithic <94190216+Pluviolithic@users.noreply.github.com> Date: Fri, 20 Oct 2023 23:14:39 -0400 Subject: [PATCH 11/11] Fix skipping final mission --- src/client/UI/Missions/init.lua | 1 - src/server/Commands/Players/CompleteMission.lua | 5 ----- src/server/Commands/Players/CompleteMissionServer.lua | 9 +++++++-- .../DeveloperProducts/Products/Rewarders.lua | 2 +- src/server/State/Actions/MissionActions.lua | 3 ++- src/shared/State/Reducer/MissionData.lua | 11 +++++++---- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/client/UI/Missions/init.lua b/src/client/UI/Missions/init.lua index fa914ea..bd2630f 100644 --- a/src/client/UI/Missions/init.lua +++ b/src/client/UI/Missions/init.lua @@ -99,7 +99,6 @@ function MissionsUI:RolloutDialogue(dialogueSegment, gemRewardValue) attributeValue, '' .. gemRewardText .. "" ) - print(text) continue end diff --git a/src/server/Commands/Players/CompleteMission.lua b/src/server/Commands/Players/CompleteMission.lua index 0a75076..0f60806 100644 --- a/src/server/Commands/Players/CompleteMission.lua +++ b/src/server/Commands/Players/CompleteMission.lua @@ -9,10 +9,5 @@ return { Name = "Player", Description = "The player whose mission you want to complete.", }, - { - Type = "number", - Name = "GemReward", - Description = "The reward you want to give in gems.", - }, }, } diff --git a/src/server/Commands/Players/CompleteMissionServer.lua b/src/server/Commands/Players/CompleteMissionServer.lua index 5e91da4..a05a42f 100644 --- a/src/server/Commands/Players/CompleteMissionServer.lua +++ b/src/server/Commands/Players/CompleteMissionServer.lua @@ -7,9 +7,14 @@ local actions = require(server.State.Actions) local selectors = require(ReplicatedStorage.Common.State.selectors) local regionUtils = require(ReplicatedStorage.Common.Utils.Player.RegionUtils) -return function(_, player: Player, gemReward: number) +return function(_, player: Player) if not selectors.isPlayerLoaded(store:getState(), player.Name) then return end - store:dispatch(actions.completeMission(player.Name, regionUtils.getPlayerLocationName(player.Name), gemReward)) + local areaName = regionUtils.getPlayerLocationName(player.Name) + local currentMissionData = selectors.getMissionData(store:getState(), player.Name)[areaName] + local gemReward = ReplicatedStorage.Missions[areaName][tostring(currentMissionData.CurrentMissionNumber)].Gems.Value + store:dispatch( + actions.completeMission(player.Name, regionUtils.getPlayerLocationName(player.Name), gemReward, true) + ) end diff --git a/src/server/PurchaseManager/DeveloperProducts/Products/Rewarders.lua b/src/server/PurchaseManager/DeveloperProducts/Products/Rewarders.lua index c4e9cbc..bab6458 100644 --- a/src/server/PurchaseManager/DeveloperProducts/Products/Rewarders.lua +++ b/src/server/PurchaseManager/DeveloperProducts/Products/Rewarders.lua @@ -14,6 +14,6 @@ return { local currentMissionData = selectors.getMissionData(store:getState(), player.Name)[areaName] local gemReward = ReplicatedStorage.Missions[areaName][tostring(currentMissionData.CurrentMissionNumber)].Gems.Value - store:dispatch(actions.completeMission(player.Name, areaName, gemReward)) + store:dispatch(actions.completeMission(player.Name, areaName, gemReward, true)) end, } diff --git a/src/server/State/Actions/MissionActions.lua b/src/server/State/Actions/MissionActions.lua index 6117485..9ec3ae7 100644 --- a/src/server/State/Actions/MissionActions.lua +++ b/src/server/State/Actions/MissionActions.lua @@ -12,11 +12,12 @@ return { end), completeMission = makeActionCreator( "completeMission", - function(playerName: string, areaName: string, gemReward: number) + function(playerName: string, areaName: string, gemReward: number, skipped: boolean) return { areaName = areaName, playerName = playerName, gemReward = gemReward, + skipped = skipped, shouldSave = true, } end diff --git a/src/shared/State/Reducer/MissionData.lua b/src/shared/State/Reducer/MissionData.lua index 8c05aed..526ca91 100644 --- a/src/shared/State/Reducer/MissionData.lua +++ b/src/shared/State/Reducer/MissionData.lua @@ -38,14 +38,17 @@ return Rodux.createReducer({}, { completeMission = function(state, action) return produce(state, function(draft) draft[action.playerName][action.areaName].Active = false - - local playerRegion = regionUtils.getPlayerLocationName(action.playerName) - local nextMissionRequirements = missionRequirements[playerRegion]:FindFirstChild( - tostring(state[action.playerName][playerRegion].CurrentMissionNumber + 1) + local nextMissionRequirements = missionRequirements[action.areaName]:FindFirstChild( + tostring(state[action.playerName][action.areaName].CurrentMissionNumber + 1) ) if nextMissionRequirements then draft[action.playerName][action.areaName].CurrentMissionProgress = 0 draft[action.playerName][action.areaName].CurrentMissionNumber += 1 + elseif action.skipped then + draft[action.playerName][action.areaName].CurrentMissionProgress = + missionRequirements[action.areaName][tostring( + state[action.playerName][action.areaName].CurrentMissionNumber + )].Requirements.Value end end) end,