diff --git a/project/src/callbacks/ProfileCallbacks.ts b/project/src/callbacks/ProfileCallbacks.ts index bf0cad73..48c909bf 100644 --- a/project/src/callbacks/ProfileCallbacks.ts +++ b/project/src/callbacks/ProfileCallbacks.ts @@ -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 { const id = this.profileController.createProfile(info, sessionID); - + this.gameController.setHideoutAreasAndCraftsTo40Secs(this.profileHelper.getFullProfile(id)); return this.httpResponse.getBody({ uid: id }); } diff --git a/project/src/controllers/GameController.ts b/project/src/controllers/GameController.ts index f4d8735f..1099abba 100644 --- a/project/src/controllers/GameController.ts +++ b/project/src/controllers/GameController.ts @@ -158,11 +158,8 @@ 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)