Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite the escalation service to use group contracts #63

Merged
merged 58 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
6efdfa6
Rewrite the escalation service to use group contracts (#28)
RDIL Dec 15, 2022
f0f1812
Fix build and type errors
RDIL Feb 1, 2023
291ae57
Improve Escalation Functionality with Contract Groups (#160)
moonysolari Mar 23, 2023
6a3686c
Fix Sinbad escalation and add group definition
VolkerSchlegel Apr 7, 2023
ebaf322
Add group contracts and fix InGroup IDs where needed
VolkerSchlegel Apr 7, 2023
403478c
Run prettier
VolkerSchlegel Apr 7, 2023
056fbc5
Add missing group definitions
VolkerSchlegel Apr 7, 2023
0865f32
Merge branch 'v6' into squash-temp
moonysolari Apr 7, 2023
037ec8d
Fixed id issues with sinbad
moonysolari Apr 7, 2023
6cb5abc
Fix missionsInLocation.ts
VolkerSchlegel Apr 7, 2023
5ef1252
Added groupdefinitions (#198)
riisikumi Apr 10, 2023
440ed71
Merge branch 'v6' into squash-temp
RDIL Apr 10, 2023
88eb470
Fix incorrect escalation contract ids
AnthonyFuller Apr 11, 2023
a2a502b
Remove missing escalations
AnthonyFuller Apr 11, 2023
2a3ab97
Add Ataro group definition
AnthonyFuller Apr 11, 2023
c41e723
Add 7DS entrances
AnthonyFuller Apr 11, 2023
98e484d
Restore no2016 functionality, add xmas to no2016 list
AnthonyFuller Apr 11, 2023
0ba8aad
Merge branch 'v6' into squash-temp
AnthonyFuller Apr 11, 2023
bb0b1c0
Add missing deluxe escalation entrance
AnthonyFuller Apr 11, 2023
23d3a1b
Fix linting
AnthonyFuller Apr 11, 2023
74146aa
Added h3 escalations (#204)
riisikumi Apr 11, 2023
d4dff9e
Fix escalation completion
AnthonyFuller Apr 11, 2023
6505974
Fix smilax level 1
AnthonyFuller Apr 11, 2023
07ecbcc
Fix escalation challenges not completing
AnthonyFuller Apr 11, 2023
b48aaa4
Get groups when resolving contracts
AnthonyFuller Apr 11, 2023
73dad25
track escalation challenge completion
moonysolari Apr 11, 2023
40733e7
fix mission end page for escalation challenges
moonysolari Apr 11, 2023
38af4ce
Merge branch 'v6' into squash-temp
AnthonyFuller Apr 11, 2023
daf2a83
Update GameChangerProperties
AnthonyFuller Apr 11, 2023
fea7712
Update EvergreenGameChangerProperties
AnthonyFuller Apr 11, 2023
9b4f1b5
Add new GameChangerProperties
AnthonyFuller Apr 11, 2023
0ee8e7f
Fix aborting on invalid escalation group
AnthonyFuller Apr 11, 2023
7833189
remove dupe yellow rabbit suit
moonysolari Apr 12, 2023
d8b3fa0
Merge branch 'squash-temp' of https://github.com/thepeacockproject/Pe…
moonysolari Apr 12, 2023
00075ff
Fixed DGS having no challenges on career page
moonysolari Apr 12, 2023
2661acc
run prettier
moonysolari Apr 12, 2023
9810849
Update Proloff Level 2
AnthonyFuller Apr 12, 2023
106a9f2
Update escalation hub tile to work with group contracts
AnthonyFuller Apr 12, 2023
ff10ce1
Merge branch 'v6' into squash-temp
AnthonyFuller Apr 12, 2023
263f7d0
Move escalations and elusives to subfolders
AnthonyFuller Apr 12, 2023
b1502f3
Add 7DS campaign
AnthonyFuller Apr 12, 2023
2254419
Fix escalation level picker
AnthonyFuller Apr 12, 2023
315be61
Fix escalations being incorrectly marked as completed
AnthonyFuller Apr 12, 2023
5d58f88
Remove completed status when editing escalation level progress
AnthonyFuller Apr 12, 2023
eb2ce90
Add new H3 escalations to level picker
AnthonyFuller Apr 12, 2023
aca151c
Add Season tag to elusives for future use
AnthonyFuller Apr 13, 2023
30ae2c0
Add Season tag to typedefs
AnthonyFuller Apr 13, 2023
f62b8a0
Respect Season tag when sending elusives
AnthonyFuller Apr 13, 2023
cb3f09d
Add Legacy Escalations
AnthonyFuller Apr 13, 2023
64be21f
Remove milfoil for now, add escalations to missions
AnthonyFuller Apr 14, 2023
21134cc
Move xmas escalation
AnthonyFuller Apr 14, 2023
56c4ade
Fix Snowdrop not showing in 2016
AnthonyFuller Apr 14, 2023
ea795b7
Add missing entitlements to escalations
AnthonyFuller Apr 14, 2023
f3a4198
Merge branch 'v6' into squash-temp
moonysolari Apr 14, 2023
241ee8a
Merge branch 'squash-temp' of https://github.com/thepeacockproject/Pe…
moonysolari Apr 14, 2023
2815cf3
Fix play next level in 2016, remove use of deprecated function
AnthonyFuller Apr 14, 2023
7182314
Move remaining Peacock escalations
AnthonyFuller Apr 14, 2023
8488e21
Swap out featured Peacock escalation
AnthonyFuller Apr 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 10 additions & 6 deletions components/candle/challengeHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
MissionManifest,
RegistryChallenge,
} from "../types/types"
import assert from "assert"
import { SavedChallengeGroup } from "../types/challenges"
import { controller } from "../controller"
import { gameDifficulty } from "../utils"
Expand Down Expand Up @@ -103,6 +102,7 @@ export function inclusionDataCheck(
contract: MissionManifest,
): boolean {
if (!incData) return true
if (!contract) return false

return (
incData.ContractIds?.includes(contract.Metadata.Id) ||
Expand Down Expand Up @@ -142,8 +142,11 @@ function isChallengeInContract(
challenge: RegistryChallenge,
forCareer = false,
): boolean {
assert.ok(contractId)
assert.ok(locationId)
// Currently don't have all the escalation groups
if (!contractId || !locationId) {
return false
}

if (!challenge) {
return false
}
Expand All @@ -161,6 +164,7 @@ function isChallengeInContract(
return true
}

const contract = controller.resolveContract(contractId, true)
if (challenge.Type === "global") {
return inclusionDataCheck(
// Global challenges should not be shown for "tutorial" missions unless for the career page,
Expand All @@ -174,13 +178,13 @@ function isChallengeInContract(
(type) => type !== "tutorial",
),
},
controller.resolveContract(contractId),
contract,
)
}

// Is this for the current contract?
// Is this for the current contract or group contract?
const isForContract = (challenge.InclusionData?.ContractIds || []).includes(
contractId,
contract.Metadata.Id,
)

// Is this a location-wide challenge?
Expand Down
16 changes: 9 additions & 7 deletions components/candle/challengeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ export class ChallengeService extends ChallengeRegistry {
gameVersion: GameVersion,
difficulty = 4,
): GroupIndexedChallengeLists {
const contract = this.controller.resolveContract(contractId)
const contract = this.controller.resolveContract(contractId, true)

assert.ok(contract)

Expand Down Expand Up @@ -555,7 +555,9 @@ export class ChallengeService extends ChallengeRegistry {

let contracts = isSniperLocation(child)
? this.controller.missionsInLocations.sniper[child]
: this.controller.missionsInLocations[child]
: (this.controller.missionsInLocations[child] ?? []).concat(
this.controller.missionsInLocations.escalations[child],
)
if (!contracts) {
contracts = []
}
Expand All @@ -580,14 +582,14 @@ export class ChallengeService extends ChallengeRegistry {
// brand new.
const { gameVersion, contractId, challengeContexts } = session

const contractJson = this.controller.resolveContract(contractId, true)

const challengeGroups = this.getChallengesForContract(
contractId,
contractJson.Metadata.Id,
gameVersion,
session.difficulty,
)

const contractJson = this.controller.resolveContract(contractId)

if (contractJson.Metadata.Type === "evergreen") {
session.evergreen = {
payout: 0,
Expand Down Expand Up @@ -769,7 +771,7 @@ export class ChallengeService extends ChallengeRegistry {
userId: string,
difficulty = 4,
): CompiledChallengeTreeCategory[] {
const contractData = this.controller.resolveContract(contractId)
const contractData = this.controller.resolveContract(contractId, true)

if (!contractData) {
return []
Expand All @@ -789,7 +791,7 @@ export class ChallengeService extends ChallengeRegistry {
}

const forContract = this.getChallengesForContract(
contractId,
contractData.Metadata.Id,
gameVersion,
difficulty,
)
Expand Down
13 changes: 7 additions & 6 deletions components/contracts/contractRouting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,13 @@ contractRoutingRouter.post(
// Add escalation data to Contract data HERE
contractData.Metadata = {
...contractData.Metadata,
...(await getPlayEscalationInfo(
contractData.Metadata.Type === "escalation",
req.jwt.unique_name,
contractIdToEscalationGroupId(req.body.id),
req.gameVersion,
)),
...(contractData.Metadata.Type === "escalation"
? getPlayEscalationInfo(
req.jwt.unique_name,
contractIdToEscalationGroupId(req.body.id),
req.gameVersion,
)
: {}),
...loadoutData,
...{
OpportunityData: getContractOpportunityData(req, contractData),
Expand Down
35 changes: 16 additions & 19 deletions components/contracts/dataGen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,28 +209,25 @@ export function generateUserCentric(
}

if (contractData.Metadata.Type === "escalation") {
const eGroupId = contractData.Metadata.InGroup
const eGroupId =
contractData.Metadata.InGroup ?? contractData.Metadata.Id

if (eGroupId) {
const p = getUserEscalationProgress(userData, eGroupId)
const p = getUserEscalationProgress(userData, eGroupId)

log(
LogLevel.DEBUG,
`Get EscalationUCProps - group: ${eGroupId} prog: ${p}`,
)
log(
LogLevel.DEBUG,
`Get EscalationUCProps - group: ${eGroupId} prog: ${p}`,
)

// I have absolutely no idea why,
// but this is incorrect on the destinations
// screen unless we do proper count - 1
// ANOTHER NOTE - Anthony:
// this currently doesn't mark it as completed when it is,
// unknown to why
uc.Data.EscalationCompletedLevels = p - 1
uc.Data.EscalationTotalLevels = getLevelCount(
controller.escalationMappings[eGroupId],
)
uc.Data.InGroup = eGroupId
}
// Probably not needed, just in case though.
delete uc.Data.Completed

uc.Data.EscalationCompletedLevels = p - 1
uc.Data.EscalationTotalLevels = getLevelCount(
controller.resolveContract(eGroupId),
)
uc.Data.EscalationCompleted = p === uc.Data.EscalationTotalLevels
if (contractData.Metadata.InGroup) uc.Data.InGroup = eGroupId
}

return uc
Expand Down
Loading