返回提交历史
Modified
src/controllers/api/giveKeyChainTriggeredMessageController.ts
+4
-4
Modified
src/services/itemDataService.ts
+32
-5
Modified
src/services/questService.ts
+3
-2
XFEstudio/XFESpaceNinjaServer
chore: add supplemental data for once awake pre-u37 (#3899)
Closes #3898 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3899 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
48c9b9ea
代码差异
3 个文件
+39
-11
@@ -1,16 +1,16 @@
1
1
import { getInventory } from "../../services/inventoryService.ts";
2
import { getAccountIdForRequest } from "../../services/loginService.ts";
2
import { getAccountForRequest } from "../../services/loginService.ts";
3
3
import { giveKeyChainMessage } from "../../services/questService.ts";
4
4
import type { IKeyChainRequest } from "../../types/requestTypes.ts";
5
5
import type { RequestHandler } from "express";
6
6
7
7
export const giveKeyChainTriggeredMessageController: RequestHandler = async (req, res) => {
8
const accountId = await getAccountIdForRequest(req);
8
const account = await getAccountForRequest(req);
9
9
const keyChainInfo = JSON.parse((req.body as Buffer).toString()) as IKeyChainRequest;
10
10
11
const inventory = await getInventory(accountId, "QuestKeys accountOwnerId");
11
const inventory = await getInventory(account._id, "QuestKeys accountOwnerId");
12
12
const questKey = inventory.QuestKeys.find(qk => qk.ItemType === keyChainInfo.KeyChain)!;
13
await giveKeyChainMessage(inventory, keyChainInfo, questKey);
13
await giveKeyChainMessage(inventory, keyChainInfo, questKey, true, account.BuildLabel);
14
14
await inventory.save();
15
15
16
16
res.send(1);
@@ -1348,7 +1348,7 @@ export const getLevelKeyRewards = (
1348
1348
levelKey: string,
1349
1349
buildLabel: string | undefined
1350
1350
): { levelKeyRewards?: IMissionReward; levelKeyRewards2?: TReward[]; levelMission?: Partial<IRegion> } => {
1351
const key = getKey(levelKey);
1351
const key = getKey(levelKey, buildLabel);
1352
1352
1353
1353
const levelKeyRewards = key?.missionReward;
1354
1354
let levelKeyRewards2 = key?.rewards;
@@ -1392,9 +1392,11 @@ export const getLevelKeyRewards = (
1392
1392
};
1393
1393
};
1394
1394
1395
export const getKeyChainMessage = ({ KeyChain, ChainStage }: IKeyChainRequest): IMessage => {
1396
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1397
const chainStages = ExportKeys[KeyChain]?.chainStages;
1395
export const getKeyChainMessage = (
1396
{ KeyChain, ChainStage }: IKeyChainRequest,
1397
buildLabel: string | undefined
1398
): IMessage => {
1399
const chainStages = getKey(KeyChain, buildLabel)?.chainStages;
1398
1400
if (!chainStages) {
1399
1401
throw new Error(`KeyChain ${KeyChain} does not contain chain stages`);
1400
1402
}
@@ -1840,7 +1842,7 @@ export const getKey = (uniqueName: string, buildLabel?: string): IKey | undefine
1840
1842
} else if (uniqueName == "/Lotus/Types/Keys/DragonQuest/DragonQuestKeyChain") {
1841
1843
// Before U19 (Hotfix: Specters of the Rail 0.12, 2016-07-20), The New Strange gave Chroma component blueprints more directly.
1842
1844
if (buildLabel && version_compare(buildLabel, "2016.07.20.00.00") < 0) {
1843
const latestData = ExportKeys["/Lotus/Types/Keys/DragonQuest/DragonQuestKeyChain"];
1845
const latestData = ExportKeys[uniqueName];
1844
1846
return {
1845
1847
...latestData,
1846
1848
chainStages: latestData.chainStages!.map(chainStage => {
@@ -1869,6 +1871,31 @@ export const getKey = (uniqueName: string, buildLabel?: string): IKey | undefine
1869
1871
})
1870
1872
};
1871
1873
}
1874
} else if (uniqueName == "/Lotus/Types/Keys/InfestedIntroQuest/InfestedIntroQuestKeyChain") {
1875
if (buildLabel && version_compare(buildLabel, gameToBuildVersion["37.0.0"]) < 0) {
1876
const latestData = ExportKeys[uniqueName];
1877
return {
1878
...latestData,
1879
chainStages: [
1880
latestData.chainStages![0],
1881
latestData.chainStages![1],
1882
latestData.chainStages![2],
1883
latestData.chainStages![3],
1884
latestData.chainStages![4],
1885
{
1886
itemsToGiveWhenTriggered: [],
1887
messageToSendWhenTriggered: {
1888
sender: "/Lotus/Language/Menu/Mailbox_WarframeSender",
1889
title: "/Lotus/Language/G1Quests/IIQCompleteMessageTitle",
1890
body: "/Lotus/Language/G1Quests/IIQCompleteMessageBody",
1891
attachments: [],
1892
countedAttachments: []
1893
}
1894
},
1895
latestData.chainStages![5]
1896
]
1897
};
1898
}
1872
1899
}
1873
1900
1874
1901
return ExportKeys[uniqueName];
@@ -394,9 +394,10 @@ export const giveKeyChainMessage = async (
394
394
inventory: TInventoryDatabaseDocument,
395
395
keyChainInfo: IKeyChainRequest,
396
396
questKey: IQuestKeyDatabase,
397
sendMessage: boolean = true
397
sendMessage: boolean = true,
398
buildLabel?: string
398
399
): Promise<void> => {
399
const keyChainMessage = getKeyChainMessage(keyChainInfo);
400
const keyChainMessage = getKeyChainMessage(keyChainInfo, buildLabel);
400
401
401
402
if ((questKey.Progress?.[0]?.c ?? 0) > 0) {
402
403
keyChainMessage.att = [];