From 56c0007caf430c559f4fc25c9282828fdb9a5cec Mon Sep 17 00:00:00 2001 From: DrakiaXYZ Date: Fri, 8 Mar 2024 09:00:06 +0000 Subject: [PATCH] Fix scav case timer not taking crafting skill into account (!252) The assembly calculation for scav case timer first applies the player's crafting skill reduction, then multiplies by the resulting time by the Fence modifier: ``` return base.ReductionCoefficient * this.fenceTraderInfo_0.FenceLoyalty.ScavCaseTimeModifier; ``` This change makes the server calculation match this expected value Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com> Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/252 Co-authored-by: DrakiaXYZ Co-committed-by: DrakiaXYZ --- project/src/controllers/HideoutController.ts | 8 +++++--- project/src/helpers/HideoutHelper.ts | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/project/src/controllers/HideoutController.ts b/project/src/controllers/HideoutController.ts index 59053902..889fdee6 100644 --- a/project/src/controllers/HideoutController.ts +++ b/project/src/controllers/HideoutController.ts @@ -675,9 +675,11 @@ export class HideoutController } // @Important: Here we need to be very exact: - // - normal recipe: Production time value is stored in attribute "productionType" with small "p" - // - scav case recipe: Production time value is stored in attribute "ProductionType" with capital "P" - const modifiedScavCaseTime = this.getScavCaseTime(pmcData, recipe.ProductionTime); + // - normal recipe: Production time value is stored in attribute "productionTime" with small "p" + // - scav case recipe: Production time value is stored in attribute "ProductionTime" with capital "P" + const adjustedCraftTime = recipe.ProductionTime + - this.hideoutHelper.getCraftingSkillProductionTimeReduction(pmcData, recipe.ProductionTime); + const modifiedScavCaseTime = this.getScavCaseTime(pmcData, adjustedCraftTime); pmcData.Hideout.Production[body.recipeId] = this.hideoutHelper.initProduction( body.recipeId, diff --git a/project/src/helpers/HideoutHelper.ts b/project/src/helpers/HideoutHelper.ts index 45250717..1698789e 100644 --- a/project/src/helpers/HideoutHelper.ts +++ b/project/src/helpers/HideoutHelper.ts @@ -999,7 +999,7 @@ export class HideoutHelper * @param productionTime Time to complete hideout craft in seconds * @returns Adjusted craft time in seconds */ - protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number + public getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number { const craftingSkill = pmcData.Skills.Common.find((skill) => skill.Id === SkillTypes.CRAFTING); if (!craftingSkill)