Fix achievement progress being wiped after doing a scav run (!232)

There is no need to copy all achievement counters from scav to PMC, we only need to copy the achievement counters where the achievement side is "Savage"

Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/232
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
This commit is contained in:
DrakiaXYZ 2024-02-18 16:32:46 +00:00 committed by chomp
parent c83f263173
commit 886d99bb71

View File

@ -412,6 +412,8 @@ export class InraidController
*/
protected migrateScavQuestProgressToPmcProfile(scavProfile: IPmcData, pmcProfile: IPmcData): void
{
const achievements = this.databaseServer.getTables().templates.achievements;
for (const quest of scavProfile.Quests)
{
const pmcQuest = pmcProfile.Quests.find((x) => x.qid === quest.qid);
@ -448,6 +450,13 @@ export class InraidController
// Loop over all scav counters and add into pmc profile
for (const scavCounter of Object.values(scavProfile.TaskConditionCounters))
{
// If this is an achievement that isn't for the scav, don't process it
const achievement = achievements.find((achievement) => achievement.id === scavCounter.sourceId);
if (achievement && achievement.side !== "Savage")
{
continue;
}
this.logger.debug(
`Processing counter: ${scavCounter.id} value: ${scavCounter.value} quest: ${scavCounter.sourceId}`,
);