feat: star days rotation (#2573)

Closes #2567

Reviewed-on: OpenWF/SpaceNinjaServer#2573
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-07-30 05:44:42 -07:00 committed by Sainan
parent f94f2005d3
commit 9286627668
11 changed files with 40 additions and 10 deletions

View File

@ -71,8 +71,8 @@
"affinityBoost": false,
"resourceBoost": false,
"tennoLiveRelay": false,
"starDays": true,
"galleonOfGhouls": 0,
"starDaysOverride": null,
"eidolonOverride": "",
"vallisOverride": "",
"duviriOverride": "",

View File

@ -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;

View File

@ -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,

View File

@ -929,10 +929,6 @@
<input class="form-check-input" type="checkbox" id="worldState.tennoLiveRelay" />
<label class="form-check-label" for="worldState.tennoLiveRelay" data-loc="worldState_tennoLiveRelay"></label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="worldState.starDays" />
<label class="form-check-label" for="worldState.starDays" data-loc="worldState_starDays"></label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="worldState.varziaFullyStocked" />
<label class="form-check-label" for="worldState.varziaFullyStocked" data-loc="worldState_varziaFullyStocked"></label>
@ -946,6 +942,14 @@
<option value="3" data-loc="worldState_we3"></option>
</select>
</div>
<div class="form-group mt-2">
<label class="form-label" for="worldState.starDaysOverride" data-loc="worldState_starDays"></label>
<select class="form-control" id="worldState.starDaysOverride" data-default="null">
<option value="null" data-loc="normal"></option>
<option value="true" data-loc="enabled"></option>
<option value="false" data-loc="disabled"></option>
</select>
</div>
<div class="form-group mt-2">
<label class="form-label" for="worldState.eidolonOverride" data-loc="worldState_eidolonOverride"></label>
<select class="form-control" id="worldState.eidolonOverride" data-default="">

View File

@ -2098,7 +2098,13 @@ for (const id of uiConfigs) {
if (elm.tagName == "SELECT") {
elm.onchange = function () {
let value = this.value;
if (!isNaN(parseInt(value))) {
if (value == "true") {
value = true;
} else if (value == "false") {
value = false;
} else if (value == "null") {
value = null;
} else if (!isNaN(parseInt(value))) {
value = parseInt(value);
}
$.post({

View File

@ -245,6 +245,7 @@ dict = {
worldState_tennoLiveRelay: `[UNTRANSLATED] TennoLive Relay`,
worldState_starDays: `Sternen-Tage`,
worldState_galleonOfGhouls: `Galeone der Ghule`,
enabled: `[UNTRANSLATED] Enabled`,
disabled: `Deaktiviert`,
worldState_we1: `Wochenende 1`,
worldState_we2: `Wochenende 2`,

View File

@ -244,6 +244,7 @@ dict = {
worldState_tennoLiveRelay: `TennoLive Relay`,
worldState_starDays: `Star Days`,
worldState_galleonOfGhouls: `Galleon of Ghouls`,
enabled: `Enabled`,
disabled: `Disabled`,
worldState_we1: `Weekend 1`,
worldState_we2: `Weekend 2`,

View File

@ -245,6 +245,7 @@ dict = {
worldState_tennoLiveRelay: `[UNTRANSLATED] TennoLive Relay`,
worldState_starDays: `Días estelares`,
worldState_galleonOfGhouls: `Galeón de Gules`,
enabled: `[UNTRANSLATED] Enabled`,
disabled: `Desactivado`,
worldState_we1: `Semana 1`,
worldState_we2: `Semana 2`,

View File

@ -245,6 +245,7 @@ dict = {
worldState_tennoLiveRelay: `[UNTRANSLATED] TennoLive Relay`,
worldState_starDays: `Jours Stellaires`,
worldState_galleonOfGhouls: `Galion des Goules`,
enabled: `[UNTRANSLATED] Enabled`,
disabled: `Désactivé`,
worldState_we1: `Weekend 1`,
worldState_we2: `Weekend 2`,

View File

@ -245,6 +245,7 @@ dict = {
worldState_tennoLiveRelay: `[UNTRANSLATED] TennoLive Relay`,
worldState_starDays: `[UNTRANSLATED] Star Days`,
worldState_galleonOfGhouls: `[UNTRANSLATED] Galleon of Ghouls`,
enabled: `[UNTRANSLATED] Enabled`,
disabled: `[UNTRANSLATED] Disabled`,
worldState_we1: `[UNTRANSLATED] Weekend 1`,
worldState_we2: `[UNTRANSLATED] Weekend 2`,

View File

@ -245,6 +245,7 @@ dict = {
worldState_tennoLiveRelay: `TennoLive 中继站`,
worldState_starDays: `活动:星日`,
worldState_galleonOfGhouls: `战术警报:尸鬼的帆船战舰`,
enabled: `[UNTRANSLATED] Enabled`,
disabled: `关闭/取消配置`,
worldState_we1: `活动阶段:第一周`,
worldState_we2: `活动阶段:第二周`,