返回提交历史
Modified
src/models/inventoryModels/inventoryModel.ts
+19
-1
Modified
src/services/importService.ts
+15
-2
Modified
src/types/inventoryTypes/inventoryTypes.ts
+5
-3
XFEstudio/SpaceNinjaServer
feat(import): accolades (#1750)
So one is able to import e.g. `{"Staff":true}` to set that field to true without going into Compass. Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1750 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
11f2ffe6
代码差异
3 个文件
+39
-6
@@ -94,7 +94,8 @@ import {
94
94
ICrewMemberClient,
95
95
ISortieRewardAttenuation,
96
96
IInvasionProgressDatabase,
97
IInvasionProgressClient
97
IInvasionProgressClient,
98
IAccolades
98
99
} from "../../types/inventoryTypes/inventoryTypes";
99
100
import { IOid } from "../../types/commonTypes";
100
101
import {
@@ -1059,6 +1060,13 @@ pendingRecipeSchema.set("toJSON", {
1059
1060
}
1060
1061
});
1061
1062
1063
const accoladesSchema = new Schema<IAccolades>(
1064
{
1065
Heirloom: Boolean
1066
},
1067
{ _id: false }
1068
);
1069
1062
1070
const infestedFoundrySchema = new Schema<IInfestedFoundryDatabase>(
1063
1071
{
1064
1072
Name: String,
@@ -1466,6 +1474,16 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1466
1474
//Mastery Rank next availability
1467
1475
TrainingDate: { type: Date, default: new Date(0) },
1468
1476
1477
//Accolades
1478
Staff: Boolean,
1479
Founder: Number,
1480
Guide: Number,
1481
Moderator: Boolean,
1482
Partner: Boolean,
1483
Accolades: accoladesSchema,
1484
//Not an accolade but unlocks an extra chat
1485
Counselor: Boolean,
1486
1469
1487
//you saw last played Region when you opened the star map
1470
1488
LastRegionPlayed: String,
1471
1489
@@ -230,17 +230,23 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
230
230
replaceSlots(db[key], client[key]);
231
231
}
232
232
}
233
// boolean
233
234
for (const key of [
234
235
"UseAdultOperatorLoadout",
235
236
"HasOwnedVoidProjectionsPreviously",
236
237
"ReceivedStartingGear",
237
238
"ArchwingEnabled",
238
"PlayedParkourTutorial"
239
"PlayedParkourTutorial",
240
"Staff",
241
"Moderator",
242
"Partner",
243
"Counselor"
239
244
] as const) {
240
245
if (client[key] !== undefined) {
241
246
db[key] = client[key];
242
247
}
243
248
}
249
// number
244
250
for (const key of [
245
251
"PlayerLevel",
246
252
"RegularCredits",
@@ -250,12 +256,15 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
250
256
"PrimeTokens",
251
257
"TradesRemaining",
252
258
"GiftsRemaining",
253
"ChallengesFixVersion"
259
"ChallengesFixVersion",
260
"Founder",
261
"Guide"
254
262
] as const) {
255
263
if (client[key] !== undefined) {
256
264
db[key] = client[key];
257
265
}
258
266
}
267
// string
259
268
for (const key of [
260
269
"ThemeStyle",
261
270
"ThemeBackground",
@@ -270,6 +279,7 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
270
279
db[key] = client[key];
271
280
}
272
281
}
282
// string[]
273
283
for (const key of [
274
284
"EquippedGear",
275
285
"EquippedEmotes",
@@ -380,6 +390,9 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
380
390
});
381
391
});
382
392
}
393
if (client.Accolades !== undefined) {
394
db.Accolades = client.Accolades;
395
}
383
396
};
384
397
385
398
const convertLoadOutConfig = (client: ILoadoutConfigClient): ILoadoutConfigDatabase => {
@@ -250,9 +250,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
250
250
Guide?: number;
251
251
Moderator?: boolean;
252
252
Partner?: boolean;
253
Accolades?: {
254
Heirloom?: boolean;
255
};
253
Accolades?: IAccolades;
256
254
Counselor?: boolean;
257
255
Upgrades: IUpgradeClient[];
258
256
EquippedGear: string[];
@@ -914,6 +912,10 @@ export interface IPendingRecipeClient
914
912
CompletionDate: IMongoDate;
915
913
}
916
914
915
export interface IAccolades {
916
Heirloom?: boolean;
917
}
918
917
919
export interface IPendingTrade {
918
920
State: number;
919
921
SelfReady: boolean;