chore: buttonify unlockAllScans, unlockAllShipFeatures, unlockAllCapturaScenes #2738
@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										36
									
								
								src/controllers/custom/unlockAllCapturaScenesController.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								src/controllers/custom/unlockAllCapturaScenesController.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,36 @@
 | 
			
		||||
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;
 | 
			
		||||
    }
 | 
			
		||||
    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
			
		||||
    return ExportVirtuals[resourceName]?.parentName;
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										23
									
								
								src/controllers/custom/unlockAllScansController.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/controllers/custom/unlockAllScansController.ts
									
									
									
									
									
										Normal file
									
								
							@ -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<string>(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();
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										19
									
								
								src/controllers/custom/unlockAllShipFeaturesController.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								src/controllers/custom/unlockAllShipFeaturesController.ts
									
									
									
									
									
										Normal file
									
								
							@ -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();
 | 
			
		||||
};
 | 
			
		||||
@ -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";
 | 
			
		||||
@ -12,7 +9,7 @@ const viewController: RequestHandler = async (req, res) => {
 | 
			
		||||
    const inventory = await getInventory(accountId, "XPInfo");
 | 
			
		||||
    const playerStats = await getStats(accountId);
 | 
			
		||||
 | 
			
		||||
    const responseJson = playerStats.toJSON() as IStatsClient;
 | 
			
		||||
    const responseJson = playerStats.toJSON<IStatsClient>();
 | 
			
		||||
    responseJson.Weapons ??= [];
 | 
			
		||||
    for (const item of inventory.XPInfo) {
 | 
			
		||||
        const weaponIndex = responseJson.Weapons.findIndex(element => element.type == item.ItemType);
 | 
			
		||||
@ -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);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
@ -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",
 | 
			
		||||
 | 
			
		||||
@ -808,8 +808,11 @@
 | 
			
		||||
                                    <label class="form-check-label" for="finishInvasionsInOneMission" data-loc="cheats_finishInvasionsInOneMission"></label>
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <div class="mt-2 mb-2 d-flex flex-wrap gap-2">
 | 
			
		||||
                                    <button class="btn btn-primary" onclick="debounce(doUnlockAllShipFeatures);" data-loc="cheats_unlockAllShipFeatures"></button>
 | 
			
		||||
                                    <button class="btn btn-primary" onclick="debounce(unlockAllMissions);" data-loc="cheats_unlockAllMissions"></button>
 | 
			
		||||
                                    <button class="btn btn-primary" onclick="debounce(markAllAsRead);" data-loc="cheats_markAllAsRead"></button>
 | 
			
		||||
                                    <button class="btn btn-primary" onclick="debounce(doUnlockAllScans);" data-loc="cheats_unlockAllScans"></button>
 | 
			
		||||
                                    <button class="btn btn-primary" onclick="debounce(doUnlockAllCapturaScenes);" data-loc="cheats_unlockAllCapturaScenes"></button>
 | 
			
		||||
                                    <button class="btn btn-primary" onclick="doUnlockAllFocusSchools();" data-loc="cheats_unlockAllFocusSchools"></button>
 | 
			
		||||
                                    <button class="btn btn-primary" onclick="doHelminthUnlockAll();" data-loc="cheats_helminthUnlockAll"></button>
 | 
			
		||||
                                    <button class="btn btn-primary" onclick="debounce(addMissingHelminthRecipes);" data-loc="cheats_addMissingSubsumedAbilities"></button>
 | 
			
		||||
@ -840,14 +843,6 @@
 | 
			
		||||
                                        <input class="form-check-input" type="checkbox" id="skipTutorial" />
 | 
			
		||||
                                        <label class="form-check-label" for="skipTutorial" data-loc="cheats_skipTutorial"></label>
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                    <div class="form-check">
 | 
			
		||||
                                        <input class="form-check-input" type="checkbox" id="unlockAllScans" />
 | 
			
		||||
                                        <label class="form-check-label" for="unlockAllScans" data-loc="cheats_unlockAllScans"></label>
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                    <div class="form-check">
 | 
			
		||||
                                        <input class="form-check-input" type="checkbox" id="unlockAllShipFeatures" />
 | 
			
		||||
                                        <label class="form-check-label" for="unlockAllShipFeatures" data-loc="cheats_unlockAllShipFeatures"></label>
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                    <div class="form-check">
 | 
			
		||||
                                        <input class="form-check-input" type="checkbox" id="unlockAllShipDecorations" />
 | 
			
		||||
                                        <label class="form-check-label" for="unlockAllShipDecorations" data-loc="cheats_unlockAllShipDecorations"></label>
 | 
			
		||||
@ -860,10 +855,6 @@
 | 
			
		||||
                                        <input class="form-check-input" type="checkbox" id="unlockAllSkins" />
 | 
			
		||||
                                        <label class="form-check-label" for="unlockAllSkins" data-loc="cheats_unlockAllSkins"></label>
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                    <div class="form-check">
 | 
			
		||||
                                        <input class="form-check-input" type="checkbox" id="unlockAllCapturaScenes" />
 | 
			
		||||
                                        <label class="form-check-label" for="unlockAllCapturaScenes" data-loc="cheats_unlockAllCapturaScenes"></label>
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                    <div class="form-check">
 | 
			
		||||
                                        <input class="form-check-input" type="checkbox" id="unlockAllDecoRecipes" />
 | 
			
		||||
                                        <label class="form-check-label" for="unlockAllDecoRecipes" data-loc="cheats_unlockAllDecoRecipes"></label>
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user