返回提交历史
Modified
src/services/worldStateService.ts
+17
-17
XFEstudio/SpaceNinjaServer
chore: increase seed ranges to be more accurate (#2029)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2029 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
0e255067
代码差异
1 个文件
+17
-17
@@ -5,7 +5,7 @@ import syndicateMissions from "@/static/fixed_responses/worldState/syndicateMiss
5
5
import { buildConfig } from "@/src/services/buildConfigService";
6
6
import { unixTimesInMs } from "@/src/constants/timeConstants";
7
7
import { config } from "@/src/services/configService";
8
import { CRng } from "@/src/services/rngService";
8
import { CRng, SRng } from "@/src/services/rngService";
9
9
import { ExportNightwave, ExportRegions, IRegion } from "warframe-public-export-plus";
10
10
import {
11
11
ICalendarDay,
@@ -234,7 +234,7 @@ const pushTilesetModifiers = (modifiers: string[], tileset: TSortieTileset): voi
234
234
};
235
235
236
236
export const getSortie = (day: number): ISortie => {
237
const seed = new CRng(day).randomInt(0, 0xffff);
237
const seed = new CRng(day).randomInt(0, 100_000);
238
238
const rng = new CRng(seed);
239
239
240
240
const boss = rng.randomElement(sortieBosses)!;
@@ -350,7 +350,7 @@ const dailyChallenges = Object.keys(ExportNightwave.challenges).filter(x =>
350
350
const getSeasonDailyChallenge = (day: number): ISeasonChallenge => {
351
351
const dayStart = EPOCH + day * 86400000;
352
352
const dayEnd = EPOCH + (day + 3) * 86400000;
353
const rng = new CRng(new CRng(day).randomInt(0, 0xffff));
353
const rng = new CRng(new CRng(day).randomInt(0, 100_000));
354
354
return {
355
355
_id: { $oid: "67e1b5ca9d00cb47" + day.toString().padStart(8, "0") },
356
356
Daily: true,
@@ -370,7 +370,7 @@ const getSeasonWeeklyChallenge = (week: number, id: number): ISeasonChallenge =>
370
370
const weekStart = EPOCH + week * 604800000;
371
371
const weekEnd = weekStart + 604800000;
372
372
const challengeId = week * 7 + id;
373
const rng = new CRng(new CRng(challengeId).randomInt(0, 0xffff));
373
const rng = new CRng(new CRng(challengeId).randomInt(0, 100_000));
374
374
return {
375
375
_id: { $oid: "67e1bb2d9d00cb47" + challengeId.toString().padStart(8, "0") },
376
376
Activation: { $date: { $numberLong: weekStart.toString() } },
@@ -387,7 +387,7 @@ const getSeasonWeeklyHardChallenge = (week: number, id: number): ISeasonChalleng
387
387
const weekStart = EPOCH + week * 604800000;
388
388
const weekEnd = weekStart + 604800000;
389
389
const challengeId = week * 7 + id;
390
const rng = new CRng(new CRng(challengeId).randomInt(0, 0xffff));
390
const rng = new CRng(new CRng(challengeId).randomInt(0, 100_000));
391
391
return {
392
392
_id: { $oid: "67e1bb2d9d00cb47" + challengeId.toString().padStart(8, "0") },
393
393
Activation: { $date: { $numberLong: weekStart.toString() } },
@@ -431,7 +431,7 @@ export const pushClassicBounties = (syndicateMissions: ISyndicateMissionInfo[],
431
431
432
432
// TODO: xpAmounts need to be calculated based on the jobType somehow?
433
433
434
const seed = new CRng(bountyCycle).randomInt(0, 0xffff);
434
const seed = new CRng(bountyCycle).randomInt(0, 100_000);
435
435
const bountyCycleStart = bountyCycle * 9000000;
436
436
const bountyCycleEnd = bountyCycleStart + 9000000;
437
437
@@ -700,7 +700,7 @@ const getCalendarSeason = (week: number): ICalendarSeason => {
700
700
//logger.debug(`birthday on day ${day}`);
701
701
eventDays.push({ day, events: [] }); // This is how CET_PLOT looks in worldState as of around 38.5.0
702
702
}
703
const rng = new CRng(new CRng(week).randomInt(0, 0xffff));
703
const rng = new CRng(new CRng(week).randomInt(0, 100_000));
704
704
const challenges = [
705
705
"/Lotus/Types/Challenges/Calendar1999/CalendarKillEnemiesEasy",
706
706
"/Lotus/Types/Challenges/Calendar1999/CalendarKillEnemiesMedium",
@@ -981,7 +981,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
981
981
}
982
982
983
983
// Elite Sanctuary Onslaught cycling every week
984
worldState.NodeOverrides.find(x => x.Node == "SolNode802")!.Seed = new CRng(week).randomInt(0, 0xffff);
984
worldState.NodeOverrides.find(x => x.Node == "SolNode802")!.Seed = new SRng(BigInt(week)).randomInt(0, 0xff_ffff);
985
985
986
986
// Holdfast, Cavia, & Hex bounties cycling every 2.5 hours; unfaithful implementation
987
987
let bountyCycle = Math.trunc(Date.now() / 9000000);
@@ -1066,14 +1066,14 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
1066
1066
}
1067
1067
1068
1068
// The client does not seem to respect activation for classic syndicate missions, so only pushing current ones.
1069
const sday = Date.now() >= rollover ? day : day - 1;
1070
const rng = new CRng(sday);
1071
pushSyndicateMissions(worldState, sday, rng.randomInt(0, 0xffff), "ba6f84724fa48049", "ArbitersSyndicate");
1072
pushSyndicateMissions(worldState, sday, rng.randomInt(0, 0xffff), "ba6f84724fa4804a", "CephalonSudaSyndicate");
1073
pushSyndicateMissions(worldState, sday, rng.randomInt(0, 0xffff), "ba6f84724fa4804e", "NewLokaSyndicate");
1074
pushSyndicateMissions(worldState, sday, rng.randomInt(0, 0xffff), "ba6f84724fa48050", "PerrinSyndicate");
1075
pushSyndicateMissions(worldState, sday, rng.randomInt(0, 0xffff), "ba6f84724fa4805e", "RedVeilSyndicate");
1076
pushSyndicateMissions(worldState, sday, rng.randomInt(0, 0xffff), "ba6f84724fa48061", "SteelMeridianSyndicate");
1069
const sdy = Date.now() >= rollover ? day : day - 1;
1070
const rng = new CRng(sdy);
1071
pushSyndicateMissions(worldState, sdy, rng.randomInt(0, 100_000), "ba6f84724fa48049", "ArbitersSyndicate");
1072
pushSyndicateMissions(worldState, sdy, rng.randomInt(0, 100_000), "ba6f84724fa4804a", "CephalonSudaSyndicate");
1073
pushSyndicateMissions(worldState, sdy, rng.randomInt(0, 100_000), "ba6f84724fa4804e", "NewLokaSyndicate");
1074
pushSyndicateMissions(worldState, sdy, rng.randomInt(0, 100_000), "ba6f84724fa48050", "PerrinSyndicate");
1075
pushSyndicateMissions(worldState, sdy, rng.randomInt(0, 100_000), "ba6f84724fa4805e", "RedVeilSyndicate");
1076
pushSyndicateMissions(worldState, sdy, rng.randomInt(0, 100_000), "ba6f84724fa48061", "SteelMeridianSyndicate");
1077
1077
}
1078
1078
1079
1079
// Archon Hunt cycling every week
@@ -1183,7 +1183,7 @@ export const getLiteSortie = (week: number): ILiteSortie => {
1183
1183
}
1184
1184
}
1185
1185
1186
const seed = new CRng(week).randomInt(0, 0xffff);
1186
const seed = new CRng(week).randomInt(0, 100_000);
1187
1187
const rng = new CRng(seed);
1188
1188
const firstNodeIndex = rng.randomInt(0, nodes.length - 1);
1189
1189
const firstNode = nodes[firstNodeIndex];