chore: handle motorcycle in addItems
All checks were successful
Build / build (18) (pull_request) Successful in 34s
Build / build (22) (pull_request) Successful in 32s
Build / build (20) (pull_request) Successful in 57s
Build / build (18) (push) Successful in 36s
Build / build (22) (push) Successful in 55s
Build / build (20) (push) Successful in 1m8s
All checks were successful
Build / build (18) (pull_request) Successful in 34s
Build / build (22) (pull_request) Successful in 32s
Build / build (20) (pull_request) Successful in 57s
Build / build (18) (push) Successful in 36s
Build / build (22) (push) Successful in 55s
Build / build (20) (push) Successful in 1m8s
This commit is contained in:
parent
6acb0f5dca
commit
0a041af6d6
@ -516,6 +516,11 @@ export const addItem = async (
|
||||
}
|
||||
};
|
||||
}
|
||||
case "Vehicles":
|
||||
if (typeName == "/Lotus/Types/Vehicles/Motorcycle/MotorcyclePowerSuit") {
|
||||
return { InventoryChanges: addMotorcycle(inventory, typeName) };
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -853,6 +858,20 @@ const addCrewShipHarness = (
|
||||
return inventoryChanges;
|
||||
};
|
||||
|
||||
const addMotorcycle = (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
typeName: string,
|
||||
inventoryChanges: IInventoryChanges = {}
|
||||
): IInventoryChanges => {
|
||||
if (inventory.Motorcycles.length != 0) {
|
||||
throw new Error("refusing to add Motorcycle because account already has one");
|
||||
}
|
||||
const index = inventory.Motorcycles.push({ ItemType: typeName }) - 1;
|
||||
inventoryChanges.Motorcycles ??= [];
|
||||
(inventoryChanges.Motorcycles as object[]).push(inventory.Motorcycles[index].toJSON());
|
||||
return inventoryChanges;
|
||||
};
|
||||
|
||||
//TODO: wrong id is not erroring
|
||||
export const addGearExpByCategory = (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
|
Loading…
x
Reference in New Issue
Block a user