Updated StartTimestamp to be stored as a string

This commit is contained in:
Dev 2024-08-22 12:34:54 +01:00
parent d9b8825b14
commit c6877f998b
4 changed files with 12 additions and 10 deletions

View File

@ -1258,7 +1258,7 @@ export class HideoutController {
request: IHideoutCircleOfCultistProductionStartRequestData, request: IHideoutCircleOfCultistProductionStartRequestData,
): IItemEventRouterResponse | PromiseLike<IItemEventRouterResponse> { ): IItemEventRouterResponse | PromiseLike<IItemEventRouterResponse> {
// Sparse, just has id, can get it via ItemTpl enum too // 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); const sacrificedItems: Item[] = this.getSacrificedItems(pmcData);

View File

@ -122,8 +122,8 @@ export class HideoutHelper {
recipeId: string, recipeId: string,
sacrificedItems: Item[], sacrificedItems: Item[],
): void { ): void {
// TODO: hard coded 12 hour craft + no fuel use, where can we get this data // TODO: hard coded 5 hour craft + no fuel use, where can we get this data
const cultistProduction = this.initProduction(recipeId, 50, false, true); const cultistProduction = this.initProduction(recipeId, 18000, false, true);
cultistProduction.GivenItemsInStart = sacrificedItems; cultistProduction.GivenItemsInStart = sacrificedItems;
// Add circle production to profile // Add circle production to profile
@ -144,7 +144,7 @@ export class HideoutHelper {
Progress: 0, Progress: 0,
inProgress: true, inProgress: true,
RecipeId: recipeId, RecipeId: recipeId,
StartTimestamp: this.timeUtil.getTimestamp(), StartTimestamp: this.timeUtil.getTimestamp().toString(),
ProductionTime: productionTime, ProductionTime: productionTime,
Products: [], Products: [],
GivenItemsInStart: [], GivenItemsInStart: [],
@ -411,7 +411,7 @@ export class HideoutHelper {
protected updateScavCaseProductionTimer(pmcData: IPmcData, productionId: string): void { protected updateScavCaseProductionTimer(pmcData: IPmcData, productionId: string): void {
const timeElapsed = const timeElapsed =
this.timeUtil.getTimestamp() - this.timeUtil.getTimestamp() -
pmcData.Hideout.Production[productionId].StartTimestamp - Number(pmcData.Hideout.Production[productionId].StartTimestamp) -
pmcData.Hideout.Production[productionId].Progress; pmcData.Hideout.Production[productionId].Progress;
pmcData.Hideout.Production[productionId].Progress += timeElapsed; 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; return btcProd;
} }
@ -1149,7 +1149,9 @@ export class HideoutHelper {
const coinSlotCount = this.getBTCSlots(pmcData); const coinSlotCount = this.getBTCSlots(pmcData);
if (pmcData.Hideout.Production[HideoutHelper.bitcoinFarm].Products.length >= coinSlotCount) { if (pmcData.Hideout.Production[HideoutHelper.bitcoinFarm].Products.length >= coinSlotCount) {
// Set start to now // 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 // Remove crafted coins from production in profile now they've been collected
@ -1183,7 +1185,7 @@ export class HideoutHelper {
* @returns true if complete * @returns true if complete
*/ */
protected hideoutImprovementIsComplete(improvement: IHideoutImprovement): boolean { protected hideoutImprovementIsComplete(improvement: IHideoutImprovement): boolean {
return improvement?.completed ? true : false; return !!improvement?.completed;
} }
/** /**

View File

@ -364,7 +364,7 @@ export interface Productive {
Progress?: number; Progress?: number;
/** Is craft in some state of being worked on by client (crafting/ready to pick up) */ /** Is craft in some state of being worked on by client (crafting/ready to pick up) */
inProgress?: boolean; inProgress?: boolean;
StartTimestamp?: number; StartTimestamp?: string;
SkipTime?: number; SkipTime?: number;
/** Seconds needed to fully craft */ /** Seconds needed to fully craft */
ProductionTime?: number; ProductionTime?: number;

View File

@ -188,7 +188,7 @@ export class EventOutputHolder {
// Water collector / Bitcoin etc // Water collector / Bitcoin etc
production.sptIsComplete = false; production.sptIsComplete = false;
production.Progress = 0; production.Progress = 0;
production.StartTimestamp = this.timeUtil.getTimestamp(); production.StartTimestamp = this.timeUtil.getTimestamp().toString();
} else if (!production?.inProgress) { } else if (!production?.inProgress) {
// Normal completed craft, delete // Normal completed craft, delete
delete productions[productionKey]; delete productions[productionKey];