From 3ccb0f1945f60c946e8d7c9c1a1bc916938ed875 Mon Sep 17 00:00:00 2001 From: Aelita4 Date: Mon, 10 Feb 2025 18:17:53 +0100 Subject: [PATCH] Fix arrival times in FleetManager --- src/lib/classes/managers/FleetManager.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/lib/classes/managers/FleetManager.ts b/src/lib/classes/managers/FleetManager.ts index 5a8c1c0..b5ce6a0 100644 --- a/src/lib/classes/managers/FleetManager.ts +++ b/src/lib/classes/managers/FleetManager.ts @@ -172,11 +172,13 @@ export default class FleetManager { else resource.amount += res.amount; } + const arrival = new Date(this.data.arrivalTime); + await this.initiateReturn(); await sendMail( null, this.data.source instanceof SystemManager ? this.data.source.data.ownedBy.id : this.data.source.system.data.ownedBy.id, - this.data.arrivalTime, + arrival, "Asteroid mined", `Your fleet has arrived at AS-${this.data.additionalData} asteroid.\n Following resources were added to the cargo inventory:\n${asteroid.resources.map(r => `${r.id} - ${r.amount}`).join('\n')}\n @@ -238,10 +240,14 @@ export default class FleetManager { } } + const arrivalTime = new Date(this.data.arrivalTime); + + await this.initiateReturn(); + await sendMail( null, this.data.source instanceof SystemManager ? this.data.source.data.ownedBy.id : this.data.source.system.data.ownedBy.id, - this.data.arrivalTime, + arrivalTime, "Spy report", `Your fleet has arrived at ${this.data.destination instanceof SystemManager ? `${this.data.destination.data.name} system` : `planet ${this.data.destination.name}`}.\n Following information was gathered:\n\n @@ -257,14 +263,12 @@ export default class FleetManager { await sendMail( null, this.data.destination instanceof SystemManager ? this.data.destination.data.ownedBy.id : (this.data.destination as Planet).system.data.ownedBy.id, - this.data.arrivalTime, + arrivalTime, "Spy probe detected", `Your systems have detected enemy spy probe at ${this.data.destination instanceof SystemManager ? `${this.data.destination.data.name} system` : `planet ${this.data.destination.name}`}.\n Probe was identified to belong to ${this.data.source instanceof SystemManager ? this.data.source.data.ownedBy.username : this.data.source.system.data.ownedBy.username}.` ); - await this.initiateReturn(); - return false; case 'COLONIZE': const destination = this.data.destination as Sector | SystemManager;