import InfestedFoundry

This commit is contained in:
Sainan 2025-01-20 08:26:33 +01:00
parent 3fa6fa7ffe
commit eb039fe969

View File

@ -8,6 +8,8 @@ import {
import { IMongoDate } from "../types/commonTypes";
import {
equipmentKeys,
IInfestedFoundryClient,
IInfestedFoundryDatabase,
IInventoryClient,
ILoadoutConfigClient,
ILoadOutPresets,
@ -75,6 +77,14 @@ const replaceSlots = (db: ISlots, client: ISlots): void => {
db.Slots = client.Slots;
};
const convertInfestedFoundry = (client: IInfestedFoundryClient): IInfestedFoundryDatabase => {
return {
...client,
LastConsumedSuit: client.LastConsumedSuit ? convertEquipment(client.LastConsumedSuit) : undefined,
AbilityOverrideUnlockCooldown: convertOptionalDate(client.AbilityOverrideUnlockCooldown)
};
};
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
for (const key of equipmentKeys) {
if (client[key]) {
@ -137,6 +147,9 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
db[key] = client[key];
}
}
if (client.InfestedFoundry) {
db.InfestedFoundry = convertInfestedFoundry(client.InfestedFoundry);
}
};
const convertLoadOutConfig = (client: ILoadoutConfigClient): ILoadoutConfigDatabase => {