From 9503efa4f44e52df4d1218e92e0a2952891a6c21 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Mon, 7 Jul 2025 05:17:49 +0200 Subject: [PATCH 1/2] chore: improve randomness of void storm missions Instead of alternating the mission pool every hour, we now use sequentallyUniqueRandomElement which should ensure that we don't duplicate any of the last x missions (x = 3 for Lith & Axi and x = 1 Meso & Neo). --- src/services/worldStateService.ts | 49 ++++++++++++++++++------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/src/services/worldStateService.ts b/src/services/worldStateService.ts index 3433883f..a7926ed4 100644 --- a/src/services/worldStateService.ts +++ b/src/services/worldStateService.ts @@ -971,25 +971,26 @@ const getCalendarSeason = (week: number): ICalendarSeason => { // Not very faithful, but to avoid the same node coming up back-to-back (which is not valid), I've split these into 2 arrays which we're alternating between. -const voidStormMissionsA = { - VoidT1: ["CrewBattleNode519", "CrewBattleNode518", "CrewBattleNode515", "CrewBattleNode503"], - VoidT2: ["CrewBattleNode501", "CrewBattleNode534", "CrewBattleNode530"], - VoidT3: ["CrewBattleNode521", "CrewBattleNode516"], +const voidStormMissions = { + VoidT1: [ + "CrewBattleNode519", + "CrewBattleNode518", + "CrewBattleNode515", + "CrewBattleNode503", + "CrewBattleNode509", + "CrewBattleNode522", + "CrewBattleNode511", + "CrewBattleNode512" + ], + VoidT2: ["CrewBattleNode501", "CrewBattleNode534", "CrewBattleNode530", "CrewBattleNode535", "CrewBattleNode533"], + VoidT3: ["CrewBattleNode521", "CrewBattleNode516", "CrewBattleNode524", "CrewBattleNode525"], VoidT4: [ "CrewBattleNode555", "CrewBattleNode553", "CrewBattleNode554", "CrewBattleNode539", "CrewBattleNode531", - "CrewBattleNode527" - ] -}; - -const voidStormMissionsB = { - VoidT1: ["CrewBattleNode509", "CrewBattleNode522", "CrewBattleNode511", "CrewBattleNode512"], - VoidT2: ["CrewBattleNode535", "CrewBattleNode533"], - VoidT3: ["CrewBattleNode524", "CrewBattleNode525"], - VoidT4: [ + "CrewBattleNode527", "CrewBattleNode542", "CrewBattleNode538", "CrewBattleNode543", @@ -997,18 +998,21 @@ const voidStormMissionsB = { "CrewBattleNode550", "CrewBattleNode529" ] -}; +} as const; + +const voidStormLookbehind = { + VoidT1: 3, + VoidT2: 1, + VoidT3: 1, + VoidT4: 3 +} as const; const pushVoidStorms = (arr: IVoidStorm[], hour: number): void => { const activation = hour * unixTimesInMs.hour + 40 * unixTimesInMs.minute; const expiry = activation + 90 * unixTimesInMs.minute; let accum = 0; - const rng = new SRng(new SRng(hour).randomInt(0, 100_000)); - const voidStormMissions = structuredClone(hour & 1 ? voidStormMissionsA : voidStormMissionsB); + const tierIdx = { VoidT1: hour * 2, VoidT2: hour, VoidT3: hour, VoidT4: hour * 2 }; for (const tier of ["VoidT1", "VoidT1", "VoidT2", "VoidT3", "VoidT4", "VoidT4"] as const) { - const idx = rng.randomInt(0, voidStormMissions[tier].length - 1); - const node = voidStormMissions[tier][idx]; - voidStormMissions[tier].splice(idx, 1); arr.push({ _id: { $oid: @@ -1016,7 +1020,12 @@ const pushVoidStorms = (arr: IVoidStorm[], hour: number): void => { "0321e89b" + (accum++).toString().padStart(8, "0") }, - Node: node, + Node: sequentallyUniqueRandomElement( + voidStormMissions[tier], + tierIdx[tier]++, + voidStormLookbehind[tier], + 2051969264 + )!, Activation: { $date: { $numberLong: activation.toString() } }, Expiry: { $date: { $numberLong: expiry.toString() } }, ActiveMissionTier: tier -- 2.47.2 From 07bdd03319a41ab454ebe565ef72090c81d3797a Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Mon, 7 Jul 2025 05:22:06 +0200 Subject: [PATCH 2/2] oops --- src/services/worldStateService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/worldStateService.ts b/src/services/worldStateService.ts index a7926ed4..db1b86d2 100644 --- a/src/services/worldStateService.ts +++ b/src/services/worldStateService.ts @@ -1020,7 +1020,7 @@ const pushVoidStorms = (arr: IVoidStorm[], hour: number): void => { "0321e89b" + (accum++).toString().padStart(8, "0") }, - Node: sequentallyUniqueRandomElement( + Node: sequentiallyUniqueRandomElement( voidStormMissions[tier], tierIdx[tier]++, voidStormLookbehind[tier], -- 2.47.2