diff --git a/src/services/worldStateService.ts b/src/services/worldStateService.ts index 2ca13620..e1946f7a 100644 --- a/src/services/worldStateService.ts +++ b/src/services/worldStateService.ts @@ -4,14 +4,7 @@ import { unixTimesInMs } from "@/src/constants/timeConstants"; import { config } from "@/src/services/configService"; import { CRng } from "@/src/services/rngService"; import { eMissionType, ExportNightwave, ExportRegions } from "warframe-public-export-plus"; -import { - ICalendarDay, - ICalendarSeason, - ILiteSortie, - ISeasonChallenge, - ISortie, - IWorldState -} from "../types/worldStateTypes"; +import { ICalendarDay, ICalendarSeason, ILiteSortie, ISeasonChallenge, IWorldState } from "../types/worldStateTypes"; const sortieBosses = [ "SORTIE_BOSS_HYENA", @@ -174,7 +167,47 @@ const getSortieTime = (day: number): number => { return dayStart + (isDst ? 16 : 17) * 3600000; }; -const pushSortieIfRelevant = (out: ISortie[], day: number): void => { +const pushSyndicateMissions = ( + worldState: IWorldState, + day: number, + seed: number, + idSuffix: string, + syndicateTag: string +): void => { + const nodeOptions: string[] = []; + for (const [key, value] of Object.entries(ExportRegions)) { + if ( + value.name.indexOf("Archwing") == -1 && // no archwing + value.systemIndex != 23 && // no 1999 stuff + value.missionIndex != 10 && // Exclude MT_PVP (for relays) + value.missionIndex != 23 && // no junctions + value.missionIndex <= 28 // no railjack or some such + ) { + nodeOptions.push(key); + } + } + + const rng = new CRng(seed); + const nodes: string[] = []; + for (let i = 0; i != 6; ++i) { + const index = rng.randomInt(0, nodeOptions.length - 1); + nodes.push(nodeOptions[index]); + nodeOptions.splice(index, 1); + } + + const dayStart = getSortieTime(day); + const dayEnd = getSortieTime(day + 1); + worldState.SyndicateMissions.push({ + _id: { $oid: Math.trunc(dayStart / 1000).toString(16) + idSuffix }, + Activation: { $date: { $numberLong: dayStart.toString() } }, + Expiry: { $date: { $numberLong: dayEnd.toString() } }, + Tag: syndicateTag, + Seed: seed, + Nodes: nodes + }); +}; + +const pushSortieIfRelevant = (worldState: IWorldState, day: number): void => { const dayStart = getSortieTime(day); if (!isBeforeNextExpectedWorldStateRefresh(dayStart)) { return; @@ -231,6 +264,7 @@ const pushSortieIfRelevant = (out: ISortie[], day: number): void => { value.name.indexOf("Archwing") == -1 && value.missionIndex != 0 && // Exclude MT_ASSASSINATION value.missionIndex != 5 && // Exclude MT_CAPTURE + value.missionIndex != 10 && // Exclude MT_PVP (for relays) value.missionIndex != 21 && // Exclude MT_PURIFY value.missionIndex != 22 && // Exclude MT_ARENA value.missionIndex != 23 && // Exclude MT_JUNCTION @@ -292,7 +326,7 @@ const pushSortieIfRelevant = (out: ISortie[], day: number): void => { missionTypes.add(missionType); } - out.push({ + worldState.Sorties.push({ _id: { $oid: Math.trunc(dayStart / 1000).toString(16) + "d4d932c97c0a3acd" }, Activation: { $date: { $numberLong: dayStart.toString() } }, Expiry: { $date: { $numberLong: dayEnd.toString() } }, @@ -301,6 +335,13 @@ const pushSortieIfRelevant = (out: ISortie[], day: number): void => { Boss: boss, Variants: selectedNodes }); + + pushSyndicateMissions(worldState, day, rng.randomInt(0, 0xffff), "ba6f84724fa48049", "ArbitersSyndicate"); + pushSyndicateMissions(worldState, day, rng.randomInt(0, 0xffff), "ba6f84724fa4804a", "CephalonSudaSyndicate"); + pushSyndicateMissions(worldState, day, rng.randomInt(0, 0xffff), "ba6f84724fa4804e", "NewLokaSyndicate"); + pushSyndicateMissions(worldState, day, rng.randomInt(0, 0xffff), "ba6f84724fa48050", "PerrinSyndicate"); + pushSyndicateMissions(worldState, day, rng.randomInt(0, 0xffff), "ba6f84724fa4805e", "RedVeilSyndicate"); + pushSyndicateMissions(worldState, day, rng.randomInt(0, 0xffff), "ba6f84724fa48061", "SteelMeridianSyndicate"); }; const dailyChallenges = Object.keys(ExportNightwave.challenges).filter(x => @@ -953,9 +994,9 @@ export const getWorldState = (buildLabel?: string): IWorldState => { }); } - // Sortie cycling every day - pushSortieIfRelevant(worldState.Sorties, day - 1); - pushSortieIfRelevant(worldState.Sorties, day); + // Sortie & syndicate missions cycling every day (at 16:00 or 17:00 UTC depending on if London, OT is observing DST) + pushSortieIfRelevant(worldState, day - 1); + pushSortieIfRelevant(worldState, day); // Archon Hunt cycling every week worldState.LiteSorties.push(getLiteSortie(week)); diff --git a/static/fixed_responses/worldState/worldState.json b/static/fixed_responses/worldState/worldState.json index dd76dd56..9adb9556 100644 --- a/static/fixed_responses/worldState/worldState.json +++ b/static/fixed_responses/worldState/worldState.json @@ -63,22 +63,6 @@ } ], "SyndicateMissions": [ - { - "_id": { "$oid": "663a4fc5ba6f84724fa48049" }, - "Activation": { "$date": { "$numberLong": "1715097541439" } }, - "Expiry": { "$date": { "$numberLong": "2000000000000" } }, - "Tag": "ArbitersSyndicate", - "Seed": 24491, - "Nodes": ["SolNode223", "SolNode89", "SolNode146", "SolNode212", "SolNode167", "SolNode48", "SolNode78"] - }, - { - "_id": { "$oid": "663a4fc5ba6f84724fa4804a" }, - "Activation": { "$date": { "$numberLong": "1715097541439" } }, - "Expiry": { "$date": { "$numberLong": "2000000000000" } }, - "Tag": "CephalonSudaSyndicate", - "Seed": 12770, - "Nodes": ["SolNode36", "SolNode59", "SettlementNode12", "SolNode61", "SolNode12", "SolNode138", "SolNode72"] - }, { "_id": { "$oid": "663a4fc5ba6f84724fa4804c" }, "Activation": { "$date": { "$numberLong": "1715097541439" } }, @@ -103,14 +87,6 @@ "Seed": 50102, "Nodes": [] }, - { - "_id": { "$oid": "663a4fc5ba6f84724fa4804e" }, - "Activation": { "$date": { "$numberLong": "1715097541439" } }, - "Expiry": { "$date": { "$numberLong": "2000000000000" } }, - "Tag": "NewLokaSyndicate", - "Seed": 16064, - "Nodes": ["SolNode101", "SolNode224", "SolNode205", "SettlementNode2", "SolNode171", "SolNode188", "SolNode75"] - }, { "_id": { "$oid": "663a4fc5ba6f84724fa4804f" }, "Activation": { "$date": { "$numberLong": "1715097541439" } }, @@ -119,14 +95,6 @@ "Seed": 77721, "Nodes": [] }, - { - "_id": { "$oid": "663a4fc5ba6f84724fa48050" }, - "Activation": { "$date": { "$numberLong": "1715097541439" } }, - "Expiry": { "$date": { "$numberLong": "2000000000000" } }, - "Tag": "PerrinSyndicate", - "Seed": 9940, - "Nodes": ["SolNode39", "SolNode14", "SolNode203", "SolNode100", "SolNode130", "SolNode64", "SettlementNode15"] - }, { "_id": { "$oid": "663a4fc5ba6f84724fa48052" }, "Activation": { "$date": { "$numberLong": "1715097541439" } }, @@ -255,14 +223,6 @@ "Seed": 67257, "Nodes": [] }, - { - "_id": { "$oid": "663a4fc5ba6f84724fa4805e" }, - "Activation": { "$date": { "$numberLong": "1715097541439" } }, - "Expiry": { "$date": { "$numberLong": "2000000000000" } }, - "Tag": "RedVeilSyndicate", - "Seed": 46649, - "Nodes": ["SolNode226", "SolNode79", "SolNode216", "SettlementNode11", "SolNode56", "SolNode41", "SolNode23"] - }, { "_id": { "$oid": "663a4fc5ba6f84724fa48060" }, "Activation": { "$date": { "$numberLong": "1715097541439" } }, @@ -270,14 +230,6 @@ "Tag": "VoxSyndicate", "Seed": 77972, "Nodes": [] - }, - { - "_id": { "$oid": "663a4fc5ba6f84724fa48061" }, - "Activation": { "$date": { "$numberLong": "1715097541439" } }, - "Expiry": { "$date": { "$numberLong": "2000000000000" } }, - "Tag": "SteelMeridianSyndicate", - "Seed": 42366, - "Nodes": ["SolNode27", "SolNode107", "SolNode214", "SettlementNode1", "SolNode177", "SolNode141", "SolNode408"] } ], "ActiveMissions": [