diff --git a/components/menus/playerProfile.ts b/components/menus/playerProfile.ts index d3073ef8..cf1ab5fb 100644 --- a/components/menus/playerProfile.ts +++ b/components/menus/playerProfile.ts @@ -17,10 +17,11 @@ */ import { getConfig, getVersionedConfig } from "../configSwizzleManager" -import type { +import { ChallengeCategoryCompletion, GameVersion, PeacockLocationsData, + PlayerProfileLocation, PlayerProfileView, ProgressionData, } from "../types/types" @@ -137,6 +138,15 @@ export function getPlayerProfileData( playerProfilePage.PlayerProfileXp.Level = userProfile.Extensions.progression.PlayerProfileXP.ProfileLevel + // Stupid workaround for Ambrose being in H2 now + if (gameVersion === "h2") { + playerProfilePage.PlayerProfileXp.Seasons[1].Locations = + playerProfilePage.PlayerProfileXp.Seasons[1].Locations.filter( + (loc) => loc.LocationId !== "LOCATION_PARENT_ROCKY", + ) + playerProfilePage.PlayerProfileXp.Seasons.pop() + } + for (const season of playerProfilePage.PlayerProfileXp.Seasons) { for (const location of season.Locations) { const locationData = xpData[location.LocationId] @@ -160,5 +170,15 @@ export function getPlayerProfileData( } } + // Final reordering for H2 + if (gameVersion === "h2") { + playerProfilePage.PlayerProfileXp.Sublocations = + playerProfilePage.PlayerProfileXp.Seasons.reduce((data, season) => { + return data.concat(season.Locations) + }, [] as PlayerProfileLocation[]) + // @ts-ignore H2 does not use this + delete playerProfilePage.PlayerProfileXp.Seasons + } + return playerProfilePage } diff --git a/components/types/types.ts b/components/types/types.ts index 30259454..1a3e25f4 100644 --- a/components/types/types.ts +++ b/components/types/types.ts @@ -410,6 +410,16 @@ export type MissionStory = { Image: string } +export type PlayerProfileLocation = { + LocationId: string + Xp: number + ActionXp: number + LocationProgression?: { + Level: number + MaxLevel: number + } +} + export type PlayerProfileView = { SubLocationData: { ParentLocation: Unlockable @@ -423,17 +433,10 @@ export type PlayerProfileView = { PlayerProfileXp: { Total: number Level: number + Sublocations?: PlayerProfileLocation[] Seasons: { Number: number - Locations: { - LocationId: string - Xp: number - ActionXp: number - LocationProgression?: { - Level: number - MaxLevel: number - } - }[] + Locations: PlayerProfileLocation[] }[] } } diff --git a/static/PlayerProfileView.json b/static/PlayerProfileView.json index a0d88674..51147ec7 100644 --- a/static/PlayerProfileView.json +++ b/static/PlayerProfileView.json @@ -116,6 +116,15 @@ "MaxLevel": 20 } }, + { + "LocationId": "LOCATION_PARENT_ROCKY", + "Xp": 0, + "ActionXp": 0, + "LocationProgression": { + "Level": 1, + "MaxLevel": 20 + } + }, { "LocationId": "LOCATION_PARENT_NORTHSEA", "Xp": 0, @@ -217,15 +226,6 @@ "MaxLevel": 5 } }, - { - "LocationId": "LOCATION_PARENT_ROCKY", - "Xp": 0, - "ActionXp": 0, - "LocationProgression": { - "Level": 1, - "MaxLevel": 20 - } - }, { "LocationId": "LOCATION_PARENT_SNUG", "Xp": 0,