Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions components/candle/challengeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import type {
GameVersion,
MissionManifest,
PeacockLocationsData,
PeacockContentMode,
RegistryChallenge,
Unlockable,
UserProfile,
Expand Down Expand Up @@ -71,6 +72,7 @@ import { getUserEscalationProgress } from "../contracts/escalations/escalationSe
import { getUnlockableById } from "../inventory"
import { enqueueEvent } from "../eventHandler"
import { randomUUID } from "crypto"
import { getFlag } from "../flags"

type ChallengeDefinitionLike = {
Context?: Record<string, unknown>
Expand Down Expand Up @@ -319,10 +321,18 @@ export abstract class ChallengeRegistry {

const set = locationMap.get(groupId)!

const peacockContent = <PeacockContentMode>getFlag("peacockContent")

for (const challenge of challenges) {
challenge.inGroup = groupId
challenge.inLocation = location
challenge.Type ??= "contract"

if (challenge.Tags.includes("peacock")) {
if (peacockContent === "NOXP") challenge.Rewards.MasteryXP = 0
else if (peacockContent === "DISABLED") continue
}

this.challenges[gameVersion].set(challenge.Id, challenge)
set.add(challenge.Id)
this.checkHeuristics(challenge, gameVersion)
Expand Down
47 changes: 47 additions & 0 deletions components/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ import type {
GenSingleMissionFunc,
GenSingleVideoFunc,
Hit,
MILLocations,
MissionManifest,
PeacockLocationsData,
PeacockContentMode,
PlayNextGetCampaignsHookReturn,
RegistryChallenge,
RequestWithJwt,
Expand Down Expand Up @@ -305,6 +307,51 @@ function registerInternals(contracts: MissionManifest[]): void {
})
}

if (<PeacockContentMode>getFlag("peacockContent") === "DISABLED") {
const toDelete = new Set<string>()

type MILLocationsRec = MILLocations & {
[key: string]: MILLocations | string[]
}

function deleteContracts(contracts: MILLocationsRec) {
for (const [key, list] of Object.entries(contracts)) {
if (typeof list === "string") {
if (toDelete.has(list)) delete contracts[key]
} else if (Array.isArray(list)) {
contracts[key] = list.filter((id) => !toDelete.has(id))
} else {
deleteContracts(<MILLocationsRec>list)
}
}
}

contracts = contracts.filter((contract) => {
if (contract.Peacock?.type === "peacock") {
// We need to delete the contracts from hardcoded missionsInLocation
// in order to avoid issues with missing contracts in registry.
toDelete.add(contract.Metadata.Id)

if (contract.Metadata.Type === "arcade") {
orderedETAs.splice(
orderedETAs.indexOf(contract.Metadata.Id),
1,
)
}

return false
}

return true
Comment on lines +329 to +345
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm very happy with this PR except for this part. I'd much rather the menu do this filtering rather than delegating it to the internal registration. Otherwise, this won't work for plugins, etc. It also just generally feels out of place here.

})

if (toDelete.size) {
deleteContracts(missionsInLocation.h1)
deleteContracts(missionsInLocation.h2)
deleteContracts(missionsInLocation.h3)
}
}

for (const contract of contracts) {
internalContracts[contract.Metadata.Id] = contract
}
Expand Down
9 changes: 9 additions & 0 deletions components/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ export const defaultFlags: Flags = {
possibleValues: ["vanilla", "sane"],
default: "vanilla",
},
peacockContent: {
category: "Gameplay",
title: "peacockContent",
desc: "Enables peacock-exclusive content. Some otherwise unobtainable content is tied to peacock escalations and challengegs. NOXP will keep the content but will not award XP bonus upon completion. ENABLED/DISABLED will enable and disable the content respectively.",
possibleValues: ["ENABLED", "NOXP", "DISABLED"],
default: "ENABLED",
requiresGameRestart: true,
requiresPeacockRestart: true,
},
legacyElusivesEnableSaving: {
category: "Services",
title: "legacyElusivesEnableSaving",
Expand Down
21 changes: 13 additions & 8 deletions components/menus/hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,23 @@ export function getHubData(gameVersion: GameVersion, userId: string) {
] of controller.challengeService.challengePacks.entries()) {
if (!pack.GameVersions.includes(gameVersion)) continue

const packCompletion =
controller.challengeService.countTotalNCompletedChallenges(
controller.challengeService.getChallengesForGroup(
id,
gameVersion,
),
userId,
gameVersion,
)

if (packCompletion.ChallengesCount === 0) continue

career[id] = {
Children: [
generateCareerEntryChild(
locations.parents["LOCATION_PARENT_ICA_FACILITY"],
controller.challengeService.countTotalNCompletedChallenges(
controller.challengeService.getChallengesForGroup(
id,
gameVersion,
),
userId,
gameVersion,
),
packCompletion,
id,
),
],
Expand Down
6 changes: 6 additions & 0 deletions components/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,11 @@ export interface MissionManifest {
Metadata: MissionManifestMetadata
readonly UserData?: Record<string, never> | never[]
Peacock?: {
/**
* Indicates the contract type for filtering purposes.
* SHOULD be set to `peacock` for Peacock-exclusive content (processed by `peacockContent` flag).
*/
type?: "peacock"
noAgencyPickupsActive?: boolean
noGear?: boolean
noCarriedWeapon?: boolean
Expand Down Expand Up @@ -1317,6 +1322,7 @@ export interface CompiledChallengeRuntimeData {

export type LoadoutSavingMechanism = "PROFILES" | "LEGACY"
export type ImageLoadingStrategy = "SAVEASREQUESTED" | "ONLINE" | "OFFLINE"
export type PeacockContentMode = "ENABLED" | "NOXP" | "DISABLED"

export type Flag = {
category?: string
Expand Down
3 changes: 3 additions & 0 deletions contractdata/AMBROSE/ESCALATION/PONTUS/PONTUS.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,8 @@
"Entitlements": ["LOCATION_ROCKY"],
"Season": 0,
"OriginalSeason": 3
},
"Peacock": {
"type": "peacock"
}
}
3 changes: 3 additions & 0 deletions contractdata/AMBROSE/ESCALATION/PONTUS/PONTUS1.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,8 @@
"Type": "escalation",
"Entitlements": ["LOCATION_ROCKY"],
"InGroup": "50fa5e99-0b51-45d4-9062-cd46dd928461"
},
"Peacock": {
"type": "peacock"
}
}
3 changes: 3 additions & 0 deletions contractdata/AMBROSE/ESCALATION/PONTUS/PONTUS2.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,8 @@
"IsNew": true
}
]
},
"Peacock": {
"type": "peacock"
}
}
3 changes: 3 additions & 0 deletions contractdata/AMBROSE/ESCALATION/PONTUS/PONTUS3.json
Original file line number Diff line number Diff line change
Expand Up @@ -253,5 +253,8 @@
"Id": "07b1bc1d-f52b-4004-a760-846c4bc3f172"
}
]
},
"Peacock": {
"type": "peacock"
}
}
12 changes: 9 additions & 3 deletions contractdata/AMBROSE/_AMBROSE_CHALLENGES.json
Original file line number Diff line number Diff line change
Expand Up @@ -2269,7 +2269,7 @@
}
}
},
"Tags": ["feats", "hard"],
"Tags": ["feats", "hard", "peacock"],
"InclusionData": {
"ContractIds": ["50fa5e99-0b51-45d4-9062-cd46dd928461"]
}
Expand Down Expand Up @@ -3349,7 +3349,7 @@
}
}
},
"Tags": ["cheesecake-pack", "story", "hard"],
"Tags": ["cheesecake-pack", "story", "hard", "peacock"],
"InclusionData": {
"ContractIds": [
"179563a4-727a-4072-b354-c9fff4e8bff0",
Expand Down Expand Up @@ -3487,7 +3487,13 @@
}
}
},
"Tags": ["cheesecake-pack", "story", "live", "medium"],
"Tags": [
"cheesecake-pack",
"story",
"live",
"medium",
"peacock"
],
"InclusionData": {
"ContractIds": ["b2aac100-dfc7-4f85-b9cd-528114436f6c"]
}
Expand Down
5 changes: 4 additions & 1 deletion contractdata/ARCADE/KASTURI/KASTURI.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@
},
"LastUpdate": "2023-02-24T10:14:36.1236307Z"
},
"UserData": {}
"UserData": {},
"Peacock": {
"type": "peacock"
}
}
5 changes: 4 additions & 1 deletion contractdata/ARCADE/KASTURI/KASTURI1.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,8 @@
{ "Id": "611cbf7d-7871-4a02-843a-06d523563519" }
]
},
"UserData": {}
"UserData": {},
"Peacock": {
"type": "peacock"
}
}
5 changes: 4 additions & 1 deletion contractdata/ARCADE/KASTURI/KASTURI2.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,8 @@
{ "Id": "c2b3f8e3-0eaf-41b3-8b8c-3cf012a1d0bc" }
]
},
"UserData": {}
"UserData": {},
"Peacock": {
"type": "peacock"
}
}
5 changes: 4 additions & 1 deletion contractdata/ARCADE/KASTURI/KASTURI3.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,8 @@
{ "Id": "3b6a356b-550f-4097-98c2-59b250136443" }
]
},
"UserData": {}
"UserData": {},
"Peacock": {
"type": "peacock"
}
}
2 changes: 1 addition & 1 deletion contractdata/ARCADE/_ARCADE_CHALLENGES.json
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@
}
}
},
"Tags": ["arcade", "hard"],
"Tags": ["arcade", "hard", "peacock"],
"InclusionData": {
"ContractIds": ["797e204a-ef3d-463b-a386-57df0fe29b8f"]
}
Expand Down
5 changes: 4 additions & 1 deletion contractdata/BERLIN/ESCALATION/CASPER/CASPER.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,8 @@
"Season": 0,
"OriginalSeason": 3
},
"UserData": {}
"UserData": {},
"Peacock": {
"type": "peacock"
}
}
5 changes: 4 additions & 1 deletion contractdata/BERLIN/ESCALATION/CASPER/CASPER1.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,8 @@
"Season": 0,
"OriginalSeason": 3
},
"UserData": {}
"UserData": {},
"Peacock": {
"type": "peacock"
}
}
5 changes: 4 additions & 1 deletion contractdata/BERLIN/ESCALATION/CASPER/CASPER2.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,8 @@
"Season": 0,
"OriginalSeason": 3
},
"UserData": {}
"UserData": {},
"Peacock": {
"type": "peacock"
}
}
5 changes: 4 additions & 1 deletion contractdata/BERLIN/ESCALATION/CASPER/CASPER3.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,5 +244,8 @@
"Season": 0,
"OriginalSeason": 3
},
"UserData": {}
"UserData": {},
"Peacock": {
"type": "peacock"
}
}
3 changes: 3 additions & 0 deletions contractdata/BERLIN/ESCALATION/MENDIE/MENDIE.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@
},
"Season": 0,
"OriginalSeason": 3
},
"Peacock": {
"type": "peacock"
}
}
3 changes: 3 additions & 0 deletions contractdata/BERLIN/ESCALATION/MENDIE/MENDIE1.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,8 @@
"InGroup": "ccdc7043-62af-44e8-a5fc-38b008c2044e",
"TileImage": "images/contracts/escalation/contractescalation_shangrila.jpg",
"Entitlements": ["LOCATION_EDGY"]
},
"Peacock": {
"type": "peacock"
}
}
3 changes: 3 additions & 0 deletions contractdata/BERLIN/ESCALATION/MENDIE/MENDIE2.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,8 @@
],
"TileImage": "images/contracts/escalation/contractescalation_shangrila.jpg",
"Entitlements": ["LOCATION_EDGY"]
},
"Peacock": {
"type": "peacock"
}
}
3 changes: 3 additions & 0 deletions contractdata/BERLIN/ESCALATION/MENDIE/MENDIE3.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,5 +342,8 @@
],
"TileImage": "images/contracts/escalation/contractescalation_shangrila.jpg",
"Entitlements": ["LOCATION_EDGY"]
},
"Peacock": {
"type": "peacock"
}
}
4 changes: 2 additions & 2 deletions contractdata/BERLIN/_BERLIN_CHALLENGES.json
Original file line number Diff line number Diff line change
Expand Up @@ -2735,7 +2735,7 @@
}
}
},
"Tags": ["feats", "hard"],
"Tags": ["feats", "hard", "peacock"],
"InclusionData": {
"ContractIds": ["ccdc7043-62af-44e8-a5fc-38b008c2044e"]
}
Expand Down Expand Up @@ -2778,7 +2778,7 @@
}
}
},
"Tags": ["feats", "hard"],
"Tags": ["feats", "hard", "peacock"],
"InclusionData": {
"ContractIds": ["5bc6a2a3-d80a-4cb3-9ebc-a93d9238950d"]
}
Expand Down
3 changes: 3 additions & 0 deletions contractdata/CHONGQING/ESCALATION/KOATSC/KOATSC.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,8 @@
},
"Season": 0,
"OriginalSeason": 3
},
"Peacock": {
"type": "peacock"
}
}
5 changes: 4 additions & 1 deletion contractdata/CHONGQING/ESCALATION/KOATSC/KOATSC1.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,8 @@
"Entitlements": ["LOCATION_WET"],
"InGroup": "07ffa72a-bbac-45ca-8c9f-b9c1b526153a"
},
"UserData": {}
"UserData": {},
"Peacock": {
"type": "peacock"
}
}
Loading