XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

chore: add TNemesisFaction

2a404496
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

3 个文件 +13 -10
Modified src/controllers/api/nemesisController.ts +3 -2
@@ -24,7 +24,8 @@ import {
24 24 IUpgradeClient,
25 25 IWeaponSkinClient,
26 26 LoadoutIndex,
27 TEquipmentKey
27 TEquipmentKey,
28 TNemesisFaction
28 29 } from "@/src/types/inventoryTypes/inventoryTypes";
29 30 import { logger } from "@/src/utils/logger";
30 31 import { RequestHandler } from "express";
@@ -269,7 +270,7 @@ interface INemesisStartRequest {
269 270 WeaponIdx: number;
270 271 AgentIdx: number;
271 272 BirthNode: string;
272 Faction: string;
273 Faction: TNemesisFaction;
273 274 Rank: number;
274 275 k: boolean;
275 276 Traded: boolean;
Modified src/helpers/nemesisHelpers.ts +7 -7
@@ -1,5 +1,5 @@
1 1 import { ExportRegions, ExportWarframes } from "warframe-public-export-plus";
2 import { IInfNode, ITypeCount } from "@/src/types/inventoryTypes/inventoryTypes";
2 import { IInfNode, ITypeCount, TNemesisFaction } from "@/src/types/inventoryTypes/inventoryTypes";
3 3 import { getRewardAtPercentage, SRng } from "@/src/services/rngService";
4 4 import { TInventoryDatabaseDocument } from "../models/inventoryModels/inventoryModel";
5 5 import { logger } from "../utils/logger";
@@ -11,7 +11,7 @@ import { fromStoreItem, toStoreItem } from "../services/itemDataService";
11 11 import { createMessage } from "../services/inboxService";
12 12 import { version_compare } from "./inventoryHelpers";
13 13
14 export const getInfNodes = (faction: string, rank: number): IInfNode[] => {
14 export const getInfNodes = (faction: TNemesisFaction, rank: number): IInfNode[] => {
15 15 const infNodes = [];
16 16 const systemIndex = systemIndexes[faction][rank];
17 17 for (const [key, value] of Object.entries(ExportRegions)) {
@@ -35,20 +35,20 @@ export const getInfNodes = (faction: string, rank: number): IInfNode[] => {
35 35 return infNodes;
36 36 };
37 37
38 const systemIndexes: Record<string, number[]> = {
38 const systemIndexes: Record<TNemesisFaction, number[]> = {
39 39 FC_GRINEER: [2, 3, 9, 11, 18],
40 40 FC_CORPUS: [1, 15, 4, 7, 8],
41 41 FC_INFESTATION: [23]
42 42 };
43 43
44 export const showdownNodes: Record<string, string> = {
44 export const showdownNodes: Record<TNemesisFaction, string> = {
45 45 FC_GRINEER: "CrewBattleNode557",
46 46 FC_CORPUS: "CrewBattleNode558",
47 47 FC_INFESTATION: "CrewBattleNode559"
48 48 };
49 49
50 50 // Get a parazon 'passcode' based on the nemesis fingerprint so it's always the same for the same nemesis.
51 export const getNemesisPasscode = (nemesis: { fp: bigint; Faction: string }): number[] => {
51 export const getNemesisPasscode = (nemesis: { fp: bigint; Faction: TNemesisFaction }): number[] => {
52 52 const rng = new SRng(nemesis.fp);
53 53 const choices = [0, 1, 2, 3, 5, 6, 7];
54 54 let choiceIndex = rng.randomInt(0, choices.length - 1);
@@ -87,7 +87,7 @@ const antivirusMods: readonly string[] = [
87 87 "/Lotus/Upgrades/Mods/Immortal/AntivirusEightMod"
88 88 ];
89 89
90 export const getNemesisPasscodeModTypes = (nemesis: { fp: bigint; Faction: string }): string[] => {
90 export const getNemesisPasscodeModTypes = (nemesis: { fp: bigint; Faction: TNemesisFaction }): string[] => {
91 91 const passcode = getNemesisPasscode(nemesis);
92 92 return nemesis.Faction == "FC_INFESTATION"
93 93 ? passcode.map(i => antivirusMods[i])
@@ -248,7 +248,7 @@ export const getWeaponsForManifest = (manifest: string): readonly string[] => {
248 248 };
249 249
250 250 export const isNemesisCompatibleWithVersion = (
251 nemesis: { manifest: string; Faction: string },
251 nemesis: { manifest: string; Faction: TNemesisFaction },
252 252 buildLabel: string
253 253 ): boolean => {
254 254 // Anything below 35.6.0 is not going to be okay given our set of supported manifests.
Modified src/types/inventoryTypes/inventoryTypes.ts +3 -1
@@ -863,6 +863,8 @@ export interface IMission extends IMissionDatabase {
863 863 RewardsCooldownTime?: IMongoDate;
864 864 }
865 865
866 export type TNemesisFaction = "FC_GRINEER" | "FC_CORPUS" | "FC_INFESTATION";
867
866 868 export interface INemesisBaseClient {
867 869 fp: bigint | number;
868 870 manifest: string;
@@ -872,7 +874,7 @@ export interface INemesisBaseClient {
872 874 WeaponIdx: number;
873 875 AgentIdx: number;
874 876 BirthNode: string;
875 Faction: string;
877 Faction: TNemesisFaction;
876 878 Rank: number;
877 879 k: boolean;
878 880 Traded: boolean;