Apply prettier changes

This commit is contained in:
AMelonInsideLemon 2024-06-26 13:28:33 +00:00 committed by github-actions[bot]
parent f78b75083b
commit 3c9da532a8

View File

@ -35,25 +35,27 @@ export const gildWeaponController: RequestHandler = async (req, res) => {
data.Caterogy = req.query.Category as WeaponTypeInternal | "Hoverboards"; data.Caterogy = req.query.Category as WeaponTypeInternal | "Hoverboards";
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
if(!inventory[data.Caterogy]){ if (!inventory[data.Caterogy]) {
throw new Error(`Category ${req.query.Category} dont foudn in inventory`); throw new Error(`Category ${req.query.Category} dont foudn in inventory`);
} }
const weaponIndex = inventory[data.Caterogy].findIndex(x => String(x._id) === data.ItemId); const weaponIndex = inventory[data.Caterogy].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.Caterogy][weaponIndex];
weapon.Features = EquipmentFeatures.GILDING; // maybe 9 idk if DOUBLE_CAPACITY is also given weapon.Features = EquipmentFeatures.GILDING; // 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.Caterogy != "OperatorAmps" && data.PolarizeSlot && data.PolarizeValue) {
weapon.Polarity= [{ weapon.Polarity = [
Slot: data.PolarizeSlot, {
Value: data.PolarizeValue Slot: data.PolarizeSlot,
}] Value: data.PolarizeValue
}
];
} }
inventory[data.Caterogy][weaponIndex] = weapon inventory[data.Caterogy][weaponIndex] = weapon;
await inventory.save(); await inventory.save();
res.json({ res.json({