From e34f687935671262408e9e1d3c4eeb108d54cacb Mon Sep 17 00:00:00 2001 From: Sainan Date: Sun, 5 Jan 2025 12:33:31 +0100 Subject: [PATCH] feat: archon shard removal --- .../api/infestedFoundryController.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/controllers/api/infestedFoundryController.ts b/src/controllers/api/infestedFoundryController.ts index 0f0833d6..d65065b5 100644 --- a/src/controllers/api/infestedFoundryController.ts +++ b/src/controllers/api/infestedFoundryController.ts @@ -40,6 +40,25 @@ export const infestedFoundryController: RequestHandler = async (req, res) => { break; } + case "x": { + // shard removal + const request = getJSONfromString(String(req.body)) as IShardUninstallRequest; + const inventory = await getInventory(accountId); + const suit = inventory.Suits.find(suit => suit._id.toString() == request.SuitId.$oid)!; + suit.ArchonCrystalUpgrades![request.Slot] = {}; + const bile = inventory.InfestedFoundry!.Resources!.find( + x => x.ItemType == "/Lotus/Types/Items/InfestedFoundry/HelminthBile" + )!; + bile.Count -= 300; + await inventory.save(); + res.json({ + InventoryChanges: { + InfestedFoundry: inventory.toJSON().InfestedFoundry + } + }); + break; + } + case "n": { // name the beast const request = getJSONfromString(String(req.body)) as IHelminthNameRequest; @@ -251,6 +270,11 @@ interface IShardInstallRequest { Color: string; } +interface IShardUninstallRequest { + SuitId: IOid; + Slot: number; +} + interface IHelminthNameRequest { newName: string; }