typo
This commit is contained in:
		
							parent
							
								
									3c9da532a8
								
							
						
					
					
						commit
						22d8b378d2
					
				@ -19,7 +19,7 @@ interface IGildWeaponRequest {
 | 
				
			|||||||
    PolarizeSlot?: number;
 | 
					    PolarizeSlot?: number;
 | 
				
			||||||
    PolarizeValue?: ArtifactPolarity;
 | 
					    PolarizeValue?: ArtifactPolarity;
 | 
				
			||||||
    ItemId: string;
 | 
					    ItemId: string;
 | 
				
			||||||
    Caterogy: WeaponTypeInternal | "Hoverboards";
 | 
					    Category: WeaponTypeInternal | "Hoverboards";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// In export there no recipes for gild action, so reputation and ressources only consumed visually
 | 
					// In export there no recipes for gild action, so reputation and ressources only consumed visually
 | 
				
			||||||
@ -30,24 +30,24 @@ export const gildWeaponController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
    const data: IGildWeaponRequest = getJSONfromString(String(req.body));
 | 
					    const data: IGildWeaponRequest = getJSONfromString(String(req.body));
 | 
				
			||||||
    data.ItemId = String(req.query.ItemId);
 | 
					    data.ItemId = String(req.query.ItemId);
 | 
				
			||||||
    if (!modularWeaponCategory.includes(req.query.Category as WeaponTypeInternal | "Hoverboards")) {
 | 
					    if (!modularWeaponCategory.includes(req.query.Category as WeaponTypeInternal | "Hoverboards")) {
 | 
				
			||||||
        throw new Error(`unknown modular weapon Category: ${req.query.Category}`);
 | 
					        throw new Error(`Unknown modular weapon Category: ${req.query.Category}`);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    data.Caterogy = req.query.Category as WeaponTypeInternal | "Hoverboards";
 | 
					    data.Category = req.query.Category as WeaponTypeInternal | "Hoverboards";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId);
 | 
				
			||||||
    if (!inventory[data.Caterogy]) {
 | 
					    if(!inventory[data.Category]) {
 | 
				
			||||||
        throw new Error(`Category ${req.query.Category} dont foudn in inventory`);
 | 
					        throw new Error(`Category ${req.query.Category} not found in inventory`);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const weaponIndex = inventory[data.Caterogy].findIndex(x => String(x._id) === data.ItemId);
 | 
					    const weaponIndex = inventory[data.Category].findIndex(x => String(x._id) === data.ItemId);
 | 
				
			||||||
    if (weaponIndex === -1) {
 | 
					    if (weaponIndex === -1) {
 | 
				
			||||||
        throw new Error(`Weapon with ${data.ItemId} not found in category ${req.query.Category}`);
 | 
					        throw new Error(`Weapon with ${data.ItemId} not found in category ${req.query.Category}`);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const weapon = inventory[data.Caterogy][weaponIndex];
 | 
					    const weapon = inventory[data.Category][weaponIndex];
 | 
				
			||||||
    weapon.Features = EquipmentFeatures.GILDING; // maybe 9 idk if DOUBLE_CAPACITY is also given
 | 
					    weapon.Features = EquipmentFeatures.GILDED; // maybe 9 idk if DOUBLE_CAPACITY is also given
 | 
				
			||||||
    weapon.ItemName = data.ItemName;
 | 
					    weapon.ItemName = data.ItemName;
 | 
				
			||||||
    weapon.XP = 0;
 | 
					    weapon.XP = 0;
 | 
				
			||||||
    if (data.Caterogy != "OperatorAmps" && data.PolarizeSlot && data.PolarizeValue) {
 | 
					    if (data.Category != "OperatorAmps" && data.PolarizeSlot && data.PolarizeValue) {
 | 
				
			||||||
        weapon.Polarity = [
 | 
					        weapon.Polarity = [
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Slot: data.PolarizeSlot,
 | 
					                Slot: data.PolarizeSlot,
 | 
				
			||||||
@ -55,12 +55,12 @@ export const gildWeaponController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    inventory[data.Caterogy][weaponIndex] = weapon;
 | 
					    inventory[data.Category][weaponIndex] = weapon;
 | 
				
			||||||
    await inventory.save();
 | 
					    await inventory.save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    res.json({
 | 
					    res.json({
 | 
				
			||||||
        InventoryChanges: {
 | 
					        InventoryChanges: {
 | 
				
			||||||
            [data.Caterogy]: [weapon]
 | 
					            [data.Category]: [weapon]
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -86,7 +86,7 @@ export enum EquipmentFeatures {
 | 
				
			|||||||
    DOUBLE_CAPACITY = 1,
 | 
					    DOUBLE_CAPACITY = 1,
 | 
				
			||||||
    UTILITY_SLOT = 2,
 | 
					    UTILITY_SLOT = 2,
 | 
				
			||||||
    GRAVIMAG_INSTALLED = 4,
 | 
					    GRAVIMAG_INSTALLED = 4,
 | 
				
			||||||
    GILDING = 8,
 | 
					    GILDED = 8,
 | 
				
			||||||
    ARCANE_SLOT = 32,
 | 
					    ARCANE_SLOT = 32,
 | 
				
			||||||
    INCARNON_GENESIS = 512
 | 
					    INCARNON_GENESIS = 512
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -113,7 +113,6 @@ export interface IEquipmentDatabase {
 | 
				
			|||||||
    Expiry?: IMongoDate;
 | 
					    Expiry?: IMongoDate;
 | 
				
			||||||
    SkillTree?: string;
 | 
					    SkillTree?: string;
 | 
				
			||||||
    ArchonCrystalUpgrades?: IArchonCrystalUpgrade[];
 | 
					    ArchonCrystalUpgrades?: IArchonCrystalUpgrade[];
 | 
				
			||||||
    ItemId: IOid;
 | 
					 | 
				
			||||||
    _id: Types.ObjectId;
 | 
					    _id: Types.ObjectId;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user