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: nightwave challenge rotation (#1317)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1317

eccea4ae
Sainan <sainan@calamity.inc>
提交于

代码差异

2 个文件 +114 -80
Modified src/controllers/dynamic/worldStateController.ts +114 -7
@@ -9,9 +9,16 @@ import { IMongoDate, IOid } from "@/src/types/commonTypes";
9 9 import { unixTimesInMs } from "@/src/constants/timeConstants";
10 10 import { config } from "@/src/services/configService";
11 11 import { CRng } from "@/src/services/rngService";
12 import { ExportRegions } from "warframe-public-export-plus";
12 import { ExportNightwave, ExportRegions } from "warframe-public-export-plus";
13
14 const EPOCH = 1734307200 * 1000; // Monday, Dec 16, 2024 @ 00:00 UTC+0; should logically be winter in 1999 iteration 0
13 15
14 16 export const worldStateController: RequestHandler = (req, res) => {
17 const day = Math.trunc((Date.now() - EPOCH) / 86400000);
18 const week = Math.trunc(day / 7);
19 const weekStart = EPOCH + week * 604800000;
20 const weekEnd = weekStart + 604800000;
21
15 22 const worldState: IWorldState = {
16 23 BuildLabel:
17 24 typeof req.query.buildLabel == "string"
@@ -22,6 +29,42 @@ export const worldStateController: RequestHandler = (req, res) => {
22 29 GlobalUpgrades: [],
23 30 LiteSorties: [],
24 31 EndlessXpChoices: [],
32 SeasonInfo: {
33 Activation: { $date: { $numberLong: "1715796000000" } },
34 Expiry: { $date: { $numberLong: "2000000000000" } },
35 AffiliationTag: "RadioLegionIntermission12Syndicate",
36 Season: 14,
37 Phase: 0,
38 Params: "",
39 ActiveChallenges: [
40 getSeasonDailyChallenge(day - 2),
41 getSeasonDailyChallenge(day - 1),
42 getSeasonDailyChallenge(day - 0),
43 getSeasonWeeklyChallenge(week, 0),
44 getSeasonWeeklyChallenge(week, 1),
45 getSeasonWeeklyHardChallenge(week, 2),
46 getSeasonWeeklyHardChallenge(week, 3),
47 {
48 _id: { $oid: "67e1b96e9d00cb47" + (week * 7 + 0).toString().padStart(8, "0") },
49 Activation: { $date: { $numberLong: weekStart.toString() } },
50 Expiry: { $date: { $numberLong: weekEnd.toString() } },
51 Challenge:
52 "/Lotus/Types/Challenges/Seasons/Weekly/SeasonWeeklyPermanentCompleteMissions" + (week - 12)
53 },
54 {
55 _id: { $oid: "67e1b96e9d00cb47" + (week * 7 + 1).toString().padStart(8, "0") },
56 Activation: { $date: { $numberLong: weekStart.toString() } },
57 Expiry: { $date: { $numberLong: weekEnd.toString() } },
58 Challenge: "/Lotus/Types/Challenges/Seasons/Weekly/SeasonWeeklyPermanentKillEximus" + (week - 12)
59 },
60 {
61 _id: { $oid: "67e1b96e9d00cb47" + (week * 7 + 2).toString().padStart(8, "0") },
62 Activation: { $date: { $numberLong: weekStart.toString() } },
63 Expiry: { $date: { $numberLong: weekEnd.toString() } },
64 Challenge: "/Lotus/Types/Challenges/Seasons/Weekly/SeasonWeeklyPermanentKillEnemies" + (week - 12)
65 }
66 ]
67 },
25 68 ...staticWorldState
26 69 };
27 70
@@ -42,12 +85,6 @@ export const worldStateController: RequestHandler = (req, res) => {
42 85 });
43 86 }
44 87
45 const EPOCH = 1734307200 * 1000; // Monday, Dec 16, 2024 @ 00:00 UTC+0; should logically be winter in 1999 iteration 0
46 const day = Math.trunc((Date.now() - EPOCH) / 86400000);
47 const week = Math.trunc(day / 7);
48 const weekStart = EPOCH + week * 604800000;
49 const weekEnd = weekStart + 604800000;
50
51 88 // Elite Sanctuary Onslaught cycling every week
52 89 worldState.NodeOverrides.find(x => x.Node == "SolNode802")!.Seed = week; // unfaithful
53 90
@@ -264,6 +301,15 @@ interface IWorldState {
264 301 LiteSorties: ILiteSortie[];
265 302 NodeOverrides: INodeOverride[];
266 303 EndlessXpChoices: IEndlessXpChoice[];
304 SeasonInfo: {
305 Activation: IMongoDate;
306 Expiry: IMongoDate;
307 AffiliationTag: string;
308 Season: number;
309 Phase: number;
310 Params: string;
311 ActiveChallenges: ISeasonChallenge[];
312 };
267 313 KnownCalendarSeasons: ICalendarSeason[];
268 314 Tmp?: string;
269 315 }
@@ -333,6 +379,14 @@ interface IEndlessXpChoice {
333 379 Choices: string[];
334 380 }
335 381
382 interface ISeasonChallenge {
383 _id: IOid;
384 Daily?: boolean;
385 Activation: IMongoDate;
386 Expiry: IMongoDate;
387 Challenge: string;
388 }
389
336 390 interface ICalendarSeason {
337 391 Activation: IMongoDate;
338 392 Expiry: IMongoDate;
@@ -342,3 +396,56 @@ interface ICalendarSeason {
342 396 }[];
343 397 YearIteration: number;
344 398 }
399
400 const dailyChallenges = Object.keys(ExportNightwave.challenges).filter(x =>
401 x.startsWith("/Lotus/Types/Challenges/Seasons/Daily/")
402 );
403
404 const getSeasonDailyChallenge = (day: number): ISeasonChallenge => {
405 const dayStart = EPOCH + day * 86400000;
406 const dayEnd = EPOCH + (day + 3) * 86400000;
407 const rng = new CRng(day);
408 return {
409 _id: { $oid: "67e1b5ca9d00cb47" + day.toString().padStart(8, "0") },
410 Daily: true,
411 Activation: { $date: { $numberLong: dayStart.toString() } },
412 Expiry: { $date: { $numberLong: dayEnd.toString() } },
413 Challenge: rng.randomElement(dailyChallenges)
414 };
415 };
416
417 const weeklyChallenges = Object.keys(ExportNightwave.challenges).filter(
418 x =>
419 x.startsWith("/Lotus/Types/Challenges/Seasons/Weekly/") &&
420 !x.startsWith("/Lotus/Types/Challenges/Seasons/Weekly/SeasonWeeklyPermanent")
421 );
422
423 const getSeasonWeeklyChallenge = (week: number, id: number): ISeasonChallenge => {
424 const weekStart = EPOCH + week * 604800000;
425 const weekEnd = weekStart + 604800000;
426 const challengeId = week * 7 + id;
427 const rng = new CRng(challengeId);
428 return {
429 _id: { $oid: "67e1bb2d9d00cb47" + challengeId.toString().padStart(8, "0") },
430 Activation: { $date: { $numberLong: weekStart.toString() } },
431 Expiry: { $date: { $numberLong: weekEnd.toString() } },
432 Challenge: rng.randomElement(weeklyChallenges)
433 };
434 };
435
436 const weeklyHardChallenges = Object.keys(ExportNightwave.challenges).filter(x =>
437 x.startsWith("/Lotus/Types/Challenges/Seasons/WeeklyHard/")
438 );
439
440 const getSeasonWeeklyHardChallenge = (week: number, id: number): ISeasonChallenge => {
441 const weekStart = EPOCH + week * 604800000;
442 const weekEnd = weekStart + 604800000;
443 const challengeId = week * 7 + id;
444 const rng = new CRng(challengeId);
445 return {
446 _id: { $oid: "67e1bb2d9d00cb47" + challengeId.toString().padStart(8, "0") },
447 Activation: { $date: { $numberLong: weekStart.toString() } },
448 Expiry: { $date: { $numberLong: weekEnd.toString() } },
449 Challenge: rng.randomElement(weeklyHardChallenges)
450 };
451 };
Modified static/fixed_responses/worldState/worldState.json +0 -73
@@ -2976,79 +2976,6 @@
2976 2976 "TwitchPromos": [],
2977 2977 "ExperimentRecommended": [],
2978 2978 "ForceLogoutVersion": 0,
2979 "SeasonInfo": {
2980 "Activation": { "$date": { "$numberLong": "1715796000000" } },
2981 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
2982 "AffiliationTag": "RadioLegionIntermission12Syndicate",
2983 "Season": 14,
2984 "Phase": 0,
2985 "Params": "",
2986 "ActiveChallenges": [
2987 {
2988 "_id": { "$oid": "001300010000000000000008" },
2989 "Daily": true,
2990 "Activation": { "$date": { "$numberLong": "1715558400000" } },
2991 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
2992 "Challenge": "/Lotus/Types/Challenges/Seasons/Daily/SeasonDailyFeedMeMore"
2993 },
2994 {
2995 "_id": { "$oid": "001300010000000000000009" },
2996 "Daily": true,
2997 "Activation": { "$date": { "$numberLong": "1715644800000" } },
2998 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
2999 "Challenge": "/Lotus/Types/Challenges/Seasons/Daily/SeasonDailyTwoForOne"
3000 },
3001 {
3002 "_id": { "$oid": "001300010000000000000010" },
3003 "Daily": true,
3004 "Activation": { "$date": { "$numberLong": "1715731200000" } },
3005 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
3006 "Challenge": "/Lotus/Types/Challenges/Seasons/Daily/SeasonDailyKillEnemiesWithFinishers"
3007 },
3008 {
3009 "_id": { "$oid": "001300010000000000000001" },
3010 "Activation": { "$date": { "$numberLong": "1715558400000" } },
3011 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
3012 "Challenge": "/Lotus/Types/Challenges/Seasons/Weekly/SeasonWeeklyPermanentCompleteMissions"
3013 },
3014 {
3015 "_id": { "$oid": "001300010000000000000002" },
3016 "Activation": { "$date": { "$numberLong": "1715558400000" } },
3017 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
3018 "Challenge": "/Lotus/Types/Challenges/Seasons/Weekly/SeasonWeeklyPermanentKillEximus"
3019 },
3020 {
3021 "_id": { "$oid": "001300010000000000000003" },
3022 "Activation": { "$date": { "$numberLong": "1715558400000" } },
3023 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
3024 "Challenge": "/Lotus/Types/Challenges/Seasons/Weekly/SeasonWeeklyPermanentKillEnemies"
3025 },
3026 {
3027 "_id": { "$oid": "001300010000000000000004" },
3028 "Activation": { "$date": { "$numberLong": "1715558400000" } },
3029 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
3030 "Challenge": "/Lotus/Types/Challenges/Seasons/Weekly/SeasonWeeklyOpenLockers"
3031 },
3032 {
3033 "_id": { "$oid": "001300010000000000000005" },
3034 "Activation": { "$date": { "$numberLong": "1715558400000" } },
3035 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
3036 "Challenge": "/Lotus/Types/Challenges/Seasons/Weekly/SeasonWeeklyBloodthirsty"
3037 },
3038 {
3039 "_id": { "$oid": "001300010000000000000006" },
3040 "Activation": { "$date": { "$numberLong": "1715558400000" } },
3041 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
3042 "Challenge": "/Lotus/Types/Challenges/Seasons/WeeklyHard/SeasonWeeklyHardEliteSanctuaryOnslaught"
3043 },
3044 {
3045 "_id": { "$oid": "001300010000000000000007" },
3046 "Activation": { "$date": { "$numberLong": "1715558400000" } },
3047 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
3048 "Challenge": "/Lotus/Types/Challenges/Seasons/WeeklyHard/SeasonWeeklyHardCompleteSortie"
3049 }
3050 ]
3051 },
3052 2979 "KnownCalendarSeasons": [
3053 2980 {
3054 2981 "Activation": { "$date": { "$numberLong": "1733961600000" } },