feat(import): additional fields #1305
@ -1264,15 +1264,15 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        //NPC Crew and weapon
 | 
					        //NPC Crew and weapon
 | 
				
			||||||
        CrewMembers: [Schema.Types.Mixed],
 | 
					        CrewMembers: [Schema.Types.Mixed],
 | 
				
			||||||
        CrewShipSalvagedWeaponSkins: [Schema.Types.Mixed],
 | 
					        CrewShipSalvagedWeaponSkins: [upgradeSchema],
 | 
				
			||||||
        CrewShipSalvagedWeapons: [Schema.Types.Mixed],
 | 
					        CrewShipSalvagedWeapons: [upgradeSchema],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //Complete Mission\Quests
 | 
					        //Complete Mission\Quests
 | 
				
			||||||
        Missions: [missionSchema],
 | 
					        Missions: [missionSchema],
 | 
				
			||||||
        QuestKeys: [questKeysSchema],
 | 
					        QuestKeys: [questKeysSchema],
 | 
				
			||||||
        ActiveQuest: { type: String, default: "" },
 | 
					        ActiveQuest: { type: String, default: "" },
 | 
				
			||||||
        //item like DojoKey or Boss missions key
 | 
					        //item like DojoKey or Boss missions key
 | 
				
			||||||
        LevelKeys: [Schema.Types.Mixed],
 | 
					        LevelKeys: [typeCountSchema],
 | 
				
			||||||
        //Active quests
 | 
					        //Active quests
 | 
				
			||||||
        Quests: [Schema.Types.Mixed],
 | 
					        Quests: [Schema.Types.Mixed],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1333,7 +1333,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
 | 
				
			|||||||
        SpectreLoadouts: { type: [spectreLoadoutsSchema], default: undefined },
 | 
					        SpectreLoadouts: { type: [spectreLoadoutsSchema], default: undefined },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //New Quest Email
 | 
					        //New Quest Email
 | 
				
			||||||
        EmailItems: [TypeXPItemSchema],
 | 
					        EmailItems: [typeCountSchema],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //Profile->Wishlist
 | 
					        //Profile->Wishlist
 | 
				
			||||||
        Wishlist: [String],
 | 
					        Wishlist: [String],
 | 
				
			||||||
 | 
				
			|||||||
@ -23,6 +23,12 @@ import {
 | 
				
			|||||||
    IKubrowPetDetailsDatabase,
 | 
					    IKubrowPetDetailsDatabase,
 | 
				
			||||||
    ILoadoutConfigClient,
 | 
					    ILoadoutConfigClient,
 | 
				
			||||||
    ILoadOutPresets,
 | 
					    ILoadOutPresets,
 | 
				
			||||||
 | 
					    INemesisClient,
 | 
				
			||||||
 | 
					    INemesisDatabase,
 | 
				
			||||||
 | 
					    IPendingRecipeClient,
 | 
				
			||||||
 | 
					    IPendingRecipeDatabase,
 | 
				
			||||||
 | 
					    IQuestKeyClient,
 | 
				
			||||||
 | 
					    IQuestKeyDatabase,
 | 
				
			||||||
    ISlots,
 | 
					    ISlots,
 | 
				
			||||||
    IUpgradeClient,
 | 
					    IUpgradeClient,
 | 
				
			||||||
    IUpgradeDatabase,
 | 
					    IUpgradeDatabase,
 | 
				
			||||||
@ -144,6 +150,27 @@ const convertKubrowDetails = (client: IKubrowPetDetailsClient): IKubrowPetDetail
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const convertQuestKey = (client: IQuestKeyClient): IQuestKeyDatabase => {
 | 
				
			||||||
 | 
					    return {
 | 
				
			||||||
 | 
					        ...client,
 | 
				
			||||||
 | 
					        CompletionDate: convertOptionalDate(client.CompletionDate)
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const convertPendingRecipe = (client: IPendingRecipeClient): IPendingRecipeDatabase => {
 | 
				
			||||||
 | 
					    return {
 | 
				
			||||||
 | 
					        ...client,
 | 
				
			||||||
 | 
					        CompletionDate: convertDate(client.CompletionDate)
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const convertNemesis = (client: INemesisClient): INemesisDatabase => {
 | 
				
			||||||
 | 
					    return {
 | 
				
			||||||
 | 
					        ...client,
 | 
				
			||||||
 | 
					        d: convertDate(client.d)
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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] !== undefined) {
 | 
					        if (client[key] !== undefined) {
 | 
				
			||||||
@ -153,10 +180,22 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
 | 
				
			|||||||
    if (client.WeaponSkins !== undefined) {
 | 
					    if (client.WeaponSkins !== undefined) {
 | 
				
			||||||
        replaceArray<IWeaponSkinDatabase>(db.WeaponSkins, client.WeaponSkins.map(convertWeaponSkin));
 | 
					        replaceArray<IWeaponSkinDatabase>(db.WeaponSkins, client.WeaponSkins.map(convertWeaponSkin));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (client.Upgrades !== undefined) {
 | 
					    for (const key of ["Upgrades", "CrewShipSalvagedWeaponSkins", "CrewShipWeaponSkins"] as const) {
 | 
				
			||||||
        replaceArray<IUpgradeDatabase>(db.Upgrades, client.Upgrades.map(convertUpgrade));
 | 
					        if (client[key] !== undefined) {
 | 
				
			||||||
 | 
					            replaceArray<IUpgradeDatabase>(db[key], client[key].map(convertUpgrade));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    for (const key of ["RawUpgrades", "MiscItems", "Consumables"] as const) {
 | 
					    }
 | 
				
			||||||
 | 
					    for (const key of [
 | 
				
			||||||
 | 
					        "RawUpgrades",
 | 
				
			||||||
 | 
					        "MiscItems",
 | 
				
			||||||
 | 
					        "Consumables",
 | 
				
			||||||
 | 
					        "Recipes",
 | 
				
			||||||
 | 
					        "LevelKeys",
 | 
				
			||||||
 | 
					        "EmailItems",
 | 
				
			||||||
 | 
					        "ShipDecorations",
 | 
				
			||||||
 | 
					        "CrewShipAmmo",
 | 
				
			||||||
 | 
					        "CrewShipRawSalvage"
 | 
				
			||||||
 | 
					    ] as const) {
 | 
				
			||||||
        if (client[key] !== undefined) {
 | 
					        if (client[key] !== undefined) {
 | 
				
			||||||
            db[key].splice(0, db[key].length);
 | 
					            db[key].splice(0, db[key].length);
 | 
				
			||||||
            client[key].forEach(x => {
 | 
					            client[key].forEach(x => {
 | 
				
			||||||
@ -190,8 +229,16 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
 | 
				
			|||||||
            replaceSlots(db[key], client[key]);
 | 
					            replaceSlots(db[key], client[key]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (client.UseAdultOperatorLoadout !== undefined) {
 | 
					    for (const key of [
 | 
				
			||||||
        db.UseAdultOperatorLoadout = client.UseAdultOperatorLoadout;
 | 
					        "UseAdultOperatorLoadout",
 | 
				
			||||||
 | 
					        "HasOwnedVoidProjectionsPreviously",
 | 
				
			||||||
 | 
					        "ReceivedStartingGear",
 | 
				
			||||||
 | 
					        "ArchwingEnabled",
 | 
				
			||||||
 | 
					        "PlayedParkourTutorial"
 | 
				
			||||||
 | 
					    ] as const) {
 | 
				
			||||||
 | 
					        if (client[key] !== undefined) {
 | 
				
			||||||
 | 
					            db[key] = client[key];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    for (const key of [
 | 
					    for (const key of [
 | 
				
			||||||
        "PlayerLevel",
 | 
					        "PlayerLevel",
 | 
				
			||||||
@ -199,18 +246,37 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
 | 
				
			|||||||
        "PremiumCredits",
 | 
					        "PremiumCredits",
 | 
				
			||||||
        "PremiumCreditsFree",
 | 
					        "PremiumCreditsFree",
 | 
				
			||||||
        "FusionPoints",
 | 
					        "FusionPoints",
 | 
				
			||||||
        "PrimeTokens"
 | 
					        "PrimeTokens",
 | 
				
			||||||
 | 
					        "TradesRemaining",
 | 
				
			||||||
 | 
					        "GiftsRemaining",
 | 
				
			||||||
 | 
					        "ChallengesFixVersion"
 | 
				
			||||||
    ] as const) {
 | 
					    ] as const) {
 | 
				
			||||||
        if (client[key] !== undefined) {
 | 
					        if (client[key] !== undefined) {
 | 
				
			||||||
            db[key] = client[key];
 | 
					            db[key] = client[key];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    for (const key of ["ThemeStyle", "ThemeBackground", "ThemeSounds", "EquippedInstrument", "FocusAbility"] as const) {
 | 
					    for (const key of [
 | 
				
			||||||
 | 
					        "ThemeStyle",
 | 
				
			||||||
 | 
					        "ThemeBackground",
 | 
				
			||||||
 | 
					        "ThemeSounds",
 | 
				
			||||||
 | 
					        "EquippedInstrument",
 | 
				
			||||||
 | 
					        "FocusAbility",
 | 
				
			||||||
 | 
					        "ActiveQuest",
 | 
				
			||||||
 | 
					        "SupportedSyndicate",
 | 
				
			||||||
 | 
					        "ActiveAvatarImageType"
 | 
				
			||||||
 | 
					    ] as const) {
 | 
				
			||||||
        if (client[key] !== undefined) {
 | 
					        if (client[key] !== undefined) {
 | 
				
			||||||
            db[key] = client[key];
 | 
					            db[key] = client[key];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    for (const key of ["EquippedGear", "EquippedEmotes", "NodeIntrosCompleted"] as const) {
 | 
					    for (const key of [
 | 
				
			||||||
 | 
					        "EquippedGear",
 | 
				
			||||||
 | 
					        "EquippedEmotes",
 | 
				
			||||||
 | 
					        "NodeIntrosCompleted",
 | 
				
			||||||
 | 
					        "DeathMarks",
 | 
				
			||||||
 | 
					        "Wishlist",
 | 
				
			||||||
 | 
					        "NemesisAbandonedRewards"
 | 
				
			||||||
 | 
					    ] as const) {
 | 
				
			||||||
        if (client[key] !== undefined) {
 | 
					        if (client[key] !== undefined) {
 | 
				
			||||||
            db[key] = client[key];
 | 
					            db[key] = client[key];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -242,6 +308,77 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
 | 
				
			|||||||
    if (client.CustomMarkers !== undefined) {
 | 
					    if (client.CustomMarkers !== undefined) {
 | 
				
			||||||
        db.CustomMarkers = client.CustomMarkers;
 | 
					        db.CustomMarkers = client.CustomMarkers;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.ChallengeProgress !== undefined) {
 | 
				
			||||||
 | 
					        db.ChallengeProgress = client.ChallengeProgress;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.QuestKeys !== undefined) {
 | 
				
			||||||
 | 
					        replaceArray<IQuestKeyDatabase>(db.QuestKeys, client.QuestKeys.map(convertQuestKey));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.LastRegionPlayed !== undefined) {
 | 
				
			||||||
 | 
					        db.LastRegionPlayed = client.LastRegionPlayed;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.PendingRecipes !== undefined) {
 | 
				
			||||||
 | 
					        replaceArray<IPendingRecipeDatabase>(db.PendingRecipes, client.PendingRecipes.map(convertPendingRecipe));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.TauntHistory !== undefined) {
 | 
				
			||||||
 | 
					        db.TauntHistory = client.TauntHistory;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.LoreFragmentScans !== undefined) {
 | 
				
			||||||
 | 
					        db.LoreFragmentScans = client.LoreFragmentScans;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    for (const key of ["PendingSpectreLoadouts", "SpectreLoadouts"] as const) {
 | 
				
			||||||
 | 
					        if (client[key] !== undefined) {
 | 
				
			||||||
 | 
					            db[key] = client[key];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.FocusXP !== undefined) {
 | 
				
			||||||
 | 
					        db.FocusXP = client.FocusXP;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    for (const key of ["Alignment", "AlignmentReplay"] as const) {
 | 
				
			||||||
 | 
					        if (client[key] !== undefined) {
 | 
				
			||||||
 | 
					            db[key] = client[key];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.StepSequencers !== undefined) {
 | 
				
			||||||
 | 
					        db.StepSequencers = client.StepSequencers;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.CompletedJobChains !== undefined) {
 | 
				
			||||||
 | 
					        db.CompletedJobChains = client.CompletedJobChains;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.Nemesis !== undefined) {
 | 
				
			||||||
 | 
					        db.Nemesis = convertNemesis(client.Nemesis);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.PlayerSkills !== undefined) {
 | 
				
			||||||
 | 
					        db.PlayerSkills = client.PlayerSkills;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.LotusCustomization !== undefined) {
 | 
				
			||||||
 | 
					        db.LotusCustomization = client.LotusCustomization;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.CollectibleSeries !== undefined) {
 | 
				
			||||||
 | 
					        db.CollectibleSeries = client.CollectibleSeries;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    for (const key of ["LibraryAvailableDailyTaskInfo", "LibraryActiveDailyTaskInfo"] as const) {
 | 
				
			||||||
 | 
					        if (client[key] !== undefined) {
 | 
				
			||||||
 | 
					            db[key] = client[key];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.EndlessXP !== undefined) {
 | 
				
			||||||
 | 
					        db.EndlessXP = client.EndlessXP;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.SongChallenges !== undefined) {
 | 
				
			||||||
 | 
					        db.SongChallenges = client.SongChallenges;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.Missions !== undefined) {
 | 
				
			||||||
 | 
					        db.Missions = client.Missions;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (client.FlavourItems !== undefined) {
 | 
				
			||||||
 | 
					        db.FlavourItems.splice(0, db.FlavourItems.length);
 | 
				
			||||||
 | 
					        client.FlavourItems.forEach(x => {
 | 
				
			||||||
 | 
					            db.FlavourItems.push({
 | 
				
			||||||
 | 
					                ItemType: x.ItemType
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const convertLoadOutConfig = (client: ILoadoutConfigClient): ILoadoutConfigDatabase => {
 | 
					const convertLoadOutConfig = (client: ILoadoutConfigClient): ILoadoutConfigDatabase => {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user