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,
): IItemEventRouterResponse | PromiseLike<IItemEventRouterResponse> {
// 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);

View File

@ -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;
}
/**

View File

@ -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;

View File

@ -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];