返回提交历史
Modified
src/controllers/api/startLibraryPersonalTargetController.ts
+1
-1
Modified
src/models/inventoryModels/inventoryModel.ts
+12
-2
Modified
src/services/missionInventoryUpdateService.ts
+63
-10
Modified
src/types/inventoryTypes/inventoryTypes.ts
+1
-1
XFEstudio/XFESpaceNinjaServer
feat: library personal target progress (#1083)
Closes #1081 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1083
b8b1c5e0
代码差异
4 个文件
+77
-14
@@ -8,7 +8,7 @@ export const startLibraryPersonalTargetController: RequestHandler = async (req,
8
8
inventory.LibraryPersonalTarget = req.query.target as string;
9
9
await inventory.save();
10
10
res.json({
11
IsQuest: false,
11
IsQuest: req.query.target == "/Lotus/Types/Game/Library/Targets/DragonframeQuestTarget",
12
12
Target: req.query.target
13
13
});
14
14
};
@@ -74,7 +74,8 @@ import {
74
74
IAlignment,
75
75
ICollectibleEntry,
76
76
IIncentiveState,
77
ISongChallenge
77
ISongChallenge,
78
ILibraryPersonalProgress
78
79
} from "../../types/inventoryTypes/inventoryTypes";
79
80
import { IOid } from "../../types/commonTypes";
80
81
import {
@@ -1005,6 +1006,15 @@ pendingCouponSchema.set("toJSON", {
1005
1006
}
1006
1007
});
1007
1008
1009
const libraryPersonalProgressSchema = new Schema<ILibraryPersonalProgress>(
1010
{
1011
TargetType: String,
1012
Scans: Number,
1013
Completed: Boolean
1014
},
1015
{ _id: false }
1016
);
1017
1008
1018
const libraryDailyTaskInfoSchema = new Schema<ILibraryDailyTaskInfo>(
1009
1019
{
1010
1020
EnemyTypes: [String],
@@ -1271,7 +1281,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1271
1281
1272
1282
LibraryPersonalTarget: String,
1273
1283
//Cephalon Simaris Entries Example:"TargetType"+"Scans"(1-10)+"Completed": true|false
1274
LibraryPersonalProgress: [Schema.Types.Mixed],
1284
LibraryPersonalProgress: { type: [libraryPersonalProgressSchema], default: [] },
1275
1285
//Cephalon Simaris Daily Task
1276
1286
LibraryAvailableDailyTaskInfo: libraryDailyTaskInfoSchema,
1277
1287
LibraryActiveDailyTaskInfo: libraryDailyTaskInfoSchema,
@@ -191,17 +191,48 @@ export const addMissionInventoryUpdates = (
191
191
break;
192
192
case "LibraryScans":
193
193
value.forEach(scan => {
194
if (inventory.LibraryActiveDailyTaskInfo) {
195
if (inventory.LibraryActiveDailyTaskInfo.EnemyTypes.find(x => x == scan.EnemyType)) {
196
inventory.LibraryActiveDailyTaskInfo.Scans ??= 0;
197
inventory.LibraryActiveDailyTaskInfo.Scans += scan.Count;
198
} else {
199
logger.warn(
200
`ignoring synthesis of ${scan.EnemyType} as it's not part of the active daily task`
201
);
194
let synthesisIgnored = true;
195
if (
196
inventory.LibraryPersonalTarget &&
197
libraryPersonalTargetToAvatar[inventory.LibraryPersonalTarget] == scan.EnemyType
198
) {
199
let progress = inventory.LibraryPersonalProgress.find(
200
x => x.TargetType == inventory.LibraryPersonalTarget
201
);
202
if (!progress) {
203
progress =
204
inventory.LibraryPersonalProgress[
205
inventory.LibraryPersonalProgress.push({
206
TargetType: inventory.LibraryPersonalTarget,
207
Scans: 0,
208
Completed: false
209
}) - 1
210
];
202
211
}
203
} else {
204
logger.warn(`no library daily task active, ignoring synthesis of ${scan.EnemyType}`);
212
progress.Scans += scan.Count;
213
if (
214
progress.Scans >=
215
(inventory.LibraryPersonalTarget ==
216
"/Lotus/Types/Game/Library/Targets/DragonframeQuestTarget"
217
? 3
218
: 10)
219
) {
220
progress.Completed = true;
221
}
222
logger.debug(`synthesis of ${scan.EnemyType} added to personal target progress`);
223
synthesisIgnored = false;
224
}
225
if (
226
inventory.LibraryActiveDailyTaskInfo &&
227
inventory.LibraryActiveDailyTaskInfo.EnemyTypes.find(x => x == scan.EnemyType)
228
) {
229
inventory.LibraryActiveDailyTaskInfo.Scans ??= 0;
230
inventory.LibraryActiveDailyTaskInfo.Scans += scan.Count;
231
logger.debug(`synthesis of ${scan.EnemyType} added to daily task progress`);
232
synthesisIgnored = false;
233
}
234
if (synthesisIgnored) {
235
logger.warn(`ignoring synthesis of ${scan.EnemyType} due to not knowing why you did that`);
205
236
}
206
237
});
207
238
break;
@@ -534,3 +565,25 @@ const corruptedMods = [
534
565
"/Lotus/StoreItems/Upgrades/Mods/Rifle/DualStat/CorruptedReloadSpeedMaxClipRifle", // Depleted Reload
535
566
"/Lotus/StoreItems/Upgrades/Mods/Warframe/DualStat/FixedShieldAndShieldGatingDuration" // Catalyzing Shields
536
567
];
568
569
const libraryPersonalTargetToAvatar: Record<string, string> = {
570
"/Lotus/Types/Game/Library/Targets/DragonframeQuestTarget":
571
"/Lotus/Types/Enemies/Grineer/Desert/Avatars/RifleLancerAvatar",
572
"/Lotus/Types/Game/Library/Targets/Research1Target":
573
"/Lotus/Types/Enemies/Grineer/Desert/Avatars/RifleLancerAvatar",
574
"/Lotus/Types/Game/Library/Targets/Research2Target":
575
"/Lotus/Types/Enemies/Corpus/BipedRobot/AIWeek/LaserDiscBipedAvatar",
576
"/Lotus/Types/Game/Library/Targets/Research3Target":
577
"/Lotus/Types/Enemies/Grineer/Desert/Avatars/EvisceratorLancerAvatar",
578
"/Lotus/Types/Game/Library/Targets/Research4Target": "/Lotus/Types/Enemies/Orokin/OrokinHealingAncientAvatar",
579
"/Lotus/Types/Game/Library/Targets/Research5Target":
580
"/Lotus/Types/Enemies/Corpus/Spaceman/AIWeek/ShotgunSpacemanAvatar",
581
"/Lotus/Types/Game/Library/Targets/Research6Target": "/Lotus/Types/Enemies/Infested/AiWeek/Runners/RunnerAvatar",
582
"/Lotus/Types/Game/Library/Targets/Research7Target":
583
"/Lotus/Types/Enemies/Grineer/AIWeek/Avatars/GrineerMeleeStaffAvatar",
584
"/Lotus/Types/Game/Library/Targets/Research8Target": "/Lotus/Types/Enemies/Orokin/OrokinHeavyFemaleAvatar",
585
"/Lotus/Types/Game/Library/Targets/Research9Target":
586
"/Lotus/Types/Enemies/Infested/AiWeek/Quadrupeds/QuadrupedAvatar",
587
"/Lotus/Types/Game/Library/Targets/Research10Target":
588
"/Lotus/Types/Enemies/Corpus/Spaceman/AIWeek/NullifySpacemanAvatar"
589
};
@@ -313,7 +313,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
313
313
Quests: any[];
314
314
Robotics: any[];
315
315
UsedDailyDeals: any[];
316
LibraryPersonalTarget: string;
316
LibraryPersonalTarget?: string;
317
317
LibraryPersonalProgress: ILibraryPersonalProgress[];
318
318
CollectibleSeries?: ICollectibleEntry[];
319
319
LibraryAvailableDailyTaskInfo?: ILibraryDailyTaskInfo;