mirror of
https://github.com/thepeacockproject/Peacock
synced 2025-02-23 03:35:25 +01:00
Respect inclusion data for GlobalChallenges
This commit is contained in:
parent
c617a23a04
commit
275cb417b2
@ -493,11 +493,37 @@ profileRouter.post(
|
||||
return res.json([])
|
||||
}
|
||||
|
||||
let challenges: CompiledChallengeRuntimeData[] = getVersionedConfig(
|
||||
"GlobalChallenges",
|
||||
req.gameVersion,
|
||||
true,
|
||||
)
|
||||
let challenges: CompiledChallengeRuntimeData[] = (
|
||||
getVersionedConfig(
|
||||
"GlobalChallenges",
|
||||
req.gameVersion,
|
||||
true,
|
||||
) as CompiledChallengeRuntimeData[]
|
||||
).filter((val) => {
|
||||
if (!val.Challenge.InclusionData) return true
|
||||
let include = false
|
||||
const incData = val.Challenge.InclusionData
|
||||
|
||||
if (!include && incData.ContractIds) {
|
||||
include = incData.ContractIds.includes(json.Metadata.Id)
|
||||
}
|
||||
|
||||
if (!include && incData.ContractTypes) {
|
||||
include = incData.ContractTypes.includes(json.Metadata.Type)
|
||||
}
|
||||
|
||||
if (!include && incData.Locations) {
|
||||
include = incData.Locations.includes(json.Metadata.Location)
|
||||
}
|
||||
|
||||
if (!include && incData.GameModes) {
|
||||
include = json.Metadata.Gamemodes.some((r) =>
|
||||
incData.GameModes.includes(r),
|
||||
)
|
||||
}
|
||||
|
||||
return include
|
||||
})
|
||||
|
||||
challenges.push(
|
||||
...Object.values(
|
||||
|
Loading…
x
Reference in New Issue
Block a user