diff --git a/config-vanilla.json b/config-vanilla.json index 37efdda5..8ac9c564 100644 --- a/config-vanilla.json +++ b/config-vanilla.json @@ -10,12 +10,9 @@ "administratorNames": [], "autoCreateAccount": true, "skipTutorial": false, - "unlockAllScans": false, - "unlockAllShipFeatures": false, "unlockAllShipDecorations": false, "unlockAllFlavourItems": false, "unlockAllSkins": false, - "unlockAllCapturaScenes": false, "fullyStockedVendors": false, "skipClanKeyCrafting": false, "noDojoRoomBuildStage": false, diff --git a/src/controllers/api/getShipController.ts b/src/controllers/api/getShipController.ts index 3166655c..ad5cd642 100644 --- a/src/controllers/api/getShipController.ts +++ b/src/controllers/api/getShipController.ts @@ -1,6 +1,4 @@ import type { RequestHandler } from "express"; -import { config } from "../../services/configService.ts"; -import allShipFeatures from "../../../static/fixed_responses/allShipFeatures.json" with { type: "json" }; import { getAccountIdForRequest } from "../../services/loginService.ts"; import { createGarden, getPersonalRooms } from "../../services/personalRoomsService.ts"; import type { IGetShipResponse, IPersonalRoomsClient } from "../../types/personalRoomsTypes.ts"; @@ -31,9 +29,5 @@ export const getShipController: RequestHandler = async (req, res) => { TailorShop: personalRooms.TailorShop }; - if (config.unlockAllShipFeatures) { - getShipResponse.Ship.Features = allShipFeatures; - } - res.json(getShipResponse); }; diff --git a/src/controllers/api/inventoryController.ts b/src/controllers/api/inventoryController.ts index 13bbd21a..3e6e8bfa 100644 --- a/src/controllers/api/inventoryController.ts +++ b/src/controllers/api/inventoryController.ts @@ -10,7 +10,7 @@ import { equipmentKeys } from "../../types/inventoryTypes/inventoryTypes.ts"; import type { IPolarity } from "../../types/inventoryTypes/commonInventoryTypes.ts"; import { ArtifactPolarity } from "../../types/inventoryTypes/commonInventoryTypes.ts"; import type { ICountedItem } from "warframe-public-export-plus"; -import { eFaction, ExportCustoms, ExportFlavour, ExportResources, ExportVirtuals } from "warframe-public-export-plus"; +import { eFaction, ExportCustoms, ExportFlavour, ExportResources } from "warframe-public-export-plus"; import { applyCheatsToInfestedFoundry, handleSubsumeCompletion } from "../../services/infestedFoundryService.ts"; import { addEmailItem, @@ -358,17 +358,6 @@ export const getInventoryResponse = async ( } } - if (config.unlockAllCapturaScenes) { - for (const uniqueName of Object.keys(ExportResources)) { - if (resourceInheritsFrom(uniqueName, "/Lotus/Types/Items/MiscItems/PhotoboothTile")) { - inventoryResponse.MiscItems.push({ - ItemType: uniqueName, - ItemCount: 1 - }); - } - } - } - if (typeof config.spoofMasteryRank === "number" && config.spoofMasteryRank >= 0) { inventoryResponse.PlayerLevel = config.spoofMasteryRank; if (!xpBasedLevelCapDisabled) { @@ -495,21 +484,3 @@ const getExpRequiredForMr = (rank: number): number => { } return 2_250_000 + 147_500 * (rank - 30); }; - -const resourceInheritsFrom = (resourceName: string, targetName: string): boolean => { - let parentName = resourceGetParent(resourceName); - for (; parentName != undefined; parentName = resourceGetParent(parentName)) { - if (parentName == targetName) { - return true; - } - } - return false; -}; - -const resourceGetParent = (resourceName: string): string | undefined => { - if (resourceName in ExportResources) { - return ExportResources[resourceName].parentName; - } - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - return ExportVirtuals[resourceName]?.parentName; -}; diff --git a/src/controllers/custom/unlockAllCapturaScenesController.ts b/src/controllers/custom/unlockAllCapturaScenesController.ts new file mode 100644 index 00000000..e7294b9a --- /dev/null +++ b/src/controllers/custom/unlockAllCapturaScenesController.ts @@ -0,0 +1,35 @@ +import type { RequestHandler } from "express"; +import { ExportResources, ExportVirtuals } from "warframe-public-export-plus"; +import { getAccountIdForRequest } from "../../services/loginService.ts"; +import { addItem, getInventory } from "../../services/inventoryService.ts"; + +export const unlockAllCapturaScenesController: RequestHandler = async (req, res) => { + const accountId = await getAccountIdForRequest(req); + const inventory = await getInventory(accountId); + + for (const uniqueName of Object.keys(ExportResources)) { + if (resourceInheritsFrom(uniqueName, "/Lotus/Types/Items/MiscItems/PhotoboothTile")) { + await addItem(inventory, uniqueName, 1); + } + } + + await inventory.save(); + res.end(); +}; + +const resourceInheritsFrom = (resourceName: string, targetName: string): boolean => { + let parentName = resourceGetParent(resourceName); + for (; parentName != undefined; parentName = resourceGetParent(parentName)) { + if (parentName == targetName) { + return true; + } + } + return false; +}; + +const resourceGetParent = (resourceName: string): string | undefined => { + if (resourceName in ExportResources) { + return ExportResources[resourceName].parentName; + } + return ExportVirtuals[resourceName]?.parentName; +}; diff --git a/src/controllers/custom/unlockAllScansController.ts b/src/controllers/custom/unlockAllScansController.ts new file mode 100644 index 00000000..fb79251e --- /dev/null +++ b/src/controllers/custom/unlockAllScansController.ts @@ -0,0 +1,23 @@ +import type { RequestHandler } from "express"; +import allScans from "../../../static/fixed_responses/allScans.json" with { type: "json" }; +import { ExportEnemies } from "warframe-public-export-plus"; +import { getAccountIdForRequest } from "../../services/loginService.ts"; +import { getStats } from "../../services/statsService.ts"; + +export const unlockAllScansController: RequestHandler = async (req, res) => { + const accountId = await getAccountIdForRequest(req); + const stats = await getStats(accountId); + + const scanTypes = new Set(allScans); + for (const type of Object.keys(ExportEnemies.avatars)) { + scanTypes.add(type); + } + + stats.Scans = []; + for (const type of scanTypes) { + stats.Scans.push({ type, scans: 9999 }); + } + + await stats.save(); + res.end(); +}; diff --git a/src/controllers/custom/unlockAllShipFeaturesController.ts b/src/controllers/custom/unlockAllShipFeaturesController.ts new file mode 100644 index 00000000..c3999bde --- /dev/null +++ b/src/controllers/custom/unlockAllShipFeaturesController.ts @@ -0,0 +1,19 @@ +import type { RequestHandler } from "express"; +import allShipFeatures from "../../../static/fixed_responses/allShipFeatures.json" with { type: "json" }; +import { getAccountIdForRequest } from "../../services/loginService.ts"; +import { getPersonalRooms } from "../../services/personalRoomsService.ts"; + +export const unlockAllShipFeaturesController: RequestHandler = async (req, res) => { + const accountId = await getAccountIdForRequest(req); + const personalRooms = await getPersonalRooms(accountId); + + const featureSet = new Set(personalRooms.Ship.Features); + for (const feature of allShipFeatures) { + if (!featureSet.has(feature)) { + personalRooms.Ship.Features.push(feature); + } + } + + await personalRooms.save(); + res.end(); +}; diff --git a/src/controllers/stats/viewController.ts b/src/controllers/stats/viewController.ts index 52d5e97f..27fe309f 100644 --- a/src/controllers/stats/viewController.ts +++ b/src/controllers/stats/viewController.ts @@ -1,8 +1,5 @@ import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "../../services/loginService.ts"; -import { config } from "../../services/configService.ts"; -import allScans from "../../../static/fixed_responses/allScans.json" with { type: "json" }; -import { ExportEnemies } from "warframe-public-export-plus"; import { getInventory } from "../../services/inventoryService.ts"; import { getStats } from "../../services/statsService.ts"; import type { IStatsClient } from "../../types/statTypes.ts"; @@ -22,24 +19,6 @@ const viewController: RequestHandler = async (req, res) => { responseJson.Weapons.push({ type: item.ItemType, xp: item.XP }); } } - if (config.unlockAllScans) { - const scans = new Set(allScans); - for (const type of Object.keys(ExportEnemies.avatars)) { - if (!scans.has(type)) scans.add(type); - } - - // Take any existing scans and also set them to 9999 - if (responseJson.Scans) { - for (const scan of responseJson.Scans) { - scans.add(scan.type); - } - } - responseJson.Scans = []; - - for (const type of scans) { - responseJson.Scans.push({ type: type, scans: 9999 }); - } - } res.json(responseJson); }; diff --git a/src/routes/custom.ts b/src/routes/custom.ts index 8f272e33..525fbe93 100644 --- a/src/routes/custom.ts +++ b/src/routes/custom.ts @@ -16,6 +16,9 @@ import { completeAllMissionsController } from "../controllers/custom/completeAll import { addMissingHelminthBlueprintsController } from "../controllers/custom/addMissingHelminthBlueprintsController.ts"; import { unlockAllProfitTakerStagesController } from "../controllers/custom/unlockAllProfitTakerStagesController.ts"; import { unlockAllSimarisResearchEntriesController } from "../controllers/custom/unlockAllSimarisResearchEntriesController.ts"; +import { unlockAllScansController } from "../controllers/custom/unlockAllScansController.ts"; +import { unlockAllShipFeaturesController } from "../controllers/custom/unlockAllShipFeaturesController.ts"; +import { unlockAllCapturaScenesController } from "../controllers/custom/unlockAllCapturaScenesController.ts"; import { abilityOverrideController } from "../controllers/custom/abilityOverrideController.ts"; import { createAccountController } from "../controllers/custom/createAccountController.ts"; @@ -52,6 +55,9 @@ customRouter.get("/completeAllMissions", completeAllMissionsController); customRouter.get("/addMissingHelminthBlueprints", addMissingHelminthBlueprintsController); customRouter.get("/unlockAllProfitTakerStages", unlockAllProfitTakerStagesController); customRouter.get("/unlockAllSimarisResearchEntries", unlockAllSimarisResearchEntriesController); +customRouter.get("/unlockAllScans", unlockAllScansController); +customRouter.get("/unlockAllShipFeatures", unlockAllShipFeaturesController); +customRouter.get("/unlockAllCapturaScenes", unlockAllCapturaScenesController); customRouter.post("/abilityOverride", abilityOverrideController); customRouter.post("/createAccount", createAccountController); diff --git a/src/services/configService.ts b/src/services/configService.ts index c79bc808..4c8ed4ef 100644 --- a/src/services/configService.ts +++ b/src/services/configService.ts @@ -18,12 +18,9 @@ export interface IConfig { administratorNames?: string[]; autoCreateAccount?: boolean; skipTutorial?: boolean; - unlockAllScans?: boolean; - unlockAllShipFeatures?: boolean; unlockAllShipDecorations?: boolean; unlockAllFlavourItems?: boolean; unlockAllSkins?: boolean; - unlockAllCapturaScenes?: boolean; unlockAllDecoRecipes?: boolean; fullyStockedVendors?: boolean; skipClanKeyCrafting?: boolean; @@ -106,6 +103,9 @@ export const configRemovedOptionsKeys = [ "unlockArcanesEverywhere", "unlockAllProfitTakerStages", "unlockAllSimarisResearchEntries", + "unlockAllScans", + "unlockAllShipFeatures", + "unlockAllCapturaScenes", "noDailyStandingLimits", "noDailyFocusLimit", "noArgonCrystalDecay", diff --git a/static/webui/index.html b/static/webui/index.html index 7a4146df..5af9d610 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -808,6 +808,9 @@
+ + + @@ -840,14 +843,6 @@
-
- - -
-
- - -
@@ -860,10 +855,6 @@
-
- - -
diff --git a/static/webui/script.js b/static/webui/script.js index e1660171..34a6662d 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -2750,6 +2750,24 @@ async function doMaxPlexus() { } } +async function doUnlockAllScans() { + await revalidateAuthz(); + await fetch("/custom/unlockAllScans?" + window.authz); + toast(loc("cheats_unlockSucc")); +} + +async function doUnlockAllShipFeatures() { + await revalidateAuthz(); + await fetch("/custom/unlockAllShipFeatures?" + window.authz); + toast(loc("cheats_unlockSucc")); +} + +async function doUnlockAllCapturaScenes() { + await revalidateAuthz(); + await fetch("/custom/unlockAllCapturaScenes?" + window.authz); + toast(loc("cheats_unlockSucc")); +} + async function unlockAllMissions() { await revalidateAuthz(); await fetch("/custom/completeAllMissions?" + window.authz);