返回提交历史
Modified
src/controllers/custom/completeAllMissionsController.ts
+14
-8
XFEstudio/XFESpaceNinjaServer
fix(webui): handle existing entries for unlock all missions (#2290)
Closes #2283 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2290 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
b42182c8
代码差异
1 个文件
+14
-8
@@ -12,18 +12,24 @@ export const completeAllMissionsController: RequestHandler = async (req, res) =>
12
12
const inventory = await getInventory(accountId);
13
13
const MissionRewards: IMissionReward[] = [];
14
14
for (const [tag, node] of Object.entries(ExportRegions)) {
15
if (!inventory.Missions.find(x => x.Tag == tag)) {
16
inventory.Missions.push({
17
Completes: 1,
18
Tier: 1,
19
Tag: tag
20
});
21
15
let mission = inventory.Missions.find(x => x.Tag == tag);
16
if (!mission) {
17
mission =
18
inventory.Missions[
19
inventory.Missions.push({
20
Completes: 0,
21
Tier: 0,
22
Tag: tag
23
}) - 1
24
];
25
}
26
if (mission.Completes == 0) {
27
mission.Completes++;
22
28
if (node.missionReward) {
23
console.log(node.missionReward);
24
29
addFixedLevelRewards(node.missionReward, inventory, MissionRewards);
25
30
}
26
31
}
32
mission.Tier = 1;
27
33
}
28
34
for (const reward of MissionRewards) {
29
35
await handleStoreItemAcquisition(reward.StoreItem, inventory, reward.ItemCount, undefined, true);