warn if client creates nemesis it was not expected to create
This commit is contained in:
parent
32c9682e73
commit
75dc6a5b2f
@ -1,3 +1,4 @@
|
||||
import { version_compare } from "@/src/helpers/inventoryHelpers";
|
||||
import {
|
||||
consumeModCharge,
|
||||
encodeNemesisGuess,
|
||||
@ -11,7 +12,7 @@ import {
|
||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
|
||||
import { freeUpSlot, getInventory } from "@/src/services/inventoryService";
|
||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||
import { getAccountForRequest } from "@/src/services/loginService";
|
||||
import { SRng } from "@/src/services/rngService";
|
||||
import { IMongoDate, IOid } from "@/src/types/commonTypes";
|
||||
import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||
@ -30,10 +31,10 @@ import { logger } from "@/src/utils/logger";
|
||||
import { RequestHandler } from "express";
|
||||
|
||||
export const nemesisController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
const account = await getAccountForRequest(req);
|
||||
if ((req.query.mode as string) == "f") {
|
||||
const body = getJSONfromString<IValenceFusionRequest>(String(req.body));
|
||||
const inventory = await getInventory(accountId, body.Category + " WeaponBin");
|
||||
const inventory = await getInventory(account._id.toString(), body.Category + " WeaponBin");
|
||||
const destWeapon = inventory[body.Category].id(body.DestWeapon.$oid)!;
|
||||
const sourceWeapon = inventory[body.Category].id(body.SourceWeapon.$oid)!;
|
||||
const destFingerprint = JSON.parse(destWeapon.UpgradeFingerprint!) as IInnateDamageFingerprint;
|
||||
@ -68,7 +69,7 @@ export const nemesisController: RequestHandler = async (req, res) => {
|
||||
}
|
||||
});
|
||||
} else if ((req.query.mode as string) == "p") {
|
||||
const inventory = await getInventory(accountId, "Nemesis");
|
||||
const inventory = await getInventory(account._id.toString(), "Nemesis");
|
||||
const body = getJSONfromString<INemesisPrespawnCheckRequest>(String(req.body));
|
||||
const passcode = getNemesisPasscode(inventory.Nemesis!);
|
||||
let guessResult = 0;
|
||||
@ -89,7 +90,7 @@ export const nemesisController: RequestHandler = async (req, res) => {
|
||||
res.json({ GuessResult: guessResult });
|
||||
} else if (req.query.mode == "r") {
|
||||
const inventory = await getInventory(
|
||||
accountId,
|
||||
account._id.toString(),
|
||||
"Nemesis LoadOutPresets CurrentLoadOutIds DataKnives Upgrades RawUpgrades"
|
||||
);
|
||||
const body = getJSONfromString<INemesisRequiemRequest>(String(req.body));
|
||||
@ -163,16 +164,21 @@ export const nemesisController: RequestHandler = async (req, res) => {
|
||||
}
|
||||
} else if ((req.query.mode as string) == "rs") {
|
||||
// report spawn; POST but no application data in body
|
||||
const inventory = await getInventory(accountId, "Nemesis");
|
||||
const inventory = await getInventory(account._id.toString(), "Nemesis");
|
||||
inventory.Nemesis!.LastEnc = inventory.Nemesis!.MissionCount;
|
||||
await inventory.save();
|
||||
res.json({ LastEnc: inventory.Nemesis!.LastEnc });
|
||||
} else if ((req.query.mode as string) == "s") {
|
||||
const inventory = await getInventory(accountId, "Nemesis");
|
||||
const inventory = await getInventory(account._id.toString(), "Nemesis");
|
||||
const body = getJSONfromString<INemesisStartRequest>(String(req.body));
|
||||
body.target.fp = BigInt(body.target.fp);
|
||||
|
||||
const manifest = getNemesisManifest(body.target.manifest);
|
||||
if (account.BuildLabel && version_compare(manifest.minBuild, account.BuildLabel) < 0) {
|
||||
logger.warn(
|
||||
`client on version ${account.BuildLabel} provided nemesis manifest ${body.target.manifest} which was expected to require ${manifest.minBuild} or above. please file a bug report.`
|
||||
);
|
||||
}
|
||||
|
||||
let weaponIdx = -1;
|
||||
if (body.target.Faction != "FC_INFESTATION") {
|
||||
@ -220,7 +226,7 @@ export const nemesisController: RequestHandler = async (req, res) => {
|
||||
});
|
||||
} else if ((req.query.mode as string) == "w") {
|
||||
const inventory = await getInventory(
|
||||
accountId,
|
||||
account._id.toString(),
|
||||
"Nemesis LoadOutPresets CurrentLoadOutIds DataKnives Upgrades RawUpgrades"
|
||||
);
|
||||
//const body = getJSONfromString<INemesisWeakenRequest>(String(req.body));
|
||||
|
Loading…
x
Reference in New Issue
Block a user