返回提交历史
Modified
src/controllers/api/inventoryController.ts
+8
-1
Modified
src/models/inventoryModels/inventoryModel.ts
+2
-2
Modified
src/services/missionInventoryUpdateService.ts
+1
-1
Modified
src/types/inventoryTypes/inventoryTypes.ts
+1
-1
XFEstudio/XFESpaceNinjaServer
fix: handle DuviriInfo being absent from inventory (#1926)
Closes #1917 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1926 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
660768b5
代码差异
4 个文件
+12
-5
@@ -106,7 +106,14 @@ export const inventoryController: RequestHandler = async (request, response) =>
106
106
const currentDuviriMood = Math.trunc(Date.now() / 7200000);
107
107
if (lastSyncDuviriMood != currentDuviriMood) {
108
108
logger.debug(`refreshing duviri seed`);
109
inventory.DuviriInfo.Seed = generateRewardSeed();
109
if (!inventory.DuviriInfo) {
110
inventory.DuviriInfo = {
111
Seed: generateRewardSeed(),
112
NumCompletions: 0
113
};
114
} else {
115
inventory.DuviriInfo.Seed = generateRewardSeed();
116
}
110
117
}
111
118
}
112
119
inventory.LastInventorySync = new Types.ObjectId();
@@ -391,8 +391,8 @@ MailboxSchema.set("toJSON", {
391
391
392
392
const DuviriInfoSchema = new Schema<IDuviriInfo>(
393
393
{
394
Seed: BigInt,
395
NumCompletions: { type: Number, default: 0 }
394
Seed: { type: BigInt, required: true },
395
NumCompletions: { type: Number, required: true }
396
396
},
397
397
{
398
398
_id: false,
@@ -601,7 +601,7 @@ export const addMissionInventoryUpdates = async (
601
601
case "duviriCaveOffers": {
602
602
// Duviri cave offers (generated with the duviri seed) change after completing one of its game modes (not when aborting).
603
603
if (inventoryUpdates.MissionStatus != "GS_QUIT") {
604
inventory.DuviriInfo.Seed = generateRewardSeed();
604
inventory.DuviriInfo!.Seed = generateRewardSeed();
605
605
}
606
606
break;
607
607
}
@@ -202,7 +202,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
202
202
OperatorLoadOuts: IOperatorConfigClient[];
203
203
KahlLoadOuts: IOperatorConfigClient[];
204
204
205
DuviriInfo: IDuviriInfo;
205
DuviriInfo?: IDuviriInfo;
206
206
Mailbox?: IMailboxClient;
207
207
SubscribedToEmails: number;
208
208
Created: IMongoDate;