1
mirror of https://github.com/thepeacockproject/Peacock synced 2024-11-16 11:03:30 +01:00

fix(playerprofile): ambrose showing in S3, not working in H2

This commit is contained in:
AnthonyFuller 2024-09-12 15:50:04 +01:00
parent 0a9e17859b
commit 09ea251193
3 changed files with 42 additions and 19 deletions

View File

@ -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
}

View File

@ -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[]
}[]
}
}

View File

@ -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,