forked from OpenWF/SpaceNinjaServer
		
	
							parent
							
								
									16bfcc44d5
								
							
						
					
					
						commit
						a0453ca61d
					
				@ -1,4 +1,4 @@
 | 
				
			|||||||
import { getInfNodes } from "@/src/helpers/nemesisHelpers";
 | 
					import { getInfNodes, getNemesisPasscode } from "@/src/helpers/nemesisHelpers";
 | 
				
			||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
					import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
				
			||||||
import { freeUpSlot, getInventory } from "@/src/services/inventoryService";
 | 
					import { freeUpSlot, getInventory } from "@/src/services/inventoryService";
 | 
				
			||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
					import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
				
			||||||
@ -45,6 +45,26 @@ export const nemesisController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
                [body.Category]: [destWeapon.toJSON()]
 | 
					                [body.Category]: [destWeapon.toJSON()]
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					    } else if ((req.query.mode as string) == "p") {
 | 
				
			||||||
 | 
					        const inventory = await getInventory(accountId, "Nemesis");
 | 
				
			||||||
 | 
					        const body = getJSONfromString<INemesisPrespawnCheckRequest>(String(req.body));
 | 
				
			||||||
 | 
					        const passcode = getNemesisPasscode(inventory.Nemesis!.fp, inventory.Nemesis!.Faction);
 | 
				
			||||||
 | 
					        let guessResult = 0;
 | 
				
			||||||
 | 
					        if (inventory.Nemesis!.Faction == "FC_INFESTATION") {
 | 
				
			||||||
 | 
					            for (let i = 0; i != 3; ++i) {
 | 
				
			||||||
 | 
					                if (body.guess[i] == passcode[0]) {
 | 
				
			||||||
 | 
					                    guessResult = 1 + i;
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            for (let i = 0; i != 3; ++i) {
 | 
				
			||||||
 | 
					                if (body.guess[i] == passcode[i]) {
 | 
				
			||||||
 | 
					                    ++guessResult;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        res.json({ GuessResult: guessResult });
 | 
				
			||||||
    } else if ((req.query.mode as string) == "s") {
 | 
					    } else if ((req.query.mode as string) == "s") {
 | 
				
			||||||
        const inventory = await getInventory(accountId, "Nemesis NemesisAbandonedRewards");
 | 
					        const inventory = await getInventory(accountId, "Nemesis NemesisAbandonedRewards");
 | 
				
			||||||
        const body = getJSONfromString<INemesisStartRequest>(String(req.body));
 | 
					        const body = getJSONfromString<INemesisStartRequest>(String(req.body));
 | 
				
			||||||
@ -148,6 +168,11 @@ interface INemesisStartRequest {
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					interface INemesisPrespawnCheckRequest {
 | 
				
			||||||
 | 
					    guess: number[]; // .length == 3
 | 
				
			||||||
 | 
					    potency?: number[];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const kuvaLichVersionSixWeapons = [
 | 
					const kuvaLichVersionSixWeapons = [
 | 
				
			||||||
    "/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Drakgoon/KuvaDrakgoon",
 | 
					    "/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Drakgoon/KuvaDrakgoon",
 | 
				
			||||||
    "/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Karak/KuvaKarak",
 | 
					    "/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Karak/KuvaKarak",
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,6 @@
 | 
				
			|||||||
import { ExportRegions } from "warframe-public-export-plus";
 | 
					import { ExportRegions } from "warframe-public-export-plus";
 | 
				
			||||||
import { IInfNode } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
					import { IInfNode } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
				
			||||||
 | 
					import { SRng } from "@/src/services/rngService";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const getInfNodes = (faction: string, rank: number): IInfNode[] => {
 | 
					export const getInfNodes = (faction: string, rank: number): IInfNode[] => {
 | 
				
			||||||
    const infNodes = [];
 | 
					    const infNodes = [];
 | 
				
			||||||
@ -30,3 +31,14 @@ const systemIndexes: Record<string, number[]> = {
 | 
				
			|||||||
    FC_CORPUS: [1, 15, 4, 7, 8],
 | 
					    FC_CORPUS: [1, 15, 4, 7, 8],
 | 
				
			||||||
    FC_INFESTATION: [23]
 | 
					    FC_INFESTATION: [23]
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Get a parazon 'passcode' based on the nemesis fingerprint so it's always the same for the same nemesis.
 | 
				
			||||||
 | 
					export const getNemesisPasscode = (fp: bigint, faction: string): number[] => {
 | 
				
			||||||
 | 
					    const rng = new SRng(fp);
 | 
				
			||||||
 | 
					    const passcode = [rng.randomInt(0, 7)];
 | 
				
			||||||
 | 
					    if (faction != "FC_INFESTATION") {
 | 
				
			||||||
 | 
					        passcode.push(rng.randomInt(0, 7));
 | 
				
			||||||
 | 
					        passcode.push(rng.randomInt(0, 7));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return passcode;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user