forked from OpenWF/SpaceNinjaServer
		
	feat: unlock all captura scenes (#650)
This commit is contained in:
		
							parent
							
								
									607ec836e9
								
							
						
					
					
						commit
						44b78ecfe8
					
				@ -21,6 +21,7 @@
 | 
			
		||||
  "unlockAllShipDecorations": true,
 | 
			
		||||
  "unlockAllFlavourItems": true,
 | 
			
		||||
  "unlockAllSkins": true,
 | 
			
		||||
  "unlockAllCapturaScenes": true,
 | 
			
		||||
  "universalPolarityEverywhere": true,
 | 
			
		||||
  "spoofMasteryRank": -1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										8
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -12,7 +12,7 @@
 | 
			
		||||
        "copyfiles": "^2.4.1",
 | 
			
		||||
        "express": "^5",
 | 
			
		||||
        "mongoose": "^8.9.2",
 | 
			
		||||
        "warframe-public-export-plus": "^0.5.15",
 | 
			
		||||
        "warframe-public-export-plus": "^0.5.16",
 | 
			
		||||
        "warframe-riven-info": "^0.1.2",
 | 
			
		||||
        "winston": "^3.17.0",
 | 
			
		||||
        "winston-daily-rotate-file": "^5.0.0"
 | 
			
		||||
@ -3877,9 +3877,9 @@
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/warframe-public-export-plus": {
 | 
			
		||||
      "version": "0.5.15",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.15.tgz",
 | 
			
		||||
      "integrity": "sha512-xsMgj1+lB2VPDCLuU88YsbwQiGQT5cNgjgNTk1iKx2ZpX31fu19tflTWrTHEJbSnqxuh/8h2LP5ZpBZV0a9fCg=="
 | 
			
		||||
      "version": "0.5.16",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.16.tgz",
 | 
			
		||||
      "integrity": "sha512-4Mgng3ojWfF0mffZDKQLwrKx6qHty7o35F5+nCDmSal1TzjeEclJCSgoMgdAO0e+Ug/lTP7FSiIXcU4SDk3gsw=="
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/warframe-riven-info": {
 | 
			
		||||
      "version": "0.1.2",
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,7 @@
 | 
			
		||||
    "copyfiles": "^2.4.1",
 | 
			
		||||
    "express": "^5",
 | 
			
		||||
    "mongoose": "^8.9.2",
 | 
			
		||||
    "warframe-public-export-plus": "^0.5.15",
 | 
			
		||||
    "warframe-public-export-plus": "^0.5.16",
 | 
			
		||||
    "warframe-riven-info": "^0.1.2",
 | 
			
		||||
    "winston": "^3.17.0",
 | 
			
		||||
    "winston-daily-rotate-file": "^5.0.0"
 | 
			
		||||
 | 
			
		||||
@ -7,9 +7,16 @@ import allDialogue from "@/static/fixed_responses/allDialogue.json";
 | 
			
		||||
import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
 | 
			
		||||
import { IShipInventory, equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
			
		||||
import { IPolarity, ArtifactPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
			
		||||
import { ExportCustoms, ExportFlavour, ExportKeys, ExportRegions, ExportResources } from "warframe-public-export-plus";
 | 
			
		||||
import {
 | 
			
		||||
    ExportCustoms,
 | 
			
		||||
    ExportFlavour,
 | 
			
		||||
    ExportKeys,
 | 
			
		||||
    ExportRegions,
 | 
			
		||||
    ExportResources,
 | 
			
		||||
    ExportVirtuals
 | 
			
		||||
} from "warframe-public-export-plus";
 | 
			
		||||
 | 
			
		||||
const inventoryController: RequestHandler = async (request, response) => {
 | 
			
		||||
export const inventoryController: RequestHandler = async (request, response) => {
 | 
			
		||||
    let account;
 | 
			
		||||
    try {
 | 
			
		||||
        account = await getAccountForRequest(request);
 | 
			
		||||
@ -152,6 +159,17 @@ const inventoryController: RequestHandler = async (request, response) => {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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" in request.query)) {
 | 
			
		||||
@ -206,4 +224,19 @@ const getExpRequiredForMr = (rank: number): number => {
 | 
			
		||||
    return 2_250_000 + 147_500 * (rank - 30);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export { inventoryController };
 | 
			
		||||
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;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -46,6 +46,7 @@ interface IConfig {
 | 
			
		||||
    unlockAllShipDecorations?: boolean;
 | 
			
		||||
    unlockAllFlavourItems?: boolean;
 | 
			
		||||
    unlockAllSkins?: boolean;
 | 
			
		||||
    unlockAllCapturaScenes?: boolean;
 | 
			
		||||
    universalPolarityEverywhere?: boolean;
 | 
			
		||||
    spoofMasteryRank?: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -253,6 +253,10 @@
 | 
			
		||||
                                        <input class="form-check-input" type="checkbox" id="unlockAllSkins" />
 | 
			
		||||
                                        <label class="form-check-label" for="unlockAllSkins">Unlock All Skins</label>
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                    <div class="form-check">
 | 
			
		||||
                                        <input class="form-check-input" type="checkbox" id="unlockAllCapturaScenes" />
 | 
			
		||||
                                        <label class="form-check-label" for="unlockAllCapturaScenes">Unlock All Captura Scenes</label>
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                    <div class="form-check">
 | 
			
		||||
                                        <input class="form-check-input" type="checkbox" id="universalPolarityEverywhere" />
 | 
			
		||||
                                        <label class="form-check-label" for="universalPolarityEverywhere">
 | 
			
		||||
 | 
			
		||||
@ -804,6 +804,7 @@ const uiConfigs = [
 | 
			
		||||
    "unlockAllShipDecorations",
 | 
			
		||||
    "unlockAllFlavourItems",
 | 
			
		||||
    "unlockAllSkins",
 | 
			
		||||
    "unlockAllCapturaScenes",
 | 
			
		||||
    "universalPolarityEverywhere",
 | 
			
		||||
    "spoofMasteryRank"
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user