fix: failure to remove shard installed via webui #1129

Merged
Sainan merged 1 commits from shard-fix into main 2025-03-09 03:41:13 -07:00
Showing only changes of commit 99e13a96e9 - Show all commits

View File

@ -57,17 +57,18 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
const suit = inventory.Suits.find(suit => suit._id.toString() == request.SuitId.$oid)!; const suit = inventory.Suits.find(suit => suit._id.toString() == request.SuitId.$oid)!;
// refund shard const miscItemChanges: IMiscItem[] = [];
const shard = Object.entries(colorToShard).find( if (suit.ArchonCrystalUpgrades![request.Slot].Color) {
([color]) => color == suit.ArchonCrystalUpgrades![request.Slot].Color // refund shard
)![1]; const shard = Object.entries(colorToShard).find(
const miscItemChanges = [ ([color]) => color == suit.ArchonCrystalUpgrades![request.Slot].Color
{ )![1];
miscItemChanges.push({
ItemType: shard, ItemType: shard,
ItemCount: 1 ItemCount: 1
} });
]; addMiscItems(inventory, miscItemChanges);
addMiscItems(inventory, miscItemChanges); }
// remove from suit // remove from suit
suit.ArchonCrystalUpgrades![request.Slot] = {}; suit.ArchonCrystalUpgrades![request.Slot] = {};