返回提交历史
Modified
src/controllers/custom/unlockAllScansController.ts
+14
-2
XFEstudio/SpaceNinjaServer
fix: give ChallengeProgress with unlockAllScans cheat (#3020)
Closes #3013 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3020 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
55e28715
代码差异
1 个文件
+14
-2
@@ -3,10 +3,11 @@ import allScans from "../../../static/fixed_responses/allScans.json" with { type
3
3
import { ExportEnemies } from "warframe-public-export-plus";
4
4
import { getAccountIdForRequest } from "../../services/loginService.ts";
5
5
import { getStats } from "../../services/statsService.ts";
6
import { getInventory } from "../../services/inventoryService.ts";
6
7
7
8
export const unlockAllScansController: RequestHandler = async (req, res) => {
8
9
const accountId = await getAccountIdForRequest(req);
9
const stats = await getStats(accountId);
10
const [stats, inventory] = await Promise.all([getStats(accountId), getInventory(accountId, "ChallengeProgress")]);
10
11
11
12
const scanTypes = new Set<string>(allScans);
12
13
for (const type of Object.keys(ExportEnemies.avatars)) {
@@ -18,6 +19,17 @@ export const unlockAllScansController: RequestHandler = async (req, res) => {
18
19
stats.Scans.push({ type, scans: 9999 });
19
20
}
20
21
21
await stats.save();
22
const jsCodex = inventory.ChallengeProgress.find(x => x.Name === "JSCodexScan");
23
24
if (jsCodex) {
25
jsCodex.Progress = 1;
26
} else {
27
inventory.ChallengeProgress.push({
28
Name: "JSCodexScan",
29
Progress: 1
30
});
31
}
32
33
await Promise.all([stats.save(), inventory.save()]);
22
34
res.end();
23
35
};