返回提交历史
Modified
.gitignore
+4
-1
Modified
config.json
+2
-2
Modified
package-lock.json
+34
-34
Modified
src/controllers/api/inventoryController.ts
+4
-4
Modified
src/helpers/inventoryHelpers.ts
+4
-0
Modified
src/models/inventoryModels/inventoryModel.ts
+692
-371
Modified
src/types/inventoryTypes/inventoryTypes.ts
+82
-50
Renamed
static/fixed_responses/allMissions.json
+0
-0
Renamed
static/fixed_responses/allQuestKeys.json
+0
-0
Modified
static/fixed_responses/postTutorialInventory.json
+0
-1
XFEstudio/SpaceNinjaServer
feat: more inventory schemas (#131)
91ced2c7
代码差异
10 个文件
+822
-463
@@ -10,4 +10,7 @@ yarn.lock
10
10
.idea/
11
11
12
12
# logs
13
/logs
13
/logs
14
15
# MongoDB VSCode extension playground scripts
16
/database_scripts
@@ -6,7 +6,7 @@
6
6
"worldSeed": "qihVmIIyYXz0E4+01UjY+ROEiAB7x3k40ZaCUtVLEF17u9TXVita+jHZRuMLB6OT8GOfX8C+kqkyrT26AJEHFV0IDUkoZ1bntDSBL6wN36tq+ttsN/8NIcy1eGIyLzHn1Cosbtp8ykPhIaFKWlWP6v0QUBObIT11xLXF8fd+7cAEUcPygnS6WK048KEjMldK5bXIkkg9NV7ZXWLhNfTVG0mN0VluNUKDlc/JCiYRkxvparpn7xKwFpxqZJIeYhOz/zaktlEcVFxxB6ewd/X+XNq7+SkPUw5btQKQeYax1AxBZHzCk0XF1ihRQKPdMeVzXIRq43Yf/8emu8siIC4dFA==",
7
7
"skipStoryModeChoice": true,
8
8
"skipTutorial": true,
9
"testMission": true,
10
"testQuestKey": true,
9
"unlockAllMissions": true,
10
"unlockAllQuests": false,
11
11
"infiniteResources": true
12
12
}
@@ -235,9 +235,9 @@
235
235
}
236
236
},
237
237
"node_modules/@mongodb-js/saslprep": {
238
"version": "1.1.1",
239
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.1.tgz",
240
"integrity": "sha512-t7c5K033joZZMspnHg/gWPE4kandgc2OxE74aYOtGKfgB9VPuVJPix0H6fhmm2erj5PBJ21mqcx34lpIGtUCsQ==",
238
"version": "1.1.4",
239
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.4.tgz",
240
"integrity": "sha512-8zJ8N1x51xo9hwPh6AWnKdLGEC5N3lDa6kms1YHmFBoRhTpJR6HG8wWk0td1MVCu9cD4YBrvjZEtd5Obw0Fbnw==",
241
241
"dependencies": {
242
242
"sparse-bitfield": "^3.0.3"
243
243
}
@@ -394,7 +394,8 @@
394
394
"node_modules/@types/node": {
395
395
"version": "18.16.3",
396
396
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz",
397
"integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q=="
397
"integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==",
398
"dev": true
398
399
},
399
400
"node_modules/@types/qs": {
400
401
"version": "6.9.7",
@@ -457,11 +458,10 @@
457
458
"integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA=="
458
459
},
459
460
"node_modules/@types/whatwg-url": {
460
"version": "8.2.2",
461
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz",
462
"integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==",
461
"version": "11.0.4",
462
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.4.tgz",
463
"integrity": "sha512-lXCmTWSHJvf0TRSO58nm978b8HJ/EdsSsEKLd3ODHFjo+3VGAyyTp4v50nWvwtzBxSMQrVOK7tcuN0zGPLICMw==",
463
464
"dependencies": {
464
"@types/node": "*",
465
465
"@types/webidl-conversions": "*"
466
466
}
467
467
},
@@ -1178,9 +1178,9 @@
1178
1178
}
1179
1179
},
1180
1180
"node_modules/bson": {
1181
"version": "6.2.0",
1182
"resolved": "https://registry.npmjs.org/bson/-/bson-6.2.0.tgz",
1183
"integrity": "sha512-ID1cI+7bazPDyL9wYy9GaQ8gEEohWvcUl/Yf0dIdutJxnmInEEyCsb4awy/OiBfall7zBA179Pahi3vCdFze3Q==",
1181
"version": "6.3.0",
1182
"resolved": "https://registry.npmjs.org/bson/-/bson-6.3.0.tgz",
1183
"integrity": "sha512-balJfqwwTBddxfnidJZagCBPP/f48zj9Sdp3OJswREOgsJzHiQSaOIAtApSgDQFYgHqAvFkp53AFSqjMDZoTFw==",
1184
1184
"engines": {
1185
1185
"node": ">=16.20.1"
1186
1186
}
@@ -2639,13 +2639,13 @@
2639
2639
}
2640
2640
},
2641
2641
"node_modules/mongodb": {
2642
"version": "6.2.0",
2643
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.2.0.tgz",
2644
"integrity": "sha512-d7OSuGjGWDZ5usZPqfvb36laQ9CPhnWkAGHT61x5P95p/8nMVeH8asloMwW6GcYFeB0Vj4CB/1wOTDG2RA9BFA==",
2642
"version": "6.3.0",
2643
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.3.0.tgz",
2644
"integrity": "sha512-tt0KuGjGtLUhLoU263+xvQmPHEGTw5LbcNC73EoFRYgSHwZt5tsoJC110hDyO1kjQzpgNrpdcSza9PknWN4LrA==",
2645
2645
"dependencies": {
2646
2646
"@mongodb-js/saslprep": "^1.1.0",
2647
2647
"bson": "^6.2.0",
2648
"mongodb-connection-string-url": "^2.6.0"
2648
"mongodb-connection-string-url": "^3.0.0"
2649
2649
},
2650
2650
"engines": {
2651
2651
"node": ">=16.20.1"
@@ -2684,22 +2684,22 @@
2684
2684
}
2685
2685
},
2686
2686
"node_modules/mongodb-connection-string-url": {
2687
"version": "2.6.0",
2688
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz",
2689
"integrity": "sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ==",
2687
"version": "3.0.0",
2688
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.0.tgz",
2689
"integrity": "sha512-t1Vf+m1I5hC2M5RJx/7AtxgABy1cZmIPQRMXw+gEIPn/cZNF3Oiy+l0UIypUwVB5trcWHq3crg2g3uAR9aAwsQ==",
2690
2690
"dependencies": {
2691
"@types/whatwg-url": "^8.2.1",
2692
"whatwg-url": "^11.0.0"
2691
"@types/whatwg-url": "^11.0.2",
2692
"whatwg-url": "^13.0.0"
2693
2693
}
2694
2694
},
2695
2695
"node_modules/mongoose": {
2696
"version": "8.0.2",
2697
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.0.2.tgz",
2698
"integrity": "sha512-Vsi9GzTXjdBVzheT1HZOZ2jHNzzR9Xwb5OyLz/FvDEAhlwrRnXnuqJf0QHINUOQSm7aoyvnPks0q85HJkd6yDw==",
2696
"version": "8.1.1",
2697
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.1.1.tgz",
2698
"integrity": "sha512-DbLb0NsiEXmaqLOpEz+AtAsgwhRw6f25gwa1dF5R7jj6lS1D8X6uTdhBSC8GDVtOwe5Tfw2EL7nTn6hiJT3Bgg==",
2699
2699
"dependencies": {
2700
2700
"bson": "^6.2.0",
2701
2701
"kareem": "2.5.1",
2702
"mongodb": "6.2.0",
2702
"mongodb": "6.3.0",
2703
2703
"mpath": "0.9.0",
2704
2704
"mquery": "5.0.0",
2705
2705
"ms": "2.1.3",
@@ -3701,14 +3701,14 @@
3701
3701
}
3702
3702
},
3703
3703
"node_modules/tr46": {
3704
"version": "3.0.0",
3705
"resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
3706
"integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
3704
"version": "4.1.1",
3705
"resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz",
3706
"integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==",
3707
3707
"dependencies": {
3708
"punycode": "^2.1.1"
3708
"punycode": "^2.3.0"
3709
3709
},
3710
3710
"engines": {
3711
"node": ">=12"
3711
"node": ">=14"
3712
3712
}
3713
3713
},
3714
3714
"node_modules/tree-kill": {
@@ -3986,15 +3986,15 @@
3986
3986
}
3987
3987
},
3988
3988
"node_modules/whatwg-url": {
3989
"version": "11.0.0",
3990
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz",
3991
"integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==",
3989
"version": "13.0.0",
3990
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-13.0.0.tgz",
3991
"integrity": "sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==",
3992
3992
"dependencies": {
3993
"tr46": "^3.0.0",
3993
"tr46": "^4.1.1",
3994
3994
"webidl-conversions": "^7.0.0"
3995
3995
},
3996
3996
"engines": {
3997
"node": ">=12"
3997
"node": ">=16"
3998
3998
}
3999
3999
},
4000
4000
"node_modules/which": {
@@ -3,8 +3,8 @@ import { toInventoryResponse } from "@/src/helpers/inventoryHelpers";
3
3
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
4
4
import { Request, RequestHandler, Response } from "express";
5
5
import config from "@/config.json";
6
import testMissions from "@/static/fixed_responses/testMissions.json";
7
import testQuestKeys from "@/static/fixed_responses/testQuestKeys.json";
6
import allMissions from "@/static/fixed_responses/allMissions.json";
7
import allQuestKeys from "@/static/fixed_responses/allQuestKeys.json";
8
8
import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
9
9
10
10
const inventoryController: RequestHandler = async (request: Request, response: Response) => {
@@ -29,8 +29,8 @@ const inventoryController: RequestHandler = async (request: Request, response: R
29
29
30
30
const inventoryResponse = toInventoryResponse(inventoryJSON);
31
31
32
if (config.testMission) inventoryResponse.Missions = testMissions;
33
if (config.testQuestKey) inventoryResponse.QuestKeys = testQuestKeys;
32
if (config.unlockAllMissions) inventoryResponse.Missions = allMissions;
33
if (config.unlockAllQuests) inventoryResponse.QuestKeys = allQuestKeys;
34
34
35
35
response.json(inventoryResponse);
36
36
};
@@ -12,3 +12,7 @@ export const toInventoryResponse = (inventoryDatabase: IInventoryDatabase): IInv
12
12
export const toOid = (objectId: Types.ObjectId) => {
13
13
return { $oid: objectId.toString() } satisfies IOid;
14
14
};
15
16
export const toMongoDate = (date: Date) => {
17
return { $date: { $numberLong: date.getTime().toString() } };
18
};
@@ -15,16 +15,66 @@ import { IOperatorLoadOutSigcol, IWeaponDatabase } from "@/src/types/inventoryTy
15
15
//Document extends will be deleted soon. TODO: delete and migrate uses to ...
16
16
export interface IInventoryDatabaseDocument extends IInventoryDatabase, Document {}
17
17
export interface IInventoryDatabase
18
extends Omit<IInventoryResponse, "TrainingDate" | "LoadOutPresets" | "Mailbox" | "PendingRecipes"> {
18
extends Omit<
19
IInventoryResponse,
20
"TrainingDate" | "LoadOutPresets" | "Mailbox" | "PendingRecipes" | "Created" | "QuestKeys" | "BlessingCooldown"
21
> {
19
22
accountOwnerId: Types.ObjectId;
23
Created: Date;
20
24
TrainingDate: Date; // TrainingDate changed from IMongoDate to Date
21
25
LoadOutPresets: Types.ObjectId; // LoadOutPresets changed from ILoadOutPresets to Types.ObjectId for population
22
26
Mailbox: Types.ObjectId; // Mailbox changed from IMailbox to Types.ObjectId
23
27
PendingRecipes: IPendingRecipe[];
28
QuestKeys: IQuestKeyDatabase[];
29
BlessingCooldown: Date;
24
30
}
25
31
26
32
export interface IInventoryResponseDocument extends IInventoryResponse, Document {}
27
33
34
export interface IQuestKeyDatabase {
35
Progress?: IQuestProgress[];
36
unlock?: boolean;
37
Completed?: boolean;
38
CustomData?: string; //TODO: check whether this actually exists
39
ItemType: string;
40
CompletionDate?: Date;
41
}
42
43
export interface IFocusUpgrades {
44
ItemType: string;
45
Level: number;
46
IsUniversal: boolean;
47
}
48
49
export interface ITypeCount {
50
ItemType: string;
51
ItemCount: number;
52
}
53
54
export interface IGenericItem2 {
55
ItemType: string;
56
ItemName: string;
57
ItemId: IOid;
58
XP: number;
59
UpgradeVer: number;
60
Features: number;
61
Polarized: number;
62
CustomizationSlotPurchases: number;
63
ModSlotPurchases: number;
64
FocusLens: string;
65
Expiry: IMongoDate;
66
Polarity: IPolarity[];
67
Configs: IItemConfig[];
68
ModularParts: string[];
69
SkillTree: string;
70
UpgradeType: string;
71
UpgradeFingerprint: string;
72
OffensiveUpgrade: string;
73
DefensiveUpgrade: string;
74
UpgradesExpiry: IMongoDate;
75
ArchonCrystalUpgrades: [];
76
}
77
28
78
export interface IGenericItem {
29
79
ItemType: string;
30
80
XP?: number;
@@ -91,7 +141,7 @@ export interface IInventoryResponse {
91
141
Pistols: IWeaponDatabase[];
92
142
Melee: IWeaponDatabase[];
93
143
Ships: IShip[];
94
QuestKeys: IQuestKey[];
144
QuestKeys: IQuestKeyResponse[];
95
145
FlavourItems: IFlavourItem[];
96
146
Scoops: IGenericItem[];
97
147
TrainingRetriesLeft: number;
@@ -100,8 +150,8 @@ export interface IInventoryResponse {
100
150
Missions: IMission[];
101
151
RandomUpgradesIdentified: number;
102
152
LastRegionPlayed: string;
103
XPInfo: IEmailItem[];
104
Recipes: IConsumable[];
153
XPInfo: ITypeXPItem[];
154
Recipes: ITypeCount[];
105
155
WeaponSkins: IWeaponSkin[];
106
156
PendingRecipes: IPendingRecipeResponse[];
107
157
TrainingDate: IMongoDate;
@@ -116,7 +166,7 @@ export interface IInventoryResponse {
116
166
LevelKeys: IConsumable[];
117
167
TauntHistory: ITauntHistory[];
118
168
StoryModeChoice: string;
119
PeriodicMissionCompletions: IPeriodicMissionCompletion[];
169
PeriodicMissionCompletions: IPeriodicMissionCompletionDatabase[];
120
170
KubrowPetEggs: IKubrowPetEgg[];
121
171
LoreFragmentScans: ILoreFragmentScan[];
122
172
EquippedEmotes: string[];
@@ -135,7 +185,7 @@ export interface IInventoryResponse {
135
185
SpectreLoadouts: ISpectreLoadout[];
136
186
SentinelWeapons: IWeaponDatabase[];
137
187
Sentinels: IWeaponDatabase[];
138
EmailItems: IEmailItem[];
188
EmailItems: ITypeXPItem[];
139
189
CompletedSyndicates: string[];
140
190
FocusXP: IFocusXP;
141
191
Wishlist: string[];
@@ -160,7 +210,7 @@ export interface IInventoryResponse {
160
210
AlignmentReplay: IAlignment;
161
211
PersonalGoalProgress: IPersonalGoalProgress[];
162
212
DailyAffiliationSolaris: number;
163
SpecialItems: ISpecialItem[];
213
SpecialItems: IGenericItem2[];
164
214
ThemeStyle: string;
165
215
ThemeBackground: string;
166
216
ThemeSounds: string;
@@ -395,17 +445,27 @@ export interface ISlot {
395
445
}
396
446
397
447
export interface ICustomization {
398
CrewshipInterior: ITerior;
448
CrewshipInterior: IShipExterior;
399
449
}
400
450
401
export interface ITerior {
451
export interface IShipExterior {
402
452
SkinFlavourItem: string;
403
Colors: IColor;
453
Colors: IShipExteriorColors;
404
454
ShipAttachments?: IShipAttachments;
405
455
}
406
456
457
//TODO: check whether it makes sense to use this specifity of color.
458
export interface IShipExteriorColors {
459
t0: number;
460
t1: number;
461
t2: number;
462
t3: number;
463
m0: number;
464
en: number;
465
}
466
407
467
export interface IShipAttachments {
408
HOOD_ORNAMENT: string;
468
HOOD_ORNAMENT: string; //TODO: Others are probably possible
409
469
}
410
470
411
471
export interface IFlavourItem {
@@ -452,7 +512,7 @@ export interface IDrone {
452
512
RepairStart?: IMongoDate;
453
513
}
454
514
455
export interface IEmailItem {
515
export interface ITypeXPItem {
456
516
ItemType: string;
457
517
XP: number;
458
518
}
@@ -511,7 +571,7 @@ export interface ISigcol {
511
571
512
572
export interface IInfestedFoundry {
513
573
Name: string;
514
Resources: IResource[];
574
Resources: ITypeCount[];
515
575
Slots: number;
516
576
XP: number;
517
577
ConsumedSuits: IConsumedSuit[];
@@ -525,11 +585,6 @@ export interface IConsumedSuit {
525
585
c?: IColor;
526
586
}
527
587
528
export interface IResource {
529
ItemType: string;
530
Count: number;
531
}
532
533
588
export interface IInvasionChainProgress {
534
589
id: IOid;
535
590
count: number;
@@ -881,12 +936,16 @@ export enum GivingSlotOrderInfo {
881
936
LotusUpgradesModsPistolDualStatElectEventPistolMod = "/Lotus/Upgrades/Mods/Pistol/DualStat/ElectEventPistolMod"
882
937
}
883
938
884
export interface IPeriodicMissionCompletion {
885
date: IMongoDate;
939
export interface IPeriodicMissionCompletionDatabase {
940
date: Date;
886
941
tag: string;
887
942
count?: number;
888
943
}
889
944
945
export interface IPeriodicMissionCompletionResponse extends Omit<IPeriodicMissionCompletionDatabase, "date"> {
946
date: IMongoDate;
947
}
948
890
949
export interface IPersonalGoalProgress {
891
950
Count: number;
892
951
Tag: string;
@@ -923,16 +982,11 @@ export interface IPlayerSkills {
923
982
LPS_DRIFT_ENDURANCE: number;
924
983
}
925
984
926
export interface IQuestKey {
927
Progress?: IProgress[];
928
unlock?: boolean;
929
Completed?: boolean;
930
CustomData?: string;
931
ItemType: string;
985
export interface IQuestKeyResponse extends Omit<IQuestKeyDatabase, "CompletionDate"> {
932
986
CompletionDate?: IMongoDate;
933
987
}
934
988
935
export interface IProgress {
989
export interface IQuestProgress {
936
990
c: number;
937
991
i: boolean;
938
992
m: boolean;
@@ -964,7 +1018,7 @@ export interface ISettings {
964
1018
965
1019
export interface IShip {
966
1020
ItemType: string;
967
ShipExterior: ITerior;
1021
ShipExterior: IShipExterior;
968
1022
AirSupportPower: string;
969
1023
ItemId: IOid;
970
1024
}
@@ -989,28 +1043,6 @@ export interface ISpaceGunConfig {
989
1043
Upgrades?: string[];
990
1044
}
991
1045
992
export interface ISpecialItem {
993
ItemType: string;
994
Configs: ISpecialItemConfig[];
995
XP?: number;
996
UpgradeVer?: number;
997
Features: number;
998
ItemId: IOid;
999
Polarized?: number;
1000
Polarity?: IPolarity[];
1001
ModSlotPurchases?: number;
1002
}
1003
1004
export interface ISpecialItemConfig {
1005
Upgrades?: string[];
1006
pricol?: IColor;
1007
Skins?: string[];
1008
attcol?: IColor;
1009
eyecol?: IPurpleCol;
1010
sigcol?: IPurpleCol;
1011
Name?: string;
1012
}
1013
1014
1046
export interface IPurpleCol {
1015
1047
en: number;
1016
1048
}
此文件没有可显示的逐行差异。
此文件没有可显示的逐行差异。
@@ -1,6 +1,5 @@
1
1
{
2
2
"SubscribedToEmails": 0,
3
"Created": { "$date": { "$numberLong": "1685829131" } },
4
3
"SubscribedToEmailsPersonalized": 0,
5
4
"RewardSeed": -5604904486637265640,
6
5
"CrewMemberBin": { "Slots": 3 },