Fix arrival times in FleetManager

This commit is contained in:
Aelita4 2025-02-10 18:17:53 +01:00
parent b08bb37029
commit 3ccb0f1945
Signed by: Aelita4
GPG Key ID: E44490C2025906C1
1 changed files with 9 additions and 5 deletions

View File

@ -172,11 +172,13 @@ export default class FleetManager {
else resource.amount += res.amount; else resource.amount += res.amount;
} }
const arrival = new Date(this.data.arrivalTime);
await this.initiateReturn(); await this.initiateReturn();
await sendMail( await sendMail(
null, null,
this.data.source instanceof SystemManager ? this.data.source.data.ownedBy.id : this.data.source.system.data.ownedBy.id, this.data.source instanceof SystemManager ? this.data.source.data.ownedBy.id : this.data.source.system.data.ownedBy.id,
this.data.arrivalTime, arrival,
"Asteroid mined", "Asteroid mined",
`Your fleet has arrived at AS-${this.data.additionalData} asteroid.\n `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 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( await sendMail(
null, null,
this.data.source instanceof SystemManager ? this.data.source.data.ownedBy.id : this.data.source.system.data.ownedBy.id, this.data.source instanceof SystemManager ? this.data.source.data.ownedBy.id : this.data.source.system.data.ownedBy.id,
this.data.arrivalTime, arrivalTime,
"Spy report", "Spy report",
`Your fleet has arrived at ${this.data.destination instanceof SystemManager ? `${this.data.destination.data.name} system` : `planet ${this.data.destination.name}`}.\n `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 Following information was gathered:\n\n
@ -257,14 +263,12 @@ export default class FleetManager {
await sendMail( await sendMail(
null, null,
this.data.destination instanceof SystemManager ? this.data.destination.data.ownedBy.id : (this.data.destination as Planet).system.data.ownedBy.id, 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", "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 `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}.` 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; return false;
case 'COLONIZE': case 'COLONIZE':
const destination = this.data.destination as Sector | SystemManager; const destination = this.data.destination as Sector | SystemManager;