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();
 | 
					    await inventory.save();
 | 
				
			||||||
    res.json({});
 | 
					    res.json({});
 | 
				
			||||||
 | 
				
			|||||||
@ -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:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user