import slots
This commit is contained in:
parent
6eb4ef81df
commit
27a855cdb1
@ -4,6 +4,7 @@ import { IMongoDate } from "../types/commonTypes";
|
|||||||
import {
|
import {
|
||||||
equipmentKeys,
|
equipmentKeys,
|
||||||
IInventoryClient,
|
IInventoryClient,
|
||||||
|
ISlots,
|
||||||
IUpgradeClient,
|
IUpgradeClient,
|
||||||
IUpgradeDatabase,
|
IUpgradeDatabase,
|
||||||
IWeaponSkinClient,
|
IWeaponSkinClient,
|
||||||
@ -55,6 +56,11 @@ const replaceArray = <T>(arr: T[], replacement: T[]): void => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const replaceSlots = (db: ISlots, client: ISlots): void => {
|
||||||
|
db.Extra = client.Extra;
|
||||||
|
db.Slots = client.Slots;
|
||||||
|
};
|
||||||
|
|
||||||
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
|
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
|
||||||
for (const key of equipmentKeys) {
|
for (const key of equipmentKeys) {
|
||||||
if (client[key]) {
|
if (client[key]) {
|
||||||
@ -67,4 +73,22 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
|
|||||||
if (client.Upgrades) {
|
if (client.Upgrades) {
|
||||||
replaceArray<IUpgradeDatabase>(db.Upgrades, client.Upgrades.map(convertUpgrade));
|
replaceArray<IUpgradeDatabase>(db.Upgrades, client.Upgrades.map(convertUpgrade));
|
||||||
}
|
}
|
||||||
|
for (const key of [
|
||||||
|
"SuitBin",
|
||||||
|
"WeaponBin",
|
||||||
|
"SentinelBin",
|
||||||
|
"SpaceSuitBin",
|
||||||
|
"SpaceWeaponBin",
|
||||||
|
"PvpBonusLoadoutBin",
|
||||||
|
"PveBonusLoadoutBin",
|
||||||
|
"RandomModBin",
|
||||||
|
"MechBin",
|
||||||
|
"CrewMemberBin",
|
||||||
|
"OperatorAmpBin",
|
||||||
|
"CrewShipSalvageBin"
|
||||||
|
] as const) {
|
||||||
|
if (client[key]) {
|
||||||
|
replaceSlots(db[key], client[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user