feat(import): additional fields (#1305)
Reviewed-on: OpenWF/SpaceNinjaServer#1305 Reviewed-by: Sainan <sainan@calamity.inc> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									a77c1906bf
								
							
						
					
					
						commit
						0085c20e11
					
				@ -76,7 +76,6 @@ import {
 | 
				
			|||||||
    IIncentiveState,
 | 
					    IIncentiveState,
 | 
				
			||||||
    ISongChallenge,
 | 
					    ISongChallenge,
 | 
				
			||||||
    ILibraryPersonalProgress,
 | 
					    ILibraryPersonalProgress,
 | 
				
			||||||
    ICrewShipWeaponDatabase,
 | 
					 | 
				
			||||||
    IRecentVendorPurchaseDatabase,
 | 
					    IRecentVendorPurchaseDatabase,
 | 
				
			||||||
    IVendorPurchaseHistoryEntryDatabase,
 | 
					    IVendorPurchaseHistoryEntryDatabase,
 | 
				
			||||||
    IVendorPurchaseHistoryEntryClient,
 | 
					    IVendorPurchaseHistoryEntryClient,
 | 
				
			||||||
@ -1118,25 +1117,6 @@ const alignmentSchema = new Schema<IAlignment>(
 | 
				
			|||||||
    { _id: false }
 | 
					    { _id: false }
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const crewShipWeaponSchema2 = new Schema<ICrewShipWeaponDatabase>(
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        ItemType: String
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    { id: false }
 | 
					 | 
				
			||||||
);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
crewShipWeaponSchema2.virtual("ItemId").get(function () {
 | 
					 | 
				
			||||||
    return { $oid: this._id.toString() } satisfies IOid;
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
crewShipWeaponSchema2.set("toJSON", {
 | 
					 | 
				
			||||||
    virtuals: true,
 | 
					 | 
				
			||||||
    transform(_document, returnedObject) {
 | 
					 | 
				
			||||||
        delete returnedObject._id;
 | 
					 | 
				
			||||||
        delete returnedObject.__v;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
 | 
					const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        accountOwnerId: Schema.Types.ObjectId,
 | 
					        accountOwnerId: Schema.Types.ObjectId,
 | 
				
			||||||
@ -1259,20 +1239,20 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        //Default RailJack
 | 
					        //Default RailJack
 | 
				
			||||||
        CrewShipAmmo: [typeCountSchema],
 | 
					        CrewShipAmmo: [typeCountSchema],
 | 
				
			||||||
        CrewShipWeapons: [crewShipWeaponSchema2],
 | 
					        CrewShipWeapons: [EquipmentSchema],
 | 
				
			||||||
        CrewShipWeaponSkins: [upgradeSchema],
 | 
					        CrewShipWeaponSkins: [upgradeSchema],
 | 
				
			||||||
 | 
					        CrewShipSalvagedWeapons: [EquipmentSchema],
 | 
				
			||||||
 | 
					        CrewShipSalvagedWeaponSkins: [upgradeSchema],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //NPC Crew and weapon
 | 
					        //RailJack Crew
 | 
				
			||||||
        CrewMembers: [Schema.Types.Mixed],
 | 
					        CrewMembers: [Schema.Types.Mixed],
 | 
				
			||||||
        CrewShipSalvagedWeaponSkins: [Schema.Types.Mixed],
 | 
					 | 
				
			||||||
        CrewShipSalvagedWeapons: [Schema.Types.Mixed],
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //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 +1313,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],
 | 
				
			||||||
@ -1527,8 +1507,8 @@ export type InventoryDocumentProps = {
 | 
				
			|||||||
    WeaponSkins: Types.DocumentArray<IWeaponSkinDatabase>;
 | 
					    WeaponSkins: Types.DocumentArray<IWeaponSkinDatabase>;
 | 
				
			||||||
    QuestKeys: Types.DocumentArray<IQuestKeyDatabase>;
 | 
					    QuestKeys: Types.DocumentArray<IQuestKeyDatabase>;
 | 
				
			||||||
    Drones: Types.DocumentArray<IDroneDatabase>;
 | 
					    Drones: Types.DocumentArray<IDroneDatabase>;
 | 
				
			||||||
    CrewShipWeapons: Types.DocumentArray<ICrewShipWeaponDatabase>;
 | 
					 | 
				
			||||||
    CrewShipWeaponSkins: Types.DocumentArray<IUpgradeDatabase>;
 | 
					    CrewShipWeaponSkins: Types.DocumentArray<IUpgradeDatabase>;
 | 
				
			||||||
 | 
					    CrewShipSalvagedWeaponsSkins: Types.DocumentArray<IUpgradeDatabase>;
 | 
				
			||||||
} & { [K in TEquipmentKey]: Types.DocumentArray<IEquipmentDatabase> };
 | 
					} & { [K in TEquipmentKey]: Types.DocumentArray<IEquipmentDatabase> };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/ban-types
 | 
					// eslint-disable-next-line @typescript-eslint/ban-types
 | 
				
			||||||
 | 
				
			|||||||
@ -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 => {
 | 
				
			||||||
 | 
				
			|||||||
@ -25,8 +25,7 @@ import {
 | 
				
			|||||||
    ILibraryDailyTaskInfo,
 | 
					    ILibraryDailyTaskInfo,
 | 
				
			||||||
    ICalendarProgress,
 | 
					    ICalendarProgress,
 | 
				
			||||||
    IDroneClient,
 | 
					    IDroneClient,
 | 
				
			||||||
    IUpgradeClient,
 | 
					    IUpgradeClient
 | 
				
			||||||
    ICrewShipWeaponClient
 | 
					 | 
				
			||||||
} from "@/src/types/inventoryTypes/inventoryTypes";
 | 
					} from "@/src/types/inventoryTypes/inventoryTypes";
 | 
				
			||||||
import { IGenericUpdate, IUpdateNodeIntrosResponse } from "../types/genericUpdate";
 | 
					import { IGenericUpdate, IUpdateNodeIntrosResponse } from "../types/genericUpdate";
 | 
				
			||||||
import { IMissionInventoryUpdateRequest, IUpdateChallengeProgressRequest } from "../types/requestTypes";
 | 
					import { IMissionInventoryUpdateRequest, IUpdateChallengeProgressRequest } from "../types/requestTypes";
 | 
				
			||||||
@ -434,7 +433,7 @@ export const addItem = async (
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    if (typeName in ExportRailjackWeapons) {
 | 
					    if (typeName in ExportRailjackWeapons) {
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            ...addCrewShipWeapon(inventory, typeName),
 | 
					            ...addEquipment(inventory, ExportRailjackWeapons[typeName].productCategory, typeName),
 | 
				
			||||||
            ...occupySlot(inventory, InventorySlot.RJ_COMPONENT_AND_ARMAMENTS, premiumPurchase)
 | 
					            ...occupySlot(inventory, InventorySlot.RJ_COMPONENT_AND_ARMAMENTS, premiumPurchase)
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -947,20 +946,6 @@ export const addSkin = (
 | 
				
			|||||||
    return inventoryChanges;
 | 
					    return inventoryChanges;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const addCrewShipWeapon = (
 | 
					 | 
				
			||||||
    inventory: TInventoryDatabaseDocument,
 | 
					 | 
				
			||||||
    typeName: string,
 | 
					 | 
				
			||||||
    inventoryChanges: IInventoryChanges = {}
 | 
					 | 
				
			||||||
): IInventoryChanges => {
 | 
					 | 
				
			||||||
    const index = inventory.CrewShipWeapons.push({ ItemType: typeName, _id: new Types.ObjectId() }) - 1;
 | 
					 | 
				
			||||||
    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
					 | 
				
			||||||
    inventoryChanges.CrewShipWeapons ??= [];
 | 
					 | 
				
			||||||
    (inventoryChanges.CrewShipWeapons as ICrewShipWeaponClient[]).push(
 | 
					 | 
				
			||||||
        inventory.CrewShipWeapons[index].toJSON<ICrewShipWeaponClient>()
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
    return inventoryChanges;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const addCrewShipWeaponSkin = (
 | 
					const addCrewShipWeaponSkin = (
 | 
				
			||||||
    inventory: TInventoryDatabaseDocument,
 | 
					    inventory: TInventoryDatabaseDocument,
 | 
				
			||||||
    typeName: string,
 | 
					    typeName: string,
 | 
				
			||||||
 | 
				
			|||||||
@ -30,9 +30,8 @@ export interface IInventoryDatabase
 | 
				
			|||||||
            | "Ships"
 | 
					            | "Ships"
 | 
				
			||||||
            | "WeaponSkins"
 | 
					            | "WeaponSkins"
 | 
				
			||||||
            | "Upgrades"
 | 
					            | "Upgrades"
 | 
				
			||||||
            | "CrewShipSalvagedWeaponSkins"
 | 
					 | 
				
			||||||
            | "CrewShipWeapons"
 | 
					 | 
				
			||||||
            | "CrewShipWeaponSkins"
 | 
					            | "CrewShipWeaponSkins"
 | 
				
			||||||
 | 
					            | "CrewShipSalvagedWeaponSkins"
 | 
				
			||||||
            | "AdultOperatorLoadOuts"
 | 
					            | "AdultOperatorLoadOuts"
 | 
				
			||||||
            | "OperatorLoadOuts"
 | 
					            | "OperatorLoadOuts"
 | 
				
			||||||
            | "KahlLoadOuts"
 | 
					            | "KahlLoadOuts"
 | 
				
			||||||
@ -60,9 +59,8 @@ export interface IInventoryDatabase
 | 
				
			|||||||
    Ships: Types.ObjectId[];
 | 
					    Ships: Types.ObjectId[];
 | 
				
			||||||
    WeaponSkins: IWeaponSkinDatabase[];
 | 
					    WeaponSkins: IWeaponSkinDatabase[];
 | 
				
			||||||
    Upgrades: IUpgradeDatabase[];
 | 
					    Upgrades: IUpgradeDatabase[];
 | 
				
			||||||
    CrewShipSalvagedWeaponSkins: IUpgradeDatabase[];
 | 
					 | 
				
			||||||
    CrewShipWeapons: ICrewShipWeaponDatabase[];
 | 
					 | 
				
			||||||
    CrewShipWeaponSkins: IUpgradeDatabase[];
 | 
					    CrewShipWeaponSkins: IUpgradeDatabase[];
 | 
				
			||||||
 | 
					    CrewShipSalvagedWeaponSkins: IUpgradeDatabase[];
 | 
				
			||||||
    AdultOperatorLoadOuts: IOperatorConfigDatabase[];
 | 
					    AdultOperatorLoadOuts: IOperatorConfigDatabase[];
 | 
				
			||||||
    OperatorLoadOuts: IOperatorConfigDatabase[];
 | 
					    OperatorLoadOuts: IOperatorConfigDatabase[];
 | 
				
			||||||
    KahlLoadOuts: IOperatorConfigDatabase[];
 | 
					    KahlLoadOuts: IOperatorConfigDatabase[];
 | 
				
			||||||
@ -114,7 +112,9 @@ export const equipmentKeys = [
 | 
				
			|||||||
    "DataKnives",
 | 
					    "DataKnives",
 | 
				
			||||||
    "MechSuits",
 | 
					    "MechSuits",
 | 
				
			||||||
    "CrewShipHarnesses",
 | 
					    "CrewShipHarnesses",
 | 
				
			||||||
    "KubrowPets"
 | 
					    "KubrowPets",
 | 
				
			||||||
 | 
					    "CrewShipWeapons",
 | 
				
			||||||
 | 
					    "CrewShipSalvagedWeapons"
 | 
				
			||||||
] as const;
 | 
					] as const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type TEquipmentKey = (typeof equipmentKeys)[number];
 | 
					export type TEquipmentKey = (typeof equipmentKeys)[number];
 | 
				
			||||||
@ -299,10 +299,8 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
 | 
				
			|||||||
    PersonalTechProjects: IPersonalTechProject[];
 | 
					    PersonalTechProjects: IPersonalTechProject[];
 | 
				
			||||||
    PlayerSkills: IPlayerSkills;
 | 
					    PlayerSkills: IPlayerSkills;
 | 
				
			||||||
    CrewShipAmmo: ITypeCount[];
 | 
					    CrewShipAmmo: ITypeCount[];
 | 
				
			||||||
    CrewShipSalvagedWeaponSkins: IUpgradeClient[];
 | 
					 | 
				
			||||||
    CrewShipWeapons: ICrewShipWeaponClient[];
 | 
					 | 
				
			||||||
    CrewShipSalvagedWeapons: IEquipmentClient[];
 | 
					 | 
				
			||||||
    CrewShipWeaponSkins: IUpgradeClient[];
 | 
					    CrewShipWeaponSkins: IUpgradeClient[];
 | 
				
			||||||
 | 
					    CrewShipSalvagedWeaponSkins: IUpgradeClient[];
 | 
				
			||||||
    TradeBannedUntil?: IMongoDate;
 | 
					    TradeBannedUntil?: IMongoDate;
 | 
				
			||||||
    PlayedParkourTutorial: boolean;
 | 
					    PlayedParkourTutorial: boolean;
 | 
				
			||||||
    SubscribedToEmailsPersonalized: number;
 | 
					    SubscribedToEmailsPersonalized: number;
 | 
				
			||||||
@ -538,17 +536,6 @@ export interface ICrewShipWeapon {
 | 
				
			|||||||
    PORT_GUNS: ICrewShipPortGuns;
 | 
					    PORT_GUNS: ICrewShipPortGuns;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// inventory.CrewShipWeapons
 | 
					 | 
				
			||||||
export interface ICrewShipWeaponClient {
 | 
					 | 
				
			||||||
    ItemType: string;
 | 
					 | 
				
			||||||
    ItemId: IOid;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export interface ICrewShipWeaponDatabase {
 | 
					 | 
				
			||||||
    ItemType: string;
 | 
					 | 
				
			||||||
    _id: Types.ObjectId;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export interface ICrewShipPilotWeapon {
 | 
					export interface ICrewShipPilotWeapon {
 | 
				
			||||||
    PRIMARY_A: IEquipmentSelection;
 | 
					    PRIMARY_A: IEquipmentSelection;
 | 
				
			||||||
    SECONDARY_A: IEquipmentSelection;
 | 
					    SECONDARY_A: IEquipmentSelection;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user