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 <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
This commit is contained in:
DrakiaXYZ 2024-04-09 07:48:18 +00:00 committed by chomp
parent 64ddca4124
commit db6ef9bddb
3 changed files with 30 additions and 8 deletions

View File

@ -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);

View File

@ -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)

View File

@ -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