返回提交历史
Modified
src/services/worldStateService.ts
+32
-23
XFEstudio/SpaceNinjaServer
chore: provide upcoming weekly acts before week rollover (#1736)
The final piece to close #1640 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1736 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
0f3d9f6c
代码差异
1 个文件
+32
-23
@@ -355,6 +355,34 @@ const getSeasonWeeklyHardChallenge = (week: number, id: number): ISeasonChalleng
355
355
};
356
356
};
357
357
358
const pushWeeklyActs = (worldState: IWorldState, week: number): void => {
359
const weekStart = EPOCH + week * 604800000;
360
const weekEnd = weekStart + 604800000;
361
362
worldState.SeasonInfo.ActiveChallenges.push(getSeasonWeeklyChallenge(week, 0));
363
worldState.SeasonInfo.ActiveChallenges.push(getSeasonWeeklyChallenge(week, 1));
364
worldState.SeasonInfo.ActiveChallenges.push(getSeasonWeeklyHardChallenge(week, 2));
365
worldState.SeasonInfo.ActiveChallenges.push(getSeasonWeeklyHardChallenge(week, 3));
366
worldState.SeasonInfo.ActiveChallenges.push({
367
_id: { $oid: "67e1b96e9d00cb47" + (week * 7 + 0).toString().padStart(8, "0") },
368
Activation: { $date: { $numberLong: weekStart.toString() } },
369
Expiry: { $date: { $numberLong: weekEnd.toString() } },
370
Challenge: "/Lotus/Types/Challenges/Seasons/Weekly/SeasonWeeklyPermanentCompleteMissions" + (week - 12)
371
});
372
worldState.SeasonInfo.ActiveChallenges.push({
373
_id: { $oid: "67e1b96e9d00cb47" + (week * 7 + 1).toString().padStart(8, "0") },
374
Activation: { $date: { $numberLong: weekStart.toString() } },
375
Expiry: { $date: { $numberLong: weekEnd.toString() } },
376
Challenge: "/Lotus/Types/Challenges/Seasons/Weekly/SeasonWeeklyPermanentKillEximus" + (week - 12)
377
});
378
worldState.SeasonInfo.ActiveChallenges.push({
379
_id: { $oid: "67e1b96e9d00cb47" + (week * 7 + 2).toString().padStart(8, "0") },
380
Activation: { $date: { $numberLong: weekStart.toString() } },
381
Expiry: { $date: { $numberLong: weekEnd.toString() } },
382
Challenge: "/Lotus/Types/Challenges/Seasons/Weekly/SeasonWeeklyPermanentKillEnemies" + (week - 12)
383
});
384
};
385
358
386
const birthdays: number[] = [
359
387
1, // Kaya
360
388
45, // Lettie
@@ -611,29 +639,10 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
611
639
if (isBeforeNextExpectedWorldStateRefresh(EPOCH + (day + 1) * 86400000)) {
612
640
worldState.SeasonInfo.ActiveChallenges.push(getSeasonDailyChallenge(day + 1));
613
641
}
614
worldState.SeasonInfo.ActiveChallenges.push(getSeasonWeeklyChallenge(week, 0));
615
worldState.SeasonInfo.ActiveChallenges.push(getSeasonWeeklyChallenge(week, 1));
616
worldState.SeasonInfo.ActiveChallenges.push(getSeasonWeeklyHardChallenge(week, 2));
617
worldState.SeasonInfo.ActiveChallenges.push(getSeasonWeeklyHardChallenge(week, 3));
618
worldState.SeasonInfo.ActiveChallenges.push({
619
_id: { $oid: "67e1b96e9d00cb47" + (week * 7 + 0).toString().padStart(8, "0") },
620
Activation: { $date: { $numberLong: weekStart.toString() } },
621
Expiry: { $date: { $numberLong: weekEnd.toString() } },
622
Challenge: "/Lotus/Types/Challenges/Seasons/Weekly/SeasonWeeklyPermanentCompleteMissions" + (week - 12)
623
});
624
worldState.SeasonInfo.ActiveChallenges.push({
625
_id: { $oid: "67e1b96e9d00cb47" + (week * 7 + 1).toString().padStart(8, "0") },
626
Activation: { $date: { $numberLong: weekStart.toString() } },
627
Expiry: { $date: { $numberLong: weekEnd.toString() } },
628
Challenge: "/Lotus/Types/Challenges/Seasons/Weekly/SeasonWeeklyPermanentKillEximus" + (week - 12)
629
});
630
worldState.SeasonInfo.ActiveChallenges.push({
631
_id: { $oid: "67e1b96e9d00cb47" + (week * 7 + 2).toString().padStart(8, "0") },
632
Activation: { $date: { $numberLong: weekStart.toString() } },
633
Expiry: { $date: { $numberLong: weekEnd.toString() } },
634
Challenge: "/Lotus/Types/Challenges/Seasons/Weekly/SeasonWeeklyPermanentKillEnemies" + (week - 12)
635
});
636
// TODO: Provide upcoming weekly acts if rollover is imminent
642
pushWeeklyActs(worldState, week);
643
if (isBeforeNextExpectedWorldStateRefresh(weekEnd)) {
644
pushWeeklyActs(worldState, week + 1);
645
}
637
646
638
647
// Elite Sanctuary Onslaught cycling every week
639
648
worldState.NodeOverrides.find(x => x.Node == "SolNode802")!.Seed = week; // unfaithful