feat: lock worldState time via config (#1361)
All checks were successful
Build / build (20) (push) Successful in 39s
Build / build (22) (push) Successful in 1m12s
Build Docker image / docker (push) Successful in 32s
Build / build (18) (push) Successful in 1m22s

Reviewed-on: #1361
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
Sainan 2025-03-29 15:42:42 -07:00 committed by Sainan
parent a7899d1c18
commit 1bdc5126b3
4 changed files with 11 additions and 8 deletions

View File

@ -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`. - `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 ]`. - `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.

View File

@ -38,10 +38,11 @@
"noDojoResearchTime": false, "noDojoResearchTime": false,
"fastClanAscension": false, "fastClanAscension": false,
"spoofMasteryRank": -1, "spoofMasteryRank": -1,
"events": { "worldState": {
"creditBoost": false, "creditBoost": false,
"affinityBoost": false, "affinityBoost": false,
"resourceBoost": false, "resourceBoost": false,
"starDays": true "starDays": true,
"lockTime": 0
} }
} }

View File

@ -24,7 +24,7 @@ export const worldStateController: RequestHandler = (req, res) => {
typeof req.query.buildLabel == "string" typeof req.query.buildLabel == "string"
? req.query.buildLabel.split(" ").join("+") ? req.query.buildLabel.split(" ").join("+")
: buildConfig.buildLabel, : buildConfig.buildLabel,
Time: Math.round(Date.now() / 1000), Time: config.worldState?.lockTime || Math.round(Date.now() / 1000),
Goals: [], Goals: [],
GlobalUpgrades: [], GlobalUpgrades: [],
LiteSorties: [], LiteSorties: [],
@ -68,7 +68,7 @@ export const worldStateController: RequestHandler = (req, res) => {
...staticWorldState ...staticWorldState
}; };
if (config.events?.starDays) { if (config.worldState?.starDays) {
worldState.Goals.push({ worldState.Goals.push({
_id: { $oid: "67a4dcce2a198564d62e1647" }, _id: { $oid: "67a4dcce2a198564d62e1647" },
Activation: { $date: { $numberLong: "1738868400000" } }, Activation: { $date: { $numberLong: "1738868400000" } },
@ -117,7 +117,7 @@ export const worldStateController: RequestHandler = (req, res) => {
Nodes: [] Nodes: []
}; };
if (config.events?.creditBoost) { if (config.worldState?.creditBoost) {
worldState.GlobalUpgrades.push({ worldState.GlobalUpgrades.push({
_id: { $oid: "5b23106f283a555109666672" }, _id: { $oid: "5b23106f283a555109666672" },
Activation: { $date: { $numberLong: "1740164400000" } }, Activation: { $date: { $numberLong: "1740164400000" } },
@ -129,7 +129,7 @@ export const worldStateController: RequestHandler = (req, res) => {
LocalizeDescTag: "" LocalizeDescTag: ""
}); });
} }
if (config.events?.affinityBoost) { if (config.worldState?.affinityBoost) {
worldState.GlobalUpgrades.push({ worldState.GlobalUpgrades.push({
_id: { $oid: "5b23106f283a555109666673" }, _id: { $oid: "5b23106f283a555109666673" },
Activation: { $date: { $numberLong: "1740164400000" } }, Activation: { $date: { $numberLong: "1740164400000" } },
@ -141,7 +141,7 @@ export const worldStateController: RequestHandler = (req, res) => {
LocalizeDescTag: "" LocalizeDescTag: ""
}); });
} }
if (config.events?.resourceBoost) { if (config.worldState?.resourceBoost) {
worldState.GlobalUpgrades.push({ worldState.GlobalUpgrades.push({
_id: { $oid: "5b23106f283a555109666674" }, _id: { $oid: "5b23106f283a555109666674" },
Activation: { $date: { $numberLong: "1740164400000" } }, Activation: { $date: { $numberLong: "1740164400000" } },

View File

@ -64,11 +64,12 @@ interface IConfig {
noDojoResearchTime?: boolean; noDojoResearchTime?: boolean;
fastClanAscension?: boolean; fastClanAscension?: boolean;
spoofMasteryRank?: number; spoofMasteryRank?: number;
events?: { worldState?: {
creditBoost?: boolean; creditBoost?: boolean;
affinityBoost?: boolean; affinityBoost?: boolean;
resourceBoost?: boolean; resourceBoost?: boolean;
starDays?: boolean; starDays?: boolean;
lockTime?: number;
}; };
} }