@@ -2,7 +2,7 @@ import { CategoryEnum, DifficultyEnum, dxdata, Regions, Song as DataSong, TypeEn
22import Chart from './Chart' ;
33import _ from 'lodash' ;
44import { ALL_MUSIC , ALL_MUSIC_140 , ALL_MUSIC_145 , ALL_MUSIC_150 , ALL_MUSIC_155 , JACKET_EXIST_IDS } from '@clansty/maibot-data' ;
5- import { LEVEL , LEVEL_EN } from './consts' ;
5+ import { DEFAULT_VERSION , LEVEL , LEVEL_EN } from './consts' ;
66import { MaiVersion } from './types' ;
77import { ASSET_TYPE , getAssetUrl } from '@clansty/maibot-utils/src/getAssetUrl' ;
88
@@ -25,7 +25,7 @@ export default class Song implements DataSong {
2525 public readonly dx ?: boolean ,
2626 // 指 DXRating 中没有的歌
2727 public readonly unlisted = false ,
28- public readonly ver : MaiVersion = 155
28+ public readonly ver : MaiVersion = DEFAULT_VERSION
2929 ) {
3030 Object . assign ( this , data ) ;
3131
@@ -146,7 +146,7 @@ export default class Song implements DataSong {
146146 return message ;
147147 }
148148
149- public static fromId ( id : number , ver : MaiVersion = 155 ) {
149+ public static fromId ( id : number , ver : MaiVersion = DEFAULT_VERSION ) {
150150 let allMusic : typeof ALL_MUSIC ;
151151 if ( ver === 160 ) {
152152 allMusic = ALL_MUSIC ;
@@ -215,7 +215,7 @@ export default class Song implements DataSong {
215215 } , dx , true , ver ) ;
216216 }
217217
218- public static search ( kw : string , ver : MaiVersion = 155 ) {
218+ public static search ( kw : string , ver : MaiVersion = DEFAULT_VERSION ) {
219219 const results = [ ] as Song [ ] ;
220220 if ( Number ( kw ) ) {
221221 const song = this . fromId ( Number ( kw ) , ver ) ;
@@ -239,7 +239,7 @@ export default class Song implements DataSong {
239239 return _ . uniqBy ( results , ( it ) => `${ it . id } _${ it . title } ` ) ;
240240 }
241241
242- public static getByCondition ( condition : ( song : Song ) => boolean , ver : MaiVersion = 155 , officialOnly = true ) : Song [ ] {
242+ public static getByCondition ( condition : ( song : Song ) => boolean , ver : MaiVersion = DEFAULT_VERSION , officialOnly = true ) : Song [ ] {
243243 let tmp = Song . getAllSongs ( ver ) ;
244244 if ( officialOnly ) {
245245 tmp = tmp . filter ( song => song . id < 2000 ) ;
@@ -249,7 +249,7 @@ export default class Song implements DataSong {
249249 }
250250
251251 public static allIds = _ . uniq ( Object . keys ( ALL_MUSIC ) . map ( Number ) . map ( it => it % 1e4 ) ) ;
252- public static getAllSongs = ( ver : MaiVersion = 155 ) => Song . allIds . filter ( it => it < 2000 ) . map ( id => Song . fromId ( id , ver ) ) . filter ( it => it ) ;
252+ public static getAllSongs = ( ver : MaiVersion = DEFAULT_VERSION ) => Song . allIds . filter ( it => it < 2000 ) . map ( id => Song . fromId ( id , ver ) ) . filter ( it => it ) ;
253253
254254 public getChart ( difficulty : DifficultyEnum | number | typeof LEVEL [ number ] , dx = this . dx ) {
255255 if ( LEVEL . includes ( difficulty as any ) ) {
0 commit comments