XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

feat: syndicate mission rotation (#1781)

Closes #1530 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1781 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

32bb6d4c
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

2 个文件 +54 -61
Modified src/services/worldStateService.ts +54 -13
@@ -4,14 +4,7 @@ import { unixTimesInMs } from "@/src/constants/timeConstants";
4 4 import { config } from "@/src/services/configService";
5 5 import { CRng } from "@/src/services/rngService";
6 6 import { eMissionType, ExportNightwave, ExportRegions } from "warframe-public-export-plus";
7 import {
8 ICalendarDay,
9 ICalendarSeason,
10 ILiteSortie,
11 ISeasonChallenge,
12 ISortie,
13 IWorldState
14 } from "../types/worldStateTypes";
7 import { ICalendarDay, ICalendarSeason, ILiteSortie, ISeasonChallenge, IWorldState } from "../types/worldStateTypes";
15 8
16 9 const sortieBosses = [
17 10 "SORTIE_BOSS_HYENA",
@@ -174,7 +167,47 @@ const getSortieTime = (day: number): number => {
174 167 return dayStart + (isDst ? 16 : 17) * 3600000;
175 168 };
176 169
177 const pushSortieIfRelevant = (out: ISortie[], day: number): void => {
170 const pushSyndicateMissions = (
171 worldState: IWorldState,
172 day: number,
173 seed: number,
174 idSuffix: string,
175 syndicateTag: string
176 ): void => {
177 const nodeOptions: string[] = [];
178 for (const [key, value] of Object.entries(ExportRegions)) {
179 if (
180 value.name.indexOf("Archwing") == -1 && // no archwing
181 value.systemIndex != 23 && // no 1999 stuff
182 value.missionIndex != 10 && // Exclude MT_PVP (for relays)
183 value.missionIndex != 23 && // no junctions
184 value.missionIndex <= 28 // no railjack or some such
185 ) {
186 nodeOptions.push(key);
187 }
188 }
189
190 const rng = new CRng(seed);
191 const nodes: string[] = [];
192 for (let i = 0; i != 6; ++i) {
193 const index = rng.randomInt(0, nodeOptions.length - 1);
194 nodes.push(nodeOptions[index]);
195 nodeOptions.splice(index, 1);
196 }
197
198 const dayStart = getSortieTime(day);
199 const dayEnd = getSortieTime(day + 1);
200 worldState.SyndicateMissions.push({
201 _id: { $oid: Math.trunc(dayStart / 1000).toString(16) + idSuffix },
202 Activation: { $date: { $numberLong: dayStart.toString() } },
203 Expiry: { $date: { $numberLong: dayEnd.toString() } },
204 Tag: syndicateTag,
205 Seed: seed,
206 Nodes: nodes
207 });
208 };
209
210 const pushSortieIfRelevant = (worldState: IWorldState, day: number): void => {
178 211 const dayStart = getSortieTime(day);
179 212 if (!isBeforeNextExpectedWorldStateRefresh(dayStart)) {
180 213 return;
@@ -231,6 +264,7 @@ const pushSortieIfRelevant = (out: ISortie[], day: number): void => {
231 264 value.name.indexOf("Archwing") == -1 &&
232 265 value.missionIndex != 0 && // Exclude MT_ASSASSINATION
233 266 value.missionIndex != 5 && // Exclude MT_CAPTURE
267 value.missionIndex != 10 && // Exclude MT_PVP (for relays)
234 268 value.missionIndex != 21 && // Exclude MT_PURIFY
235 269 value.missionIndex != 22 && // Exclude MT_ARENA
236 270 value.missionIndex != 23 && // Exclude MT_JUNCTION
@@ -292,7 +326,7 @@ const pushSortieIfRelevant = (out: ISortie[], day: number): void => {
292 326 missionTypes.add(missionType);
293 327 }
294 328
295 out.push({
329 worldState.Sorties.push({
296 330 _id: { $oid: Math.trunc(dayStart / 1000).toString(16) + "d4d932c97c0a3acd" },
297 331 Activation: { $date: { $numberLong: dayStart.toString() } },
298 332 Expiry: { $date: { $numberLong: dayEnd.toString() } },
@@ -301,6 +335,13 @@ const pushSortieIfRelevant = (out: ISortie[], day: number): void => {
301 335 Boss: boss,
302 336 Variants: selectedNodes
303 337 });
338
339 pushSyndicateMissions(worldState, day, rng.randomInt(0, 0xffff), "ba6f84724fa48049", "ArbitersSyndicate");
340 pushSyndicateMissions(worldState, day, rng.randomInt(0, 0xffff), "ba6f84724fa4804a", "CephalonSudaSyndicate");
341 pushSyndicateMissions(worldState, day, rng.randomInt(0, 0xffff), "ba6f84724fa4804e", "NewLokaSyndicate");
342 pushSyndicateMissions(worldState, day, rng.randomInt(0, 0xffff), "ba6f84724fa48050", "PerrinSyndicate");
343 pushSyndicateMissions(worldState, day, rng.randomInt(0, 0xffff), "ba6f84724fa4805e", "RedVeilSyndicate");
344 pushSyndicateMissions(worldState, day, rng.randomInt(0, 0xffff), "ba6f84724fa48061", "SteelMeridianSyndicate");
304 345 };
305 346
306 347 const dailyChallenges = Object.keys(ExportNightwave.challenges).filter(x =>
@@ -953,9 +994,9 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
953 994 });
954 995 }
955 996
956 // Sortie cycling every day
957 pushSortieIfRelevant(worldState.Sorties, day - 1);
958 pushSortieIfRelevant(worldState.Sorties, day);
997 // Sortie & syndicate missions cycling every day (at 16:00 or 17:00 UTC depending on if London, OT is observing DST)
998 pushSortieIfRelevant(worldState, day - 1);
999 pushSortieIfRelevant(worldState, day);
959 1000
960 1001 // Archon Hunt cycling every week
961 1002 worldState.LiteSorties.push(getLiteSortie(week));
Modified static/fixed_responses/worldState/worldState.json +0 -48
@@ -63,22 +63,6 @@
63 63 }
64 64 ],
65 65 "SyndicateMissions": [
66 {
67 "_id": { "$oid": "663a4fc5ba6f84724fa48049" },
68 "Activation": { "$date": { "$numberLong": "1715097541439" } },
69 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
70 "Tag": "ArbitersSyndicate",
71 "Seed": 24491,
72 "Nodes": ["SolNode223", "SolNode89", "SolNode146", "SolNode212", "SolNode167", "SolNode48", "SolNode78"]
73 },
74 {
75 "_id": { "$oid": "663a4fc5ba6f84724fa4804a" },
76 "Activation": { "$date": { "$numberLong": "1715097541439" } },
77 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
78 "Tag": "CephalonSudaSyndicate",
79 "Seed": 12770,
80 "Nodes": ["SolNode36", "SolNode59", "SettlementNode12", "SolNode61", "SolNode12", "SolNode138", "SolNode72"]
81 },
82 66 {
83 67 "_id": { "$oid": "663a4fc5ba6f84724fa4804c" },
84 68 "Activation": { "$date": { "$numberLong": "1715097541439" } },
@@ -103,14 +87,6 @@
103 87 "Seed": 50102,
104 88 "Nodes": []
105 89 },
106 {
107 "_id": { "$oid": "663a4fc5ba6f84724fa4804e" },
108 "Activation": { "$date": { "$numberLong": "1715097541439" } },
109 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
110 "Tag": "NewLokaSyndicate",
111 "Seed": 16064,
112 "Nodes": ["SolNode101", "SolNode224", "SolNode205", "SettlementNode2", "SolNode171", "SolNode188", "SolNode75"]
113 },
114 90 {
115 91 "_id": { "$oid": "663a4fc5ba6f84724fa4804f" },
116 92 "Activation": { "$date": { "$numberLong": "1715097541439" } },
@@ -119,14 +95,6 @@
119 95 "Seed": 77721,
120 96 "Nodes": []
121 97 },
122 {
123 "_id": { "$oid": "663a4fc5ba6f84724fa48050" },
124 "Activation": { "$date": { "$numberLong": "1715097541439" } },
125 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
126 "Tag": "PerrinSyndicate",
127 "Seed": 9940,
128 "Nodes": ["SolNode39", "SolNode14", "SolNode203", "SolNode100", "SolNode130", "SolNode64", "SettlementNode15"]
129 },
130 98 {
131 99 "_id": { "$oid": "663a4fc5ba6f84724fa48052" },
132 100 "Activation": { "$date": { "$numberLong": "1715097541439" } },
@@ -255,14 +223,6 @@
255 223 "Seed": 67257,
256 224 "Nodes": []
257 225 },
258 {
259 "_id": { "$oid": "663a4fc5ba6f84724fa4805e" },
260 "Activation": { "$date": { "$numberLong": "1715097541439" } },
261 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
262 "Tag": "RedVeilSyndicate",
263 "Seed": 46649,
264 "Nodes": ["SolNode226", "SolNode79", "SolNode216", "SettlementNode11", "SolNode56", "SolNode41", "SolNode23"]
265 },
266 226 {
267 227 "_id": { "$oid": "663a4fc5ba6f84724fa48060" },
268 228 "Activation": { "$date": { "$numberLong": "1715097541439" } },
@@ -270,14 +230,6 @@
270 230 "Tag": "VoxSyndicate",
271 231 "Seed": 77972,
272 232 "Nodes": []
273 },
274 {
275 "_id": { "$oid": "663a4fc5ba6f84724fa48061" },
276 "Activation": { "$date": { "$numberLong": "1715097541439" } },
277 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
278 "Tag": "SteelMeridianSyndicate",
279 "Seed": 42366,
280 "Nodes": ["SolNode27", "SolNode107", "SolNode214", "SettlementNode1", "SolNode177", "SolNode141", "SolNode408"]
281 233 }
282 234 ],
283 235 "ActiveMissions": [