Add method for capping skill progress (!376)

Adds a check to the `ProfileFixerService` to cap skill progress at 5100. This prevents users from going over the cap with applications like profile editor, resulting in potential negative crafting times and other oddities.

Co-authored-by: Cj <161484149+CJ-SPT@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT/Server/pulls/376
Co-authored-by: Cj <cj@noreply.dev.sp-tarkov.com>
Co-committed-by: Cj <cj@noreply.dev.sp-tarkov.com>
This commit is contained in:
Cj 2024-07-15 19:34:26 +00:00 committed by chomp
parent 4fd113d00d
commit 00fffa7845

View File

@ -157,6 +157,11 @@ export class ProfileFixerService
}
}
if (pmcProfile.Skills)
{
this.checkForSkillsOverMaxLevel(pmcProfile);
}
this.fixNullTraderSalesSums(pmcProfile);
this.fixNullTraderNextResupply(pmcProfile);
this.updateProfileQuestDataValues(pmcProfile);
@ -171,6 +176,23 @@ export class ProfileFixerService
this.updateProfileQuestDataValues(scavProfile);
}
/**
* Check for and cap profile skills at 5100.
* @param pmcProfile profile to check and fix
*/
protected checkForSkillsOverMaxLevel(pmcProfile: IPmcData): void
{
const skills = pmcProfile.Skills.Common;
for (let skill of skills)
{
if (skill.Progress > 5100)
{
skill.Progress = 5100;
}
}
}
protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void
{
const weaponStandArea = pmcProfile.Hideout.Areas.find((x) => x.type === HideoutAreas.WEAPON_STAND);