XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

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>

92866276
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

11 个文件 +40 -10
Modified config-vanilla.json +1 -1
@@ -71,8 +71,8 @@
71 71 "affinityBoost": false,
72 72 "resourceBoost": false,
73 73 "tennoLiveRelay": false,
74 "starDays": true,
75 74 "galleonOfGhouls": 0,
75 "starDaysOverride": null,
76 76 "eidolonOverride": "",
77 77 "vallisOverride": "",
78 78 "duviriOverride": "",
Modified src/services/configService.ts +1 -1
@@ -82,8 +82,8 @@ export interface IConfig {
82 82 affinityBoost?: boolean;
83 83 resourceBoost?: boolean;
84 84 tennoLiveRelay?: boolean;
85 starDays?: boolean;
86 85 galleonOfGhouls?: number;
86 starDaysOverride?: boolean;
87 87 eidolonOverride?: string;
88 88 vallisOverride?: string;
89 89 duviriOverride?: string;
Modified src/services/worldStateService.ts +17 -3
@@ -1349,6 +1349,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
1349 1349 const week = Math.trunc(day / 7);
1350 1350 const weekStart = EPOCH + week * 604800000;
1351 1351 const weekEnd = weekStart + 604800000;
1352 const date = new Date(timeMs);
1352 1353
1353 1354 const worldState: IWorldState = {
1354 1355 BuildLabel: typeof buildLabel == "string" ? buildLabel.split(" ").join("+") : buildConfig.buildLabel,
@@ -1401,11 +1402,24 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
1401 1402 Node: "TennoConBHUB6"
1402 1403 });
1403 1404 }
1404 if (config.worldState?.starDays) {
1405 const isFebruary = date.getUTCMonth() == 1;
1406 if (config.worldState?.starDaysOverride ?? isFebruary) {
1405 1407 worldState.Goals.push({
1406 1408 _id: { $oid: "67a4dcce2a198564d62e1647" },
1407 Activation: { $date: { $numberLong: "1738868400000" } },
1408 Expiry: { $date: { $numberLong: "2000000000000" } },
1409 Activation: {
1410 $date: {
1411 $numberLong: config.worldState?.starDaysOverride
1412 ? "1738868400000"
1413 : Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1).toString()
1414 }
1415 },
1416 Expiry: {
1417 $date: {
1418 $numberLong: config.worldState?.starDaysOverride
1419 ? "2000000000000"
1420 : Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + 1, 1).toString()
1421 }
1422 },
1409 1423 Count: 0,
1410 1424 Goal: 0,
1411 1425 Success: 0,
Modified static/webui/index.html +8 -4
@@ -929,10 +929,6 @@
929 929 <input class="form-check-input" type="checkbox" id="worldState.tennoLiveRelay" />
930 930 <label class="form-check-label" for="worldState.tennoLiveRelay" data-loc="worldState_tennoLiveRelay"></label>
931 931 </div>
932 <div class="form-check">
933 <input class="form-check-input" type="checkbox" id="worldState.starDays" />
934 <label class="form-check-label" for="worldState.starDays" data-loc="worldState_starDays"></label>
935 </div>
936 932 <div class="form-check">
937 933 <input class="form-check-input" type="checkbox" id="worldState.varziaFullyStocked" />
938 934 <label class="form-check-label" for="worldState.varziaFullyStocked" data-loc="worldState_varziaFullyStocked"></label>
@@ -946,6 +942,14 @@
946 942 <option value="3" data-loc="worldState_we3"></option>
947 943 </select>
948 944 </div>
945 <div class="form-group mt-2">
946 <label class="form-label" for="worldState.starDaysOverride" data-loc="worldState_starDays"></label>
947 <select class="form-control" id="worldState.starDaysOverride" data-default="null">
948 <option value="null" data-loc="normal"></option>
949 <option value="true" data-loc="enabled"></option>
950 <option value="false" data-loc="disabled"></option>
951 </select>
952 </div>
949 953 <div class="form-group mt-2">
950 954 <label class="form-label" for="worldState.eidolonOverride" data-loc="worldState_eidolonOverride"></label>
951 955 <select class="form-control" id="worldState.eidolonOverride" data-default="">
Modified static/webui/script.js +7 -1
@@ -2098,7 +2098,13 @@ for (const id of uiConfigs) {
2098 2098 if (elm.tagName == "SELECT") {
2099 2099 elm.onchange = function () {
2100 2100 let value = this.value;
2101 if (!isNaN(parseInt(value))) {
2101 if (value == "true") {
2102 value = true;
2103 } else if (value == "false") {
2104 value = false;
2105 } else if (value == "null") {
2106 value = null;
2107 } else if (!isNaN(parseInt(value))) {
2102 2108 value = parseInt(value);
2103 2109 }
2104 2110 $.post({
Modified static/webui/translations/de.js +1 -0
@@ -245,6 +245,7 @@ dict = {
245 245 worldState_tennoLiveRelay: `[UNTRANSLATED] TennoLive Relay`,
246 246 worldState_starDays: `Sternen-Tage`,
247 247 worldState_galleonOfGhouls: `Galeone der Ghule`,
248 enabled: `[UNTRANSLATED] Enabled`,
248 249 disabled: `Deaktiviert`,
249 250 worldState_we1: `Wochenende 1`,
250 251 worldState_we2: `Wochenende 2`,
Modified static/webui/translations/en.js +1 -0
@@ -244,6 +244,7 @@ dict = {
244 244 worldState_tennoLiveRelay: `TennoLive Relay`,
245 245 worldState_starDays: `Star Days`,
246 246 worldState_galleonOfGhouls: `Galleon of Ghouls`,
247 enabled: `Enabled`,
247 248 disabled: `Disabled`,
248 249 worldState_we1: `Weekend 1`,
249 250 worldState_we2: `Weekend 2`,
Modified static/webui/translations/es.js +1 -0
@@ -245,6 +245,7 @@ dict = {
245 245 worldState_tennoLiveRelay: `[UNTRANSLATED] TennoLive Relay`,
246 246 worldState_starDays: `Días estelares`,
247 247 worldState_galleonOfGhouls: `Galeón de Gules`,
248 enabled: `[UNTRANSLATED] Enabled`,
248 249 disabled: `Desactivado`,
249 250 worldState_we1: `Semana 1`,
250 251 worldState_we2: `Semana 2`,
Modified static/webui/translations/fr.js +1 -0
@@ -245,6 +245,7 @@ dict = {
245 245 worldState_tennoLiveRelay: `[UNTRANSLATED] TennoLive Relay`,
246 246 worldState_starDays: `Jours Stellaires`,
247 247 worldState_galleonOfGhouls: `Galion des Goules`,
248 enabled: `[UNTRANSLATED] Enabled`,
248 249 disabled: `Désactivé`,
249 250 worldState_we1: `Weekend 1`,
250 251 worldState_we2: `Weekend 2`,
Modified static/webui/translations/ru.js +1 -0
@@ -245,6 +245,7 @@ dict = {
245 245 worldState_tennoLiveRelay: `[UNTRANSLATED] TennoLive Relay`,
246 246 worldState_starDays: `[UNTRANSLATED] Star Days`,
247 247 worldState_galleonOfGhouls: `[UNTRANSLATED] Galleon of Ghouls`,
248 enabled: `[UNTRANSLATED] Enabled`,
248 249 disabled: `[UNTRANSLATED] Disabled`,
249 250 worldState_we1: `[UNTRANSLATED] Weekend 1`,
250 251 worldState_we2: `[UNTRANSLATED] Weekend 2`,
Modified static/webui/translations/zh.js +1 -0
@@ -245,6 +245,7 @@ dict = {
245 245 worldState_tennoLiveRelay: `TennoLive 中继站`,
246 246 worldState_starDays: `活动:星日`,
247 247 worldState_galleonOfGhouls: `战术警报:尸鬼的帆船战舰`,
248 enabled: `[UNTRANSLATED] Enabled`,
248 249 disabled: `关闭/取消配置`,
249 250 worldState_we1: `活动阶段:第一周`,
250 251 worldState_we2: `活动阶段:第二周`,