From 1a15f4cf71d2e128149e631a5b6964a91668e7cd Mon Sep 17 00:00:00 2001 From: moonysolari <118079569+moonysolari@users.noreply.github.com> Date: Thu, 26 Jan 2023 10:15:27 -0500 Subject: [PATCH] Fix HITMAN 2 stuck at loading main menu (#91) * Fix H2 hub stuck at loading --- components/controller.ts | 13 +++++++++++-- components/menuData.ts | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/components/controller.ts b/components/controller.ts index 6f29464b..afb93788 100644 --- a/components/controller.ts +++ b/components/controller.ts @@ -1201,11 +1201,20 @@ export function contractIdToHitObject( } const subLocation = getSubLocationFromContract(contract, gameVersion) + let parentLocId = subLocation?.Properties?.ParentLocation + if (parentLocId === "LOCATION_PARENT_ICA_SHIP_FACILITY") { + parentLocId = "LOCATION_PARENT_ICA_FACILITY" + } + + if (parentLocId === "LOCATION_PARENT_COASTALTOWN_EBOLA") { + parentLocId = "LOCATION_PARENT_COASTALTOWN" + } + const parentLocation = getVersionedConfig( "LocationsData", gameVersion, false, - ).parents[subLocation?.Properties?.ParentLocation] + ).parents[parentLocId] // failed to find the location, must be from a newer game if (!subLocation && (gameVersion === "h1" || gameVersion === "h2")) { @@ -1224,7 +1233,7 @@ export function contractIdToHitObject( } const challenges = controller.challengeService.getGroupedChallengeLists({ type: ChallengeFilterType.ParentLocation, - locationParentId: parentLocation.Id, + locationParentId: parentLocation?.Id, }) const challengeCompletion = controller.challengeService.countTotalNCompletedChallenges( diff --git a/components/menuData.ts b/components/menuData.ts index 6f3fceed..4c979990 100644 --- a/components/menuData.ts +++ b/components/menuData.ts @@ -232,7 +232,7 @@ menuDataRouter.get("/Hub", (req: RequestWithJwt, res) => { req.gameVersion, ) - career[parent].Children.push({ + career[parent]?.Children.push({ IsLocked: location.Properties.IsLocked, Name: location.DisplayNameLocKey, Image: location.Properties.Icon,