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 category = modularWeaponTypes[data.WeaponType];
|
||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
|
|
||||||
const configs = applyDefaultUpgrades(inventory, getDefaultUpgrades(data.Parts));
|
const defaultUpgrades = getDefaultUpgrades(data.Parts);
|
||||||
|
const configs = applyDefaultUpgrades(inventory, defaultUpgrades);
|
||||||
// Give weapon
|
|
||||||
const inventoryChanges: IInventoryChanges = {
|
const inventoryChanges: IInventoryChanges = {
|
||||||
...addEquipment(inventory, category, data.WeaponType, data.Parts, {}, { Configs: configs }),
|
...addEquipment(inventory, category, data.WeaponType, data.Parts, {}, { Configs: configs }),
|
||||||
...occupySlot(inventory, productCategoryToInventoryBin(category)!, false)
|
...occupySlot(inventory, productCategoryToInventoryBin(category)!, false)
|
||||||
};
|
};
|
||||||
|
if (defaultUpgrades) {
|
||||||
|
inventoryChanges.RawUpgrades = defaultUpgrades.map(x => ({ ItemType: x.ItemType, ItemCount: 1 }));
|
||||||
|
}
|
||||||
|
|
||||||
// Remove credits & parts
|
// Remove credits & parts
|
||||||
const miscItemChanges = [];
|
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)!
|
const weaponInfo = getSaleInfos(partTypeToParts, payload.Revision).find(x => x.Name == payload.SaleName)!
|
||||||
.Weapons[payload.ItemIndex];
|
.Weapons[payload.ItemIndex];
|
||||||
const category = modularWeaponTypes[weaponInfo.ItemType];
|
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 = {
|
const inventoryChanges: IInventoryChanges = {
|
||||||
...addEquipment(
|
...addEquipment(
|
||||||
inventory,
|
inventory,
|
||||||
@ -62,6 +63,9 @@ export const modularWeaponSaleController: RequestHandler = async (req, res) => {
|
|||||||
...occupySlot(inventory, productCategoryToInventoryBin(category)!, true),
|
...occupySlot(inventory, productCategoryToInventoryBin(category)!, true),
|
||||||
...updateCurrency(inventory, weaponInfo.PremiumPrice, true)
|
...updateCurrency(inventory, weaponInfo.PremiumPrice, true)
|
||||||
};
|
};
|
||||||
|
if (defaultUpgrades) {
|
||||||
|
inventoryChanges.RawUpgrades = defaultUpgrades.map(x => ({ ItemType: x.ItemType, ItemCount: 1 }));
|
||||||
|
}
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.json({
|
res.json({
|
||||||
InventoryChanges: inventoryChanges
|
InventoryChanges: inventoryChanges
|
||||||
|
Loading…
x
Reference in New Issue
Block a user