返回提交历史
Modified
src/controllers/custom/addItemsController.ts
+1
-1
Modified
src/services/inventoryService.ts
+5
-2
XFEstudio/SpaceNinjaServer
fix: ignore purchaseQuantity for webui add items (#1944)
Closes #1942 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1944 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
f7906c91
代码差异
2 个文件
+6
-3
@@ -7,7 +7,7 @@ export const addItemsController: RequestHandler = async (req, res) => {
7
7
const requests = req.body as IAddItemRequest[];
8
8
const inventory = await getInventory(accountId);
9
9
for (const request of requests) {
10
await addItem(inventory, request.ItemType, request.ItemCount, true);
10
await addItem(inventory, request.ItemType, request.ItemCount, true, undefined, undefined, true);
11
11
}
12
12
await inventory.save();
13
13
res.end();
@@ -332,7 +332,8 @@ export const addItem = async (
332
332
quantity: number = 1,
333
333
premiumPurchase: boolean = false,
334
334
seed?: bigint,
335
targetFingerprint?: string
335
targetFingerprint?: string,
336
exactQuantity: boolean = false
336
337
): Promise<IInventoryChanges> => {
337
338
// Bundles are technically StoreItems but a) they don't have a normal counterpart, and b) they are used in non-StoreItem contexts, e.g. email attachments.
338
339
if (typeName in ExportBundles) {
@@ -490,7 +491,9 @@ export const addItem = async (
490
491
// Multipling by purchase quantity for gear because:
491
492
// - The Saya's Vigil scanner message has it as a non-counted attachment.
492
493
// - Blueprints for Ancient Protector Specter, Shield Osprey Specter, etc. have num=1 despite giving their purchaseQuantity.
493
quantity *= ExportGear[typeName].purchaseQuantity ?? 1;
494
if (!exactQuantity) {
495
quantity *= ExportGear[typeName].purchaseQuantity ?? 1;
496
}
494
497
const consumablesChanges = [
495
498
{
496
499
ItemType: typeName,