From 00fffa784593e8b7e494e67caedd24aa11eee9a6 Mon Sep 17 00:00:00 2001 From: Cj Date: Mon, 15 Jul 2024 19:34:26 +0000 Subject: [PATCH] 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 Co-committed-by: Cj --- project/src/services/ProfileFixerService.ts | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/project/src/services/ProfileFixerService.ts b/project/src/services/ProfileFixerService.ts index e4dff527..20d1fe2d 100644 --- a/project/src/services/ProfileFixerService.ts +++ b/project/src/services/ProfileFixerService.ts @@ -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);