From c6877f998b655f0d4b3f8f58067eadaf803c7177 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 22 Aug 2024 12:34:54 +0100 Subject: [PATCH] Updated `StartTimestamp` to be stored as a string --- project/src/controllers/HideoutController.ts | 2 +- project/src/helpers/HideoutHelper.ts | 16 +++++++++------- project/src/models/eft/common/tables/IBotBase.ts | 2 +- project/src/routers/EventOutputHolder.ts | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/project/src/controllers/HideoutController.ts b/project/src/controllers/HideoutController.ts index b43557b3..6a3d4318 100644 --- a/project/src/controllers/HideoutController.ts +++ b/project/src/controllers/HideoutController.ts @@ -1258,7 +1258,7 @@ export class HideoutController { request: IHideoutCircleOfCultistProductionStartRequestData, ): IItemEventRouterResponse | PromiseLike { // Sparse, just has id, can get it via ItemTpl enum too - const cultistCraftData = this.databaseService.getHideout().production.scavRecipes[0]; + const cultistCraftData = this.databaseService.getHideout().production.cultistRecipes[0]; const sacrificedItems: Item[] = this.getSacrificedItems(pmcData); diff --git a/project/src/helpers/HideoutHelper.ts b/project/src/helpers/HideoutHelper.ts index ee7e672b..576bfeaf 100644 --- a/project/src/helpers/HideoutHelper.ts +++ b/project/src/helpers/HideoutHelper.ts @@ -122,8 +122,8 @@ export class HideoutHelper { recipeId: string, sacrificedItems: Item[], ): void { - // TODO: hard coded 12 hour craft + no fuel use, where can we get this data - const cultistProduction = this.initProduction(recipeId, 50, false, true); + // TODO: hard coded 5 hour craft + no fuel use, where can we get this data + const cultistProduction = this.initProduction(recipeId, 18000, false, true); cultistProduction.GivenItemsInStart = sacrificedItems; // Add circle production to profile @@ -144,7 +144,7 @@ export class HideoutHelper { Progress: 0, inProgress: true, RecipeId: recipeId, - StartTimestamp: this.timeUtil.getTimestamp(), + StartTimestamp: this.timeUtil.getTimestamp().toString(), ProductionTime: productionTime, Products: [], GivenItemsInStart: [], @@ -411,7 +411,7 @@ export class HideoutHelper { protected updateScavCaseProductionTimer(pmcData: IPmcData, productionId: string): void { const timeElapsed = this.timeUtil.getTimestamp() - - pmcData.Hideout.Production[productionId].StartTimestamp - + Number(pmcData.Hideout.Production[productionId].StartTimestamp) - pmcData.Hideout.Production[productionId].Progress; pmcData.Hideout.Production[productionId].Progress += timeElapsed; } @@ -947,7 +947,7 @@ export class HideoutHelper { } } - btcProd.StartTimestamp = this.timeUtil.getTimestamp(); + btcProd.StartTimestamp = this.timeUtil.getTimestamp().toString(); return btcProd; } @@ -1149,7 +1149,9 @@ export class HideoutHelper { const coinSlotCount = this.getBTCSlots(pmcData); if (pmcData.Hideout.Production[HideoutHelper.bitcoinFarm].Products.length >= coinSlotCount) { // Set start to now - pmcData.Hideout.Production[HideoutHelper.bitcoinFarm].StartTimestamp = this.timeUtil.getTimestamp(); + pmcData.Hideout.Production[HideoutHelper.bitcoinFarm].StartTimestamp = this.timeUtil + .getTimestamp() + .toString(); } // Remove crafted coins from production in profile now they've been collected @@ -1183,7 +1185,7 @@ export class HideoutHelper { * @returns true if complete */ protected hideoutImprovementIsComplete(improvement: IHideoutImprovement): boolean { - return improvement?.completed ? true : false; + return !!improvement?.completed; } /** diff --git a/project/src/models/eft/common/tables/IBotBase.ts b/project/src/models/eft/common/tables/IBotBase.ts index c7c0a6ca..69d0d6b1 100644 --- a/project/src/models/eft/common/tables/IBotBase.ts +++ b/project/src/models/eft/common/tables/IBotBase.ts @@ -364,7 +364,7 @@ export interface Productive { Progress?: number; /** Is craft in some state of being worked on by client (crafting/ready to pick up) */ inProgress?: boolean; - StartTimestamp?: number; + StartTimestamp?: string; SkipTime?: number; /** Seconds needed to fully craft */ ProductionTime?: number; diff --git a/project/src/routers/EventOutputHolder.ts b/project/src/routers/EventOutputHolder.ts index c29f813f..39e9e93c 100644 --- a/project/src/routers/EventOutputHolder.ts +++ b/project/src/routers/EventOutputHolder.ts @@ -188,7 +188,7 @@ export class EventOutputHolder { // Water collector / Bitcoin etc production.sptIsComplete = false; production.Progress = 0; - production.StartTimestamp = this.timeUtil.getTimestamp(); + production.StartTimestamp = this.timeUtil.getTimestamp().toString(); } else if (!production?.inProgress) { // Normal completed craft, delete delete productions[productionKey];