import all equipmentKeys
This commit is contained in:
parent
e7d655aa58
commit
6eb4ef81df
@ -2,6 +2,7 @@ import { Types } from "mongoose";
|
||||
import { IEquipmentClient, IEquipmentDatabase } from "../types/inventoryTypes/commonInventoryTypes";
|
||||
import { IMongoDate } from "../types/commonTypes";
|
||||
import {
|
||||
equipmentKeys,
|
||||
IInventoryClient,
|
||||
IUpgradeClient,
|
||||
IUpgradeDatabase,
|
||||
@ -55,8 +56,10 @@ const replaceArray = <T>(arr: T[], replacement: T[]): void => {
|
||||
};
|
||||
|
||||
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
|
||||
if (client.Suits) {
|
||||
replaceArray<IEquipmentDatabase>(db.Suits, client.Suits.map(convertEquipment));
|
||||
for (const key of equipmentKeys) {
|
||||
if (client[key]) {
|
||||
replaceArray<IEquipmentDatabase>(db[key], client[key].map(convertEquipment));
|
||||
}
|
||||
}
|
||||
if (client.WeaponSkins) {
|
||||
replaceArray<IWeaponSkinDatabase>(db.WeaponSkins, client.WeaponSkins.map(convertWeaponSkin));
|
||||
|
@ -24,10 +24,10 @@ export interface IInventoryDatabase
|
||||
| "BlessingCooldown"
|
||||
| "Ships"
|
||||
| "WeaponSkins"
|
||||
| "Suits"
|
||||
| "Upgrades"
|
||||
| "CrewShipSalvagedWeaponSkins"
|
||||
| "CrewShipWeaponSkins"
|
||||
| TEquipmentKey
|
||||
> {
|
||||
accountOwnerId: Types.ObjectId;
|
||||
Created: Date;
|
||||
@ -40,10 +40,23 @@ export interface IInventoryDatabase
|
||||
BlessingCooldown: Date;
|
||||
Ships: Types.ObjectId[];
|
||||
WeaponSkins: IWeaponSkinDatabase[];
|
||||
Suits: IEquipmentDatabase[];
|
||||
Upgrades: IUpgradeDatabase[];
|
||||
CrewShipSalvagedWeaponSkins: IUpgradeDatabase[];
|
||||
CrewShipWeaponSkins: IUpgradeDatabase[];
|
||||
|
||||
Suits: IEquipmentDatabase[];
|
||||
LongGuns: IEquipmentDatabase[];
|
||||
Pistols: IEquipmentDatabase[];
|
||||
Melee: IEquipmentDatabase[];
|
||||
SpecialItems: IEquipmentDatabase[];
|
||||
Sentinels: IEquipmentDatabase[];
|
||||
SentinelWeapons: IEquipmentDatabase[];
|
||||
SpaceSuits: IEquipmentDatabase[];
|
||||
SpaceGuns: IEquipmentDatabase[];
|
||||
SpaceMelee: IEquipmentDatabase[];
|
||||
Hoverboards: IEquipmentDatabase[];
|
||||
OperatorAmps: IEquipmentDatabase[];
|
||||
MoaPets: IEquipmentDatabase[];
|
||||
}
|
||||
|
||||
export interface IQuestKeyDatabase {
|
||||
@ -136,6 +149,20 @@ export interface IDailyAffiliations {
|
||||
}
|
||||
|
||||
export interface IInventoryClient extends IDailyAffiliations {
|
||||
Suits: IEquipmentClient[];
|
||||
LongGuns: IEquipmentClient[];
|
||||
Pistols: IEquipmentClient[];
|
||||
Melee: IEquipmentClient[];
|
||||
SpecialItems: IEquipmentClient[];
|
||||
Sentinels: IEquipmentClient[];
|
||||
SentinelWeapons: IEquipmentClient[];
|
||||
SpaceSuits: IEquipmentClient[];
|
||||
SpaceGuns: IEquipmentClient[];
|
||||
SpaceMelee: IEquipmentClient[];
|
||||
Hoverboards: IEquipmentClient[];
|
||||
OperatorAmps: IEquipmentClient[];
|
||||
MoaPets: IEquipmentClient[];
|
||||
|
||||
Horses: IEquipmentDatabase[];
|
||||
DrifterMelee: IEquipmentDatabase[];
|
||||
DrifterGuns: IEquipmentDatabase[];
|
||||
@ -172,10 +199,6 @@ export interface IInventoryClient extends IDailyAffiliations {
|
||||
ChallengeProgress: IChallengeProgress[];
|
||||
RawUpgrades: IRawUpgrade[];
|
||||
ReceivedStartingGear: boolean;
|
||||
Suits: IEquipmentClient[];
|
||||
LongGuns: IEquipmentDatabase[];
|
||||
Pistols: IEquipmentDatabase[];
|
||||
Melee: IEquipmentDatabase[];
|
||||
Ships: IShipInventory[];
|
||||
QuestKeys: IQuestKeyResponse[];
|
||||
FlavourItems: IFlavourItem[];
|
||||
@ -222,14 +245,9 @@ export interface IInventoryClient extends IDailyAffiliations {
|
||||
Affiliations: IAffiliation[];
|
||||
QualifyingInvasions: any[];
|
||||
FactionScores: number[];
|
||||
SpaceSuits: IEquipmentDatabase[];
|
||||
SpaceMelee: IEquipmentDatabase[];
|
||||
SpaceGuns: IEquipmentDatabase[];
|
||||
ArchwingEnabled: boolean;
|
||||
PendingSpectreLoadouts?: ISpectreLoadout[];
|
||||
SpectreLoadouts?: ISpectreLoadout[];
|
||||
SentinelWeapons: IEquipmentDatabase[];
|
||||
Sentinels: IEquipmentDatabase[];
|
||||
EmailItems: ITypeCount[];
|
||||
CompletedSyndicates: string[];
|
||||
FocusXP: IFocusXP;
|
||||
@ -246,13 +264,11 @@ export interface IInventoryClient extends IDailyAffiliations {
|
||||
CompletedJobs: ICompletedJob[];
|
||||
FocusAbility: string;
|
||||
FocusUpgrades: IFocusUpgrade[];
|
||||
OperatorAmps: IEquipmentDatabase[];
|
||||
HasContributedToDojo?: boolean;
|
||||
HWIDProtectEnabled?: boolean;
|
||||
KubrowPetPrints: IKubrowPetPrint[];
|
||||
AlignmentReplay: IAlignment;
|
||||
PersonalGoalProgress: IPersonalGoalProgress[];
|
||||
SpecialItems: IEquipmentDatabase[];
|
||||
ThemeStyle: string;
|
||||
ThemeBackground: string;
|
||||
ThemeSounds: string;
|
||||
@ -261,12 +277,10 @@ export interface IInventoryClient extends IDailyAffiliations {
|
||||
LoginMilestoneRewards: string[];
|
||||
OperatorLoadOuts: IOperatorConfigClient[];
|
||||
RecentVendorPurchases: Array<number | string>;
|
||||
Hoverboards: IEquipmentDatabase[];
|
||||
NodeIntrosCompleted: string[];
|
||||
GuildId?: IOid;
|
||||
CompletedJobChains: ICompletedJobChain[];
|
||||
SeasonChallengeHistory: ISeasonChallenge[];
|
||||
MoaPets: IEquipmentDatabase[];
|
||||
EquippedInstrument?: string;
|
||||
InvasionChainProgress: IInvasionChainProgress[];
|
||||
DataKnives: IEquipmentDatabase[];
|
||||
|
Loading…
x
Reference in New Issue
Block a user