最後活躍 1 month ago

nuno 已修改 1 month ago. 還原成這個修訂版本

1 file changed, 21 insertions

gistfile1.txt(檔案已創建)

@@ -0,0 +1,21 @@
1 + resetWeek(): void {
2 + // Fire the weekly reset on Monday 00:00 (WRank reset) (UTC+2 = Sunday 22:00)
3 + const nowUtcNoon = new Date();
4 + nowUtcNoon.setUTCHours(12, 0, 0, 0);
5 +
6 + const newWeekKey = WRank.weekKey(nowUtcNoon);
7 + const prevWeekKey = WRank.weekKey(new Date(nowUtcNoon.getTime() - 7 * 24 * 60 * 60 * 1000));
8 + const prevWeek = _data[prevWeekKey];
9 + const newWeek = ensureWeek(newWeekKey);
10 +
11 + if (prevWeek) {
12 + Bringer.update({ week: prevWeek });
13 + for (const nation of [Nation.Capella, Nation.Procyon]) {
14 + const bringer = prevWeek.bringer[nation];
15 + if (bringer) newWeek.bringer[nation] = bringer;
16 + }
17 + }
18 +
19 + WRank.save();
20 + log.info(`Week reset to ${newWeekKey}. Bringer: ${JSON.stringify(newWeek.bringer)}`);
21 + },
上一頁 下一頁