fix: ignore purchaseQuantity for webui add items #1944
@ -7,7 +7,7 @@ export const addItemsController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
    const requests = req.body as IAddItemRequest[];
 | 
					    const requests = req.body as IAddItemRequest[];
 | 
				
			||||||
    const inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId);
 | 
				
			||||||
    for (const request of requests) {
 | 
					    for (const request of requests) {
 | 
				
			||||||
        await addItem(inventory, request.ItemType, request.ItemCount, true);
 | 
					        await addItem(inventory, request.ItemType, request.ItemCount, true, undefined, undefined, true);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    await inventory.save();
 | 
					    await inventory.save();
 | 
				
			||||||
    res.end();
 | 
					    res.end();
 | 
				
			||||||
 | 
				
			|||||||
@ -332,7 +332,8 @@ export const addItem = async (
 | 
				
			|||||||
    quantity: number = 1,
 | 
					    quantity: number = 1,
 | 
				
			||||||
    premiumPurchase: boolean = false,
 | 
					    premiumPurchase: boolean = false,
 | 
				
			||||||
    seed?: bigint,
 | 
					    seed?: bigint,
 | 
				
			||||||
    targetFingerprint?: string
 | 
					    targetFingerprint?: string,
 | 
				
			||||||
 | 
					    exactQuantity = false
 | 
				
			||||||
): Promise<IInventoryChanges> => {
 | 
					): Promise<IInventoryChanges> => {
 | 
				
			||||||
    // 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.
 | 
					    // 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.
 | 
				
			||||||
    if (typeName in ExportBundles) {
 | 
					    if (typeName in ExportBundles) {
 | 
				
			||||||
@ -490,7 +491,9 @@ export const addItem = async (
 | 
				
			|||||||
        // Multipling by purchase quantity for gear because:
 | 
					        // Multipling by purchase quantity for gear because:
 | 
				
			||||||
        // - The Saya's Vigil scanner message has it as a non-counted attachment.
 | 
					        // - The Saya's Vigil scanner message has it as a non-counted attachment.
 | 
				
			||||||
        // - Blueprints for Ancient Protector Specter, Shield Osprey Specter, etc. have num=1 despite giving their purchaseQuantity.
 | 
					        // - Blueprints for Ancient Protector Specter, Shield Osprey Specter, etc. have num=1 despite giving their purchaseQuantity.
 | 
				
			||||||
        quantity *= ExportGear[typeName].purchaseQuantity ?? 1;
 | 
					        if (!exactQuantity) {
 | 
				
			||||||
 | 
					            quantity *= ExportGear[typeName].purchaseQuantity ?? 1;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        const consumablesChanges = [
 | 
					        const consumablesChanges = [
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                ItemType: typeName,
 | 
					                ItemType: typeName,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user