From 9286627668e974573f776e15d6dccde673361aa6 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Wed, 30 Jul 2025 05:44:42 -0700 Subject: [PATCH] feat: star days rotation (#2573) Closes #2567 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2573 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com> --- config-vanilla.json | 2 +- src/services/configService.ts | 2 +- src/services/worldStateService.ts | 20 +++++++++++++++++--- static/webui/index.html | 12 ++++++++---- static/webui/script.js | 8 +++++++- static/webui/translations/de.js | 1 + static/webui/translations/en.js | 1 + static/webui/translations/es.js | 1 + static/webui/translations/fr.js | 1 + static/webui/translations/ru.js | 1 + static/webui/translations/zh.js | 1 + 11 files changed, 40 insertions(+), 10 deletions(-) diff --git a/config-vanilla.json b/config-vanilla.json index 94bd57441..12600852d 100644 --- a/config-vanilla.json +++ b/config-vanilla.json @@ -71,8 +71,8 @@ "affinityBoost": false, "resourceBoost": false, "tennoLiveRelay": false, - "starDays": true, "galleonOfGhouls": 0, + "starDaysOverride": null, "eidolonOverride": "", "vallisOverride": "", "duviriOverride": "", diff --git a/src/services/configService.ts b/src/services/configService.ts index d76db1bd1..f92fe0105 100644 --- a/src/services/configService.ts +++ b/src/services/configService.ts @@ -82,8 +82,8 @@ export interface IConfig { affinityBoost?: boolean; resourceBoost?: boolean; tennoLiveRelay?: boolean; - starDays?: boolean; galleonOfGhouls?: number; + starDaysOverride?: boolean; eidolonOverride?: string; vallisOverride?: string; duviriOverride?: string; diff --git a/src/services/worldStateService.ts b/src/services/worldStateService.ts index 69b3eb2db..fc757768c 100644 --- a/src/services/worldStateService.ts +++ b/src/services/worldStateService.ts @@ -1349,6 +1349,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => { const week = Math.trunc(day / 7); const weekStart = EPOCH + week * 604800000; const weekEnd = weekStart + 604800000; + const date = new Date(timeMs); const worldState: IWorldState = { BuildLabel: typeof buildLabel == "string" ? buildLabel.split(" ").join("+") : buildConfig.buildLabel, @@ -1401,11 +1402,24 @@ export const getWorldState = (buildLabel?: string): IWorldState => { Node: "TennoConBHUB6" }); } - if (config.worldState?.starDays) { + const isFebruary = date.getUTCMonth() == 1; + if (config.worldState?.starDaysOverride ?? isFebruary) { worldState.Goals.push({ _id: { $oid: "67a4dcce2a198564d62e1647" }, - Activation: { $date: { $numberLong: "1738868400000" } }, - Expiry: { $date: { $numberLong: "2000000000000" } }, + Activation: { + $date: { + $numberLong: config.worldState?.starDaysOverride + ? "1738868400000" + : Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1).toString() + } + }, + Expiry: { + $date: { + $numberLong: config.worldState?.starDaysOverride + ? "2000000000000" + : Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + 1, 1).toString() + } + }, Count: 0, Goal: 0, Success: 0, diff --git a/static/webui/index.html b/static/webui/index.html index 78deadc7c..398c16619 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -929,10 +929,6 @@ -
- - -
@@ -946,6 +942,14 @@
+
+ + +