From bf12f90c8899ab0324841c0684573c18f54232b3 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Sun, 22 Jun 2025 06:37:17 -0700 Subject: [PATCH] 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: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2241 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com> --- config.json.example | 1 - src/controllers/api/inventoryController.ts | 28 +------ .../custom/completeAllMissionsController.ts | 34 ++++++++ src/helpers/stringHelpers.ts | 6 ++ src/routes/custom.ts | 2 + src/services/configService.ts | 1 - src/services/missionInventoryUpdateService.ts | 2 +- static/webui/index.html | 9 +- static/webui/script.js | 84 ++++++++++--------- 9 files changed, 91 insertions(+), 76 deletions(-) create mode 100644 src/controllers/custom/completeAllMissionsController.ts diff --git a/config.json.example b/config.json.example index 9287091c..78eac7a1 100644 --- a/config.json.example +++ b/config.json.example @@ -13,7 +13,6 @@ "skipTutorial": false, "skipAllDialogue": false, "unlockAllScans": false, - "unlockAllMissions": false, "infiniteCredits": false, "infinitePlatinum": false, "infiniteEndo": false, diff --git a/src/controllers/api/inventoryController.ts b/src/controllers/api/inventoryController.ts index cdaf8d4d..ed4b8cff 100644 --- a/src/controllers/api/inventoryController.ts +++ b/src/controllers/api/inventoryController.ts @@ -6,13 +6,7 @@ import allDialogue from "@/static/fixed_responses/allDialogue.json"; import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes"; import { IInventoryClient, IShipInventory, equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes"; import { IPolarity, ArtifactPolarity, EquipmentFeatures } from "@/src/types/inventoryTypes/commonInventoryTypes"; -import { - ExportCustoms, - ExportFlavour, - ExportRegions, - ExportResources, - ExportVirtuals -} from "warframe-public-export-plus"; +import { ExportCustoms, ExportFlavour, ExportResources, ExportVirtuals } from "warframe-public-export-plus"; import { applyCheatsToInfestedFoundry, handleSubsumeCompletion } from "@/src/services/infestedFoundryService"; import { addMiscItems, @@ -22,7 +16,7 @@ import { generateRewardSeed } from "@/src/services/inventoryService"; import { logger } from "@/src/utils/logger"; -import { catBreadHash } from "@/src/helpers/stringHelpers"; +import { addString, catBreadHash } from "@/src/helpers/stringHelpers"; import { Types } from "mongoose"; import { getNemesisManifest } from "@/src/helpers/nemesisHelpers"; import { getPersonalRooms } from "@/src/services/personalRoomsService"; @@ -167,18 +161,6 @@ export const getInventoryResponse = async ( } } - if (config.unlockAllMissions) { - inventoryResponse.Missions = []; - for (const tag of Object.keys(ExportRegions)) { - inventoryResponse.Missions.push({ - Completes: 1, - Tier: 1, - Tag: tag - }); - } - addString(inventoryResponse.NodeIntrosCompleted, "TeshinHardModeUnlocked"); - } - if (config.unlockAllShipDecorations) { inventoryResponse.ShipDecorations = []; for (const [uniqueName, item] of Object.entries(ExportResources)) { @@ -362,12 +344,6 @@ const allEudicoHeistJobs = [ "/Lotus/Types/Gameplay/Venus/Jobs/Heists/HeistProfitTakerBountyFour" ]; -const addString = (arr: string[], str: string): void => { - if (arr.indexOf(str) == -1) { - arr.push(str); - } -}; - const getExpRequiredForMr = (rank: number): number => { if (rank <= 30) { return 2500 * rank * rank; diff --git a/src/controllers/custom/completeAllMissionsController.ts b/src/controllers/custom/completeAllMissionsController.ts new file mode 100644 index 00000000..2e7ac2fb --- /dev/null +++ b/src/controllers/custom/completeAllMissionsController.ts @@ -0,0 +1,34 @@ +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(); +}; diff --git a/src/helpers/stringHelpers.ts b/src/helpers/stringHelpers.ts index 06d2ac28..3512c1ea 100644 --- a/src/helpers/stringHelpers.ts +++ b/src/helpers/stringHelpers.ts @@ -54,3 +54,9 @@ export const regexEscape = (str: string): string => { str = str.split("}").join("\\}"); return str; }; + +export const addString = (arr: string[], str: string): void => { + if (arr.indexOf(str) == -1) { + arr.push(str); + } +}; diff --git a/src/routes/custom.ts b/src/routes/custom.ts index 75eb80a4..35d89d4d 100644 --- a/src/routes/custom.ts +++ b/src/routes/custom.ts @@ -12,6 +12,7 @@ import { ircDroppedController } from "@/src/controllers/custom/ircDroppedControl import { unlockAllIntrinsicsController } from "@/src/controllers/custom/unlockAllIntrinsicsController"; import { addMissingMaxRankModsController } from "@/src/controllers/custom/addMissingMaxRankModsController"; import { webuiFileChangeDetectedController } from "@/src/controllers/custom/webuiFileChangeDetectedController"; +import { completeAllMissionsController } from "@/src/controllers/custom/completeAllMissionsController"; import { createAccountController } from "@/src/controllers/custom/createAccountController"; import { createMessageController } from "@/src/controllers/custom/createMessageController"; @@ -40,6 +41,7 @@ customRouter.get("/ircDropped", ircDroppedController); customRouter.get("/unlockAllIntrinsics", unlockAllIntrinsicsController); customRouter.get("/addMissingMaxRankMods", addMissingMaxRankModsController); customRouter.get("/webuiFileChangeDetected", webuiFileChangeDetectedController); +customRouter.get("/completeAllMissions", completeAllMissionsController); customRouter.post("/createAccount", createAccountController); customRouter.post("/createMessage", createMessageController); diff --git a/src/services/configService.ts b/src/services/configService.ts index 6ef2e96f..79d76d73 100644 --- a/src/services/configService.ts +++ b/src/services/configService.ts @@ -19,7 +19,6 @@ export interface IConfig { skipTutorial?: boolean; skipAllDialogue?: boolean; unlockAllScans?: boolean; - unlockAllMissions?: boolean; infiniteCredits?: boolean; infinitePlatinum?: boolean; infiniteEndo?: boolean; diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index 499115f9..e903f9de 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -1367,7 +1367,7 @@ export const addFixedLevelRewards = ( if (rewards.countedItems) { for (const item of rewards.countedItems) { MissionRewards.push({ - StoreItem: `/Lotus/StoreItems${item.ItemType.substring("Lotus/".length)}`, + StoreItem: toStoreItem(item.ItemType), ItemCount: item.ItemCount }); } diff --git a/static/webui/index.html b/static/webui/index.html index 1a748968..dca46e9d 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -452,9 +452,6 @@ -