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