forked from OpenWF/SpaceNinjaServer
		
	feat: add spoofMasteryRank config (#229)
Co-authored-by: Sainan <Sainan@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									dea35fbd99
								
							
						
					
					
						commit
						2e8c94d34b
					
				@ -17,5 +17,6 @@
 | 
			
		||||
  "infiniteResources": true,
 | 
			
		||||
  "unlockallShipFeatures": true,
 | 
			
		||||
  "unlockAllShipDecorations": true,
 | 
			
		||||
  "unlockAllFlavourItems": true
 | 
			
		||||
  "unlockAllFlavourItems": true,
 | 
			
		||||
  "spoofMasteryRank": -1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -51,7 +51,30 @@ const inventoryController: RequestHandler = async (request: Request, response: R
 | 
			
		||||
    if (config.unlockAllShipDecorations) inventoryResponse.ShipDecorations = allShipDecorations;
 | 
			
		||||
    if (config.unlockAllFlavourItems) inventoryResponse.FlavourItems = allFlavourItems satisfies IFlavourItem[];
 | 
			
		||||
 | 
			
		||||
    if (
 | 
			
		||||
        typeof config.spoofMasteryRank === "number" &&
 | 
			
		||||
        config.spoofMasteryRank >= 0 &&
 | 
			
		||||
        config.spoofMasteryRank <= 5030
 | 
			
		||||
    ) {
 | 
			
		||||
        inventoryResponse.PlayerLevel = config.spoofMasteryRank;
 | 
			
		||||
        inventoryResponse.XPInfo = [];
 | 
			
		||||
        let numFrames = getExpRequiredForMr(config.spoofMasteryRank) / 6000;
 | 
			
		||||
        while (numFrames-- > 0) {
 | 
			
		||||
            inventoryResponse.XPInfo.push({
 | 
			
		||||
                ItemType: "/Lotus/Powersuits/Mag/Mag",
 | 
			
		||||
                XP: 1_600_000
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    response.json(inventoryResponse);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const getExpRequiredForMr = (rank: number): number => {
 | 
			
		||||
    if (rank <= 30) {
 | 
			
		||||
        return 2500 * rank * rank;
 | 
			
		||||
    }
 | 
			
		||||
    return 2_250_000 + 147_500 * (rank - 30);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export { inventoryController };
 | 
			
		||||
 | 
			
		||||
@ -16,6 +16,7 @@ interface IConfig {
 | 
			
		||||
    unlockallShipFeatures?: boolean;
 | 
			
		||||
    unlockAllShipDecorations?: boolean;
 | 
			
		||||
    unlockAllFlavourItems?: boolean;
 | 
			
		||||
    spoofMasteryRank?: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface ILoggerConfig {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user