From 5f9d3abcb10080c4513f871602010cb94468a4da Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Fri, 28 Mar 2025 23:58:34 +0100 Subject: [PATCH 1/2] Config: Rename 'events' to 'worldState' --- config.json.example | 2 +- src/controllers/dynamic/worldStateController.ts | 8 ++++---- src/services/configService.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config.json.example b/config.json.example index c8a2df6a..ef51405b 100644 --- a/config.json.example +++ b/config.json.example @@ -38,7 +38,7 @@ "noDojoResearchTime": false, "fastClanAscension": false, "spoofMasteryRank": -1, - "events": { + "worldState": { "creditBoost": false, "affinityBoost": false, "resourceBoost": false, diff --git a/src/controllers/dynamic/worldStateController.ts b/src/controllers/dynamic/worldStateController.ts index 1de8422d..33bc17f4 100644 --- a/src/controllers/dynamic/worldStateController.ts +++ b/src/controllers/dynamic/worldStateController.ts @@ -68,7 +68,7 @@ export const worldStateController: RequestHandler = (req, res) => { ...staticWorldState }; - if (config.events?.starDays) { + if (config.worldState?.starDays) { worldState.Goals.push({ _id: { $oid: "67a4dcce2a198564d62e1647" }, Activation: { $date: { $numberLong: "1738868400000" } }, @@ -117,7 +117,7 @@ export const worldStateController: RequestHandler = (req, res) => { Nodes: [] }; - if (config.events?.creditBoost) { + if (config.worldState?.creditBoost) { worldState.GlobalUpgrades.push({ _id: { $oid: "5b23106f283a555109666672" }, Activation: { $date: { $numberLong: "1740164400000" } }, @@ -129,7 +129,7 @@ export const worldStateController: RequestHandler = (req, res) => { LocalizeDescTag: "" }); } - if (config.events?.affinityBoost) { + if (config.worldState?.affinityBoost) { worldState.GlobalUpgrades.push({ _id: { $oid: "5b23106f283a555109666673" }, Activation: { $date: { $numberLong: "1740164400000" } }, @@ -141,7 +141,7 @@ export const worldStateController: RequestHandler = (req, res) => { LocalizeDescTag: "" }); } - if (config.events?.resourceBoost) { + if (config.worldState?.resourceBoost) { worldState.GlobalUpgrades.push({ _id: { $oid: "5b23106f283a555109666674" }, Activation: { $date: { $numberLong: "1740164400000" } }, diff --git a/src/services/configService.ts b/src/services/configService.ts index 114eccc9..fbf075f8 100644 --- a/src/services/configService.ts +++ b/src/services/configService.ts @@ -64,7 +64,7 @@ interface IConfig { noDojoResearchTime?: boolean; fastClanAscension?: boolean; spoofMasteryRank?: number; - events?: { + worldState?: { creditBoost?: boolean; affinityBoost?: boolean; resourceBoost?: boolean; -- 2.47.2 From f59fc9ce3bd14b4df5f3bcb0d1d53c6cc3aae7a4 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Fri, 28 Mar 2025 23:58:48 +0100 Subject: [PATCH 2/2] Config: Add worldState.lockTime --- README.md | 1 + config.json.example | 3 ++- src/controllers/dynamic/worldStateController.ts | 2 +- src/services/configService.ts | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 55edddd0..ef091058 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,4 @@ To get an idea of what functionality you can expect to be missing [have a look t - `logger.level` can be `fatal`, `error`, `warn`, `info`, `http`, `debug`, or `trace`. - `myIrcAddresses` can be used to point to an IRC server. If not provided, defaults to `[ myAddress ]`. +- `worldState.lockTime` will lock the time provided in worldState if nonzero, e.g. `1743202800` for night in POE. diff --git a/config.json.example b/config.json.example index ef51405b..d1c93a66 100644 --- a/config.json.example +++ b/config.json.example @@ -42,6 +42,7 @@ "creditBoost": false, "affinityBoost": false, "resourceBoost": false, - "starDays": true + "starDays": true, + "lockTime": 0 } } diff --git a/src/controllers/dynamic/worldStateController.ts b/src/controllers/dynamic/worldStateController.ts index 33bc17f4..05c7f60f 100644 --- a/src/controllers/dynamic/worldStateController.ts +++ b/src/controllers/dynamic/worldStateController.ts @@ -24,7 +24,7 @@ export const worldStateController: RequestHandler = (req, res) => { typeof req.query.buildLabel == "string" ? req.query.buildLabel.split(" ").join("+") : buildConfig.buildLabel, - Time: Math.round(Date.now() / 1000), + Time: config.worldState?.lockTime || Math.round(Date.now() / 1000), Goals: [], GlobalUpgrades: [], LiteSorties: [], diff --git a/src/services/configService.ts b/src/services/configService.ts index fbf075f8..3aaa2796 100644 --- a/src/services/configService.ts +++ b/src/services/configService.ts @@ -69,6 +69,7 @@ interface IConfig { affinityBoost?: boolean; resourceBoost?: boolean; starDays?: boolean; + lockTime?: number; }; } -- 2.47.2