chore: remove consumables, recipes, etc. from array when their ItemCount becomes 0 #1216
@ -8,7 +8,6 @@ import { HydratedDocument, Types } from "mongoose";
 | 
			
		||||
import { SlotNames, IInventoryChanges, IBinChanges, slotNames } from "@/src/types/purchaseTypes";
 | 
			
		||||
import {
 | 
			
		||||
    IChallengeProgress,
 | 
			
		||||
    IConsumable,
 | 
			
		||||
    IFlavourItem,
 | 
			
		||||
    IMiscItem,
 | 
			
		||||
    IMission,
 | 
			
		||||
@ -378,7 +377,7 @@ export const addItem = async (
 | 
			
		||||
            {
 | 
			
		||||
                ItemType: typeName,
 | 
			
		||||
                ItemCount: quantity
 | 
			
		||||
            } satisfies IConsumable
 | 
			
		||||
            } satisfies ITypeCount
 | 
			
		||||
        ];
 | 
			
		||||
        addConsumables(inventory, consumablesChanges);
 | 
			
		||||
        return {
 | 
			
		||||
@ -1102,7 +1101,7 @@ export const addMiscItems = (inventory: TInventoryDatabaseDocument, itemsArray:
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const addShipDecorations = (inventory: TInventoryDatabaseDocument, itemsArray: IConsumable[]): void => {
 | 
			
		||||
export const addShipDecorations = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[]): void => {
 | 
			
		||||
    const { ShipDecorations } = inventory;
 | 
			
		||||
 | 
			
		||||
    itemsArray.forEach(({ ItemCount, ItemType }) => {
 | 
			
		||||
@ -1116,7 +1115,7 @@ export const addShipDecorations = (inventory: TInventoryDatabaseDocument, itemsA
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const addConsumables = (inventory: TInventoryDatabaseDocument, itemsArray: IConsumable[]): void => {
 | 
			
		||||
export const addConsumables = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[]): void => {
 | 
			
		||||
    const { Consumables } = inventory;
 | 
			
		||||
 | 
			
		||||
    itemsArray.forEach(({ ItemCount, ItemType }) => {
 | 
			
		||||
 | 
			
		||||
@ -236,8 +236,8 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
 | 
			
		||||
    FusionTreasures: IFusionTreasure[];
 | 
			
		||||
    WebFlags: IWebFlags;
 | 
			
		||||
    CompletedAlerts: string[];
 | 
			
		||||
    Consumables: IConsumable[];
 | 
			
		||||
    LevelKeys: IConsumable[];
 | 
			
		||||
    Consumables: ITypeCount[];
 | 
			
		||||
    LevelKeys: ITypeCount[];
 | 
			
		||||
    TauntHistory?: ITaunt[];
 | 
			
		||||
    StoryModeChoice: string;
 | 
			
		||||
    PeriodicMissionCompletions: IPeriodicMissionCompletionDatabase[];
 | 
			
		||||
@ -265,7 +265,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
 | 
			
		||||
    Drones: IDroneClient[];
 | 
			
		||||
    StepSequencers: IStepSequencer[];
 | 
			
		||||
    ActiveAvatarImageType: string;
 | 
			
		||||
    ShipDecorations: IConsumable[];
 | 
			
		||||
    ShipDecorations: ITypeCount[];
 | 
			
		||||
    DiscoveredMarkers: IDiscoveredMarker[];
 | 
			
		||||
    CompletedJobs: ICompletedJob[];
 | 
			
		||||
    FocusAbility?: string;
 | 
			
		||||
@ -293,7 +293,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
 | 
			
		||||
    Settings: ISettings;
 | 
			
		||||
    PersonalTechProjects: IPersonalTechProject[];
 | 
			
		||||
    PlayerSkills: IPlayerSkills;
 | 
			
		||||
    CrewShipAmmo: IConsumable[];
 | 
			
		||||
    CrewShipAmmo: ITypeCount[];
 | 
			
		||||
    CrewShipSalvagedWeaponSkins: IUpgradeClient[];
 | 
			
		||||
    CrewShipWeapons: ICrewShipWeaponClient[];
 | 
			
		||||
    CrewShipSalvagedWeapons: IEquipmentClient[];
 | 
			
		||||
@ -303,7 +303,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
 | 
			
		||||
    SubscribedToEmailsPersonalized: number;
 | 
			
		||||
    InfestedFoundry?: IInfestedFoundryClient;
 | 
			
		||||
    BlessingCooldown?: IMongoDate;
 | 
			
		||||
    CrewShipRawSalvage: IConsumable[];
 | 
			
		||||
    CrewShipRawSalvage: ITypeCount[];
 | 
			
		||||
    CrewMembers: ICrewMember[];
 | 
			
		||||
    LotusCustomization: ILotusCustomization;
 | 
			
		||||
    UseAdultOperatorLoadout?: boolean;
 | 
			
		||||
@ -417,11 +417,6 @@ export interface ICompletedJob {
 | 
			
		||||
    StageCompletions: number[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IConsumable {
 | 
			
		||||
    ItemCount: number;
 | 
			
		||||
    ItemType: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ICrewMember {
 | 
			
		||||
    ItemType: string;
 | 
			
		||||
    NemesisFingerprint: number;
 | 
			
		||||
@ -891,7 +886,7 @@ export enum GettingSlotOrderInfo {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IGiving {
 | 
			
		||||
    RawUpgrades: IConsumable[];
 | 
			
		||||
    RawUpgrades: ITypeCount[];
 | 
			
		||||
    _SlotOrderInfo: GivingSlotOrderInfo[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -924,7 +919,7 @@ export interface IPersonalTechProject {
 | 
			
		||||
    State: number;
 | 
			
		||||
    ReqCredits: number;
 | 
			
		||||
    ItemType: string;
 | 
			
		||||
    ReqItems: IConsumable[];
 | 
			
		||||
    ReqItems: ITypeCount[];
 | 
			
		||||
    CompletionDate?: IMongoDate;
 | 
			
		||||
    ItemId: IOid;
 | 
			
		||||
    ProductCategory?: string;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user