feat: handle purchasing of archwing, archgun, & archmelee #326
@ -961,6 +961,7 @@ type InventoryDocumentProps = {
 | 
			
		||||
    SpaceSuits: Types.DocumentArray<IEquipmentDatabase>;
 | 
			
		||||
    SpaceGuns: Types.DocumentArray<IEquipmentDatabase>;
 | 
			
		||||
    SpaceMelee: Types.DocumentArray<IEquipmentDatabase>;
 | 
			
		||||
    SentinelWeapons: Types.DocumentArray<IEquipmentDatabase>;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// eslint-disable-next-line @typescript-eslint/ban-types
 | 
			
		||||
 | 
			
		||||
@ -416,24 +416,12 @@ export const addWeapon = async (
 | 
			
		||||
): Promise<IEquipmentClient> => {
 | 
			
		||||
    const inventory = await getInventory(accountId);
 | 
			
		||||
 | 
			
		||||
    let weaponIndex;
 | 
			
		||||
    switch (weaponType) {
 | 
			
		||||
        case "LongGuns":
 | 
			
		||||
        case "Pistols":
 | 
			
		||||
        case "Melee":
 | 
			
		||||
        case "OperatorAmps":
 | 
			
		||||
        case "SpaceGuns":
 | 
			
		||||
        case "SpaceMelee":
 | 
			
		||||
            weaponIndex = inventory[weaponType].push({
 | 
			
		||||
    const weaponIndex = inventory[weaponType].push({
 | 
			
		||||
        ItemType: weaponName,
 | 
			
		||||
        Configs: [],
 | 
			
		||||
        XP: 0,
 | 
			
		||||
        ModularParts: modularParts
 | 
			
		||||
    });
 | 
			
		||||
            break;
 | 
			
		||||
        default:
 | 
			
		||||
            throw new Error("unknown weapon type: " + weaponType);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const changedInventory = await inventory.save();
 | 
			
		||||
    return changedInventory[weaponType][weaponIndex - 1].toJSON();
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user