SpaceNinjaServer/src/controllers/custom/completeAllMissionsController.ts
Sainan bf12f90c88
All checks were successful
Build / build (push) Successful in 55s
Build Docker image / docker-arm64 (push) Successful in 1m2s
Build Docker image / docker-amd64 (push) Successful in 1m11s
chore: replace unlockAllMissions config with an account cheats button (#2241)
This way, mission completion rewards are given. This is especially import for junction rewards like quest keys (Closes #2229).

Reviewed-on: #2241
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
2025-06-22 06:37:17 -07:00

35 lines
1.5 KiB
TypeScript

import { addString } from "@/src/helpers/stringHelpers";
import { getInventory } from "@/src/services/inventoryService";
import { getAccountIdForRequest } from "@/src/services/loginService";
import { addFixedLevelRewards } from "@/src/services/missionInventoryUpdateService";
import { handleStoreItemAcquisition } from "@/src/services/purchaseService";
import { IMissionReward } from "@/src/types/missionTypes";
import { RequestHandler } from "express";
import { ExportRegions } from "warframe-public-export-plus";
export const completeAllMissionsController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId);
const MissionRewards: IMissionReward[] = [];
for (const [tag, node] of Object.entries(ExportRegions)) {
if (!inventory.Missions.find(x => x.Tag == tag)) {
inventory.Missions.push({
Completes: 1,
Tier: 1,
Tag: tag
});
if (node.missionReward) {
console.log(node.missionReward);
addFixedLevelRewards(node.missionReward, inventory, MissionRewards);
}
}
}
for (const reward of MissionRewards) {
await handleStoreItemAcquisition(reward.StoreItem, inventory, reward.ItemCount, undefined, true);
}
addString(inventory.NodeIntrosCompleted, "TeshinHardModeUnlocked");
await inventory.save();
res.end();
};