返回提交历史
Modified
src/controllers/api/nemesisController.ts
+26
-1
Modified
src/helpers/nemesisHelpers.ts
+12
-0
XFEstudio/SpaceNinjaServer
feat: nemesis mode p (#1276)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1276
a0453ca6
代码差异
2 个文件
+38
-1
@@ -1,4 +1,4 @@
1
import { getInfNodes } from "@/src/helpers/nemesisHelpers";
1
import { getInfNodes, getNemesisPasscode } from "@/src/helpers/nemesisHelpers";
2
2
import { getJSONfromString } from "@/src/helpers/stringHelpers";
3
3
import { freeUpSlot, getInventory } from "@/src/services/inventoryService";
4
4
import { getAccountIdForRequest } from "@/src/services/loginService";
@@ -45,6 +45,26 @@ export const nemesisController: RequestHandler = async (req, res) => {
45
45
[body.Category]: [destWeapon.toJSON()]
46
46
}
47
47
});
48
} else if ((req.query.mode as string) == "p") {
49
const inventory = await getInventory(accountId, "Nemesis");
50
const body = getJSONfromString<INemesisPrespawnCheckRequest>(String(req.body));
51
const passcode = getNemesisPasscode(inventory.Nemesis!.fp, inventory.Nemesis!.Faction);
52
let guessResult = 0;
53
if (inventory.Nemesis!.Faction == "FC_INFESTATION") {
54
for (let i = 0; i != 3; ++i) {
55
if (body.guess[i] == passcode[0]) {
56
guessResult = 1 + i;
57
break;
58
}
59
}
60
} else {
61
for (let i = 0; i != 3; ++i) {
62
if (body.guess[i] == passcode[i]) {
63
++guessResult;
64
}
65
}
66
}
67
res.json({ GuessResult: guessResult });
48
68
} else if ((req.query.mode as string) == "s") {
49
69
const inventory = await getInventory(accountId, "Nemesis NemesisAbandonedRewards");
50
70
const body = getJSONfromString<INemesisStartRequest>(String(req.body));
@@ -148,6 +168,11 @@ interface INemesisStartRequest {
148
168
};
149
169
}
150
170
171
interface INemesisPrespawnCheckRequest {
172
guess: number[]; // .length == 3
173
potency?: number[];
174
}
175
151
176
const kuvaLichVersionSixWeapons = [
152
177
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Drakgoon/KuvaDrakgoon",
153
178
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Karak/KuvaKarak",
@@ -1,5 +1,6 @@
1
1
import { ExportRegions } from "warframe-public-export-plus";
2
2
import { IInfNode } from "@/src/types/inventoryTypes/inventoryTypes";
3
import { SRng } from "@/src/services/rngService";
3
4
4
5
export const getInfNodes = (faction: string, rank: number): IInfNode[] => {
5
6
const infNodes = [];
@@ -30,3 +31,14 @@ const systemIndexes: Record<string, number[]> = {
30
31
FC_CORPUS: [1, 15, 4, 7, 8],
31
32
FC_INFESTATION: [23]
32
33
};
34
35
// Get a parazon 'passcode' based on the nemesis fingerprint so it's always the same for the same nemesis.
36
export const getNemesisPasscode = (fp: bigint, faction: string): number[] => {
37
const rng = new SRng(fp);
38
const passcode = [rng.randomInt(0, 7)];
39
if (faction != "FC_INFESTATION") {
40
passcode.push(rng.randomInt(0, 7));
41
passcode.push(rng.randomInt(0, 7));
42
}
43
return passcode;
44
};