返回提交历史
Modified
src/controllers/api/inboxController.ts
+12
-3
Modified
src/services/worldStateService.ts
+22
-0
Modified
src/types/worldStateTypes.ts
+13
-0
XFEstudio/XFESpaceNinjaServer
fix: compatibility with echoes of duviri (#1928)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1928 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
ed54e00a
代码差异
3 个文件
+47
-3
@@ -14,6 +14,7 @@ import { logger } from "@/src/utils/logger";
14
14
import { ExportFlavour } from "warframe-public-export-plus";
15
15
import { handleStoreItemAcquisition } from "@/src/services/purchaseService";
16
16
import { fromStoreItem, isStoreItem } from "@/src/services/itemDataService";
17
import { IOid } from "@/src/types/commonTypes";
17
18
18
19
export const inboxController: RequestHandler = async (req, res) => {
19
20
const { deleteId, lastMessage: latestClientMessageId, messageId } = req.query;
@@ -28,10 +29,10 @@ export const inboxController: RequestHandler = async (req, res) => {
28
29
return;
29
30
}
30
31
31
await deleteMessageRead(deleteId as string);
32
await deleteMessageRead(parseOid(deleteId as string));
32
33
res.status(200).end();
33
34
} else if (messageId) {
34
const message = await getMessage(messageId as string);
35
const message = await getMessage(parseOid(messageId as string));
35
36
message.r = true;
36
37
await message.save();
37
38
@@ -100,7 +101,7 @@ export const inboxController: RequestHandler = async (req, res) => {
100
101
await createNewEventMessages(req);
101
102
const messages = await Inbox.find({ ownerId: accountId }).sort({ date: 1 });
102
103
103
const latestClientMessage = messages.find(m => m._id.toString() === latestClientMessageId);
104
const latestClientMessage = messages.find(m => m._id.toString() === parseOid(latestClientMessageId as string));
104
105
105
106
if (!latestClientMessage) {
106
107
logger.debug(`this should only happen after DeleteAllRead `);
@@ -123,3 +124,11 @@ export const inboxController: RequestHandler = async (req, res) => {
123
124
res.json({ Inbox: inbox });
124
125
}
125
126
};
127
128
// 33.6.0 has query arguments like lastMessage={"$oid":"68112baebf192e786d1502bb"} instead of lastMessage=68112baebf192e786d1502bb
129
const parseOid = (oid: string): string => {
130
if (oid[0] == "{") {
131
return (JSON.parse(oid) as IOid).$oid;
132
}
133
return oid;
134
};
@@ -724,6 +724,11 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
724
724
SyndicateMissions: [...staticWorldState.SyndicateMissions]
725
725
};
726
726
727
// Omit void fissures for versions prior to Whispers in the Walls to avoid errors with the unknown deimos nodes having void fissures.
728
if (buildLabel && version_compare(buildLabel, "2023.11.06.13.39") <= 0) {
729
worldState.ActiveMissions = [];
730
}
731
727
732
if (config.worldState?.starDays) {
728
733
worldState.Goals.push({
729
734
_id: { $oid: "67a4dcce2a198564d62e1647" },
@@ -1227,3 +1232,20 @@ export const isArchwingMission = (node: IRegion): boolean => {
1227
1232
}
1228
1233
return false;
1229
1234
};
1235
1236
export const version_compare = (a: string, b: string): number => {
1237
const a_digits = a
1238
.split("/")[0]
1239
.split(".")
1240
.map(x => parseInt(x));
1241
const b_digits = b
1242
.split("/")[0]
1243
.split(".")
1244
.map(x => parseInt(x));
1245
for (let i = 0; i != a_digits.length; ++i) {
1246
if (a_digits[i] != b_digits[i]) {
1247
return a_digits[i] > b_digits[i] ? 1 : -1;
1248
}
1249
}
1250
return 0;
1251
};
@@ -10,6 +10,7 @@ export interface IWorldState {
10
10
LiteSorties: ILiteSortie[];
11
11
SyndicateMissions: ISyndicateMissionInfo[];
12
12
GlobalUpgrades: IGlobalUpgrade[];
13
ActiveMissions: IFissure[];
13
14
NodeOverrides: INodeOverride[];
14
15
EndlessXpChoices: IEndlessXpChoice[];
15
16
SeasonInfo: {
@@ -71,6 +72,18 @@ export interface IGlobalUpgrade {
71
72
LocalizeDescTag: string;
72
73
}
73
74
75
export interface IFissure {
76
_id: IOid;
77
Region: number;
78
Seed: number;
79
Activation: IMongoDate;
80
Expiry: IMongoDate;
81
Node: string;
82
MissionType: string;
83
Modifier: string;
84
Hard?: boolean;
85
}
86
74
87
export interface INodeOverride {
75
88
_id: IOid;
76
89
Activation?: IMongoDate;