返回提交历史
Modified
src/services/statsService.ts
+9
-13
Modified
src/types/statTypes.ts
+1
-0
XFEstudio/SpaceNinjaServer
chore(stats): fix eslint warnings (#1262)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1262
e83970d3
代码差异
2 个文件
+10
-13
@@ -148,7 +148,7 @@ export const updateStats = async (accountOwnerId: string, payload: IStatsUpdate)
148
148
if (enemy) {
149
149
if (category === "KILL_ENEMY") {
150
150
enemy.kills ??= 0;
151
const captureCount = (actionData["CAPTURE_ENEMY"] as IUploadEntry)?.[type];
151
const captureCount = (actionData as IStatsAdd)["CAPTURE_ENEMY"]?.[type];
152
152
if (captureCount) {
153
153
enemy.kills += Math.max(count - captureCount, 0);
154
154
enemy.captures ??= 0;
@@ -198,21 +198,19 @@ export const updateStats = async (accountOwnerId: string, payload: IStatsUpdate)
198
198
break;
199
199
200
200
case "CIPHER":
201
if (data["0"] > 0) {
201
if ((data as IUploadEntry)["0"] > 0) {
202
202
playerStats.CiphersFailed ??= 0;
203
playerStats.CiphersFailed += data["0"];
203
playerStats.CiphersFailed += (data as IUploadEntry)["0"];
204
204
}
205
if (data["1"] > 0) {
205
if ((data as IUploadEntry)["1"] > 0) {
206
206
playerStats.CiphersSolved ??= 0;
207
playerStats.CiphersSolved += data["1"];
207
playerStats.CiphersSolved += (data as IUploadEntry)["1"];
208
208
}
209
209
break;
210
210
211
211
default:
212
212
if (!ignoredCategories.includes(category)) {
213
if (!unknownCategories[action]) {
214
unknownCategories[action] = [];
215
}
213
unknownCategories[action] ??= [];
216
214
unknownCategories[action].push(category);
217
215
}
218
216
break;
@@ -312,7 +310,7 @@ export const updateStats = async (accountOwnerId: string, payload: IStatsUpdate)
312
310
case "CaliberChicksScore":
313
311
case "DojoObstacleScore":
314
312
playerStats[category] ??= 0;
315
if (data > playerStats[category]) playerStats[category] = data;
313
if (data > playerStats[category]) playerStats[category] = data as number;
316
314
break;
317
315
318
316
case "OlliesCrashCourseScore":
@@ -331,14 +329,12 @@ export const updateStats = async (accountOwnerId: string, payload: IStatsUpdate)
331
329
"/Lotus/Types/Items/EmailItems/BeatOlliesCrashCourseInNinetySecEmailItem"
332
330
);
333
331
}
334
if (data > playerStats[category]) playerStats[category] = data;
332
if (data > playerStats[category]) playerStats[category] = data as number;
335
333
break;
336
334
337
335
default:
338
336
if (!ignoredCategories.includes(category)) {
339
if (!unknownCategories[action]) {
340
unknownCategories[action] = [];
341
}
337
unknownCategories[action] ??= [];
342
338
unknownCategories[action].push(category);
343
339
}
344
340
break;
@@ -134,6 +134,7 @@ export interface IStatsAdd {
134
134
EXECUTE_ENEMY_ITEM?: IUploadEntry;
135
135
KILL_ASSIST?: IUploadEntry;
136
136
KILL_ASSIST_ITEM?: IUploadEntry;
137
CAPTURE_ENEMY?: IUploadEntry;
137
138
}
138
139
139
140
export interface IUploadEntry {