forked from OpenWF/SpaceNinjaServer
		
	fix: provide proper response when unbranding a suit (#1697)
Fixes #1695 Reviewed-on: OpenWF/SpaceNinjaServer#1697 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									79492efbb4
								
							
						
					
					
						commit
						0d8f5ee66c
					
				@ -18,6 +18,7 @@ import {
 | 
				
			|||||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
 | 
					import { IInventoryChanges } from "@/src/types/purchaseTypes";
 | 
				
			||||||
import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
					import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
				
			||||||
import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
					import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
				
			||||||
 | 
					import { toOid } from "@/src/helpers/inventoryHelpers";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface IClaimCompletedRecipeRequest {
 | 
					interface IClaimCompletedRecipeRequest {
 | 
				
			||||||
    RecipeIds: IOid[];
 | 
					    RecipeIds: IOid[];
 | 
				
			||||||
@ -80,6 +81,7 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) =
 | 
				
			|||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        logger.debug("Claiming Recipe", { recipe, pendingRecipe });
 | 
					        logger.debug("Claiming Recipe", { recipe, pendingRecipe });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let BrandedSuits: undefined | IOid[];
 | 
				
			||||||
        if (recipe.secretIngredientAction == "SIA_SPECTRE_LOADOUT_COPY") {
 | 
					        if (recipe.secretIngredientAction == "SIA_SPECTRE_LOADOUT_COPY") {
 | 
				
			||||||
            inventory.PendingSpectreLoadouts ??= [];
 | 
					            inventory.PendingSpectreLoadouts ??= [];
 | 
				
			||||||
            inventory.SpectreLoadouts ??= [];
 | 
					            inventory.SpectreLoadouts ??= [];
 | 
				
			||||||
@ -104,9 +106,10 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) =
 | 
				
			|||||||
                inventory.BrandedSuits!.findIndex(x => x.equals(pendingRecipe.SuitToUnbrand)),
 | 
					                inventory.BrandedSuits!.findIndex(x => x.equals(pendingRecipe.SuitToUnbrand)),
 | 
				
			||||||
                1
 | 
					                1
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
 | 
					            BrandedSuits = [toOid(pendingRecipe.SuitToUnbrand!)];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let InventoryChanges = {};
 | 
					        let InventoryChanges: IInventoryChanges = {};
 | 
				
			||||||
        if (recipe.consumeOnUse) {
 | 
					        if (recipe.consumeOnUse) {
 | 
				
			||||||
            addRecipes(inventory, [
 | 
					            addRecipes(inventory, [
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
@ -134,6 +137,6 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) =
 | 
				
			|||||||
            };
 | 
					            };
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        await inventory.save();
 | 
					        await inventory.save();
 | 
				
			||||||
        res.json({ InventoryChanges });
 | 
					        res.json({ InventoryChanges, BrandedSuits });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user