fix: give ChallengeProgress with unlockAllScans cheat (#3020)
Closes #3013 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Reviewed-on: #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>
This commit was merged in pull request #3020.
This commit is contained in:
@@ -3,10 +3,11 @@ import allScans from "../../../static/fixed_responses/allScans.json" with { type
|
||||
import { ExportEnemies } from "warframe-public-export-plus";
|
||||
import { getAccountIdForRequest } from "../../services/loginService.ts";
|
||||
import { getStats } from "../../services/statsService.ts";
|
||||
import { getInventory } from "../../services/inventoryService.ts";
|
||||
|
||||
export const unlockAllScansController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
const stats = await getStats(accountId);
|
||||
const [stats, inventory] = await Promise.all([getStats(accountId), getInventory(accountId, "ChallengeProgress")]);
|
||||
|
||||
const scanTypes = new Set<string>(allScans);
|
||||
for (const type of Object.keys(ExportEnemies.avatars)) {
|
||||
@@ -18,6 +19,17 @@ export const unlockAllScansController: RequestHandler = async (req, res) => {
|
||||
stats.Scans.push({ type, scans: 9999 });
|
||||
}
|
||||
|
||||
await stats.save();
|
||||
const jsCodex = inventory.ChallengeProgress.find(x => x.Name === "JSCodexScan");
|
||||
|
||||
if (jsCodex) {
|
||||
jsCodex.Progress = 1;
|
||||
} else {
|
||||
inventory.ChallengeProgress.push({
|
||||
Name: "JSCodexScan",
|
||||
Progress: 1
|
||||
});
|
||||
}
|
||||
|
||||
await Promise.all([stats.save(), inventory.save()]);
|
||||
res.end();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user