diff --git a/src/controllers/api/upgradesController.ts b/src/controllers/api/upgradesController.ts index b0545632..88c01dc7 100644 --- a/src/controllers/api/upgradesController.ts +++ b/src/controllers/api/upgradesController.ts @@ -1,7 +1,7 @@ import { RequestHandler } from "express"; import { IUpgradesRequest } from "@/src/types/requestTypes"; -import { FocusSchool } from "@/src/types/inventoryTypes/commonInventoryTypes"; -import { IGenericItemDatabase, IMiscItem, TGenericItemKey } from "@/src/types/inventoryTypes/inventoryTypes"; +import { FocusSchool, IEquipmentDatabase } from "@/src/types/inventoryTypes/commonInventoryTypes"; +import { IMiscItem, IEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService"; @@ -28,7 +28,7 @@ export const upgradesController: RequestHandler = async (req, res) => { switch (operation.UpgradeRequirement) { case "/Lotus/Types/Items/MiscItems/OrokinReactor": case "/Lotus/Types/Items/MiscItems/OrokinCatalyst": - for (const item of inventory[payload.ItemCategory as TGenericItemKey] as IGenericItemDatabase[]) { + for (const item of inventory[payload.ItemCategory as IEquipmentKey] as IEquipmentDatabase[]) { if (item._id.toString() == payload.ItemId.$oid) { item.Features ??= 0; item.Features |= 1; @@ -38,7 +38,7 @@ export const upgradesController: RequestHandler = async (req, res) => { break; case "/Lotus/Types/Items/MiscItems/UtilityUnlocker": case "/Lotus/Types/Items/MiscItems/WeaponUtilityUnlocker": - for (const item of inventory[payload.ItemCategory as TGenericItemKey] as IGenericItemDatabase[]) { + for (const item of inventory[payload.ItemCategory as IEquipmentKey] as IEquipmentDatabase[]) { if (item._id.toString() == payload.ItemId.$oid) { item.Features ??= 0; item.Features |= 2; @@ -49,7 +49,7 @@ export const upgradesController: RequestHandler = async (req, res) => { case "/Lotus/Types/Items/MiscItems/WeaponPrimaryArcaneUnlocker": case "/Lotus/Types/Items/MiscItems/WeaponSecondaryArcaneUnlocker": case "/Lotus/Types/Items/MiscItems/WeaponMeleeArcaneUnlocker": - for (const item of inventory[payload.ItemCategory as TGenericItemKey] as IGenericItemDatabase[]) { + for (const item of inventory[payload.ItemCategory as IEquipmentKey] as IEquipmentDatabase[]) { if (item._id.toString() == payload.ItemId.$oid) { item.Features ??= 0; item.Features |= 32; @@ -61,7 +61,7 @@ export const upgradesController: RequestHandler = async (req, res) => { case "/Lotus/Types/Items/MiscItems/FormaUmbra": case "/Lotus/Types/Items/MiscItems/FormaAura": case "/Lotus/Types/Items/MiscItems/FormaStance": - for (const item of inventory[payload.ItemCategory as TGenericItemKey] as IGenericItemDatabase[]) { + for (const item of inventory[payload.ItemCategory as IEquipmentKey] as IEquipmentDatabase[]) { if (item._id.toString() == payload.ItemId.$oid) { item.XP = 0; setSlotPolarity(item, operation.PolarizeSlot, operation.PolarizeValue); @@ -72,7 +72,7 @@ export const upgradesController: RequestHandler = async (req, res) => { } break; case "/Lotus/Types/Items/MiscItems/ModSlotUnlocker": - for (const item of inventory[payload.ItemCategory as TGenericItemKey] as IGenericItemDatabase[]) { + for (const item of inventory[payload.ItemCategory as IEquipmentKey] as IEquipmentDatabase[]) { if (item._id.toString() == payload.ItemId.$oid) { item.ModSlotPurchases ??= 0; item.ModSlotPurchases += 1; @@ -87,7 +87,7 @@ export const upgradesController: RequestHandler = async (req, res) => { } break; case "/Lotus/Types/Items/MiscItems/CustomizationSlotUnlocker": - for (const item of inventory[payload.ItemCategory as TGenericItemKey] as IGenericItemDatabase[]) { + for (const item of inventory[payload.ItemCategory as IEquipmentKey] as IEquipmentDatabase[]) { if (item._id.toString() == payload.ItemId.$oid) { item.CustomizationSlotPurchases ??= 0; item.CustomizationSlotPurchases += 1; @@ -103,7 +103,7 @@ export const upgradesController: RequestHandler = async (req, res) => { break; case "": console.assert(operation.OperationType == "UOT_SWAP_POLARITY"); - for (const item of inventory[payload.ItemCategory as TGenericItemKey] as IGenericItemDatabase[]) { + for (const item of inventory[payload.ItemCategory as IEquipmentKey] as IEquipmentDatabase[]) { if (item._id.toString() == payload.ItemId.$oid) { for (let i = 0; i != operation.PolarityRemap.length; ++i) { if (operation.PolarityRemap[i].Slot != i) { @@ -122,7 +122,7 @@ export const upgradesController: RequestHandler = async (req, res) => { res.json({ InventoryChanges }); }; -const setSlotPolarity = (item: IGenericItemDatabase, slot: number, polarity: FocusSchool): void => { +const setSlotPolarity = (item: IEquipmentDatabase, slot: number, polarity: FocusSchool): void => { item.Polarity ??= []; const entry = item.Polarity.find(entry => entry.Slot == slot); if (entry) { diff --git a/src/models/inventoryModels/inventoryModel.ts b/src/models/inventoryModels/inventoryModel.ts index 679216b7..dc91ddb7 100644 --- a/src/models/inventoryModels/inventoryModel.ts +++ b/src/models/inventoryModels/inventoryModel.ts @@ -8,7 +8,6 @@ import { IBooster, IInventoryResponse, ISlots, - IGenericItem, IMailbox, IDuviriInfo, IPendingRecipe as IPendingRecipeDatabase, @@ -16,14 +15,13 @@ import { ITypeCount, IFocusXP, IFocusUpgrades, - IGenericItem2, ITypeXPItem, IChallengeProgress, IStepSequencer, IAffiliation, INotePacks, ICompletedJobChain, - ISeasonChallengeHistory, + ISeasonChallenge, IPlayerSkills, ISettings, IInfestedFoundry, @@ -40,15 +38,14 @@ import { ILoreFragmentScan } from "../../types/inventoryTypes/inventoryTypes"; import { IOid } from "../../types/commonTypes"; -import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes"; -import { IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes"; import { IAbilityOverride, IColor, IItemConfig, - IOperatorConfigClient, IOperatorConfigDatabase, - IPolarity + IPolarity, + IEquipmentDatabase, + IOperatorConfigClient } from "@/src/types/inventoryTypes/commonInventoryTypes"; import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers"; @@ -185,33 +182,35 @@ ItemConfigSchema.set("toJSON", { } }); -//TODO: migrate to one schema for weapons and suits.. and possibly others -const WeaponSchema = new Schema( - { - ItemType: String, - Configs: [ItemConfigSchema], - UpgradeVer: Number, - XP: Number, - Features: Number, - Polarized: Number, - Polarity: [polaritySchema], - FocusLens: String, - ModSlotPurchases: Number, - CustomizationSlotPurchases: Number, - UpgradeType: Schema.Types.Mixed, //todo - UpgradeFingerprint: String, - ItemName: String, - ModularParts: [String], - UnlockLevel: Number - }, - { id: false } -); +const EquipmentSchema = new Schema({ + ItemType: String, + Configs: [ItemConfigSchema], + UpgradeVer: Number, + XP: Number, + Features: Number, + Polarized: Number, + Polarity: [polaritySchema], + FocusLens: String, + ModSlotPurchases: Number, + CustomizationSlotPurchases: Number, + UpgradeType: Schema.Types.Mixed, //todo + UpgradeFingerprint: String, + ItemName: String, + InfestationDate: Date, + InfestationDays: Number, + InfestationType: String, + ModularParts: [String], + UnlockLevel: Number, + Expiry: Date, + SkillTree: String, + ArchonCrystalUpgrades: [Schema.Types.Mixed] //TODO +}); -WeaponSchema.virtual("ItemId").get(function () { +EquipmentSchema.virtual("ItemId").get(function () { return { $oid: this._id.toString() } satisfies IOid; }); -WeaponSchema.set("toJSON", { +EquipmentSchema.set("toJSON", { virtuals: true, transform(_document, returnedObject) { delete returnedObject._id; @@ -248,7 +247,7 @@ RawUpgrades.set("toJSON", { }); //TODO: find out what this is -const upgrqadesSchema = new Schema( +const upgradesSchema = new Schema( { UpgradeFingerprint: String, ItemType: String @@ -256,42 +255,11 @@ const upgrqadesSchema = new Schema( { id: false } ); -upgrqadesSchema.virtual("ItemId").get(function () { +upgradesSchema.virtual("ItemId").get(function () { return toOid(this._id); }); -upgrqadesSchema.set("toJSON", { - virtuals: true, - transform(_document, returnedObject) { - delete returnedObject._id; - delete returnedObject.__v; - } -}); - -//TODO: reduce weapon and suit schemas to one schema if reasonable -const suitSchema = new Schema( - { - ItemType: String, - Configs: [ItemConfigSchema], - UpgradeVer: Number, - XP: Number, - InfestationDate: Date, - Features: Number, - Polarity: [polaritySchema], - Polarized: Number, - ModSlotPurchases: Number, - CustomizationSlotPurchases: Number, - FocusLens: String, - UnlockLevel: Number - }, - { id: false } -); - -suitSchema.virtual("ItemId").get(function () { - return { $oid: this._id.toString() } satisfies IOid; -}); - -suitSchema.set("toJSON", { +upgradesSchema.set("toJSON", { virtuals: true, transform(_document, returnedObject) { delete returnedObject._id; @@ -321,33 +289,6 @@ FlavourItemSchema.set("toJSON", { } }); -const GenericItemSchema = new Schema( - { - ItemType: String, - Configs: [ItemConfigSchema], - UpgradeVer: Number, - XP: Number, - Features: Number, - Polarity: [polaritySchema], - Polarized: Number, - ModSlotPurchases: Number, - CustomizationSlotPurchases: Number - }, - { id: false } -); - -GenericItemSchema.virtual("ItemId").get(function () { - return { $oid: this._id.toString() } satisfies IOid; -}); - -GenericItemSchema.set("toJSON", { - virtuals: true, - transform(_document, returnedObject) { - delete returnedObject._id; - delete returnedObject.__v; - } -}); - // "Mailbox": { "LastInboxId": { "$oid": "123456780000000000000000" } } const MailboxSchema = new Schema( { @@ -384,30 +325,6 @@ DuviriInfoSchema.set("toJSON", { } }); -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const GenericItemSchema2 = new Schema({ - ItemType: String, - ItemName: String, - XP: Number, - UpgradeVer: Number, //this is probably __v - Features: Number, - Polarized: Number, - CustomizationSlotPurchases: Number, - ModSlotPurchases: Number, - FocusLens: String, - Expiry: Date, //TODO: needs conversion - Polarity: [polaritySchema], - Configs: [ItemConfigSchema], - ModularParts: [String], - SkillTree: String, - UpgradeType: String, - UpgradeFingerprint: String, - OffensiveUpgrade: String, - DefensiveUpgrade: String, - UpgradesExpiry: Date, //TODO: needs conversion - ArchonCrystalUpgrades: [] -}); - const TypeXPItemSchema = new Schema( { ItemType: String, @@ -475,7 +392,7 @@ const completedJobChainsSchema = new Schema( { _id: false } ); -const seasonChallengeHistorySchema = new Schema( +const seasonChallengeHistorySchema = new Schema( { challenge: String, id: String @@ -696,31 +613,31 @@ const inventorySchema = new Schema( //Non Upgrade Mods Example:I have 999 item WeaponElectricityDamageMod (only "ItemCount"+"ItemType") RawUpgrades: [RawUpgrades], //Upgrade Mods\Riven\Arcane Example:"UpgradeFingerprint"+"ItemType"+"" - Upgrades: [upgrqadesSchema], + Upgrades: [upgradesSchema], //Warframe - Suits: [suitSchema], + Suits: [EquipmentSchema], //Primary Weapon - LongGuns: [WeaponSchema], + LongGuns: [EquipmentSchema], //Secondary Weapon - Pistols: [WeaponSchema], + Pistols: [EquipmentSchema], //Melee Weapon - Melee: [WeaponSchema], + Melee: [EquipmentSchema], //Ability Weapon like Ultimate Mech\Excalibur\Ivara etc - SpecialItems: [GenericItemSchema], + SpecialItems: [EquipmentSchema], //The Mandachord(Octavia) is a step sequencer StepSequencers: [StepSequencersSchema], //Sentinel(like Helios or modular) - Sentinels: [Schema.Types.Mixed], + Sentinels: [EquipmentSchema], //Any /Sentinels/SentinelWeapons/ (like warframe weapon) - SentinelWeapons: [Schema.Types.Mixed], + SentinelWeapons: [EquipmentSchema], //Modular Pets - MoaPets: [Schema.Types.Mixed], + MoaPets: [EquipmentSchema], KubrowPetEggs: [Schema.Types.Mixed], //Like PowerSuit Cat\Kubrow or etc Pets - KubrowPets: [Schema.Types.Mixed], + KubrowPets: [EquipmentSchema], //Prints Cat(3 Prints)\Kubrow(2 Prints) Pets KubrowPetPrints: [Schema.Types.Mixed], @@ -735,27 +652,27 @@ const inventorySchema = new Schema( //to use add SummonItem to Consumables+EquippedGear //Archwing need Suits+Melee+Guns - SpaceSuits: [GenericItemSchema], - SpaceMelee: [GenericItemSchema], - SpaceGuns: [Schema.Types.Mixed], + SpaceSuits: [EquipmentSchema], + SpaceMelee: [EquipmentSchema], + SpaceGuns: [EquipmentSchema], ArchwingEnabled: Boolean, //Mech need Suits+SpaceGuns+SpecialItem - MechSuits: [suitSchema], + MechSuits: [EquipmentSchema], ///Restoratives/HoverboardSummon (like Suit) - Hoverboards: [Schema.Types.Mixed], + Hoverboards: [EquipmentSchema], //Use Operator\Drifter UseAdultOperatorLoadout: Boolean, //Operator\Drifter Weapon - OperatorAmps: [Schema.Types.Mixed], + OperatorAmps: [EquipmentSchema], //Operator OperatorLoadOuts: [operatorConfigSchema], //Drifter AdultOperatorLoadOuts: [operatorConfigSchema], - DrifterMelee: [GenericItemSchema], - DrifterGuns: [GenericItemSchema], + DrifterMelee: [EquipmentSchema], + DrifterGuns: [EquipmentSchema], //ErsatzHorsePowerSuit - Horses: [GenericItemSchema], + Horses: [EquipmentSchema], //LandingCraft like Liset Ships: { type: [Schema.Types.ObjectId], ref: "Ships" }, @@ -763,7 +680,7 @@ const inventorySchema = new Schema( ShipDecorations: [typeCountSchema], //RailJack Setting(Mods,Skin,Weapon,etc) - CrewShipHarnesses: [Schema.Types.Mixed], + CrewShipHarnesses: [EquipmentSchema], //Railjack/Components(https://warframe.fandom.com/wiki/Railjack/Components) CrewShipRawSalvage: [Schema.Types.Mixed], @@ -790,7 +707,7 @@ const inventorySchema = new Schema( FlavourItems: [FlavourItemSchema], //Lunaro Weapon - Scoops: [GenericItemSchema], + Scoops: [EquipmentSchema], //Mastery Rank*(Need item XPInfo to rank up) PlayerLevel: Number, @@ -907,7 +824,7 @@ const inventorySchema = new Schema( InvasionChainProgress: [Schema.Types.Mixed], //https://warframe.fandom.com/wiki/Parazon - DataKnives: [GenericItemSchema], + DataKnives: [EquipmentSchema], //CorpusLich or GrineerLich NemesisAbandonedRewards: [String], @@ -1000,24 +917,24 @@ inventorySchema.set("toJSON", { // type overwrites for subdocuments/subdocument arrays type InventoryDocumentProps = { - Suits: Types.DocumentArray; - LongGuns: Types.DocumentArray; - Pistols: Types.DocumentArray; - Melee: Types.DocumentArray; + Suits: Types.DocumentArray; + LongGuns: Types.DocumentArray; + Pistols: Types.DocumentArray; + Melee: Types.DocumentArray; FlavourItems: Types.DocumentArray; RawUpgrades: Types.DocumentArray; Upgrades: Types.DocumentArray; MiscItems: Types.DocumentArray; Boosters: Types.DocumentArray; OperatorLoadOuts: Types.DocumentArray; - SpecialItems: Types.DocumentArray; + SpecialItems: Types.DocumentArray; AdultOperatorLoadOuts: Types.DocumentArray; //TODO: this should still contain _id - MechSuits: Types.DocumentArray; - Scoops: Types.DocumentArray; - DataKnives: Types.DocumentArray; - DrifterMelee: Types.DocumentArray; - Sentinels: Types.DocumentArray; - Horses: Types.DocumentArray; + MechSuits: Types.DocumentArray; + Scoops: Types.DocumentArray; + DataKnives: Types.DocumentArray; + DrifterMelee: Types.DocumentArray; + Sentinels: Types.DocumentArray; + Horses: Types.DocumentArray; PendingRecipes: Types.DocumentArray; }; diff --git a/src/models/inventoryModels/loadoutModel.ts b/src/models/inventoryModels/loadoutModel.ts index 7bd2aaa1..a0cd68e1 100644 --- a/src/models/inventoryModels/loadoutModel.ts +++ b/src/models/inventoryModels/loadoutModel.ts @@ -1,5 +1,6 @@ import { IOid } from "@/src/types/commonTypes"; -import { ILoadoutConfigDatabase, ILoadoutDatabase, IEquipmentSelection } from "@/src/types/saveLoadoutTypes"; +import { IEquipmentSelection } from "@/src/types/inventoryTypes/commonInventoryTypes"; +import { ILoadoutConfigDatabase, ILoadoutDatabase } from "@/src/types/saveLoadoutTypes"; import { Model, Schema, Types, model } from "mongoose"; const oidSchema = new Schema( diff --git a/src/services/inventoryService.ts b/src/services/inventoryService.ts index e5f82b97..b06dcd14 100644 --- a/src/services/inventoryService.ts +++ b/src/services/inventoryService.ts @@ -2,9 +2,7 @@ import { Inventory } from "@/src/models/inventoryModels/inventoryModel"; import new_inventory from "@/static/fixed_responses/postTutorialInventory.json"; import { config } from "@/src/services/configService"; import { Types } from "mongoose"; -import { ISuitClient } from "@/src/types/inventoryTypes/SuitTypes"; import { SlotNames } from "@/src/types/purchaseTypes"; -import { IWeaponClient } from "@/src/types/inventoryTypes/weaponTypes"; import { IChallengeProgress, IConsumable, @@ -13,7 +11,7 @@ import { IMiscItem, IMission, IRawUpgrade, - ISeasonChallengeHistory, + ISeasonChallenge, ITypeCount, InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes"; @@ -27,6 +25,7 @@ import { import { logger } from "@/src/utils/logger"; import { WeaponTypeInternal, getWeaponType, getExalted } from "@/src/services/itemDataService"; import { ISyndicateSacrifice, ISyndicateSacrificeResponse } from "../types/syndicateTypes"; +import { IEquipmentClient } from "../types/inventoryTypes/commonInventoryTypes"; export const createInventory = async ( accountOwnerId: Types.ObjectId, @@ -237,7 +236,7 @@ export const addSentinel = async (sentinelName: string, accountId: string) => { return changedInventory.Sentinels[sentinelIndex - 1].toJSON(); }; -export const addPowerSuit = async (powersuitName: string, accountId: string): Promise => { +export const addPowerSuit = async (powersuitName: string, accountId: string): Promise => { const specialItems = getExalted(powersuitName); if (specialItems != false) { for await (const specialItem of specialItems) { @@ -386,7 +385,7 @@ export const addWeapon = async ( weaponType: WeaponTypeInternal, weaponName: string, accountId: string -): Promise => { +): Promise => { const inventory = await getInventory(accountId); let weaponIndex; @@ -418,7 +417,7 @@ export const addCustomization = async (customizatonName: string, accountId: stri const addGearExpByCategory = ( inventory: IInventoryDatabaseDocument, - gearArray: ISuitClient[] | IWeaponClient[] | undefined, + gearArray: IEquipmentClient[] | undefined, categoryName: "Pistols" | "LongGuns" | "Melee" | "Suits" ) => { const category = inventory[categoryName]; @@ -534,7 +533,7 @@ export const updateChallengeProgress = async (challenges: IUpdateChallengeProgre export const addSeasonalChallengeHistory = ( inventory: IInventoryDatabaseDocument, - itemsArray: ISeasonChallengeHistory[] | undefined + itemsArray: ISeasonChallenge[] | undefined ) => { const category = inventory.SeasonChallengeHistory; diff --git a/src/types/inventoryTypes/SuitTypes.ts b/src/types/inventoryTypes/SuitTypes.ts deleted file mode 100644 index 8fe48081..00000000 --- a/src/types/inventoryTypes/SuitTypes.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { IOid } from "@/src/types/commonTypes"; -import { IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; -import { Types } from "mongoose"; -import { IItemConfig } from "./commonInventoryTypes"; - -export interface ISuitClient extends Omit { - ItemId: IOid; -} - -export interface ISuitDatabase { - ItemType: string; - Configs: IItemConfig[]; - UpgradeVer?: number; - XP?: number; - InfestationDate?: Date; - Features?: number; - Polarity?: IPolarity[]; - Polarized?: number; - ModSlotPurchases?: number; - CustomizationSlotPurchases?: number; - FocusLens?: string; - UnlockLevel?: number; - _id: Types.ObjectId; - ItemId?: IOid; // only in response -} diff --git a/src/types/inventoryTypes/commonInventoryTypes.ts b/src/types/inventoryTypes/commonInventoryTypes.ts index b86cb719..8596c6e4 100644 --- a/src/types/inventoryTypes/commonInventoryTypes.ts +++ b/src/types/inventoryTypes/commonInventoryTypes.ts @@ -1,4 +1,4 @@ -import { IOid } from "@/src/types/commonTypes"; +import { IMongoDate, IOid } from "@/src/types/commonTypes"; import { Types } from "mongoose"; export interface IPolarity { @@ -38,15 +38,8 @@ export interface ISlotsBin { Slots: number; } -// ISigCol? IsIgCoL? ISIGCOL! -export interface Isigcol { - t0: number; - t1: number; - en: number; -} - -interface IItemConfigBase { - Skins: string[]; +export interface IItemConfig { + Skins?: string[]; pricol?: IColor; attcol?: IColor; sigcol?: IColor; @@ -56,12 +49,7 @@ interface IItemConfigBase { cloth?: IColor; Upgrades?: string[]; Name?: string; - ugly?: boolean; -} - -//TODO: Proper names for the different config types, this should be something like -//IItemConfigPlayable -export interface IItemConfig extends IItemConfigBase { + OperatorAmp?: IOid; Songs?: ISong[]; AbilityOverride?: IAbilityOverride; PvpUpgrades?: string[]; @@ -74,14 +62,47 @@ export interface ISong { p?: string; s: string; } - -//TODO: Consider renaming it to loadout instead of config -export interface IOperatorConfigDatabase extends IItemConfigBase { +export interface IOperatorConfigDatabase extends IItemConfig { _id: Types.ObjectId; - AbilityOverride?: IAbilityOverride; // not present in adultOperator - OperatorAmp?: IOid; // not present in adultOperator } export interface IOperatorConfigClient extends Omit { ItemId: IOid; } + +export interface IEquipmentSelection { + ItemId: IOid; + mod?: number; + cus?: number; + ItemType?: string; + hide?: boolean; +} + +export interface IEquipmentClient extends Omit { + ItemId: IOid; +} + +export interface IEquipmentDatabase { + ItemType: string; + ItemName?: string; + Configs: IItemConfig[]; + UpgradeVer?: number; + XP?: number; + Features?: number; + Polarized?: number; + Polarity?: IPolarity[]; + FocusLens?: string; + ModSlotPurchases?: number; + CustomizationSlotPurchases?: number; + UpgradeType?: string; + UpgradeFingerprint?: string; + InfestationDate?: IMongoDate; + InfestationDays?: number; + InfestationType?: string; + ModularParts?: string[]; + UnlockLevel?: number; + Expiry?: IMongoDate; + SkillTree?: string; + ArchonCrystalUpgrades?: []; //TODO + _id: Types.ObjectId; +} diff --git a/src/types/inventoryTypes/inventoryTypes.ts b/src/types/inventoryTypes/inventoryTypes.ts index 3bc903cd..4b4f589a 100644 --- a/src/types/inventoryTypes/inventoryTypes.ts +++ b/src/types/inventoryTypes/inventoryTypes.ts @@ -2,15 +2,13 @@ import { Document, Types } from "mongoose"; import { IOid, IMongoDate } from "../commonTypes"; import { - IAbilityOverride, IColor, FocusSchool, - IPolarity, IItemConfig, - IOperatorConfigClient + IOperatorConfigClient, + IEquipmentSelection, + IEquipmentDatabase } from "@/src/types/inventoryTypes/commonInventoryTypes"; -import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes"; -import { IOperatorLoadOutSigcol, IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes"; //Document extends will be deleted soon. TODO: delete and migrate uses to ... export interface IInventoryDatabaseDocument extends IInventoryDatabase, Document {} @@ -61,48 +59,14 @@ export interface ITypeCount { ItemCount: number; } -export interface IGenericItem2 { - ItemType: string; - ItemName: string; - ItemId: IOid; - XP: number; - UpgradeVer: number; - Features: number; - Polarized: number; - CustomizationSlotPurchases: number; - ModSlotPurchases: number; - FocusLens: string; - Expiry: IMongoDate; - Polarity: IPolarity[]; - Configs: IItemConfig[]; - ModularParts: string[]; - SkillTree: string; - UpgradeType: string; - UpgradeFingerprint: string; - OffensiveUpgrade: string; - DefensiveUpgrade: string; - UpgradesExpiry: IMongoDate; - ArchonCrystalUpgrades: []; -} - -export interface IGenericItem { - ItemType: string; - XP?: number; - Configs: IItemConfig[]; - UpgradeVer: number; - ItemId: IOid; - Features?: number; - Polarity?: IPolarity[]; - Polarized?: number; - ModSlotPurchases?: number; - CustomizationSlotPurchases?: number; -} - -export interface IGenericItemDatabase extends Omit { - _id: Types.ObjectId; -} - -export type TGenericItemKey = "Suits" | "LongGuns" | "Pistols" | "Melee"; +export type IEquipmentKey = + | "Suits" + | "LongGuns" + | "Pistols" + | "Melee" + | "SpecialItems" + | "Sentinels" + | "SentinelWeapons"; export interface IDuviriInfo { Seed: number; @@ -119,12 +83,12 @@ export interface IPendingRecipeResponse extends Omit; Missions: IMission[]; - RandomUpgradesIdentified: number; + RandomUpgradesIdentified?: number; LastRegionPlayed: string; XPInfo: ITypeXPItem[]; Recipes: ITypeCount[]; @@ -198,14 +162,14 @@ export interface IInventoryResponse { Affiliations: IAffiliation[]; QualifyingInvasions: any[]; FactionScores: number[]; - SpaceSuits: IGenericItem[]; - SpaceMelee: IGenericItem[]; - SpaceGuns: ISpaceGun[]; + SpaceSuits: IEquipmentDatabase[]; + SpaceMelee: IEquipmentDatabase[]; + SpaceGuns: IEquipmentDatabase[]; ArchwingEnabled: boolean; PendingSpectreLoadouts: any[]; SpectreLoadouts: ISpectreLoadout[]; - SentinelWeapons: IWeaponDatabase[]; - Sentinels: IWeaponDatabase[]; + SentinelWeapons: IEquipmentDatabase[]; + Sentinels: IEquipmentDatabase[]; EmailItems: ITypeXPItem[]; CompletedSyndicates: string[]; FocusXP: IFocusXP; @@ -216,7 +180,7 @@ export interface IInventoryResponse { Drones: IDrone[]; StepSequencers: IStepSequencer[]; ActiveAvatarImageType: string; - KubrowPets: IKubrowPet[]; + KubrowPets: IEquipmentDatabase[]; ShipDecorations: IConsumable[]; DailyAffiliationCetus: number; DailyAffiliationQuills: number; @@ -224,14 +188,14 @@ export interface IInventoryResponse { CompletedJobs: ICompletedJob[]; FocusAbility: string; FocusUpgrades: IFocusUpgrade[]; - OperatorAmps: IOperatorAmp[]; - HasContributedToDojo: boolean; + OperatorAmps: IEquipmentDatabase[]; + HasContributedToDojo?: boolean; HWIDProtectEnabled: boolean; KubrowPetPrints: IKubrowPetPrint[]; AlignmentReplay: IAlignment; PersonalGoalProgress: IPersonalGoalProgress[]; DailyAffiliationSolaris: number; - SpecialItems: IGenericItem[]; + SpecialItems: IEquipmentDatabase[]; ThemeStyle: string; ThemeBackground: string; ThemeSounds: string; @@ -242,17 +206,17 @@ export interface IInventoryResponse { DailyAffiliationVentkids: number; DailyAffiliationVox: number; RecentVendorPurchases: Array; - Hoverboards: IHoverboard[]; + Hoverboards: IEquipmentDatabase[]; NodeIntrosCompleted: string[]; GuildId?: IOid; CompletedJobChains: ICompletedJobChain[]; - SeasonChallengeHistory: ISeasonChallengeHistory[]; - MoaPets: IMoaPet[]; + SeasonChallengeHistory: ISeasonChallenge[]; + MoaPets: IEquipmentDatabase[]; EquippedInstrument: string; InvasionChainProgress: IInvasionChainProgress[]; - DataKnives: IGenericItem[]; + DataKnives: IEquipmentDatabase[]; NemesisHistory: INemesisHistory[]; - LastNemesisAllySpawnTime: IMongoDate; + LastNemesisAllySpawnTime?: IMongoDate; Settings: ISettings; PersonalTechProjects: IPersonalTechProject[]; CrewShips: ICrewShip[]; @@ -262,15 +226,15 @@ export interface IInventoryResponse { CrewShipWeapons: ICrewShipWeapon[]; CrewShipSalvagedWeapons: ICrewShipWeapon[]; CrewShipWeaponSkins: ICrewShipSalvagedWeaponSkin[]; - TradeBannedUntil: IMongoDate; + TradeBannedUntil?: IMongoDate; PlayedParkourTutorial: boolean; SubscribedToEmailsPersonalized: number; DailyAffiliationEntrati: number; DailyAffiliationNecraloid: number; - MechSuits: ISuitDatabase[]; + MechSuits: IEquipmentDatabase[]; InfestedFoundry: IInfestedFoundry; BlessingCooldown: IMongoDate; - CrewShipHarnesses: ICrewShipHarness[]; + CrewShipHarnesses: IEquipmentDatabase[]; CrewShipRawSalvage: IConsumable[]; CrewMembers: ICrewMember[]; AdultOperatorLoadOuts: IOperatorConfigClient[]; @@ -297,16 +261,6 @@ export interface IInventoryResponse { DeathSquadable: boolean; } -export interface IAdultOperatorLoadOut { - Skins: string[]; - attcol: IColor; - eyecol: IColor; - facial: IColor; - pricol: IColor; - Upgrades?: string[]; - ItemId: IOid; -} - export interface IAffiliation { Initiated?: boolean; Standing: number; @@ -384,14 +338,11 @@ export interface ICrewMember { WeaponId: IOid; XP: number; PowersuitType: string; - Configs: ICrewMemberConfig[]; + Configs: IItemConfig[]; SecondInCommand: boolean; ItemId: IOid; } -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface ICrewMemberConfig {} - export interface ISkillEfficiency { PILOTING: ICombat; GUNNERY: ICombat; @@ -404,21 +355,6 @@ export interface ICombat { Assigned: number; } -export interface ICrewShipHarness { - ItemType: string; - Configs: ICrewShipHarnessConfig[]; - Features: number; - UpgradeVer: number; - XP: number; - Polarity: IPolarity[]; - Polarized: number; - ItemId: IOid; -} - -export interface ICrewShipHarnessConfig { - Upgrades?: string[]; -} - export enum InventorySlot { SUITS = "SuitBin", WEAPONS = "WeaponBin", @@ -443,25 +379,21 @@ export interface ICrewShipWeapon { ItemType: string; UpgradeType?: string; UpgradeFingerprint?: string; - Configs?: ICrewShipHarnessConfig[]; + Configs?: IItemConfig[]; UpgradeVer?: number; ItemId: IOid; } export interface ICrewShip { ItemType: string; - Configs: ICrewShipConfig[]; + Configs: IItemConfig[]; Weapon: ICrewshipWeapon; Customization: ICustomization; ItemName: string; RailjackImage: IFlavourItem; CrewMembers: ICrewMembers; ItemId: IOid; -} - -export interface ICrewShipConfig { - Skins?: string[]; - pricol?: IColor; + _id: Types.ObjectId; } export interface ICrewMembers { @@ -484,16 +416,6 @@ export interface IShipExterior { ShipAttachments?: IShipAttachments; } -//TODO: check whether it makes sense to use this specifity of color. -export interface IShipExteriorColors { - t0: number; - t1: number; - t2: number; - t3: number; - m0: number; - en: number; -} - export interface IShipAttachments { HOOD_ORNAMENT: string; //TODO: Others are probably possible } @@ -512,22 +434,12 @@ export interface ICrewshipWeapon { PORT_GUNS: IPortGuns; } -export interface IPilot { - PRIMARY_A: IL; - SECONDARY_A: IL; -} - -// L? Bozo. -export interface IL { - ItemId?: IOid; - mod?: number; - cus?: number; - ItemType?: string; - hide?: boolean; -} - export interface IPortGuns { - PRIMARY_A: IL; + PRIMARY_A: IEquipmentSelection; +} + +export interface IPilot extends IPortGuns { + SECONDARY_A: IEquipmentSelection; } export interface IDiscoveredMarker { @@ -569,38 +481,6 @@ export interface IFusionTreasure { Sockets: number; } -export interface IHoverboard { - ItemType: string; - Configs: IHoverboardConfig[]; - ModularParts: string[]; - ItemName?: string; - Polarity?: IPolarity[]; - UpgradeVer: number; - XP: number; - Features: number; - ItemId: IOid; -} - -export interface IHoverboardConfig { - Upgrades?: string[]; - Skins?: IPurpleSkin[]; - pricol?: IColor; - sigcol?: ISigcol; - attcol?: IColor; -} - -export enum IPurpleSkin { - Empty = "", - The5Be4Af71A38E4A9306040E15 = "5be4af71a38e4a9306040e15", - The5C930Ac3A38E4A24Bc3Ad5De = "5c930ac3a38e4a24bc3ad5de", - The5C9C6F9857904A7A3B25656B = "5c9c6f9857904a7a3b25656b", - The5Dd8A8E3A38E4A321A45E6A0 = "5dd8a8e3a38e4a321a45e6a0" -} - -export interface ISigcol { - t3: number; -} - export interface IInfestedFoundry { Name: string; Resources: ITypeCount[]; @@ -653,44 +533,13 @@ export interface ITraits { Personality: string; BodyType: string; Head?: string; - Tail?: Tail; -} - -export enum Tail { - Empty = "", - LotusTypesGameCatbrowPetTailsCatbrowTailA = "/Lotus/Types/Game/CatbrowPet/Tails/CatbrowTailA", - LotusTypesGameCatbrowPetTailsCatbrowTailB = "/Lotus/Types/Game/CatbrowPet/Tails/CatbrowTailB", - LotusTypesGameCatbrowPetTailsCatbrowTailC = "/Lotus/Types/Game/CatbrowPet/Tails/CatbrowTailC", - LotusTypesGameCatbrowPetTailsCatbrowTailD = "/Lotus/Types/Game/CatbrowPet/Tails/CatbrowTailD" + Tail?: string; } export enum KubrowPetPrintItemType { LotusTypesGameKubrowPetImprintedTraitPrint = "/Lotus/Types/Game/KubrowPet/ImprintedTraitPrint" } -export interface IKubrowPet { - ItemType: string; - Configs: IKubrowPetConfig[]; - UpgradeVer: number; - Details: IDetails; - XP?: number; - Polarized?: number; - Polarity?: IPolarity[]; - Features?: number; - InfestationDate?: IMongoDate; - InfestationDays?: number; - InfestationType?: string; - ItemId: IOid; - ModularParts?: string[]; -} - -export interface IKubrowPetConfig { - Skins?: string[]; - pricol?: IColor; - attcol?: IColor; - Upgrades?: string[]; -} - export interface IDetails { Name: string; IsPuppy: boolean; @@ -733,74 +582,32 @@ export interface ILibraryPersonalProgress { //this needs to be checked against ILoadoutDatabase export interface ILoadOutPresets { - NORMAL: INormal[]; - NORMAL_PVP: IArchwing[]; - LUNARO: ILunaro[]; - ARCHWING: IArchwing[]; - SENTINEL: IArchwing[]; - OPERATOR: IArchwing[]; - GEAR: IGear[]; - KDRIVE: IKdrive[]; - DATAKNIFE: IArchwing[]; - MECH: IMech[]; - OPERATOR_ADULT: IArchwing[]; + NORMAL: ILoadoutConfigClient[]; + NORMAL_PVP: ILoadoutConfigClient[]; + LUNARO: ILoadoutConfigClient[]; + ARCHWING: ILoadoutConfigClient[]; + SENTINEL: ILoadoutConfigClient[]; + OPERATOR: ILoadoutConfigClient[]; + GEAR: ILoadoutConfigClient[]; + KDRIVE: ILoadoutConfigClient[]; + DATAKNIFE: ILoadoutConfigClient[]; + MECH: ILoadoutConfigClient[]; + OPERATOR_ADULT: ILoadoutConfigClient[]; } -export interface IArchwing { - PresetIcon: string; - Favorite: boolean; - n?: string; - s: IL; - l?: IL; - m?: IL; - ItemId: IOid; - p?: IL; -} - -export interface IGear { - n: string; - s: IL; - p: IL; - l: IL; - m: IL; - ItemId: IOid; -} - -export interface IKdrive { - PresetIcon: string; - Favorite: boolean; - s: IL; - ItemId: IOid; -} - -export interface ILunaro { - n: string; - s: IL; - m: IL; - ItemId: IOid; -} - -export interface IMech { - PresetIcon: string; - Favorite: boolean; - s: IL; - h: IL; - a: IL; - ItemId: IOid; -} - -export interface INormal { - FocusSchool: FocusSchool; - PresetIcon: string; - Favorite: boolean; - n: string; - s: IL; - p: IL; - l: IL; - m: IL; - h: IL; - a?: IL; +export interface ILoadoutConfigClient { + FocusSchool?: FocusSchool; + PresetIcon?: string; + Favorite?: boolean; + n?: string; // Loadout name + s?: IEquipmentSelection; // Suit + p?: IEquipmentSelection; + l?: IEquipmentSelection; // Primary weapon + m?: IEquipmentSelection; // Melee weapon + h?: IEquipmentSelection; // Gravimag weapon + a?: IEquipmentSelection; ItemId: IOid; + Remove?: boolean; // when client wants to remove a config, it only includes ItemId & Remove. } export enum UpgradeType { @@ -813,16 +620,7 @@ export interface ILoreFragmentScan { ItemType: string; } -export interface ILotusCustomization { - Upgrades: any[]; - PvpUpgrades: any[]; - Skins: string[]; - pricol: IColor; - attcol: any[]; - sigcol: any[]; - eyecol: any[]; - facial: any[]; - Songs: any[]; +export interface ILotusCustomization extends IItemConfig { Persona: string; } @@ -833,18 +631,6 @@ export interface IMission { RewardsCooldownTime?: IMongoDate; } -export interface IMoaPet { - ItemType: string; - Configs: IKubrowPetConfig[]; - UpgradeVer: number; - ModularParts: string[]; - XP?: number; - Features?: number; - ItemName: string; - Polarity?: IPolarity[]; - ItemId: IOid; -} - export interface INemesisHistory { fp: number; manifest: Manifest; @@ -879,30 +665,6 @@ export enum Manifest { LotusTypesGameNemesisKuvaLichKuvaLichManifestVersionTwo = "/Lotus/Types/Game/Nemesis/KuvaLich/KuvaLichManifestVersionTwo" } -export interface IOperatorAmp { - ItemType: string; - Configs: IKubrowPetConfig[]; - ModularParts?: string[]; - XP?: number; - UpgradeVer?: number; - ItemName?: string; - Features?: number; - ItemId: IOid; -} - -export interface IOperatorLoadOut { - Skins: string[]; - pricol?: IColor; - attcol?: IColor; - eyecol: IColor; - facial?: IColor; - sigcol?: IOperatorLoadOutSigcol; - OperatorAmp?: IOid; - Upgrades?: string[]; - AbilityOverride: IAbilityOverride; - ItemId: IOid; -} - export interface IPendingCoupon { Expiry: IMongoDate; Discount: number; @@ -1031,12 +793,7 @@ export interface IRawUpgrade { LastAdded?: IOid; } -export interface ISeasonChallengeHistory { - challenge: string; - id: string; -} - -export interface ISeasonChallengeCompletions { +export interface ISeasonChallenge { challenge: string; id: string; } @@ -1060,30 +817,6 @@ export interface IShipInventory { ItemId: IOid; } -export interface ISpaceGun { - ItemType: string; - Configs: ISpaceGunConfig[]; - XP?: number; - UpgradeVer?: number; - ItemId: IOid; - Features?: number; - Polarized?: number; - Polarity?: IPolarity[]; - UpgradeType?: UpgradeType; - UpgradeFingerprint?: string; - ItemName?: string; -} - -export interface ISpaceGunConfig { - Skins?: string[]; - pricol?: IColor; - Upgrades?: string[]; -} - -export interface IPurpleCol { - en: number; -} - export interface ISpectreLoadout { LongGuns: string; Melee: string; diff --git a/src/types/inventoryTypes/weaponTypes.ts b/src/types/inventoryTypes/weaponTypes.ts deleted file mode 100644 index 46d11d01..00000000 --- a/src/types/inventoryTypes/weaponTypes.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { IOid } from "@/src/types/commonTypes"; -import { IItemConfig } from "./commonInventoryTypes"; -import { IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; -import { Types } from "mongoose"; - -export interface IWeaponClient extends Omit { - ItemId: IOid; -} - -export interface IWeaponDatabase { - ItemType: string; - Configs: IItemConfig[]; - UpgradeVer?: number; - XP?: number; - Features?: number; - Polarized?: number; - Polarity?: IPolarity[]; - FocusLens?: string; - ModSlotPurchases?: number; - CustomizationSlotPurchases?: number; - UpgradeType?: string; - UpgradeFingerprint?: string; - ItemName?: string; - ModularParts?: string[]; - UnlockLevel?: number; - _id: Types.ObjectId; -} - -export interface IOperatorLoadOutSigcol { - t0?: number; - t1?: number; - en?: number; -} diff --git a/src/types/purchaseTypes.ts b/src/types/purchaseTypes.ts index 73ee085c..db143470 100644 --- a/src/types/purchaseTypes.ts +++ b/src/types/purchaseTypes.ts @@ -1,6 +1,5 @@ -import { ISuitClient } from "@/src/types/inventoryTypes/SuitTypes"; import { IFlavourItem } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IWeaponClient } from "@/src/types/inventoryTypes/weaponTypes"; +import { IEquipmentClient } from "./inventoryTypes/commonInventoryTypes"; export interface IPurchaseRequest { PurchaseParams: IPurchaseParams; @@ -23,11 +22,11 @@ export interface IPurchaseResponse { SuitBin?: IBinChanges; WeaponBin?: IBinChanges; MechBin?: IBinChanges; - MechSuits?: ISuitClient[]; - Suits?: ISuitClient[]; - LongGuns?: IWeaponClient[]; - Pistols?: IWeaponClient[]; - Melee?: IWeaponClient[]; + MechSuits?: IEquipmentClient[]; + Suits?: IEquipmentClient[]; + LongGuns?: IEquipmentClient[]; + Pistols?: IEquipmentClient[]; + Melee?: IEquipmentClient[]; PremiumCredits?: number; PremiumCreditsFree?: number; RegularCredits?: number; diff --git a/src/types/requestTypes.ts b/src/types/requestTypes.ts index 78ea111f..6dc35b76 100644 --- a/src/types/requestTypes.ts +++ b/src/types/requestTypes.ts @@ -1,5 +1,5 @@ import { IOid } from "./commonTypes"; -import { IPolarity, FocusSchool } from "@/src/types/inventoryTypes/commonInventoryTypes"; +import { IPolarity, FocusSchool, IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes"; import { IBooster, IChallengeProgress, @@ -8,11 +8,8 @@ import { IMiscItem, IMission, IRawUpgrade, - ISeasonChallengeCompletions, - ISeasonChallengeHistory + ISeasonChallenge } from "./inventoryTypes/inventoryTypes"; -import { IWeaponClient } from "./inventoryTypes/weaponTypes"; -import { ISuitClient } from "./inventoryTypes/SuitTypes"; export interface IArtifactsRequest { Upgrade: ICrewShipSalvagedWeaponSkin; @@ -35,18 +32,18 @@ export interface IAffiliationChange { export interface IUpdateChallengeProgressRequest { ChallengeProgress: IChallengeProgress[]; - SeasonChallengeHistory: ISeasonChallengeHistory[]; - SeasonChallengeCompletions: ISeasonChallengeCompletions[]; + SeasonChallengeHistory: ISeasonChallenge[]; + SeasonChallengeCompletions: ISeasonChallenge[]; } export interface IMissionInventoryUpdateRequest { rewardsMultiplier?: number; ActiveBoosters?: IBooster[]; AffiliationChanges?: IAffiliationChange[]; - LongGuns?: IWeaponClient[]; - Pistols?: IWeaponClient[]; - Suits?: ISuitClient[]; - Melee?: IWeaponClient[]; + LongGuns?: IEquipmentClient[]; + Pistols?: IEquipmentClient[]; + Suits?: IEquipmentClient[]; + Melee?: IEquipmentClient[]; RawUpgrades?: IRawUpgrade[]; MiscItems?: IMiscItem[]; Consumables?: IConsumable[]; diff --git a/src/types/saveLoadoutTypes.ts b/src/types/saveLoadoutTypes.ts index 09577594..4f434eef 100644 --- a/src/types/saveLoadoutTypes.ts +++ b/src/types/saveLoadoutTypes.ts @@ -1,6 +1,7 @@ import { IOid } from "@/src/types/commonTypes"; import { IItemConfig, IOperatorConfigClient } from "@/src/types/inventoryTypes/commonInventoryTypes"; import { Types } from "mongoose"; +import { ILoadoutConfigClient } from "./inventoryTypes/inventoryTypes"; export interface ISaveLoadoutRequest { LoadOuts: ILoadoutClient; @@ -72,23 +73,3 @@ export interface ILoadoutEntry { export interface ILoadoutConfigDatabase extends Omit { _id: Types.ObjectId; } - -// for request and response from and to client -export interface ILoadoutConfigClient { - ItemId: IOid; - Remove?: boolean; // when client wants to remove a config, it only includes ItemId & Remove. - n?: string; - PresetIcon?: string; - Favorite?: boolean; - s?: IEquipmentSelection; - p?: IEquipmentSelection; - l?: IEquipmentSelection; - m?: IEquipmentSelection; -} - -export interface IEquipmentSelection { - ItemId?: IOid; - mod?: number; - cus?: number; - hide?: boolean; -}