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: add worldState.circuitGameModes config option (#2192)

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

9af0e06b
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

5 个文件 +57 -5
Modified README.md +1 -0
@@ -33,3 +33,4 @@ SpaceNinjaServer requires a `config.json`. To set it up, you can copy the [confi
33 33 - `RadioLegion2Syndicate` for The Emissary
34 34 - `RadioLegionIntermissionSyndicate` for Intermission I
35 35 - `RadioLegionSyndicate` for The Wolf of Saturn Six
36 - `worldState.circuitGameModes` can be provided with an array of valid game modes (`Survival`, `VoidFlood`, `Excavation`, `Defense`, `Exterminate`, `Assassination`, `Alchemy`)
Modified config.json.example +2 -1
@@ -58,7 +58,8 @@
58 58 "starDays": true,
59 59 "eidolonOverride": "",
60 60 "vallisOverride": "",
61 "nightwaveOverride": ""
61 "nightwaveOverride": "",
62 "circuitGameModes": null
62 63 },
63 64 "dev": {
64 65 "keepVendorsExpired": false
Modified src/services/configService.ts +1 -0
@@ -65,6 +65,7 @@ interface IConfig {
65 65 eidolonOverride?: string;
66 66 vallisOverride?: string;
67 67 nightwaveOverride?: string;
68 circuitGameModes?: string[];
68 69 };
69 70 dev?: {
70 71 keepVendorsExpired?: boolean;
Modified src/services/worldStateService.ts +8 -4
@@ -16,8 +16,10 @@ import {
16 16 ISortie,
17 17 ISortieMission,
18 18 ISyndicateMissionInfo,
19 ITmp,
19 20 IVoidStorm,
20 IWorldState
21 IWorldState,
22 TCircuitGameMode
21 23 } from "../types/worldStateTypes";
22 24 import { version_compare } from "../helpers/inventoryHelpers";
23 25 import { logger } from "../utils/logger";
@@ -1303,10 +1305,9 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
1303 1305 const cheeseInterval = hourInSeconds * 8;
1304 1306 const cheeseDuration = hourInSeconds * 2;
1305 1307 const cheeseIndex = Math.trunc(timeSecs / cheeseInterval);
1306 const tmp = {
1308 const tmp: ITmp = {
1307 1309 cavabegin: "1690761600",
1308 1310 PurchasePlatformLockEnabled: true,
1309 tcsn: true,
1310 1311 pgr: {
1311 1312 ts: "1732572900",
1312 1313 en: "CUSTOM DECALS @ ZEVILA",
@@ -1330,10 +1331,13 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
1330 1331 fbst: {
1331 1332 a: cheeseIndex * cheeseInterval, // This has a bug where the client shows a negative time for "Xtra cheese starts in ..." until it refreshes the world state. This is because we're only providing the new activation as soon as that time/date is reached. However, this is 100% faithful to live.
1332 1333 e: cheeseIndex * cheeseInterval + cheeseDuration,
1333 n: (cheeseIndex + 1) * hourInSeconds * 8
1334 n: (cheeseIndex + 1) * cheeseInterval
1334 1335 },
1335 1336 sfn: [550, 553, 554, 555][halfHour % 4]
1336 1337 };
1338 if (Array.isArray(config.worldState?.circuitGameModes)) {
1339 tmp.edg = config.worldState.circuitGameModes as TCircuitGameMode[];
1340 }
1337 1341 worldState.Tmp = JSON.stringify(tmp);
1338 1342
1339 1343 return worldState;
Modified src/types/worldStateTypes.ts +45 -0
@@ -191,3 +191,48 @@ export interface ICalendarEvent {
191 191 dialogueName?: string;
192 192 dialogueConvo?: string;
193 193 }
194
195 export type TCircuitGameMode =
196 | "Survival"
197 | "VoidFlood"
198 | "Excavation"
199 | "Defense"
200 | "Exterminate"
201 | "Assassination"
202 | "Alchemy";
203
204 export interface ITmp {
205 cavabegin: string;
206 PurchasePlatformLockEnabled: boolean; // Seems unused
207 pgr: IPgr;
208 ennnd?: boolean; // True if 1999 demo is available (no effect for >=38.6.0)
209 mbrt?: boolean; // Related to mobile app rating request
210 fbst: IFbst;
211 sfn: number;
212 edg?: TCircuitGameMode[]; // The Circuit game modes overwrite
213 }
214
215 interface IPgr {
216 ts: string;
217 en: string;
218 fr: string;
219 it: string;
220 de: string;
221 es: string;
222 pt: string;
223 ru: string;
224 pl: string;
225 uk: string;
226 tr: string;
227 ja: string;
228 zh: string;
229 ko: string;
230 tc: string;
231 th: string;
232 }
233
234 interface IFbst {
235 a: number;
236 e: number;
237 n: number;
238 }