返回提交历史
Modified
src/controllers/api/nemesisController.ts
+5
-20
XFEstudio/SpaceNinjaServer
chore: no-op nemesis mode=w (#2196)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2196 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
bf40155d
代码差异
1 个文件
+5
-20
@@ -151,7 +151,8 @@ export const nemesisController: RequestHandler = async (req, res) => {
151
151
inventory.Nemesis!.HenchmenKilled += antivirusGain;
152
152
if (inventory.Nemesis!.HenchmenKilled >= 100) {
153
153
inventory.Nemesis!.HenchmenKilled = 100;
154
// Client doesn't seem to request mode=w for infested liches, so weakening it here.
154
155
// Weaken nemesis now.
155
156
inventory.Nemesis!.InfNodes = [
156
157
{
157
158
Node: getNemesisManifest(inventory.Nemesis!.manifest).showdownNode,
@@ -294,31 +295,15 @@ export const nemesisController: RequestHandler = async (req, res) => {
294
295
target: inventory.toJSON().Nemesis
295
296
});
296
297
} else if ((req.query.mode as string) == "w") {
297
const inventory = await getInventory(
298
account._id.toString(),
299
"Nemesis LoadOutPresets CurrentLoadOutIds DataKnives Upgrades RawUpgrades"
300
);
298
const inventory = await getInventory(account._id.toString(), "Nemesis");
301
299
//const body = getJSONfromString<INemesisWeakenRequest>(String(req.body));
302
300
303
if (inventory.Nemesis!.Weakened) {
304
logger.warn(`client is weakening an already-weakened nemesis?!`);
305
}
306
307
inventory.Nemesis!.InfNodes = [
308
{
309
Node: getNemesisManifest(inventory.Nemesis!.manifest).showdownNode,
310
Influence: 1
311
}
312
];
313
inventory.Nemesis!.Weakened = true;
301
// As of 38.6.0, this request is no longer sent, instead mode=r already weakens the nemesis if appropriate.
302
// We always weaken the nemesis in mode=r so simply giving the client back the nemesis.
314
303
315
304
const response: INemesisWeakenResponse = {
316
305
target: inventory.toJSON<IInventoryClient>().Nemesis!
317
306
};
318
319
await consumePasscodeModCharges(inventory, response);
320
321
await inventory.save();
322
307
res.json(response);
323
308
} else {
324
309
logger.debug(`data provided to ${req.path}: ${String(req.body)}`);