Prevent developer profile changes bleeding into non-dev accounts

This commit is contained in:
Dev 2024-02-03 23:40:20 +00:00
parent 3dacbc98b2
commit 4d88b2a94a
6 changed files with 19 additions and 47 deletions

View File

@ -158,8 +158,6 @@ export class GameController
this.updateProfileHealthValues(pmcProfile);
}
this.profileFixerService.setHideoutAreasAndCraftsTo40Secs(fullProfile);
if (this.locationConfig.fixEmptyBotWavesSettings.enabled)
{
this.fixBrokenOfflineMapWaves();

View File

@ -152,9 +152,13 @@ export class HideoutController
return this.httpResponse.appendErrorToOutput(output);
}
const ctime = hideoutData.stages[hideoutArea.level + 1].constructionTime;
let ctime = hideoutData.stages[hideoutArea.level + 1].constructionTime;
if (ctime > 0)
{
if (this.profileHelper.isDeveloperAccount(sessionID))
{
ctime = 40;
}
const timestamp = this.timeUtil.getTimestamp();
hideoutArea.completeTime = Math.round(timestamp + ctime);
@ -654,7 +658,7 @@ export class HideoutController
pmcData.Hideout.Production[body.recipeId] = this.hideoutHelper.initProduction(
body.recipeId,
modifiedScavCaseTime,
this.profileHelper.isDeveloperAccount(sessionID) ? 40 : modifiedScavCaseTime,
false,
);
pmcData.Hideout.Production[body.recipeId].sptIsScavCase = true;

View File

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

View File

@ -79,7 +79,7 @@ export class HideoutHelper
return this.httpResponse.appendErrorToOutput(this.eventOutputHolder.getOutput(sessionID));
}
const modifiedProductionTime = recipe.productionTime
let modifiedProductionTime = recipe.productionTime
- this.getCraftingSkillProductionTimeReduction(pmcData, recipe.productionTime);
// @Important: Here we need to be very exact:
@ -89,6 +89,12 @@ export class HideoutHelper
{
pmcData.Hideout.Production = {};
}
if (modifiedProductionTime > 0 && this.profileHelper.isDeveloperAccount(sessionID))
{
modifiedProductionTime = 40;
}
pmcData.Hideout.Production[body.recipeId] = this.initProduction(
body.recipeId,
modifiedProductionTime,

View File

@ -5,6 +5,7 @@ import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/tables/IBotBase";
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData";
import { AccountTypes } from "@spt-aki/models/enums/AccountTypes";
import { SkillTypes } from "@spt-aki/models/enums/SkillTypes";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
@ -447,4 +448,9 @@ export class ProfileHelper
return skillToReturn;
}
public isDeveloperAccount(sessionID: string): boolean
{
return this.getFullProfile(sessionID).info.edition.toLowerCase().startsWith(AccountTypes.SPT_DEVELOPER);
}
}

View File

@ -1387,43 +1387,4 @@ 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");
}
}