let client know that it also acquired RawUpgrades for defaultUpgrades
All checks were successful
Build / build (22) (push) Successful in 39s
Build / build (20) (push) Successful in 1m7s
Build / build (18) (push) Successful in 1m6s
Build / build (18) (pull_request) Successful in 45s
Build / build (20) (pull_request) Successful in 1m7s
Build / build (22) (pull_request) Successful in 1m3s
All checks were successful
Build / build (22) (push) Successful in 39s
Build / build (20) (push) Successful in 1m7s
Build / build (18) (push) Successful in 1m6s
Build / build (18) (pull_request) Successful in 45s
Build / build (20) (pull_request) Successful in 1m7s
Build / build (22) (pull_request) Successful in 1m3s
This commit is contained in:
parent
8077b9e4b6
commit
22be3cc707
@ -28,13 +28,15 @@ export const modularWeaponCraftingController: RequestHandler = async (req, res)
|
||||
const category = modularWeaponTypes[data.WeaponType];
|
||||
const inventory = await getInventory(accountId);
|
||||
|
||||
const configs = applyDefaultUpgrades(inventory, getDefaultUpgrades(data.Parts));
|
||||
|
||||
// Give weapon
|
||||
const defaultUpgrades = getDefaultUpgrades(data.Parts);
|
||||
const configs = applyDefaultUpgrades(inventory, defaultUpgrades);
|
||||
const inventoryChanges: IInventoryChanges = {
|
||||
...addEquipment(inventory, category, data.WeaponType, data.Parts, {}, { Configs: configs }),
|
||||
...occupySlot(inventory, productCategoryToInventoryBin(category)!, false)
|
||||
};
|
||||
if (defaultUpgrades) {
|
||||
inventoryChanges.RawUpgrades = defaultUpgrades.map(x => ({ ItemType: x.ItemType, ItemCount: 1 }));
|
||||
}
|
||||
|
||||
// Remove credits & parts
|
||||
const miscItemChanges = [];
|
||||
|
@ -39,7 +39,8 @@ export const modularWeaponSaleController: RequestHandler = async (req, res) => {
|
||||
const weaponInfo = getSaleInfos(partTypeToParts, payload.Revision).find(x => x.Name == payload.SaleName)!
|
||||
.Weapons[payload.ItemIndex];
|
||||
const category = modularWeaponTypes[weaponInfo.ItemType];
|
||||
const configs = applyDefaultUpgrades(inventory, getDefaultUpgrades(weaponInfo.ModularParts));
|
||||
const defaultUpgrades = getDefaultUpgrades(weaponInfo.ModularParts);
|
||||
const configs = applyDefaultUpgrades(inventory, defaultUpgrades);
|
||||
const inventoryChanges: IInventoryChanges = {
|
||||
...addEquipment(
|
||||
inventory,
|
||||
@ -62,6 +63,9 @@ export const modularWeaponSaleController: RequestHandler = async (req, res) => {
|
||||
...occupySlot(inventory, productCategoryToInventoryBin(category)!, true),
|
||||
...updateCurrency(inventory, weaponInfo.PremiumPrice, true)
|
||||
};
|
||||
if (defaultUpgrades) {
|
||||
inventoryChanges.RawUpgrades = defaultUpgrades.map(x => ({ ItemType: x.ItemType, ItemCount: 1 }));
|
||||
}
|
||||
await inventory.save();
|
||||
res.json({
|
||||
InventoryChanges: inventoryChanges
|
||||
|
Loading…
x
Reference in New Issue
Block a user