chore: add crewship to freestanding inventory
This commit is contained in:
parent
603708de2f
commit
f6afdd4869
@ -143,11 +143,10 @@ export const addItem = async (
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else if (ExportResources[typeName].productCategory == "CrewShips") {
|
} else if (ExportResources[typeName].productCategory == "CrewShips") {
|
||||||
return {
|
const inventory = await getInventory(accountId);
|
||||||
InventoryChanges: {
|
const inventoryChanges = addCrewShip(inventory, typeName);
|
||||||
CrewShips: [await addCrewShip(typeName, accountId)]
|
await inventory.save();
|
||||||
}
|
return { InventoryChanges: inventoryChanges };
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
const miscItemChanges = [
|
const miscItemChanges = [
|
||||||
{
|
{
|
||||||
@ -590,11 +589,15 @@ export const addSkin = async (typeName: string, accountId: string): Promise<IWea
|
|||||||
return changedInventory.WeaponSkins[index].toJSON() as object as IWeaponSkinClient;
|
return changedInventory.WeaponSkins[index].toJSON() as object as IWeaponSkinClient;
|
||||||
};
|
};
|
||||||
|
|
||||||
const addCrewShip = async (typeName: string, accountId: string) => {
|
const addCrewShip = (
|
||||||
const inventory = await getInventory(accountId);
|
inventory: TInventoryDatabaseDocument,
|
||||||
|
typeName: string,
|
||||||
|
inventoryChanges: IInventoryChanges = {}
|
||||||
|
): IInventoryChanges => {
|
||||||
const index = inventory.CrewShips.push({ ItemType: typeName }) - 1;
|
const index = inventory.CrewShips.push({ ItemType: typeName }) - 1;
|
||||||
const changedInventory = await inventory.save();
|
inventoryChanges.CrewShips ??= [];
|
||||||
return changedInventory.CrewShips[index].toJSON();
|
(inventoryChanges.CrewShips as object[]).push(inventory.CrewShips[index].toJSON());
|
||||||
|
return inventoryChanges;
|
||||||
};
|
};
|
||||||
|
|
||||||
const addGearExpByCategory = (
|
const addGearExpByCategory = (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user