Update src/controllers/api/activateRandomModController.ts
This commit is contained in:
		
							parent
							
								
									92a3ba0f32
								
							
						
					
					
						commit
						468f2c7389
					
				@ -1,11 +1,12 @@
 | 
				
			|||||||
import { toOid } from "@/src/helpers/inventoryHelpers";
 | 
					import { toOid } from "@/src/helpers/inventoryHelpers";
 | 
				
			||||||
import { createVeiledRivenFingerprint, rivenRawToRealWeighted } from "@/src/helpers/rivenHelper";
 | 
					import { createVeiledRivenFingerprint, createUnveiledRivenFingerprint, rivenRawToRealWeighted } from "@/src/helpers/rivenHelper";
 | 
				
			||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
					import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
				
			||||||
import { addMods, getInventory } from "@/src/services/inventoryService";
 | 
					import { addMods, getInventory } from "@/src/services/inventoryService";
 | 
				
			||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
					import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
				
			||||||
import { getRandomElement } from "@/src/services/rngService";
 | 
					import { getRandomElement } from "@/src/services/rngService";
 | 
				
			||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { ExportUpgrades } from "warframe-public-export-plus";
 | 
					import { ExportUpgrades } from "warframe-public-export-plus";
 | 
				
			||||||
 | 
					import { config } from "@/src/services/configService";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const activateRandomModController: RequestHandler = async (req, res) => {
 | 
					export const activateRandomModController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const accountId = await getAccountIdForRequest(req);
 | 
					    const accountId = await getAccountIdForRequest(req);
 | 
				
			||||||
@ -18,7 +19,7 @@ export const activateRandomModController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    ]);
 | 
					    ]);
 | 
				
			||||||
    const rivenType = getRandomElement(rivenRawToRealWeighted[request.ItemType])!;
 | 
					    const rivenType = getRandomElement(rivenRawToRealWeighted[request.ItemType])!;
 | 
				
			||||||
    const fingerprint = createVeiledRivenFingerprint(ExportUpgrades[rivenType]);
 | 
						const fingerprint = config.instantFinishRivenChallenge ? createUnveiledRivenFingerprint(ExportUpgrades[rivenType]) : createVeiledRivenFingerprint(ExportUpgrades[rivenType]);
 | 
				
			||||||
    const upgradeIndex =
 | 
					    const upgradeIndex =
 | 
				
			||||||
        inventory.Upgrades.push({
 | 
					        inventory.Upgrades.push({
 | 
				
			||||||
            ItemType: rivenType,
 | 
					            ItemType: rivenType,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user