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

Commit

Permalink
Add gem and fear multiplier gamepasses
Browse files Browse the repository at this point in the history
  • Loading branch information
Pluviolithic committed Oct 23, 2023
1 parent df66484 commit 3742388
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 10 deletions.
5 changes: 5 additions & 0 deletions src/client/UI/Missions/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ local interfaces = require(StarterPlayer.StarterPlayerScripts.Client.UI.Collidab
local statusUIListeners = {}
local missionRequirements = ReplicatedStorage.Missions
local missionSkipProductID = ReplicatedStorage.Config.DevProductData.IDs.MissionSkip.Value
local doubleGemsGamepassID = tostring(ReplicatedStorage.Config.GamepassData.IDs["2xGems"].Value)
local rolloutSpeed = ReplicatedStorage.Config.Text.MissionTextRolloutSpeed.Value
local MissionsUI = CentralUI.new(player.PlayerGui:WaitForChild "MissionsUI")
local MissionFearRewardUI = require(script.MissionFearRewardUI)
Expand Down Expand Up @@ -87,6 +88,10 @@ function MissionsUI:_initialize(): ()
end

function MissionsUI:RolloutDialogue(dialogueSegment, gemRewardValue)
if selectors.hasGamepass(store:getState(), player.Name, doubleGemsGamepassID) then
gemRewardValue *= 2
end

local splitText = {}
local text = if typeof(dialogueSegment) == "string" then dialogueSegment else dialogueSegment.Value
local gemRewardText = formatter.formatNumberWithSuffix(gemRewardValue) .. " Gems"
Expand Down
3 changes: 2 additions & 1 deletion src/server/Combat/Missions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Remotes.Server:Get("CompleteMission"):SetCallback(function(player: Player)
return false
end

store:dispatch(actions.completeMission(player.Name, areaName, currentMissionRequirements.Gems.Value))
store:dispatch(actions.completeMission(player.Name, areaName))
store:dispatch(actions.incrementPlayerStat(player.Name, "Gems", currentMissionRequirements.Gems.Value))

return true
end)
Expand Down
1 change: 1 addition & 0 deletions src/server/PlayerManager/ProfileTemplate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ return {
MultiplierData = {
FearMultiplier = 1,
StrengthMultiplier = 1,
GemsMultiplier = 1,
},

PurchaseData = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ return {
[tostring(IDs["2xStrength"].Value)] = function(player: Player)
store:dispatch(actions.incrementPlayerMultiplier(player.Name, "StrengthMultiplier", 2))
end,
[tostring(IDs["2xFear"].Value)] = function(player: Player)
store:dispatch(actions.incrementPlayerMultiplier(player.Name, "FearMultiplier", 2))
end,
[tostring(IDs["2xGems"].Value)] = function(player: Player)
store:dispatch(actions.incrementPlayerMultiplier(player.Name, "GemsMultiplier", 2))
end,

[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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ return {
local gemReward =
ReplicatedStorage.Missions[areaName][tostring(currentMissionData.CurrentMissionNumber)].Gems.Value
store:dispatch(actions.completeMission(player.Name, areaName, gemReward, true))
store:dispatch(actions.incrementPlayerStat(player.Name, "Gems", gemReward))
end,
}
3 changes: 1 addition & 2 deletions src/server/State/Actions/MissionActions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ return {
end),
completeMission = makeActionCreator(
"completeMission",
function(playerName: string, areaName: string, gemReward: number, skipped: boolean)
function(playerName: string, areaName: string, skipped: boolean)
return {
areaName = areaName,
playerName = playerName,
gemReward = gemReward,
skipped = skipped,
shouldSave = true,
}
Expand Down
1 change: 1 addition & 0 deletions src/shared/State/DefaultStates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ return {
MultiplierData = {
FearMultiplier = 1,
StrengthMultiplier = 1,
GemsMultiplier = 1,
},

PetData = {
Expand Down
5 changes: 0 additions & 5 deletions src/shared/State/Reducer/Stats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,4 @@ return Rodux.createReducer({}, {
draft[action.playerName].CurrentPetEquipCount += removedPetEquipCount
end)
end,
completeMission = function(state, action)
return produce(state, function(draft)
draft[action.playerName].Gems += action.gemReward
end)
end,
})

0 comments on commit 3742388

Please sign in to comment.