File tree Expand file tree Collapse file tree 2 files changed +23
-17
lines changed Expand file tree Collapse file tree 2 files changed +23
-17
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import type { Operator, Version } from 'models/arknights'
4
4
import type { Response } from 'models/network'
5
5
import type { Level } from 'models/operation'
6
6
7
- import { withoutUnusedLevels } from '../models/level'
8
7
import { request } from '../utils/fetcher'
9
8
10
9
const ONE_DAY = 1000 * 60 * 60 * 24
@@ -26,7 +25,29 @@ export const useLevels = ({ suspense }: { suspense?: boolean } = {}) => {
26
25
fetcher : async ( input : string , init ?: RequestInit ) => {
27
26
const res = await request < LevelResponse > ( input , init )
28
27
29
- res . data = withoutUnusedLevels ( res . data )
28
+ const stageIds = new Set < string > ( )
29
+
30
+ res . data = res . data . filter ( ( level ) => {
31
+ if (
32
+ // 引航者试炼
33
+ level . levelId . includes ( 'bossrush' ) ||
34
+ // 肉鸽
35
+ level . levelId . includes ( 'roguelike' ) ||
36
+ // 保全派驻
37
+ level . levelId . includes ( 'legion' )
38
+ ) {
39
+ return false
40
+ }
41
+
42
+ if ( stageIds . has ( level . stageId ) ) {
43
+ console . warn ( 'Duplicate level removed:' , level . stageId , level . name )
44
+ return false
45
+ }
46
+
47
+ stageIds . add ( level . stageId )
48
+
49
+ return true
50
+ } )
30
51
31
52
return res
32
53
} ,
Original file line number Diff line number Diff line change @@ -33,21 +33,6 @@ export function isCustomLevel(level: Level): boolean {
33
33
return customLevelKey in level
34
34
}
35
35
36
- export function withoutUnusedLevels ( levels : Level [ ] ) {
37
- const unusedKeywords = [
38
- // 引航者试炼
39
- 'bossrush' ,
40
- // 肉鸽
41
- 'roguelike' ,
42
- // 保全派驻
43
- 'legion' ,
44
- ]
45
- return levels . filter (
46
- ( level ) =>
47
- ! unusedKeywords . some ( ( keyword ) => level . levelId . includes ( keyword ) ) ,
48
- )
49
- }
50
-
51
36
export function isHardMode ( stageId : string ) {
52
37
return stageId . endsWith ( HARD_MODE_SUFFIX )
53
38
}
You can’t perform that action at this time.
0 commit comments