more inventory schemas

This commit is contained in:
Ordis 2024-02-12 14:28:02 +01:00
parent 8156036203
commit 3d87d6ce6f
10 changed files with 823 additions and 464 deletions

3
.gitignore vendored
View File

@ -11,3 +11,6 @@ yarn.lock
# logs
/logs
# MongoDB VSCode extension playground scripts
/database_scripts

View File

@ -6,7 +6,7 @@
"worldSeed": "qihVmIIyYXz0E4+01UjY+ROEiAB7x3k40ZaCUtVLEF17u9TXVita+jHZRuMLB6OT8GOfX8C+kqkyrT26AJEHFV0IDUkoZ1bntDSBL6wN36tq+ttsN/8NIcy1eGIyLzHn1Cosbtp8ykPhIaFKWlWP6v0QUBObIT11xLXF8fd+7cAEUcPygnS6WK048KEjMldK5bXIkkg9NV7ZXWLhNfTVG0mN0VluNUKDlc/JCiYRkxvparpn7xKwFpxqZJIeYhOz/zaktlEcVFxxB6ewd/X+XNq7+SkPUw5btQKQeYax1AxBZHzCk0XF1ihRQKPdMeVzXIRq43Yf/8emu8siIC4dFA==",
"skipStoryModeChoice": true,
"skipTutorial": true,
"testMission": true,
"testQuestKey": true,
"unlockAllMissions": true,
"unlockAllQuests": false,
"infiniteResources": true
}

68
package-lock.json generated
View File

@ -235,9 +235,9 @@
}
},
"node_modules/@mongodb-js/saslprep": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.1.tgz",
"integrity": "sha512-t7c5K033joZZMspnHg/gWPE4kandgc2OxE74aYOtGKfgB9VPuVJPix0H6fhmm2erj5PBJ21mqcx34lpIGtUCsQ==",
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.4.tgz",
"integrity": "sha512-8zJ8N1x51xo9hwPh6AWnKdLGEC5N3lDa6kms1YHmFBoRhTpJR6HG8wWk0td1MVCu9cD4YBrvjZEtd5Obw0Fbnw==",
"dependencies": {
"sparse-bitfield": "^3.0.3"
}
@ -394,7 +394,8 @@
"node_modules/@types/node": {
"version": "18.16.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz",
"integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q=="
"integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==",
"dev": true
},
"node_modules/@types/qs": {
"version": "6.9.7",
@ -457,11 +458,10 @@
"integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA=="
},
"node_modules/@types/whatwg-url": {
"version": "8.2.2",
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz",
"integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==",
"version": "11.0.4",
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.4.tgz",
"integrity": "sha512-lXCmTWSHJvf0TRSO58nm978b8HJ/EdsSsEKLd3ODHFjo+3VGAyyTp4v50nWvwtzBxSMQrVOK7tcuN0zGPLICMw==",
"dependencies": {
"@types/node": "*",
"@types/webidl-conversions": "*"
}
},
@ -1178,9 +1178,9 @@
}
},
"node_modules/bson": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/bson/-/bson-6.2.0.tgz",
"integrity": "sha512-ID1cI+7bazPDyL9wYy9GaQ8gEEohWvcUl/Yf0dIdutJxnmInEEyCsb4awy/OiBfall7zBA179Pahi3vCdFze3Q==",
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/bson/-/bson-6.3.0.tgz",
"integrity": "sha512-balJfqwwTBddxfnidJZagCBPP/f48zj9Sdp3OJswREOgsJzHiQSaOIAtApSgDQFYgHqAvFkp53AFSqjMDZoTFw==",
"engines": {
"node": ">=16.20.1"
}
@ -2639,13 +2639,13 @@
}
},
"node_modules/mongodb": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.2.0.tgz",
"integrity": "sha512-d7OSuGjGWDZ5usZPqfvb36laQ9CPhnWkAGHT61x5P95p/8nMVeH8asloMwW6GcYFeB0Vj4CB/1wOTDG2RA9BFA==",
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.3.0.tgz",
"integrity": "sha512-tt0KuGjGtLUhLoU263+xvQmPHEGTw5LbcNC73EoFRYgSHwZt5tsoJC110hDyO1kjQzpgNrpdcSza9PknWN4LrA==",
"dependencies": {
"@mongodb-js/saslprep": "^1.1.0",
"bson": "^6.2.0",
"mongodb-connection-string-url": "^2.6.0"
"mongodb-connection-string-url": "^3.0.0"
},
"engines": {
"node": ">=16.20.1"
@ -2684,22 +2684,22 @@
}
},
"node_modules/mongodb-connection-string-url": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz",
"integrity": "sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ==",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.0.tgz",
"integrity": "sha512-t1Vf+m1I5hC2M5RJx/7AtxgABy1cZmIPQRMXw+gEIPn/cZNF3Oiy+l0UIypUwVB5trcWHq3crg2g3uAR9aAwsQ==",
"dependencies": {
"@types/whatwg-url": "^8.2.1",
"whatwg-url": "^11.0.0"
"@types/whatwg-url": "^11.0.2",
"whatwg-url": "^13.0.0"
}
},
"node_modules/mongoose": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.0.2.tgz",
"integrity": "sha512-Vsi9GzTXjdBVzheT1HZOZ2jHNzzR9Xwb5OyLz/FvDEAhlwrRnXnuqJf0QHINUOQSm7aoyvnPks0q85HJkd6yDw==",
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.1.1.tgz",
"integrity": "sha512-DbLb0NsiEXmaqLOpEz+AtAsgwhRw6f25gwa1dF5R7jj6lS1D8X6uTdhBSC8GDVtOwe5Tfw2EL7nTn6hiJT3Bgg==",
"dependencies": {
"bson": "^6.2.0",
"kareem": "2.5.1",
"mongodb": "6.2.0",
"mongodb": "6.3.0",
"mpath": "0.9.0",
"mquery": "5.0.0",
"ms": "2.1.3",
@ -3701,14 +3701,14 @@
}
},
"node_modules/tr46": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
"integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz",
"integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==",
"dependencies": {
"punycode": "^2.1.1"
"punycode": "^2.3.0"
},
"engines": {
"node": ">=12"
"node": ">=14"
}
},
"node_modules/tree-kill": {
@ -3986,15 +3986,15 @@
}
},
"node_modules/whatwg-url": {
"version": "11.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz",
"integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==",
"version": "13.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-13.0.0.tgz",
"integrity": "sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==",
"dependencies": {
"tr46": "^3.0.0",
"tr46": "^4.1.1",
"webidl-conversions": "^7.0.0"
},
"engines": {
"node": ">=12"
"node": ">=16"
}
},
"node_modules/which": {

View File

@ -3,8 +3,8 @@ import { toInventoryResponse } from "@/src/helpers/inventoryHelpers";
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
import { Request, RequestHandler, Response } from "express";
import config from "@/config.json";
import testMissions from "@/static/fixed_responses/testMissions.json";
import testQuestKeys from "@/static/fixed_responses/testQuestKeys.json";
import allMissions from "@/static/fixed_responses/allMissions.json";
import allQuestKeys from "@/static/fixed_responses/allQuestKeys.json";
import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
const inventoryController: RequestHandler = async (request: Request, response: Response) => {
@ -29,8 +29,8 @@ const inventoryController: RequestHandler = async (request: Request, response: R
const inventoryResponse = toInventoryResponse(inventoryJSON);
if (config.testMission) inventoryResponse.Missions = testMissions;
if (config.testQuestKey) inventoryResponse.QuestKeys = testQuestKeys;
if (config.unlockAllMissions) inventoryResponse.Missions = allMissions;
if (config.unlockAllQuests) inventoryResponse.QuestKeys = allQuestKeys;
response.json(inventoryResponse);
};

View File

@ -12,3 +12,7 @@ export const toInventoryResponse = (inventoryDatabase: IInventoryDatabase): IInv
export const toOid = (objectId: Types.ObjectId) => {
return { $oid: objectId.toString() } satisfies IOid;
};
export const toMongoDate = (date: Date) => {
return { $date: { $numberLong: date.getTime().toString() } };
};

File diff suppressed because it is too large Load Diff

View File

@ -15,16 +15,66 @@ import { IOperatorLoadOutSigcol, IWeaponDatabase } from "@/src/types/inventoryTy
//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" | "Mailbox" | "PendingRecipes"> {
extends Omit<
IInventoryResponse,
"TrainingDate" | "LoadOutPresets" | "Mailbox" | "PendingRecipes" | "Created" | "QuestKeys" | "BlessingCooldown"
> {
accountOwnerId: Types.ObjectId;
Created: Date;
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
PendingRecipes: IPendingRecipe[];
QuestKeys: IQuestKeyDatabase[];
BlessingCooldown: Date;
}
export interface IInventoryResponseDocument extends IInventoryResponse, Document {}
export interface IQuestKeyDatabase {
Progress?: IQuestProgress[];
unlock?: boolean;
Completed?: boolean;
CustomData?: string; //TODO: check whether this actually exists
ItemType: string;
CompletionDate?: Date;
}
export interface IFocusUpgrades {
ItemType: string;
Level: number;
IsUniversal: boolean;
}
export interface ITypeCount {
ItemType: string;
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;
@ -91,7 +141,7 @@ export interface IInventoryResponse {
Pistols: IWeaponDatabase[];
Melee: IWeaponDatabase[];
Ships: IShip[];
QuestKeys: IQuestKey[];
QuestKeys: IQuestKeyResponse[];
FlavourItems: IFlavourItem[];
Scoops: IGenericItem[];
TrainingRetriesLeft: number;
@ -100,8 +150,8 @@ export interface IInventoryResponse {
Missions: IMission[];
RandomUpgradesIdentified: number;
LastRegionPlayed: string;
XPInfo: IEmailItem[];
Recipes: IConsumable[];
XPInfo: ITypeXPItem[];
Recipes: ITypeCount[];
WeaponSkins: IWeaponSkin[];
PendingRecipes: IPendingRecipeResponse[];
TrainingDate: IMongoDate;
@ -116,7 +166,7 @@ export interface IInventoryResponse {
LevelKeys: IConsumable[];
TauntHistory: ITauntHistory[];
StoryModeChoice: string;
PeriodicMissionCompletions: IPeriodicMissionCompletion[];
PeriodicMissionCompletions: IPeriodicMissionCompletionDatabase[];
KubrowPetEggs: IKubrowPetEgg[];
LoreFragmentScans: ILoreFragmentScan[];
EquippedEmotes: string[];
@ -135,7 +185,7 @@ export interface IInventoryResponse {
SpectreLoadouts: ISpectreLoadout[];
SentinelWeapons: IWeaponDatabase[];
Sentinels: IWeaponDatabase[];
EmailItems: IEmailItem[];
EmailItems: ITypeXPItem[];
CompletedSyndicates: string[];
FocusXP: IFocusXP;
Wishlist: string[];
@ -160,7 +210,7 @@ export interface IInventoryResponse {
AlignmentReplay: IAlignment;
PersonalGoalProgress: IPersonalGoalProgress[];
DailyAffiliationSolaris: number;
SpecialItems: ISpecialItem[];
SpecialItems: IGenericItem2[];
ThemeStyle: string;
ThemeBackground: string;
ThemeSounds: string;
@ -395,17 +445,27 @@ export interface ISlot {
}
export interface ICustomization {
CrewshipInterior: ITerior;
CrewshipInterior: IShipExterior;
}
export interface ITerior {
export interface IShipExterior {
SkinFlavourItem: string;
Colors: IColor;
Colors: IShipExteriorColors;
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;
HOOD_ORNAMENT: string; //TODO: Others are probably possible
}
export interface IFlavourItem {
@ -452,7 +512,7 @@ export interface IDrone {
RepairStart?: IMongoDate;
}
export interface IEmailItem {
export interface ITypeXPItem {
ItemType: string;
XP: number;
}
@ -511,7 +571,7 @@ export interface ISigcol {
export interface IInfestedFoundry {
Name: string;
Resources: IResource[];
Resources: ITypeCount[];
Slots: number;
XP: number;
ConsumedSuits: IConsumedSuit[];
@ -525,11 +585,6 @@ export interface IConsumedSuit {
c?: IColor;
}
export interface IResource {
ItemType: string;
Count: number;
}
export interface IInvasionChainProgress {
id: IOid;
count: number;
@ -881,12 +936,16 @@ export enum GivingSlotOrderInfo {
LotusUpgradesModsPistolDualStatElectEventPistolMod = "/Lotus/Upgrades/Mods/Pistol/DualStat/ElectEventPistolMod"
}
export interface IPeriodicMissionCompletion {
date: IMongoDate;
export interface IPeriodicMissionCompletionDatabase {
date: Date;
tag: string;
count?: number;
}
export interface IPeriodicMissionCompletionResponse extends Omit<IPeriodicMissionCompletionDatabase, "date"> {
date: IMongoDate;
}
export interface IPersonalGoalProgress {
Count: number;
Tag: string;
@ -923,16 +982,11 @@ export interface IPlayerSkills {
LPS_DRIFT_ENDURANCE: number;
}
export interface IQuestKey {
Progress?: IProgress[];
unlock?: boolean;
Completed?: boolean;
CustomData?: string;
ItemType: string;
export interface IQuestKeyResponse extends Omit<IQuestKeyDatabase, "CompletionDate"> {
CompletionDate?: IMongoDate;
}
export interface IProgress {
export interface IQuestProgress {
c: number;
i: boolean;
m: boolean;
@ -964,7 +1018,7 @@ export interface ISettings {
export interface IShip {
ItemType: string;
ShipExterior: ITerior;
ShipExterior: IShipExterior;
AirSupportPower: string;
ItemId: IOid;
}
@ -989,28 +1043,6 @@ export interface ISpaceGunConfig {
Upgrades?: string[];
}
export interface ISpecialItem {
ItemType: string;
Configs: ISpecialItemConfig[];
XP?: number;
UpgradeVer?: number;
Features: number;
ItemId: IOid;
Polarized?: number;
Polarity?: IPolarity[];
ModSlotPurchases?: number;
}
export interface ISpecialItemConfig {
Upgrades?: string[];
pricol?: IColor;
Skins?: string[];
attcol?: IColor;
eyecol?: IPurpleCol;
sigcol?: IPurpleCol;
Name?: string;
}
export interface IPurpleCol {
en: number;
}

View File

@ -1,6 +1,5 @@
{
"SubscribedToEmails": 0,
"Created": { "$date": { "$numberLong": "1685829131" } },
"SubscribedToEmailsPersonalized": 0,
"RewardSeed": -5604904486637265640,
"CrewMemberBin": { "Slots": 3 },