Cleanup of setHideoutAreasAndCraftsTo40Secs to more central location

This commit is contained in:
Dev 2024-02-03 19:42:49 +00:00
parent 48e6f3052d
commit 1a9dc1ea2b
4 changed files with 47 additions and 47 deletions

View File

@ -1,7 +1,7 @@
import { inject, injectable } from "tsyringe";
import { GameController } from "@spt-aki/controllers/GameController";
import { ProfileController } from "@spt-aki/controllers/ProfileController";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
@ -20,7 +20,6 @@ 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()
@ -30,8 +29,7 @@ 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
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
)
{}
@ -45,7 +43,6 @@ 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

@ -18,7 +18,6 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques
import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse";
import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails";
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
import { AccountTypes } from "@spt-aki/models/enums/AccountTypes";
import { BonusType } from "@spt-aki/models/enums/BonusType";
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
import { SkillTypes } from "@spt-aki/models/enums/SkillTypes";
@ -159,7 +158,7 @@ export class GameController
this.updateProfileHealthValues(pmcProfile);
}
this.setHideoutAreasAndCraftsTo40Secs(fullProfile);
this.profileFixerService.setHideoutAreasAndCraftsTo40Secs(fullProfile);
if (this.locationConfig.fixEmptyBotWavesSettings.enabled)
{
@ -353,45 +352,6 @@ export class GameController
}
}
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)
{
hideoutProd.productionTime = 40;
}
}
this.logger.warning("DEVELOPER: SETTING ALL HIDEOUT PRODUCTIONS TO 40 SECONDS");
for (const hideoutArea of this.databaseServer.getTables().hideout.areas)
{
for (const stageKey in hideoutArea.stages)
{
const stage = hideoutArea.stages[stageKey];
if (stage.constructionTime > 40)
{
stage.constructionTime = 40;
}
}
}
this.logger.warning("DEVELOPER: SETTING ALL HIDEOUT AREAS TO 40 SECOND UPGRADES");
for (const scavCaseCraft of this.databaseServer.getTables().hideout.scavcase)
{
if (scavCaseCraft.ProductionTime > 40)
{
scavCaseCraft.ProductionTime = 40;
}
}
this.logger.warning("DEVELOPER: SETTING ALL SCAV CASES TO 40 SECONDS");
}
/** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */
protected adjustMapBotLimits(): void
{

View File

@ -232,6 +232,9 @@ export class ProfileController
this.seasonalEventService.enableSeasonalEvents(sessionID);
}
const fullProfile = this.profileHelper.getFullProfile(account.id);
this.profileFixerService.setHideoutAreasAndCraftsTo40Secs(fullProfile);
return pmcData._id;
}

View File

@ -11,6 +11,7 @@ import { IHideoutImprovement } from "@spt-aki/models/eft/common/tables/IBotBase"
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests";
import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea";
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
import { AccountTypes } from "@spt-aki/models/enums/AccountTypes";
import { BonusType } from "@spt-aki/models/enums/BonusType";
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas";
@ -1386,4 +1387,43 @@ export class ProfileFixerService
}
}
}
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)
{
hideoutProd.productionTime = 40;
}
}
this.logger.warning("DEVELOPER: SETTING ALL HIDEOUT PRODUCTIONS TO 40 SECONDS");
for (const hideoutArea of this.databaseServer.getTables().hideout.areas)
{
for (const stageKey in hideoutArea.stages)
{
const stage = hideoutArea.stages[stageKey];
if (stage.constructionTime > 40)
{
stage.constructionTime = 40;
}
}
}
this.logger.warning("DEVELOPER: SETTING ALL HIDEOUT AREAS TO 40 SECOND UPGRADES");
for (const scavCaseCraft of this.databaseServer.getTables().hideout.scavcase)
{
if (scavCaseCraft.ProductionTime > 40)
{
scavCaseCraft.ProductionTime = 40;
}
}
this.logger.warning("DEVELOPER: SETTING ALL SCAV CASES TO 40 SECONDS");
}
}