Skip to content

Commit aff7ddc

Browse files
committed
feat: 150 data support
1 parent a8eccf9 commit aff7ddc

File tree

13 files changed

+71478
-756
lines changed

13 files changed

+71478
-756
lines changed

apps/tools/all-music.json

Lines changed: 499 additions & 361 deletions
Large diffs are not rendered by default.

apps/tools/src/genPlateCondition.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { XMLParser } from 'fast-xml-parser';
22
import fs from 'node:fs';
33
import fsP from 'node:fs/promises';
44

5-
const PLATE_NAME = '真超檄橙晓桃樱紫堇白雪辉舞熊华爽煌宙星祭祝双'.split('');
6-
const PLATE_NAME_GAME = '真超檄橙暁桃櫻紫菫白雪輝舞熊華爽煌宙星祭祝双'.split('');
5+
const PLATE_NAME = '真超檄橙晓桃樱紫堇白雪辉舞熊华爽煌宙星祭祝双宴'.split('');
6+
const PLATE_NAME_GAME = '真超檄橙暁桃櫻紫菫白雪輝舞熊華爽煌宙星祭祝双宴'.split('');
77

88
const baseDir = process.argv[2];
99
const parser = new XMLParser();

apps/web/src/routes/b50/components/B50.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
1-
import { RatingListEntry, UserMusic, Song, Nameplate as NameplateData, UserCombinedRating, MaiVersion, BUDDIES_PLUS_LOGO, BUDDIES_LOGO, Chart } from '@clansty/maibot-types';
1+
import { RatingListEntry, UserMusic, Song, Nameplate as NameplateData, UserCombinedRating, MaiVersion, BUDDIES_PLUS_LOGO, BUDDIES_LOGO, Chart, PRISM_LOGO } from '@clansty/maibot-types';
22
import B50Song from './B50Song';
33
import { computeRa, ratingAnalyse } from '@clansty/maibot-utils';
44
import styles from './B50.module.css';
55
import Nameplate from '~/components/Nameplate';
66
import { component$ } from '@builder.io/qwik';
77

8+
const getLogoByVersion = (ver: MaiVersion) => {
9+
switch (ver) {
10+
case 150: return PRISM_LOGO;
11+
case 145: return BUDDIES_PLUS_LOGO;
12+
case 140: return BUDDIES_LOGO;
13+
default: return BUDDIES_LOGO;
14+
}
15+
};
16+
817
export default component$(({ rating, user, ver }: { rating: UserCombinedRating, user: NameplateData, ver: MaiVersion }) =>
918
<div style={{ padding: '0 20px' }}>
1019
<div class={`${styles.b50Header} flex items-center p-[20px_0] gap-[10px_40px]`}>
1120
<div class="text-1.8em">
1221
<Nameplate user={user} />
1322
</div>
1423
<div class={`${styles.hideOnSmallScreen} grow`} />
15-
<img class={styles.hideOnSmallScreen} src={ver === 145 ? BUDDIES_PLUS_LOGO : BUDDIES_LOGO} alt="" height={120} />
24+
<img class={styles.hideOnSmallScreen} src={getLogoByVersion(ver)} alt="" height={120} />
1625
</div>
1726

1827
<RatingTable rating={rating.best35} userMusic={rating.musicList} title="旧版本 Best 35" ver={ver} />

packages/clients/src/AquaDxLegacy.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ export default class AquaDxLegacy extends UserSource {
1818
}
1919

2020
public static async create(kv: KVStorage, powerOnToken: string) {
21-
let uri = await kv.get<string>('apiBase');
22-
if (!uri) {
23-
console.log('请求 powerOn');
24-
uri = await AquaDxLegacy.powerOn('http://aquadx-cf.hydev.org', powerOnToken);
25-
const url = new URL(uri);
26-
// 不然会出现不会自动解压 deflate 的问题
27-
url.host = 'aquadx-cf.hydev.org';
28-
uri = url.toString();
29-
await kv.set('apiBase', uri, 172800);
30-
}
31-
return new this(uri);
21+
// let uri = await kv.get<string>('apiBase');
22+
// if (!uri) {
23+
// console.log('请求 powerOn');
24+
// uri = await AquaDxLegacy.powerOn('http://aquadx-cf.hydev.org', powerOnToken);
25+
// const url = new URL(uri);
26+
// // 不然会出现不会自动解压 deflate 的问题
27+
// url.host = 'aquadx-cf.hydev.org';
28+
// uri = url.toString();
29+
// await kv.set('apiBase', uri, 172800);
30+
// }
31+
return new this('https://example.com/');
3232
}
3333

3434
public async getUserData(userId: number) {

packages/clients/src/UserProfile.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BUDDIES_LOGO, BUDDIES_PLUS_LOGO, GameVariantPlateMusicList, MaiVersion, PLATE_MUSIC_LIST_145, PLATE_MUSIC_LIST_CN, PLATE_MUSIC_LIST_JP, Regions, Env, Song, UserPreviewSummary, UserProfileDto } from '@clansty/maibot-types';
1+
import { BUDDIES_LOGO, BUDDIES_PLUS_LOGO, GameVariantPlateMusicList, MaiVersion, PLATE_MUSIC_LIST_145, PLATE_MUSIC_LIST_CN, PLATE_MUSIC_LIST_JP, Regions, Env, Song, UserPreviewSummary, UserProfileDto, PRISM_LOGO, PLATE_MUSIC_LIST_150 } from '@clansty/maibot-types';
22
import { UserSource } from './UserSource';
33
import AquaDxLegacy from './AquaDxLegacy';
44
import SdgbProxied from './SdgbProxied';
@@ -67,10 +67,12 @@ export class UserProfile {
6767
switch (this.region) {
6868
case 'jp':
6969
switch (await this.getVersion()) {
70-
case 140:
71-
return PLATE_MUSIC_LIST_JP;
70+
case 150:
71+
return PLATE_MUSIC_LIST_150;
7272
case 145:
7373
return PLATE_MUSIC_LIST_145;
74+
case 140:
75+
return PLATE_MUSIC_LIST_JP;
7476
}
7577
return PLATE_MUSIC_LIST_JP;
7678
case 'cn':
@@ -86,16 +88,19 @@ export class UserProfile {
8688
case 'SDGB':
8789
return 140;
8890
case 'SDGA':
89-
return 145;
91+
return 150;
9092
case 'AquaDX':
9193
case 'AquaDX-v2':
9294
try {
9395
const preview = await this.getUserPreview();
9496
const version = Number(preview.lastRomVersion.split('.')[1]);
97+
console.log('User version:', version);
9598
if (version < 45)
9699
return 140;
97-
else
100+
else if (version < 50)
98101
return 145;
102+
else
103+
return 150;
99104
} catch (e) {
100105
console.error('Failed to get user version', e);
101106
return 140;
@@ -117,6 +122,8 @@ export class UserProfile {
117122
return BUDDIES_LOGO;
118123
case 145:
119124
return BUDDIES_PLUS_LOGO;
125+
case 150:
126+
return PRISM_LOGO;
120127
}
121128
}
122129

0 commit comments

Comments
 (0)