From db6ef9bddbe41a0eb4e852ec5162ad935e62321c Mon Sep 17 00:00:00 2001 From: DrakiaXYZ Date: Tue, 9 Apr 2024 07:48:18 +0000 Subject: [PATCH] Fix bitcoin production time being incorrect (!284) - Don't apply crafting skill cooldown reduction to bitcoin farm - Adjust profile bitcoin production time on login to be the correct production time (takes into account dev profile) Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com> Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/284 Co-authored-by: DrakiaXYZ Co-committed-by: DrakiaXYZ --- project/src/controllers/GameController.ts | 1 + project/src/helpers/HideoutHelper.ts | 22 +++++++++++++-------- project/src/services/ProfileFixerService.ts | 15 ++++++++++++++ 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/project/src/controllers/GameController.ts b/project/src/controllers/GameController.ts index cb8439e1..f32fed06 100644 --- a/project/src/controllers/GameController.ts +++ b/project/src/controllers/GameController.ts @@ -203,6 +203,7 @@ export class GameController this.hideoutHelper.setHideoutImprovementsToCompleted(pmcProfile); this.hideoutHelper.unlockHideoutWallInProfile(pmcProfile); this.profileFixerService.addMissingIdsToBonuses(pmcProfile); + this.profileFixerService.fixBitcoinProductionTime(pmcProfile); } this.logProfileDetails(fullProfile); diff --git a/project/src/helpers/HideoutHelper.ts b/project/src/helpers/HideoutHelper.ts index 7793db80..bbd98544 100644 --- a/project/src/helpers/HideoutHelper.ts +++ b/project/src/helpers/HideoutHelper.ts @@ -595,7 +595,7 @@ export class HideoutHelper * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation * @returns Items craft time with bonuses subtracted */ - protected getAdjustedCraftTimeWithSkills( + public getAdjustedCraftTimeWithSkills( pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus = false, @@ -613,13 +613,19 @@ export class HideoutHelper return undefined; } - // Seconds to deduct from crafts total time - let timeReductionSeconds = this.getSkillProductionTimeReduction( - pmcData, - recipe.productionTime, - SkillTypes.CRAFTING, - globalSkillsDb.Crafting.ProductionTimeReductionPerLevel, - ); + let timeReductionSeconds = 0; + + // Bitcoin farm is excluded from crafting skill cooldown reduction + if (recipeId !== HideoutHelper.bitcoinFarm) + { + // Seconds to deduct from crafts total time + timeReductionSeconds += this.getSkillProductionTimeReduction( + pmcData, + recipe.productionTime, + SkillTypes.CRAFTING, + globalSkillsDb.Crafting.ProductionTimeReductionPerLevel, + ); + } // Some crafts take into account hideout management, e.g. fuel, water/air filters if (applyHideoutManagementBonus) diff --git a/project/src/services/ProfileFixerService.ts b/project/src/services/ProfileFixerService.ts index 6824fd41..852626d3 100644 --- a/project/src/services/ProfileFixerService.ts +++ b/project/src/services/ProfileFixerService.ts @@ -1311,6 +1311,21 @@ export class ProfileFixerService } } + /** + * 3.8.0 utilized the wrong ProductionTime for bitcoin, fix it if it's found + */ + public fixBitcoinProductionTime(pmcProfile: IPmcData): void + { + const btcProd = pmcProfile.Hideout?.Production[HideoutHelper.bitcoinFarm]; + if (btcProd) + { + btcProd.ProductionTime = this.hideoutHelper.getAdjustedCraftTimeWithSkills( + pmcProfile, + HideoutHelper.bitcoinProductionId, + ); + } + } + /** * At some point the property name was changed,migrate data across to new name * @param pmcProfile Profile to migrate improvements in