working
This commit is contained in:
		
							parent
							
								
									79c58f2558
								
							
						
					
					
						commit
						ee6f9cb985
					
				
							
								
								
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -327,9 +327,9 @@ | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@types/express": { | ||||
|       "version": "4.17.20", | ||||
|       "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.20.tgz", | ||||
|       "integrity": "sha512-rOaqlkgEvOW495xErXMsmyX3WKBInbhG5eqojXYi3cGUaLoRDlXa5d52fkfWZT963AZ3v2eZ4MbKE6WpDAGVsw==", | ||||
|       "version": "4.17.21", | ||||
|       "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", | ||||
|       "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", | ||||
|       "dev": true, | ||||
|       "dependencies": { | ||||
|         "@types/body-parser": "*", | ||||
|  | ||||
							
								
								
									
										6
									
								
								src/controllers/api/focusController.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/controllers/api/focusController.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | ||||
| import { Handler } from "express"; | ||||
| 
 | ||||
| export const focusController: Handler = (_req, _res) => { | ||||
|     //console.log("focusController", req.query);
 | ||||
|     _res.sendStatus(400); | ||||
| }; | ||||
| @ -3,26 +3,24 @@ import { IGenericUpdate } from "@/src/types/genericUpdate"; | ||||
| import { RequestHandler } from "express"; | ||||
| 
 | ||||
| // TODO: Nightwave evidence submission support is the only thing missing.
 | ||||
| // TODO: Also, you might want to test this, because I definitely didn't.
 | ||||
| const genericUpdateController: RequestHandler = async (request, response) => { | ||||
|     const accountId = request.query.accountId as string; | ||||
| // TODO: this was added by someone without testing.  It may not work.
 | ||||
| // eslint-disable-next-line @typescript-eslint/no-misused-promises
 | ||||
| const genericUpdateController: RequestHandler = async (_request, response) => { | ||||
|     // const accountId = request.query.accountId as string;
 | ||||
| 
 | ||||
|     const [body] = String(request.body).split("\n"); | ||||
|     // const [body] = String(request.body).split("\n");
 | ||||
| 
 | ||||
|     let reply = {}; | ||||
|     try { | ||||
|         const update = JSON.parse(body) as IGenericUpdate; | ||||
|         if (typeof update !== "object") { | ||||
|             throw new Error("Invalid data format"); | ||||
|         } | ||||
|     // let reply = {};
 | ||||
|     // try {
 | ||||
|     //     const update = JSON.parse(body) as IGenericUpdate;
 | ||||
|     //     if (typeof update !== "object") {
 | ||||
|     //         throw new Error("Invalid data format");
 | ||||
|     //     }
 | ||||
| 
 | ||||
|         reply = await updateGeneric(update, accountId); | ||||
|     } catch (err) { | ||||
|         console.error("Error parsing JSON data:", err); | ||||
|     } | ||||
| 
 | ||||
|     // Response support added for when Nightwave is supported below.
 | ||||
|     // response.json(reply);
 | ||||
|     //     reply = await updateGeneric(update, accountId);
 | ||||
|     // } catch (err) {
 | ||||
|     //     console.error("Error parsing JSON data:", err);
 | ||||
|     // }
 | ||||
| 
 | ||||
|     response.json({}); | ||||
| }; | ||||
|  | ||||
| @ -13,6 +13,77 @@ const getShipController: RequestHandler = async (req, res) => { | ||||
|         res.status(500).json({ error: "error finding a corresponding ship" }); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     ship.Ship.Features = [ | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/AdvancedOrdisFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/AlchemyRoomFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/AlertsFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/ArsenalFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/CeresNavigationFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/ClanFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/EarthNavigationFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/EidolonArchwingFoundryUpgradeFeatureBlueprint", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/EidolonArchwingFoundryUpgradeFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/ErisNavigationFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/EuropaNavigationFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/FoundryConcurrentBuildFormaFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/FoundryFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/FoundryVesselUpgradeFeatureBlueprint", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/FoundryVesselUpgradeFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/GeneticFoundryCatbrowUpgradeFeatureBlueprint", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/GeneticFoundryCatbrowUpgradeFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/GeneticFoundryFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/GeneticFoundryUpgradeFeatureBlueprint", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/GeneticFoundryUpgradeFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryArchonShardBlueprint", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryArchonShardFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryBlueprint", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryUpgradeBlueprint", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryUpgradeFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/JupiterNavigationFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/MarketTierOneFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/MarketTierTwoFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/MarsNavigationFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/MercuryNavigationFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/ModsFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/ModsFusionFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/ModsTransmuteFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/NeptuneNavigationFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/PersonalQuartersFeatureBlueprint", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/PersonalQuartersFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/PhobosNavigationFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/PlutoNavigationFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackHoodBraceFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackHoodFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackHullFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackNacelleLeftFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackNacelleRightFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackTailFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHoodBraceFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHoodBraceFeatureItemBlueprint", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHoodFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHoodFeatureItemBlueprint", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHullFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHullFeatureItemBlueprint", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackNacelleLeftFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackNacelleLeftFeatureItemBlueprint", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackNacelleRightFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackNacelleRightFeatureItemBlueprint", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackTailFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackTailFeatureItemBlueprint", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/RailjackCephalonShipFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/RailjackKeyShipFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/SaturnNavigationFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/SednaNavigationFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/ShipFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/SocialMenuFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/SolarChartFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/UranusNavigationFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/VenusNavigationFeatureItem", | ||||
|         "/Lotus/Types/Items/ShipFeatureItems/VoidProjectionFeatureItem" | ||||
|     ]; | ||||
| 
 | ||||
|     res.json(ship); | ||||
| }; | ||||
| 
 | ||||
|  | ||||
| @ -31,7 +31,6 @@ const inventoryController: RequestHandler = async (request: Request, response: R | ||||
|     if (config.testMission) inventoryResponse.Missions = testMissions; | ||||
|     if (config.testQuestKey) inventoryResponse.QuestKeys = testQuestKeys; | ||||
| 
 | ||||
|     inventoryResponse.DuviriInfo = { Seed: -123123123123123123, NumCompletions: 0 }; | ||||
|     response.json(inventoryResponse); | ||||
| }; | ||||
| 
 | ||||
|  | ||||
| @ -50,7 +50,7 @@ const loginController: RequestHandler = async (request, response) => { | ||||
|             return; | ||||
|         } catch (error: unknown) { | ||||
|             if (error instanceof Error) { | ||||
|                 throw new Error("error creating account"); | ||||
|                 throw new Error("error creating account", error); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -8,14 +8,17 @@ import { parseString } from "@/src/helpers/general"; | ||||
| const saveLoadoutController: RequestHandler = async (req, res) => { | ||||
|     //validate here
 | ||||
|     const accountId = parseString(req.query.accountId); | ||||
|     const body: ISaveLoadoutRequest = JSON.parse(req.body as string) as ISaveLoadoutRequest; | ||||
|     // console.log(util.inspect(body, { showHidden: false, depth: null, colors: true }));
 | ||||
| 
 | ||||
|     // eslint-disable-next-line @typescript-eslint/no-unused-vars
 | ||||
|     const { UpgradeVer, ...equipmentChanges } = body; | ||||
|     await handleInventoryItemConfigChange(equipmentChanges, accountId); | ||||
|     try { | ||||
|         const body: ISaveLoadoutRequest = JSON.parse(req.body as string) as ISaveLoadoutRequest; | ||||
|         // console.log(util.inspect(body, { showHidden: false, depth: null, colors: true }));
 | ||||
| 
 | ||||
|     res.status(200).end(); | ||||
|         // eslint-disable-next-line @typescript-eslint/no-unused-vars
 | ||||
|         const { UpgradeVer, ...equipmentChanges } = body; | ||||
|         await handleInventoryItemConfigChange(equipmentChanges, accountId); | ||||
|     } catch (error) { | ||||
|         res.status(200).end(); | ||||
|     } | ||||
| }; | ||||
| 
 | ||||
| export { saveLoadoutController }; | ||||
|  | ||||
							
								
								
									
										6
									
								
								src/controllers/api/setBootLocationController.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/controllers/api/setBootLocationController.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | ||||
| import { Request, Response } from "express"; | ||||
| 
 | ||||
| export const setBootLocationController = (req: Request, res: Response) => { | ||||
|     console.log("setBootLocationController", req.query); | ||||
|     res.end(); | ||||
| }; | ||||
| @ -1,8 +0,0 @@ | ||||
| import { RequestHandler } from "express"; | ||||
| import view from "@/static/fixed_responses/view.json"; | ||||
| 
 | ||||
| const viewController: RequestHandler = (_req, res) => { | ||||
|     res.json(view); | ||||
| }; | ||||
| 
 | ||||
| export { viewController }; | ||||
| @ -1,7 +1,8 @@ | ||||
| import { RequestHandler } from "express"; | ||||
| import view from "@/static/fixed_responses/view.json"; | ||||
| 
 | ||||
| const viewController: RequestHandler = (_req, res) => { | ||||
|     res.json({}); | ||||
|     res.json(view); | ||||
| }; | ||||
| 
 | ||||
| export { viewController }; | ||||
|  | ||||
| @ -1,10 +1,14 @@ | ||||
| import { IOid } from "@/src/types/commonTypes"; | ||||
| import { IInventoryDatabase, IInventoryResponse } from "@/src/types/inventoryTypes/inventoryTypes"; | ||||
| import { Types } from "mongoose"; | ||||
| 
 | ||||
| // a schema's toJSON is responsible for changing Oid and Date to their corresponding Response versions __id to "ItemId":{"$oid":"6450f720bc562ebf030222d4"}, and a Date to "date":{"$date":{"$numberLong":"unix timestamp"})
 | ||||
| const toInventoryResponse = (inventoryDatabase: IInventoryDatabase): IInventoryResponse => { | ||||
| export const toInventoryResponse = (inventoryDatabase: IInventoryDatabase): IInventoryResponse => { | ||||
|     // eslint-disable-next-line @typescript-eslint/no-unused-vars
 | ||||
|     const { accountOwnerId, ...inventoryResponse } = inventoryDatabase; | ||||
|     return inventoryResponse as unknown as IInventoryResponse; | ||||
| }; | ||||
| 
 | ||||
| export { toInventoryResponse }; | ||||
| export const toOid = (objectId: Types.ObjectId) => { | ||||
|     return { $oid: objectId.toString() } satisfies IOid; | ||||
| }; | ||||
|  | ||||
| @ -7,17 +7,23 @@ import { | ||||
|     IBooster, | ||||
|     IInventoryResponse, | ||||
|     IInventoryDatabaseDocument, | ||||
|     ISlots | ||||
|     ISlots, | ||||
|     IGenericItem, | ||||
|     IMailbox, | ||||
|     IDuviriInfo | ||||
| } from "../../types/inventoryTypes/inventoryTypes"; | ||||
| import { IMongoDate, IOid } from "../../types/commonTypes"; | ||||
| import { | ||||
|     IItemConfig, | ||||
|     ISuitDatabase, | ||||
|     IOperatorConfigClient, | ||||
|     IOperatorConfigDatabase | ||||
| } from "@/src/types/inventoryTypes/SuitTypes"; | ||||
| import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes"; | ||||
| import { IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes"; | ||||
| import { IAbilityOverride, IColor, IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; | ||||
| import { | ||||
|     IAbilityOverride, | ||||
|     IColor, | ||||
|     IItemConfig, | ||||
|     IOperatorConfigClient, | ||||
|     IOperatorConfigDatabase, | ||||
|     IPolarity | ||||
| } from "@/src/types/inventoryTypes/commonInventoryTypes"; | ||||
| import { toOid } from "@/src/helpers/inventoryHelpers"; | ||||
| 
 | ||||
| const polaritySchema = new Schema<IPolarity>({ | ||||
|     Slot: Number, | ||||
| @ -51,6 +57,7 @@ const operatorConfigSchema = new Schema<IOperatorConfigDatabase>( | ||||
|         eyecol: colorSchema, | ||||
|         facial: colorSchema, | ||||
|         syancol: colorSchema, | ||||
|         cloth: colorSchema, | ||||
|         Upgrades: [String], | ||||
|         Name: String, // not sure if possible in operator
 | ||||
|         ugly: Boolean // not sure if possible in operator
 | ||||
| @ -141,10 +148,13 @@ const BoosterSchema = new Schema<IBooster>({ | ||||
|     ItemType: String | ||||
| }); | ||||
| 
 | ||||
| const RawUpgrades = new Schema<IRawUpgrade>({ | ||||
|     ItemType: String, | ||||
|     ItemCount: Number | ||||
| }); | ||||
| const RawUpgrades = new Schema<IRawUpgrade>( | ||||
|     { | ||||
|         ItemType: String, | ||||
|         ItemCount: Number | ||||
|     }, | ||||
|     { id: false } | ||||
| ); | ||||
| 
 | ||||
| RawUpgrades.virtual("LastAdded").get(function () { | ||||
|     return { $oid: this._id.toString() } satisfies IOid; | ||||
| @ -158,7 +168,7 @@ RawUpgrades.set("toJSON", { | ||||
|     } | ||||
| }); | ||||
| 
 | ||||
| //TODO: validate what this is
 | ||||
| //TODO: find out what this is
 | ||||
| const Upgrade = new Schema({ | ||||
|     UpgradeFingerprint: String, | ||||
|     ItemType: String | ||||
| @ -208,14 +218,18 @@ suitSchema.set("toJSON", { | ||||
| 
 | ||||
| const slotsBinSchema = new Schema<ISlots>( | ||||
|     { | ||||
|         Slots: Number | ||||
|         Slots: Number, | ||||
|         Extra: Number | ||||
|     }, | ||||
|     { _id: false } | ||||
| ); | ||||
| 
 | ||||
| const FlavourItemSchema = new Schema({ | ||||
|     ItemType: String | ||||
| }); | ||||
| const FlavourItemSchema = new Schema( | ||||
|     { | ||||
|         ItemType: String | ||||
|     }, | ||||
|     { _id: false } | ||||
| ); | ||||
| 
 | ||||
| FlavourItemSchema.set("toJSON", { | ||||
|     transform(_document, returnedObject) { | ||||
| @ -224,7 +238,70 @@ FlavourItemSchema.set("toJSON", { | ||||
|     } | ||||
| }); | ||||
| 
 | ||||
| const GenericItemSchema = new Schema<IGenericItem>( | ||||
|     { | ||||
|         ItemType: String, | ||||
|         Configs: [ItemConfigSchema], | ||||
|         UpgradeVer: Number //this is probably just __v
 | ||||
|     }, | ||||
|     { 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<IMailbox>( | ||||
|     { | ||||
|         LastInboxId: { | ||||
|             type: Schema.Types.ObjectId, | ||||
|             set: (v: IMailbox["LastInboxId"]) => v.$oid.toString() | ||||
|         } | ||||
|     }, | ||||
|     { id: false, _id: false } | ||||
| ); | ||||
| 
 | ||||
| MailboxSchema.set("toJSON", { | ||||
|     transform(_document, returnedObject) { | ||||
|         delete returnedObject.__v; | ||||
|         //TODO: there is a lot of any here
 | ||||
|         returnedObject.LastInboxId = toOid(returnedObject.LastInboxId as Types.ObjectId); | ||||
|     } | ||||
| }); | ||||
| 
 | ||||
| const DuviriInfoSchema = new Schema<IDuviriInfo>( | ||||
|     { | ||||
|         Seed: Number, | ||||
|         NumCompletions: Number | ||||
|     }, | ||||
|     { | ||||
|         _id: false, | ||||
|         id: false | ||||
|     } | ||||
| ); | ||||
| 
 | ||||
| DuviriInfoSchema.set("toJSON", { | ||||
|     transform(_document, returnedObject) { | ||||
|         delete returnedObject.__v; | ||||
|     } | ||||
| }); | ||||
| 
 | ||||
| const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({ | ||||
|     Horses: [GenericItemSchema], | ||||
|     DrifterMelee: [GenericItemSchema], | ||||
|     DrifterGuns: [GenericItemSchema], | ||||
|     DuviriInfo: DuviriInfoSchema, | ||||
|     Mailbox: MailboxSchema, | ||||
|     KahlLoadOuts: [Schema.Types.Mixed], | ||||
|     accountOwnerId: Schema.Types.ObjectId, | ||||
|     SubscribedToEmails: Number, | ||||
|     Created: Schema.Types.Mixed, | ||||
| @ -236,11 +313,15 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({ | ||||
|     SuitBin: slotsBinSchema, | ||||
|     WeaponBin: slotsBinSchema, | ||||
|     SentinelBin: slotsBinSchema, | ||||
|     SpaceSuitBin: Schema.Types.Mixed, | ||||
|     SpaceWeaponBin: Schema.Types.Mixed, | ||||
|     PvpBonusLoadoutBin: Schema.Types.Mixed, | ||||
|     PveBonusLoadoutBin: Schema.Types.Mixed, | ||||
|     RandomModBin: Schema.Types.Mixed, | ||||
|     SpaceSuitBin: slotsBinSchema, | ||||
|     SpaceWeaponBin: slotsBinSchema, | ||||
|     PvpBonusLoadoutBin: slotsBinSchema, | ||||
|     PveBonusLoadoutBin: slotsBinSchema, | ||||
|     RandomModBin: slotsBinSchema, | ||||
|     OperatorAmpBin: slotsBinSchema, | ||||
|     CrewShipSalvageBin: slotsBinSchema, | ||||
|     MechBin: slotsBinSchema, | ||||
|     CrewMemberBin: slotsBinSchema, | ||||
|     TradesRemaining: Number, | ||||
|     DailyAffiliation: Number, | ||||
|     DailyAffiliationPvp: Number, | ||||
| @ -260,7 +341,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({ | ||||
|     Ships: [Schema.Types.Mixed], | ||||
|     QuestKeys: [Schema.Types.Mixed], | ||||
|     FlavourItems: [FlavourItemSchema], | ||||
|     Scoops: [Schema.Types.Mixed], | ||||
|     Scoops: [GenericItemSchema], | ||||
|     TrainingRetriesLeft: Number, | ||||
|     LoadOutPresets: { type: Schema.Types.ObjectId, ref: "Loadout" }, | ||||
|     CurrentLoadOutIds: [Schema.Types.Mixed], | ||||
| @ -294,14 +375,14 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({ | ||||
|     Affiliations: [Schema.Types.Mixed], | ||||
|     QualifyingInvasions: [Schema.Types.Mixed], | ||||
|     FactionScores: [Number], | ||||
|     SpaceSuits: [Schema.Types.Mixed], | ||||
|     SpaceMelee: [Schema.Types.Mixed], | ||||
|     SpaceSuits: [GenericItemSchema], | ||||
|     SpaceMelee: [GenericItemSchema], | ||||
|     SpaceGuns: [Schema.Types.Mixed], | ||||
|     ArchwingEnabled: Boolean, | ||||
|     PendingSpectreLoadouts: [Schema.Types.Mixed], | ||||
|     SpectreLoadouts: [Schema.Types.Mixed], | ||||
|     SentinelWeapons: [Schema.Types.Mixed], | ||||
|     Sentinels: [Schema.Types.Mixed], | ||||
|     Sentinels: [WeaponSchema], | ||||
|     SentinelWeapons: [WeaponSchema], | ||||
|     EmailItems: [Schema.Types.Mixed], | ||||
|     CompletedSyndicates: [String], | ||||
|     FocusXP: Schema.Types.Mixed, | ||||
| @ -314,7 +395,6 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({ | ||||
|     ActiveAvatarImageType: String, | ||||
|     KubrowPets: [Schema.Types.Mixed], | ||||
|     ShipDecorations: [Schema.Types.Mixed], | ||||
|     OperatorAmpBin: Schema.Types.Mixed, | ||||
|     DailyAffiliationCetus: Number, | ||||
|     DailyAffiliationQuills: Number, | ||||
|     DiscoveredMarkers: [Schema.Types.Mixed], | ||||
| @ -346,13 +426,12 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({ | ||||
|     MoaPets: [Schema.Types.Mixed], | ||||
|     EquippedInstrument: String, | ||||
|     InvasionChainProgress: [Schema.Types.Mixed], | ||||
|     DataKnives: [Schema.Types.Mixed], | ||||
|     DataKnives: [GenericItemSchema], | ||||
|     NemesisHistory: [Schema.Types.Mixed], | ||||
|     LastNemesisAllySpawnTime: Schema.Types.Mixed, | ||||
|     Settings: Schema.Types.Mixed, | ||||
|     PersonalTechProjects: [Schema.Types.Mixed], | ||||
|     CrewShips: [Schema.Types.Mixed], | ||||
|     CrewShipSalvageBin: Schema.Types.Mixed, | ||||
|     PlayerSkills: Schema.Types.Mixed, | ||||
|     CrewShipAmmo: [Schema.Types.Mixed], | ||||
|     CrewShipSalvagedWeaponSkins: [Schema.Types.Mixed], | ||||
| @ -362,13 +441,11 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({ | ||||
|     TradeBannedUntil: Schema.Types.Mixed, | ||||
|     PlayedParkourTutorial: Boolean, | ||||
|     SubscribedToEmailsPersonalized: Number, | ||||
|     MechBin: Schema.Types.Mixed, | ||||
|     DailyAffiliationEntrati: Number, | ||||
|     DailyAffiliationNecraloid: Number, | ||||
|     MechSuits: [Schema.Types.Mixed], | ||||
|     MechSuits: [suitSchema], | ||||
|     InfestedFoundry: Schema.Types.Mixed, | ||||
|     BlessingCooldown: Schema.Types.Mixed, | ||||
|     CrewMemberBin: Schema.Types.Mixed, | ||||
|     CrewShipHarnesses: [Schema.Types.Mixed], | ||||
|     CrewShipRawSalvage: [Schema.Types.Mixed], | ||||
|     CrewMembers: [Schema.Types.Mixed], | ||||
| @ -393,10 +470,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({ | ||||
|     HasResetAccount: Boolean, | ||||
|     PendingCoupon: Schema.Types.Mixed, | ||||
|     Harvestable: Boolean, | ||||
|     DeathSquadable: Boolean, | ||||
|     Horses: [Schema.Types.Mixed], | ||||
|     DrifterMelee: [Schema.Types.Mixed], | ||||
|     KahlLoadOuts: [Schema.Types.Mixed] | ||||
|     DeathSquadable: Boolean | ||||
| }); | ||||
| 
 | ||||
| inventorySchema.set("toJSON", { | ||||
| @ -425,6 +499,12 @@ type InventoryDocumentProps = { | ||||
|     Boosters: Types.DocumentArray<IBooster>; | ||||
|     OperatorLoadOuts: Types.DocumentArray<IOperatorConfigClient>; | ||||
|     AdultOperatorLoadOuts: Types.DocumentArray<IOperatorConfigClient>; | ||||
|     MechSuits: Types.DocumentArray<ISuitDatabase>; | ||||
|     Scoops: Types.DocumentArray<IGenericItem>; | ||||
|     DataKnives: Types.DocumentArray<IGenericItem>; | ||||
|     DrifterMelee: Types.DocumentArray<IGenericItem>; | ||||
|     Sentinels: Types.DocumentArray<IWeaponDatabase>; | ||||
|     Horses: Types.DocumentArray<IGenericItem>; | ||||
| }; | ||||
| 
 | ||||
| type InventoryModelType = Model<IInventoryDatabase, {}, InventoryDocumentProps>; | ||||
|  | ||||
| @ -26,13 +26,14 @@ import { setActiveQuestController } from "@/src/controllers/api/setActiveQuestCo | ||||
| import { surveysController } from "@/src/controllers/api/surveysController"; | ||||
| import { updateChallengeProgressController } from "@/src/controllers/api/updateChallengeProgressController"; | ||||
| import { updateSessionGetController, updateSessionPostController } from "@/src/controllers/api/updateSessionController"; | ||||
| import { viewController } from "@/src/controllers/api/viewController"; | ||||
| import { joinSessionController } from "@/src/controllers/api/joinSessionController"; | ||||
| import { saveLoadoutController } from "@/src/controllers/api/saveLoadout"; | ||||
| import { trainingResultController } from "@/src/controllers/api/trainingResultController"; | ||||
| import { artifactsController } from "../controllers/api/artifactsController"; | ||||
| 
 | ||||
| import express from "express"; | ||||
| import { setBootLocationController } from "@/src/controllers/api/setBootLocationController"; | ||||
| import { focusController } from "@/src/controllers/api/focusController"; | ||||
| 
 | ||||
| const apiRouter = express.Router(); | ||||
| 
 | ||||
| @ -46,7 +47,6 @@ apiRouter.get("/loginRewards.php", loginRewardsController); | ||||
| apiRouter.get("/checkDailyMissionBonus.php", checkDailyMissionBonusController); | ||||
| apiRouter.get("/inbox.php", inboxController); | ||||
| apiRouter.get("/getShip.php", getShipController); | ||||
| apiRouter.get("/view.php", viewController); | ||||
| apiRouter.get("/drones.php", dronesController); | ||||
| apiRouter.get("/getIgnoredUsers.php", getIgnoredUsersController); | ||||
| apiRouter.get("/getNewRewardSeed.php", getNewRewardSeedController); | ||||
| @ -58,8 +58,10 @@ apiRouter.get("/hub", hubController); | ||||
| apiRouter.get("/modularWeaponSale.php", modularWeaponSaleController); | ||||
| apiRouter.get("/deleteSession.php", deleteSessionController); | ||||
| apiRouter.get("/logout.php", logoutController); | ||||
| apiRouter.get("/setBootLocation.php", setBootLocationController); | ||||
| 
 | ||||
| // post
 | ||||
| apiRouter.post("/focus.php", focusController); | ||||
| apiRouter.post("/artifacts.php", artifactsController); | ||||
| apiRouter.post("/findSessions.php", findSessionsController); | ||||
| // eslint-disable-next-line @typescript-eslint/no-misused-promises
 | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| import { viewController } from "../controllers/api/viewController"; | ||||
| import { viewController } from "../controllers/stats/viewController"; | ||||
| import { uploadController } from "@/src/controllers/stats/uploadController"; | ||||
| 
 | ||||
| import express from "express"; | ||||
|  | ||||
| @ -17,7 +17,7 @@ import { | ||||
| import { IGenericUpdate } from "../types/genericUpdate"; | ||||
| import { IArtifactsRequest, IMissionInventoryUpdateRequest } from "../types/requestTypes"; | ||||
| 
 | ||||
| const createInventory = async (accountOwnerId: Types.ObjectId, loadOutPresetId: Types.ObjectId) => { | ||||
| export const createInventory = async (accountOwnerId: Types.ObjectId, loadOutPresetId: Types.ObjectId) => { | ||||
|     try { | ||||
|         const inventory = new Inventory({ | ||||
|             ...new_inventory, | ||||
| @ -53,13 +53,28 @@ export const getInventory = async (accountOwnerId: string) => { | ||||
|     return inventory; | ||||
| }; | ||||
| 
 | ||||
| const addPowerSuit = async (powersuitName: string, accountId: string): Promise<ISuitClient> => { | ||||
| //TODO: genericMethod for all the add methods, they share a lot of logic
 | ||||
| export const addSentinel = async (sentinelName: string, accountId: string) => { | ||||
|     const inventory = await getInventory(accountId); | ||||
|     const sentinelIndex = inventory.Sentinels.push({ ItemType: sentinelName, Configs: [], XP: 0 }); | ||||
|     const changedInventory = await inventory.save(); | ||||
|     return changedInventory.Sentinels[sentinelIndex - 1].toJSON(); | ||||
| }; | ||||
| 
 | ||||
| export const addPowerSuit = async (powersuitName: string, accountId: string): Promise<ISuitClient> => { | ||||
|     const inventory = await getInventory(accountId); | ||||
|     const suitIndex = inventory.Suits.push({ ItemType: powersuitName, Configs: [], UpgradeVer: 101, XP: 0 }); | ||||
|     const changedInventory = await inventory.save(); | ||||
|     return changedInventory.Suits[suitIndex - 1].toJSON(); | ||||
| }; | ||||
| 
 | ||||
| export const addMechSuit = async (mechsuitName: string, accountId: string) => { | ||||
|     const inventory = await getInventory(accountId); | ||||
|     const suitIndex = inventory.MechSuits.push({ ItemType: mechsuitName, Configs: [], UpgradeVer: 101, XP: 0 }); | ||||
|     const changedInventory = await inventory.save(); | ||||
|     return changedInventory.MechSuits[suitIndex - 1].toJSON(); | ||||
| }; | ||||
| 
 | ||||
| export const updateSlots = async (slotType: SlotType, accountId: string, slots: number) => { | ||||
|     const inventory = await getInventory(accountId); | ||||
| 
 | ||||
| @ -70,6 +85,9 @@ export const updateSlots = async (slotType: SlotType, accountId: string, slots: | ||||
|         case SlotType.WEAPON: | ||||
|             inventory.WeaponBin.Slots += slots; | ||||
|             break; | ||||
|         case SlotType.MECHSUIT: | ||||
|             inventory.MechBin.Slots += slots; | ||||
|             break; | ||||
|         default: | ||||
|             throw new Error("invalid slot type"); | ||||
|     } | ||||
| @ -343,5 +361,3 @@ export const upgradeMod = async (artifactsData: IArtifactsRequest, accountId: st | ||||
|         throw error; | ||||
|     } | ||||
| }; | ||||
| 
 | ||||
| export { createInventory, addPowerSuit }; | ||||
|  | ||||
| @ -1,6 +1,14 @@ | ||||
| import { getWeaponType } from "@/src/helpers/purchaseHelpers"; | ||||
| import { getSubstringFromKeyword } from "@/src/helpers/stringHelpers"; | ||||
| import { addBooster, addCustomization, addPowerSuit, addWeapon, updateSlots } from "@/src/services/inventoryService"; | ||||
| import { | ||||
|     addBooster, | ||||
|     addCustomization, | ||||
|     addMechSuit, | ||||
|     addPowerSuit, | ||||
|     addSentinel, | ||||
|     addWeapon, | ||||
|     updateSlots | ||||
| } from "@/src/services/inventoryService"; | ||||
| import { IPurchaseRequest, SlotType } from "@/src/types/purchaseTypes"; | ||||
| 
 | ||||
| export const getStoreItemCategory = (storeItem: string) => { | ||||
| @ -72,8 +80,25 @@ const handleWeaponsPurchase = async (weaponName: string, accountId: string) => { | ||||
| }; | ||||
| 
 | ||||
| const handlePowersuitPurchase = async (powersuitName: string, accountId: string) => { | ||||
|     if (powersuitName.includes("EntratiMech")) { | ||||
|         const mechSuit = await addMechSuit(powersuitName, accountId); | ||||
|         await updateSlots(SlotType.MECHSUIT, accountId, -1); | ||||
|         console.log("mech suit", mechSuit); | ||||
| 
 | ||||
|         return { | ||||
|             InventoryChanges: { | ||||
|                 MechBin: { | ||||
|                     count: 1, | ||||
|                     platinum: 0, | ||||
|                     Slots: -1 | ||||
|                 }, | ||||
|                 MechSuits: [mechSuit] | ||||
|             } | ||||
|         }; | ||||
|     } | ||||
| 
 | ||||
|     const suit = await addPowerSuit(powersuitName, accountId); | ||||
|     await updateSlots(SlotType.WEAPON, accountId, -1); | ||||
|     await updateSlots(SlotType.SUIT, accountId, -1); | ||||
| 
 | ||||
|     return { | ||||
|         InventoryChanges: { | ||||
| @ -95,13 +120,24 @@ const handleTypesPurchase = async (typesName: string, accountId: string) => { | ||||
|             return await handleSuitCustomizationsPurchase(typesName, accountId); | ||||
|         // case "Recipes":
 | ||||
|         //     break;
 | ||||
|         // case "Sentinels":
 | ||||
|         //     break;
 | ||||
|         case "Sentinels": | ||||
|             return await handleSentinelPurchase(typesName, accountId); | ||||
|         default: | ||||
|             throw new Error(`unknown Types category: ${typeCategory} not implemented or new`); | ||||
|     } | ||||
| }; | ||||
| 
 | ||||
| const handleSentinelPurchase = async (sentinelName: string, accountId: string) => { | ||||
|     const sentinel = await addSentinel(sentinelName, accountId); | ||||
| 
 | ||||
|     return { | ||||
|         InventoryChanges: { | ||||
|             SentinelBin: { count: 1, platinum: 0, Slots: -1 }, | ||||
|             Sentinels: [sentinel] | ||||
|         } | ||||
|     }; | ||||
| }; | ||||
| 
 | ||||
| const handleSuitCustomizationsPurchase = async (customizationName: string, accountId: string) => { | ||||
|     const customization = await addCustomization(customizationName, accountId); | ||||
| 
 | ||||
|  | ||||
| @ -15,13 +15,20 @@ export const isEmptyObject = (obj: unknown): boolean => { | ||||
| 
 | ||||
| //setup default items on account creation or like originally in giveStartingItems.php
 | ||||
| 
 | ||||
| //export const updateLoadout = (loadout: ISaveLoadoutRequest, accountId: string) => {};
 | ||||
| //TODO: avoid multiple saves for less db calls
 | ||||
| //TODO: change update functions to only add and not save
 | ||||
| 
 | ||||
| /* loadouts has loadoutconfigs | ||||
| operatorloadouts has itemconfig, but no multiple config ids | ||||
| itemconfig has multiple config ids | ||||
| */ | ||||
| 
 | ||||
| //support multiple loadouts and multiple items and multiple configs per item
 | ||||
| export const handleInventoryItemConfigChange = async ( | ||||
|     equipmentChanges: ISaveLoadoutRequestNoUpgradeVer, | ||||
|     accountId: string | ||||
| ) => { | ||||
|     const inventory = await getInventory(accountId); | ||||
| 
 | ||||
|     for (const [_equipmentName, _equipment] of Object.entries(equipmentChanges)) { | ||||
|         const equipment = _equipment as ISaveLoadoutRequestNoUpgradeVer[keyof ISaveLoadoutRequestNoUpgradeVer]; | ||||
|         const equipmentName = _equipmentName as keyof ISaveLoadoutRequestNoUpgradeVer; | ||||
| @ -34,12 +41,10 @@ export const handleInventoryItemConfigChange = async ( | ||||
|         switch (equipmentName) { | ||||
|             case "OperatorLoadOuts": | ||||
|             case "AdultOperatorLoadOuts": { | ||||
|                 console.log("loadout received", equipmentName); | ||||
| 
 | ||||
|                 const inventory = await getInventory(accountId); | ||||
|                 const operatorConfig = equipment as IOperatorConfigEntry; | ||||
|                 const operatorLoadout = inventory[equipmentName]; | ||||
| 
 | ||||
|                 console.log("loadout received", equipmentName, operatorConfig); | ||||
|                 // all non-empty entries are one loadout slot
 | ||||
|                 for (const [loadoutId, loadoutConfig] of Object.entries(operatorConfig)) { | ||||
|                     // console.log("loadoutId", loadoutId, "loadoutconfig", loadoutConfig);
 | ||||
| @ -123,20 +128,25 @@ export const handleInventoryItemConfigChange = async ( | ||||
|             case "LongGuns": | ||||
|             case "Pistols": | ||||
|             case "Suits": | ||||
|             case "Melee": { | ||||
|             case "Melee": | ||||
|             case "Scoops": | ||||
|             case "DataKnives": | ||||
|             case "DrifterMelee": | ||||
|             case "Sentinels": | ||||
|             case "Horses": { | ||||
|                 console.log("? ???? ?", equipmentName, equipment); | ||||
| 
 | ||||
|                 const itemEntry = equipment as IItemEntry; | ||||
|                 const itemEntries = equipment as IItemEntry; | ||||
|                 const inventory = await getInventory(accountId); | ||||
|                 for (const [itemId, itemConfig] of Object.entries(itemEntry)) { | ||||
|                     const inventoryItem = inventory[equipmentName].find(item => item._id.toString() === itemId); | ||||
|                 for (const [itemId, itemConfigEntries] of Object.entries(itemEntries)) { | ||||
|                     const inventoryItem = inventory[equipmentName].find(item => item._id?.toString() === itemId); | ||||
| 
 | ||||
|                     if (!inventoryItem) { | ||||
|                         throw new Error(`inventory item ${equipmentName} not found with id ${itemId}`); | ||||
|                     } | ||||
| 
 | ||||
|                     //config ids are 0,1,2 can there be a 3?
 | ||||
|                     for (const [configId, config] of Object.entries(itemConfig)) { | ||||
|                     for (const [configId, config] of Object.entries(itemConfigEntries)) { | ||||
|                         inventoryItem.Configs[parseInt(configId)] = config; | ||||
|                     } | ||||
|                 } | ||||
| @ -145,35 +155,40 @@ export const handleInventoryItemConfigChange = async ( | ||||
|             } | ||||
|             case "CurrentLoadOutIds": { | ||||
|                 //TODO: remove duplicate getInventory after finding out when currentloadOutId is sent
 | ||||
|                 const loadoutIds = equipment as IOid[]; | ||||
|                 const loadoutIds = equipment as IOid[]; // TODO: Check for more than just an array of oids, I think i remember one instance
 | ||||
|                 const inventory = await getInventory(accountId); | ||||
|                 inventory.CurrentLoadOutIds = loadoutIds; | ||||
|                 await inventory.save(); | ||||
|                 break; | ||||
|             } | ||||
|             case "EquippedGear": { | ||||
|                 inventory.EquippedGear = equipment as string[]; | ||||
|                 break; | ||||
|             } | ||||
|             default: { | ||||
|                 console.log("category not implemented", equipmentName); | ||||
|                 console.log("category not implemented", equipmentName, equipment); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         //case "OperatorAmps":
 | ||||
|         // case "Sentinels":
 | ||||
| 
 | ||||
|         // case "SentinelWeapons":
 | ||||
|         // case "KubrowPets":
 | ||||
|         // case "SpaceSuits":
 | ||||
|         // case "SpaceGuns":
 | ||||
|         // case "SpaceMelee":
 | ||||
|         // case "Scoops":
 | ||||
| 
 | ||||
|         // case "SpecialItems":
 | ||||
|         // case "MoaPets":
 | ||||
|         // case "Hoverboards":
 | ||||
|         // case "DataKnives":
 | ||||
| 
 | ||||
|         // case "MechSuits":
 | ||||
|         // case "CrewShipHarnesses":
 | ||||
|         // case "Horses":
 | ||||
|         // case "DrifterMelee":
 | ||||
| 
 | ||||
|         //
 | ||||
| 
 | ||||
|         // case "CrewShips":
 | ||||
|         //case "KahlLoadOuts": not sure yet how to handle kahl: it is not sent in inventory
 | ||||
|     } | ||||
|     await inventory.save(); | ||||
| }; | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| import { IOid } from "@/src/types/commonTypes"; | ||||
| import { IAbilityOverride, IColor, IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; | ||||
| import { IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; | ||||
| import { Types } from "mongoose"; | ||||
| import { IItemConfig } from "./commonInventoryTypes"; | ||||
| 
 | ||||
| export interface ISuitClient extends ISuitDatabase { | ||||
|     ItemId: IOid; | ||||
| @ -19,43 +20,5 @@ export interface ISuitDatabase { | ||||
|     FocusLens?: string; | ||||
|     UnlockLevel?: number; | ||||
|     _id: Types.ObjectId; | ||||
| } | ||||
| 
 | ||||
| interface IItemConfigBase { | ||||
|     Skins: string[]; | ||||
|     pricol?: IColor; | ||||
|     attcol?: IColor; | ||||
|     sigcol?: IColor; | ||||
|     eyecol?: IColor; | ||||
|     facial?: IColor; | ||||
|     syancol?: IColor; | ||||
|     cloth?: IColor; | ||||
|     Upgrades?: string[]; | ||||
|     Name?: string; | ||||
|     ugly?: boolean; | ||||
| } | ||||
| 
 | ||||
| export interface IItemConfig extends IItemConfigBase { | ||||
|     Songs?: ISong[]; | ||||
|     AbilityOverride?: IAbilityOverride; | ||||
|     PvpUpgrades?: string[]; | ||||
|     ugly?: boolean; | ||||
| } | ||||
| 
 | ||||
| export interface ISong { | ||||
|     m?: string; | ||||
|     b?: string; | ||||
|     p?: string; | ||||
|     s: string; | ||||
| } | ||||
| 
 | ||||
| //TODO: Consider renaming it to loadout instead of config
 | ||||
| export interface IOperatorConfigDatabase extends IItemConfigBase { | ||||
|     _id: Types.ObjectId; | ||||
|     AbilityOverride?: IAbilityOverride; // not present in adultOperator
 | ||||
|     OperatorAmp?: IOid; // not present in adultOperator
 | ||||
| } | ||||
| 
 | ||||
| export interface IOperatorConfigClient extends Omit<IOperatorConfigDatabase, "_id"> { | ||||
|     ItemId: IOid; | ||||
|     ItemId?: IOid; // only in response
 | ||||
| } | ||||
|  | ||||
| @ -1,3 +1,6 @@ | ||||
| import { IOid } from "@/src/types/commonTypes"; | ||||
| import { Types } from "mongoose"; | ||||
| 
 | ||||
| export interface IPolarity { | ||||
|     Slot: number; | ||||
|     Value: FocusSchool; | ||||
| @ -41,3 +44,44 @@ export interface Isigcol { | ||||
|     t1: number; | ||||
|     en: number; | ||||
| } | ||||
| 
 | ||||
| interface IItemConfigBase { | ||||
|     Skins: string[]; | ||||
|     pricol?: IColor; | ||||
|     attcol?: IColor; | ||||
|     sigcol?: IColor; | ||||
|     eyecol?: IColor; | ||||
|     facial?: IColor; | ||||
|     syancol?: IColor; | ||||
|     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 { | ||||
|     Songs?: ISong[]; | ||||
|     AbilityOverride?: IAbilityOverride; | ||||
|     PvpUpgrades?: string[]; | ||||
|     ugly?: boolean; | ||||
| } | ||||
| 
 | ||||
| export interface ISong { | ||||
|     m?: string; | ||||
|     b?: string; | ||||
|     p?: string; | ||||
|     s: string; | ||||
| } | ||||
| 
 | ||||
| //TODO: Consider renaming it to loadout instead of config
 | ||||
| export interface IOperatorConfigDatabase extends IItemConfigBase { | ||||
|     _id: Types.ObjectId; | ||||
|     AbilityOverride?: IAbilityOverride; // not present in adultOperator
 | ||||
|     OperatorAmp?: IOid; // not present in adultOperator
 | ||||
| } | ||||
| 
 | ||||
| export interface IOperatorConfigClient extends Omit<IOperatorConfigDatabase, "_id"> { | ||||
|     ItemId: IOid; | ||||
| } | ||||
|  | ||||
| @ -1,17 +1,24 @@ | ||||
| /* eslint-disable @typescript-eslint/no-explicit-any */ | ||||
| import { Document, Types } from "mongoose"; | ||||
| import { IOid, IMongoDate } from "../commonTypes"; | ||||
| import { IAbilityOverride, IColor, FocusSchool, IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; | ||||
| import { IOperatorConfigClient, ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes"; | ||||
| import { | ||||
|     IAbilityOverride, | ||||
|     IColor, | ||||
|     FocusSchool, | ||||
|     IPolarity, | ||||
|     IItemConfig, | ||||
|     IOperatorConfigClient | ||||
| } from "@/src/types/inventoryTypes/commonInventoryTypes"; | ||||
| import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes"; | ||||
| import { IOperatorLoadOutSigcol, IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes"; | ||||
| import { IItemConfig } from "@/src/types/saveLoadoutTypes"; | ||||
| 
 | ||||
| //Document extends will be deleted soon. TODO: delete and migrate uses to ...
 | ||||
| export interface IInventoryDatabaseDocument extends IInventoryDatabase, Document {} | ||||
| export interface IInventoryDatabase extends Omit<IInventoryResponse, "TrainingDate" | "LoadOutPresets"> { | ||||
| export interface IInventoryDatabase extends Omit<IInventoryResponse, "TrainingDate" | "LoadOutPresets" | "Mailbox"> { | ||||
|     accountOwnerId: Types.ObjectId; | ||||
|     TrainingDate: Date; // TrainingDate changed from IMongoDate to Date
 | ||||
|     LoadOutPresets: Types.ObjectId; // LoadOutPresets changed from ILoadOutPresets to Types.ObjectId for population
 | ||||
|     Mailbox: Types.ObjectId; // Mailbox changed from IMailbox to Types.ObjectId
 | ||||
| } | ||||
| 
 | ||||
| export interface IInventoryResponseDocument extends IInventoryResponse, Document {} | ||||
| @ -22,13 +29,25 @@ export interface IGenericItem { | ||||
|     Configs: IItemConfig[]; | ||||
|     UpgradeVer: number; | ||||
|     ItemId: IOid; | ||||
|     Features?: number; //space suit has this
 | ||||
| } | ||||
| 
 | ||||
| export interface IDuviriInfo { | ||||
|     Seed: number; | ||||
|     NumCompletions: number; | ||||
| } | ||||
| 
 | ||||
| export interface IMailbox { | ||||
|     LastInboxId: IOid; | ||||
| } | ||||
| 
 | ||||
| export interface IInventoryResponse { | ||||
|     KahlLoadOuts: IGenericItem[]; | ||||
|     DrifterMelee: IGenericItem[]; | ||||
|     Horses: IGenericItem[]; | ||||
|     DuviriInfo: { Seed: number; NumCompletions: number }; // TODO: add to schema
 | ||||
|     DrifterMelee: IGenericItem[]; | ||||
|     DrifterGuns: IGenericItem[]; | ||||
|     DuviriInfo: IDuviriInfo; | ||||
|     Mailbox: IMailbox; | ||||
|     KahlLoadOuts: IGenericItem[]; | ||||
|     SubscribedToEmails: number; | ||||
|     Created: IMongoDate; | ||||
|     RewardSeed: number; | ||||
| @ -41,9 +60,13 @@ export interface IInventoryResponse { | ||||
|     SentinelBin: ISlots; | ||||
|     SpaceSuitBin: ISlots; | ||||
|     SpaceWeaponBin: ISlots; | ||||
|     PvpBonusLoadoutBin: ICrewMemberBinClass; | ||||
|     PvpBonusLoadoutBin: ISlots; | ||||
|     PveBonusLoadoutBin: ISlots; | ||||
|     RandomModBin: ISlots; | ||||
|     MechBin: ISlots; | ||||
|     CrewMemberBin: ISlots; | ||||
|     OperatorAmpBin: ISlots; | ||||
|     CrewShipSalvageBin: ISlots; | ||||
|     TradesRemaining: number; | ||||
|     DailyAffiliation: number; | ||||
|     DailyAffiliationPvp: number; | ||||
| @ -63,7 +86,7 @@ export interface IInventoryResponse { | ||||
|     Ships: IShip[]; | ||||
|     QuestKeys: IQuestKey[]; | ||||
|     FlavourItems: IFlavourItem[]; | ||||
|     Scoops: IScoop[]; | ||||
|     Scoops: IGenericItem[]; | ||||
|     TrainingRetriesLeft: number; | ||||
|     LoadOutPresets: ILoadOutPresets; | ||||
|     CurrentLoadOutIds: Array<any[] | IOid>; | ||||
| @ -97,14 +120,14 @@ export interface IInventoryResponse { | ||||
|     Affiliations: IAffiliation[]; | ||||
|     QualifyingInvasions: any[]; | ||||
|     FactionScores: number[]; | ||||
|     SpaceSuits: ISpace[]; | ||||
|     SpaceMelee: ISpace[]; | ||||
|     SpaceSuits: IGenericItem[]; | ||||
|     SpaceMelee: IGenericItem[]; | ||||
|     SpaceGuns: ISpaceGun[]; | ||||
|     ArchwingEnabled: boolean; | ||||
|     PendingSpectreLoadouts: any[]; | ||||
|     SpectreLoadouts: ISpectreLoadout[]; | ||||
|     SentinelWeapons: ISentinelWeapon[]; | ||||
|     Sentinels: ISentinel[]; | ||||
|     SentinelWeapons: IWeaponDatabase[]; | ||||
|     Sentinels: IWeaponDatabase[]; | ||||
|     EmailItems: IEmailItem[]; | ||||
|     CompletedSyndicates: string[]; | ||||
|     FocusXP: IFocusXP; | ||||
| @ -117,7 +140,6 @@ export interface IInventoryResponse { | ||||
|     ActiveAvatarImageType: string; | ||||
|     KubrowPets: IKubrowPet[]; | ||||
|     ShipDecorations: IConsumable[]; | ||||
|     OperatorAmpBin: ISlots; | ||||
|     DailyAffiliationCetus: number; | ||||
|     DailyAffiliationQuills: number; | ||||
|     DiscoveredMarkers: IDiscoveredMarker[]; | ||||
| @ -149,13 +171,12 @@ export interface IInventoryResponse { | ||||
|     MoaPets: IMoaPet[]; | ||||
|     EquippedInstrument: string; | ||||
|     InvasionChainProgress: IInvasionChainProgress[]; | ||||
|     DataKnives: IDataKnife[]; | ||||
|     DataKnives: IGenericItem[]; | ||||
|     NemesisHistory: INemesisHistory[]; | ||||
|     LastNemesisAllySpawnTime: IMongoDate; | ||||
|     Settings: ISettings; | ||||
|     PersonalTechProjects: IPersonalTechProject[]; | ||||
|     CrewShips: ICrewShip[]; | ||||
|     CrewShipSalvageBin: ISlots; | ||||
|     PlayerSkills: IPlayerSkills; | ||||
|     CrewShipAmmo: IConsumable[]; | ||||
|     CrewShipSalvagedWeaponSkins: ICrewShipSalvagedWeaponSkin[]; | ||||
| @ -165,13 +186,11 @@ export interface IInventoryResponse { | ||||
|     TradeBannedUntil: IMongoDate; | ||||
|     PlayedParkourTutorial: boolean; | ||||
|     SubscribedToEmailsPersonalized: number; | ||||
|     MechBin: ICrewMemberBinClass; | ||||
|     DailyAffiliationEntrati: number; | ||||
|     DailyAffiliationNecraloid: number; | ||||
|     MechSuits: IMechSuit[]; | ||||
|     MechSuits: ISuitDatabase[]; | ||||
|     InfestedFoundry: IInfestedFoundry; | ||||
|     BlessingCooldown: IMongoDate; | ||||
|     CrewMemberBin: ICrewMemberBinClass; | ||||
|     CrewShipHarnesses: ICrewShipHarness[]; | ||||
|     CrewShipRawSalvage: IConsumable[]; | ||||
|     CrewMembers: ICrewMember[]; | ||||
| @ -275,10 +294,6 @@ export interface IConsumable { | ||||
|     ItemType: string; | ||||
| } | ||||
| 
 | ||||
| export interface ICrewMemberBinClass { | ||||
|     Slots: number; | ||||
| } | ||||
| 
 | ||||
| export interface ICrewMember { | ||||
|     ItemType: string; | ||||
|     NemesisFingerprint: number; | ||||
| @ -418,22 +433,6 @@ export interface IPortGuns { | ||||
|     PRIMARY_A: IL; | ||||
| } | ||||
| 
 | ||||
| export interface IDataKnife { | ||||
|     ItemType: string; | ||||
|     XP: number; | ||||
|     Configs: IDataKnifeConfig[]; | ||||
|     UpgradeVer: number; | ||||
|     ItemId: IOid; | ||||
| } | ||||
| 
 | ||||
| export interface IDataKnifeConfig { | ||||
|     Upgrades?: string[]; | ||||
|     pricol?: IColor; | ||||
|     Skins: string[]; | ||||
|     attcol?: IColor; | ||||
|     sigcol?: IColor; | ||||
| } | ||||
| 
 | ||||
| export interface IDiscoveredMarker { | ||||
|     tag: string; | ||||
|     discoveryState: number[]; | ||||
| @ -733,17 +732,6 @@ export interface ILotusCustomization { | ||||
|     Persona: string; | ||||
| } | ||||
| 
 | ||||
| export interface IMechSuit { | ||||
|     ItemType: string; | ||||
|     Configs: IDataKnifeConfig[]; | ||||
|     Features: number; | ||||
|     UpgradeVer: number; | ||||
|     XP: number; | ||||
|     Polarity: IPolarity[]; | ||||
|     Polarized: number; | ||||
|     ItemId: IOid; | ||||
| } | ||||
| 
 | ||||
| export interface IMission { | ||||
|     Completes: number; | ||||
|     Tier?: number; | ||||
| @ -932,6 +920,7 @@ export interface IQuestKey { | ||||
|     Progress?: IProgress[]; | ||||
|     unlock?: boolean; | ||||
|     Completed?: boolean; | ||||
|     CustomData?: string; | ||||
|     ItemType: string; | ||||
|     CompletionDate?: IMongoDate; | ||||
| } | ||||
| @ -949,17 +938,6 @@ export interface IRawUpgrade { | ||||
|     LastAdded?: IOid; | ||||
| } | ||||
| 
 | ||||
| export interface IScoop { | ||||
|     ItemType: string; | ||||
|     Configs: IScoopConfig[]; | ||||
|     UpgradeVer: number; | ||||
|     ItemId: IOid; | ||||
| } | ||||
| 
 | ||||
| export interface IScoopConfig { | ||||
|     pricol?: IColor; | ||||
| } | ||||
| 
 | ||||
| export interface ISeasonChallengeHistory { | ||||
|     challenge: string; | ||||
|     id: string; | ||||
| @ -969,40 +947,6 @@ export interface ISentientSpawnChanceBoosters { | ||||
|     numOceanMissionsCompleted: number; | ||||
| } | ||||
| 
 | ||||
| export interface ISentinelWeapon { | ||||
|     ItemType: string; | ||||
|     Configs: ISentinelWeaponConfig[]; | ||||
|     UpgradeVer?: number; | ||||
|     XP?: number; | ||||
|     ItemId: IOid; | ||||
|     Features?: number; | ||||
|     Polarity?: IPolarity[]; | ||||
|     Polarized?: number; | ||||
| } | ||||
| 
 | ||||
| export interface ISentinelWeaponConfig { | ||||
|     Skins?: FluffySkin[]; | ||||
|     Upgrades?: string[]; | ||||
| } | ||||
| 
 | ||||
| export enum FluffySkin { | ||||
|     Empty = "", | ||||
|     LotusUpgradesSkinsHolsterCustomizationsGlaiveInPlace = "/Lotus/Upgrades/Skins/HolsterCustomizations/GlaiveInPlace", | ||||
|     LotusUpgradesSkinsHolsterCustomizationsPistolHipsR = "/Lotus/Upgrades/Skins/HolsterCustomizations/PistolHipsR", | ||||
|     LotusUpgradesSkinsHolsterCustomizationsRifleUpperBack = "/Lotus/Upgrades/Skins/HolsterCustomizations/RifleUpperBack" | ||||
| } | ||||
| 
 | ||||
| export interface ISentinel { | ||||
|     ItemType: string; | ||||
|     Configs: IKubrowPetConfig[]; | ||||
|     UpgradeVer: number; | ||||
|     XP: number; | ||||
|     Features?: number; | ||||
|     Polarity?: IPolarity[]; | ||||
|     Polarized?: number; | ||||
|     ItemId: IOid; | ||||
| } | ||||
| 
 | ||||
| export interface ISettings { | ||||
|     FriendInvRestriction: string; | ||||
|     GiftMode: string; | ||||
| @ -1038,15 +982,6 @@ export interface ISpaceGunConfig { | ||||
|     Upgrades?: string[]; | ||||
| } | ||||
| 
 | ||||
| export interface ISpace { | ||||
|     ItemType: string; | ||||
|     Configs: IKubrowPetConfig[]; | ||||
|     XP: number; | ||||
|     UpgradeVer: number; | ||||
|     ItemId: IOid; | ||||
|     Features?: number; | ||||
| } | ||||
| 
 | ||||
| export interface ISpecialItem { | ||||
|     ItemType: string; | ||||
|     Configs: ISpecialItemConfig[]; | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| import { IOid } from "@/src/types/commonTypes"; | ||||
| import { IItemConfig } from "@/src/types/inventoryTypes/SuitTypes"; | ||||
| import { IItemConfig } from "./commonInventoryTypes"; | ||||
| import { IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; | ||||
| import { Types } from "mongoose"; | ||||
| 
 | ||||
|  | ||||
| @ -40,5 +40,6 @@ export type IBinChanges = { | ||||
| 
 | ||||
| export enum SlotType { | ||||
|     SUIT = "SuitBin", | ||||
|     WEAPON = "WeaponBin" | ||||
|     WEAPON = "WeaponBin", | ||||
|     MECHSUIT = "MechBin" | ||||
| } | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| import { IOid } from "@/src/types/commonTypes"; | ||||
| import { IItemConfig, IOperatorConfigClient } from "@/src/types/inventoryTypes/SuitTypes"; | ||||
| import { IItemConfig, IOperatorConfigClient } from "@/src/types/inventoryTypes/commonInventoryTypes"; | ||||
| import { Types } from "mongoose"; | ||||
| 
 | ||||
| export interface ISaveLoadoutRequest { | ||||
| @ -31,6 +31,7 @@ export interface ISaveLoadoutRequest { | ||||
|     CrewShips: IItemEntry; | ||||
|     CurrentLoadOutIds: IOid[]; | ||||
|     ValidNewLoadoutId: string; | ||||
|     EquippedGear: string[]; | ||||
| } | ||||
| 
 | ||||
| export interface ISaveLoadoutRequestNoUpgradeVer extends Omit<ISaveLoadoutRequest, "UpgradeVer"> {} | ||||
| @ -89,4 +90,3 @@ export interface IEquipmentSelection { | ||||
|     mod: number; | ||||
|     cus: number; | ||||
| } | ||||
| export { IItemConfig }; | ||||
|  | ||||
| @ -5,7 +5,7 @@ | ||||
|   "RewardSeed": -5604904486637265640, | ||||
|   "CrewMemberBin": { "Slots": 3 }, | ||||
|   "CrewShipSalvageBin": { "Slots": 8 }, | ||||
|   "DrifterMelee": [{ "ItemType": "/Lotus/Types/Friendly/PlayerControllable/Weapons/DuviriDualSwords", "ItemId": { "$oid": "647bd268c547fe5b2909e715" } }], | ||||
|   "DrifterMelee": [{ "ItemType": "/Lotus/Types/Friendly/PlayerControllable/Weapons/DuviriDualSwords", "ItemId": { "$oid": "647bd27cf856530b4f3bf343" } }], | ||||
|   "FusionPoints": 0, | ||||
|   "MechBin": { "Slots": 4 }, | ||||
|   "OperatorAmpBin": { "Slots": 8 }, | ||||
| @ -84,7 +84,24 @@ | ||||
|   "CrewShipWeaponSkins": [], | ||||
|   "DrifterGuns": [], | ||||
|   "Drones": [], | ||||
|   "Horses": [], | ||||
|   "Horses": [ | ||||
|     { | ||||
|       "ItemType": "/Lotus/Types/NeutralCreatures/ErsatzHorse/ErsatzHorsePowerSuit", | ||||
|       "Configs": [ | ||||
|         { | ||||
|           "Skins": ["", "", "/Lotus/Upgrades/Skins/Horse/ErsatzHorseTailDefault"] | ||||
|         }, | ||||
|         { | ||||
|           "Skins": ["", "", "/Lotus/Upgrades/Skins/Horse/ErsatzHorseTailDefault"] | ||||
|         }, | ||||
|         { | ||||
|           "Skins": ["", "", "/Lotus/Upgrades/Skins/Horse/ErsatzHorseTailDefault"] | ||||
|         } | ||||
|       ], | ||||
|       "UpgradeVer": 101, | ||||
|       "ItemId": { "$oid": "647bd27cf856530b4f3bf343" } | ||||
|     } | ||||
|   ], | ||||
|   "Hoverboards": [], | ||||
|   "KubrowPets": [], | ||||
|   "KubrowPetEggs": [], | ||||
|  | ||||
| @ -7,5 +7,35 @@ | ||||
|   }, | ||||
|   { | ||||
|     "ItemType": "/Lotus/Types/Keys/DuviriQuest/DuviriQuestKeyChain" | ||||
|   }, | ||||
|   { | ||||
|     "ItemType": "/Lotus/Types/Keys/WarWithinQuest/WarWithinQuestKeyChain" | ||||
|   }, | ||||
|   { | ||||
|     "ItemType": "/Lotus/Types/Keys/SacrificeQuest/SacrificeQuestKeyChain" | ||||
|   }, | ||||
|   { | ||||
|     "ItemType": "/Lotus/Types/Keys/NewWarIntroQuest/NewWarIntroKeyChain" | ||||
|   }, | ||||
|   { | ||||
|     "ItemType": "/Lotus/Types/Keys/NewWarQuest/NewWarQuestKeyChain" | ||||
|   }, | ||||
|   { | ||||
|     "ItemType": "/Lotus/Types/Keys/ApostasyQuest/ApostasyKeyChain" | ||||
|   }, | ||||
|   { | ||||
|     "ItemType": "/Lotus/Types/Keys/WarWithinQuest/WarWithinQuestKeyChain" | ||||
|   }, | ||||
|   { | ||||
|     "ItemType": "/Lotus/Types/Keys/OrokinMoonQuest/OrokinMoonQuestKeyChain" | ||||
|   }, | ||||
|   { | ||||
|     "ItemType": "/Lotus/Types/Keys/ZarimanQuest/ZarimanQuestKeyChain" | ||||
|   }, | ||||
|   { | ||||
|     "ItemType": "/Lotus/Types/Keys/DuviriQuest/DuviriQuestKeyChain" | ||||
|   }, | ||||
|   { | ||||
|     "ItemType": "/Lotus/Types/Keys/ArchwingQuest/ArchwingQuestKeyChain" | ||||
|   } | ||||
| ] | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user