fix: selling MiscItems doesn't remove them from inventory

This commit is contained in:
Sainan 2024-12-31 21:21:29 +01:00
parent 48aa145a20
commit fe04a20e26
2 changed files with 11 additions and 0 deletions

View File

@ -86,6 +86,16 @@ export const sellController: RequestHandler = async (req, res) => {
} }
}); });
} }
if (payload.Items.MiscItems) {
payload.Items.MiscItems.forEach(sellItem => {
addMiscItems(inventory, [
{
ItemType: sellItem.String,
ItemCount: sellItem.Count * -1
}
]);
});
}
await inventory.save(); await inventory.save();
res.json({}); res.json({});

View File

@ -7,6 +7,7 @@ export interface ISellRequest {
Consumables?: ISellItem[]; Consumables?: ISellItem[];
Recipes?: ISellItem[]; Recipes?: ISellItem[];
Upgrades?: ISellItem[]; Upgrades?: ISellItem[];
MiscItems?: ISellItem[];
}; };
SellPrice: number; SellPrice: number;
SellCurrency: SellCurrency: