fix: selling MiscItems doesn't remove them from inventory (#680)
This commit is contained in:
		
							parent
							
								
									0c6f6e556f
								
							
						
					
					
						commit
						52d1b72701
					
				@ -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();
 | 
			
		||||
    res.json({});
 | 
			
		||||
 | 
			
		||||
@ -7,6 +7,7 @@ export interface ISellRequest {
 | 
			
		||||
        Consumables?: ISellItem[];
 | 
			
		||||
        Recipes?: ISellItem[];
 | 
			
		||||
        Upgrades?: ISellItem[];
 | 
			
		||||
        MiscItems?: ISellItem[];
 | 
			
		||||
    };
 | 
			
		||||
    SellPrice: number;
 | 
			
		||||
    SellCurrency:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user