Fix dev profiles on creation not having correct "shortened" crafting times

new call only happens when a creation of profile happens
This commit is contained in:
CWXDEV 2024-02-03 16:39:20 +00:00
parent f17d385d56
commit 27927dd456
2 changed files with 13 additions and 7 deletions

View File

@ -1,5 +1,6 @@
import { inject, injectable } from "tsyringe";
import { GameController } from "@spt-aki/controllers/GameController";
import { ProfileController } from "@spt-aki/controllers/ProfileController";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
@ -19,6 +20,7 @@ import { ISearchFriendResponse } from "@spt-aki/models/eft/profile/ISearchFriend
import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
/** Handle profile related client events */
@injectable()
@ -28,6 +30,8 @@ export class ProfileCallbacks
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
@inject("TimeUtil") protected timeUtil: TimeUtil,
@inject("ProfileController") protected profileController: ProfileController,
@inject("GameController") protected gameController: GameController,
@inject("ProfileHelper") protected profileHelper: ProfileHelper
)
{}
@ -41,7 +45,7 @@ export class ProfileCallbacks
): IGetBodyResponseData<ICreateProfileResponse>
{
const id = this.profileController.createProfile(info, sessionID);
this.gameController.setHideoutAreasAndCraftsTo40Secs(this.profileHelper.getFullProfile(id));
return this.httpResponse.getBody({ uid: id });
}

View File

@ -159,10 +159,7 @@ export class GameController
this.updateProfileHealthValues(pmcProfile);
}
if (fullProfile.info.edition.toLowerCase().startsWith(AccountTypes.SPT_DEVELOPER))
{
this.setHideoutAreasAndCraftsTo40Secs();
}
this.setHideoutAreasAndCraftsTo40Secs(fullProfile);
if (this.locationConfig.fixEmptyBotWavesSettings.enabled)
{
@ -356,8 +353,13 @@ export class GameController
}
}
protected setHideoutAreasAndCraftsTo40Secs(): void
public setHideoutAreasAndCraftsTo40Secs(fullProfile: IAkiProfile): void
{
if (!fullProfile.info.edition.toLowerCase().startsWith(AccountTypes.SPT_DEVELOPER))
{
return;
}
for (const hideoutProd of this.databaseServer.getTables().hideout.production)
{
if (hideoutProd.productionTime > 40)