返回提交历史
Modified
src/controllers/dynamic/worldStateController.ts
+9
-0
Modified
src/types/worldStateTypes.ts
+23
-1
XFEstudio/XFESpaceNinjaServer
feat: worldState l parameter (#3126)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3126 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
c9b571b2
代码差异
2 个文件
+32
-1
@@ -16,5 +16,14 @@ export const worldStateController: RequestHandler = async (req, res) => {
16
16
17
17
await Promise.all(populatePromises);
18
18
19
if (req.query.l && worldState.Events) {
20
for (const event of worldState.Events) {
21
const msg = event.Messages.find(x => x.LanguageCode == req.query.l)?.Message ?? event.Msg;
22
if (msg) {
23
event.Messages = [{ Message: msg }];
24
}
25
}
26
}
27
19
28
res.json(worldState);
20
29
};
@@ -4,9 +4,10 @@ import type { IMongoDate, IOid } from "./commonTypes.ts";
4
4
export interface IWorldState {
5
5
WorldSeed?: string;
6
6
Version: number; // for goals
7
MobileVersion?: string; // if present, the companion app may show a warning about being out of dateworldState.Events
7
8
BuildLabel: string;
8
9
Time: number;
9
InGameMarket: IInGameMarket;
10
Events?: IEvent[];
10
11
Goals: IGoal[];
11
12
Alerts: IAlert[];
12
13
Sorties: ISortie[];
@@ -15,6 +16,7 @@ export interface IWorldState {
15
16
ActiveMissions: IFissure[];
16
17
FlashSales: IFlashSale[];
17
18
GlobalUpgrades: IGlobalUpgrade[];
19
InGameMarket: IInGameMarket;
18
20
Invasions: IInvasion[];
19
21
NodeOverrides: INodeOverride[];
20
22
VoidTraders: IVoidTrader[];
@@ -37,6 +39,26 @@ export interface IWorldState {
37
39
Tmp?: string;
38
40
}
39
41
42
export interface IEvent {
43
_id?: IOid;
44
Msg?: string;
45
Messages: {
46
LanguageCode?: string;
47
Message: string;
48
}[];
49
Prop: string;
50
Icon?: string;
51
Priority?: boolean;
52
MobileOnly?: boolean;
53
Community?: boolean;
54
Date?: IMongoDate;
55
ImageUrl?: string;
56
EventEndDate?: IMongoDate;
57
HideEndDateModifier?: boolean;
58
EventStartDate?: IMongoDate;
59
EventLiveUrl?: string;
60
}
61
40
62
export interface IAlert {
41
63
_id: IOid;
42
64
Activation: IMongoDate;