mirror of
https://github.com/thepeacockproject/Peacock
synced 2025-03-01 14:43:02 +01:00
Add support for elusivesAreShown
to arcade
This commit is contained in:
parent
d098c087e7
commit
3270faf9cd
@ -285,6 +285,35 @@ export const validateMission = (m: MissionManifest): boolean => {
|
||||
const internalContracts: Record<string, MissionManifest> = {}
|
||||
|
||||
function registerInternals(contracts: MissionManifest[]): void {
|
||||
if (getFlag("elusivesAreShown") === true) {
|
||||
contracts = contracts.map((contract) => {
|
||||
const c = { ...contract }
|
||||
|
||||
switch (c.Metadata.Type) {
|
||||
// @ts-expect-error no-fallthrough
|
||||
case "arcade":
|
||||
// Fallthrough to objective handling if it isn't a group definition
|
||||
if (c.Metadata.GroupDefinition) break
|
||||
// @eslint-disable-next-line no-fallthrough
|
||||
case "elusive":
|
||||
assert.ok(
|
||||
c.Data.Objectives,
|
||||
"elusive/arcade has no objectives",
|
||||
)
|
||||
c.Data.Objectives = c.Data.Objectives.map((obj) => {
|
||||
if (obj.SuccessEvent?.EventName === "Kill") {
|
||||
obj.IsHidden = false
|
||||
}
|
||||
|
||||
return obj
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
return c
|
||||
})
|
||||
}
|
||||
|
||||
for (const contract of contracts) {
|
||||
internalContracts[contract.Metadata.Id] = contract
|
||||
}
|
||||
@ -842,33 +871,6 @@ export class Controller {
|
||||
* @internal
|
||||
*/
|
||||
_addElusiveTargets(): void {
|
||||
if (getFlag("elusivesAreShown") === true) {
|
||||
registerInternals(
|
||||
this._internalElusives!.map((elusive) => {
|
||||
const e = { ...elusive }
|
||||
|
||||
assert.ok(e.Data.Objectives, "no objectives on ET")
|
||||
|
||||
e.Data.Objectives = e.Data.Objectives.map(
|
||||
(missionObjective) => {
|
||||
if (
|
||||
missionObjective.SuccessEvent?.EventName ===
|
||||
"Kill"
|
||||
) {
|
||||
missionObjective.IsHidden = false
|
||||
}
|
||||
|
||||
return missionObjective
|
||||
},
|
||||
)
|
||||
|
||||
return e
|
||||
}),
|
||||
)
|
||||
this._internalElusives = undefined
|
||||
return
|
||||
}
|
||||
|
||||
registerInternals(this._internalElusives!)
|
||||
this._internalElusives = undefined
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user