Persist achievement data from client into server profile on raid end

This commit is contained in:
Dev 2024-01-04 17:17:11 +00:00
parent eeaa593ea4
commit c5bb09cce5

View File

@ -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<string, number>): 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