From c5bb09cce52d72eabad8326bf40296bd2c6a0eb1 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 4 Jan 2024 17:17:11 +0000 Subject: [PATCH] Persist achievement data from client into server profile on raid end --- project/src/helpers/InRaidHelper.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/project/src/helpers/InRaidHelper.ts b/project/src/helpers/InRaidHelper.ts index ff09eda5..062685c6 100644 --- a/project/src/helpers/InRaidHelper.ts +++ b/project/src/helpers/InRaidHelper.ts @@ -229,6 +229,8 @@ export class InRaidHelper // Scav client data has standing values of 0 for all traders, DO NOT RUN ON SCAV RAIDS this.applyTraderStandingAdjustments(pmcData.TradersInfo, saveProgressRequest.profile.TradersInfo); + this.updateProfileAchievements(pmcData, saveProgressRequest.profile.Achievements); + this.profileFixerService.checkForAndFixPmcProfileIssues(pmcData); } @@ -466,6 +468,24 @@ export class InRaidHelper } } + /** + * Transfer client achievements into profile + * @param profile Player pmc profile + * @param clientAchievements Achievements from client + */ + protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record): void + { + if (!profile.Achievements) + { + profile.Achievements = {}; + } + + for (const achievementId in clientAchievements) + { + profile.Achievements[achievementId] = clientAchievements[achievementId]; + } + } + /** * Set the SPT inraid location Profile property to 'none' * @param sessionID Session id