koishi-plugin-noah 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/constants.d.ts +6 -6
- package/lib/core/services/card-service.d.ts +32 -17
- package/lib/core/services/server-service.d.ts +36 -14
- package/lib/core/services/user-service.d.ts +13 -9
- package/lib/core/utils/card.d.ts +10 -8
- package/lib/core/utils/role.d.ts +16 -0
- package/lib/drawer/BaseDrawer.d.ts +5 -5
- package/lib/drawer/DrawerFactory.d.ts +6 -0
- package/lib/drawer/core/index.d.ts +7 -4
- package/lib/drawer/iidx/index.d.ts +14 -5
- package/lib/drawer/index.d.ts +16 -1
- package/lib/drawer/sdvx/index.d.ts +17 -9
- package/lib/games/sdvx/config.d.ts +5 -0
- package/lib/games/sdvx/services/music-service.d.ts +11 -0
- package/lib/games/sdvx/services/score-service.d.ts +10 -6
- package/lib/games/sdvx/types/index.d.ts +18 -0
- package/lib/games/sdvx/utils/vf.d.ts +9 -9
- package/lib/index.js +234 -89
- package/lib/servers/Asphyxia/index.d.ts +3 -0
- package/lib/servers/Mao/index.d.ts +3 -0
- package/lib/servers/ServerFactory.d.ts +6 -0
- package/lib/servers/index.d.ts +15 -0
- package/lib/servers/utils/difficulty.d.ts +8 -8
- package/lib/servers/utils/grade.d.ts +10 -0
- package/lib/servers/utils/xml.d.ts +7 -8
- package/lib/types/config.d.ts +40 -0
- package/lib/types/index.d.ts +48 -32
- package/package.json +1 -1
package/lib/constants.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Context } from 'koishi';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* @param ctx Koishi
|
|
3
|
+
* 使用应用程序上下文初始化全局常量
|
|
4
|
+
* @param ctx - Koishi 上下文对象
|
|
5
5
|
*/
|
|
6
6
|
export declare function initConstants(ctx: Context): void;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* @param ctx Koishi
|
|
10
|
-
* @param assetPath
|
|
11
|
-
* @returns
|
|
8
|
+
* 获取完整的资源路径,将基础目录和资源数据路径组合
|
|
9
|
+
* @param ctx - Koishi 上下文对象
|
|
10
|
+
* @param assetPath - 资源目录中的相对路径
|
|
11
|
+
* @returns 完整的资源文件路径
|
|
12
12
|
*/
|
|
13
13
|
export declare function getAssetPath(ctx: Context, assetPath: string): string;
|
|
@@ -6,45 +6,60 @@ export declare class CardService {
|
|
|
6
6
|
constructor(ctx: Context);
|
|
7
7
|
/**
|
|
8
8
|
* 获取所有卡片列表
|
|
9
|
+
* @returns 包含所有卡片的数组
|
|
9
10
|
*/
|
|
10
11
|
getAllCards(): Promise<Card[]>;
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @param uid
|
|
14
|
-
* @returns
|
|
13
|
+
* 根据用户ID获取卡片列表
|
|
14
|
+
* @param uid - 用户ID
|
|
15
|
+
* @returns 该用户绑定的卡片完整信息列表
|
|
15
16
|
*/
|
|
16
17
|
getCardsByUid(uid: number): Promise<Card[]>;
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
+
* 根据卡片ID获取卡片信息
|
|
20
|
+
* @param id - 卡片ID
|
|
21
|
+
* @returns 卡片信息,不存在则返回null
|
|
19
22
|
*/
|
|
20
23
|
getCardById(id: number): Promise<Card | null>;
|
|
21
24
|
/**
|
|
22
|
-
*
|
|
25
|
+
* 根据卡号获取卡片信息
|
|
26
|
+
* @param code - 卡号
|
|
27
|
+
* @returns 卡片信息,不存在则返回null
|
|
23
28
|
*/
|
|
24
29
|
getCardByCode(code: string): Promise<Card | null>;
|
|
25
30
|
/**
|
|
26
|
-
*
|
|
31
|
+
* 根据卡片名称获取卡片信息
|
|
32
|
+
* @param name - 卡片名称
|
|
33
|
+
* @returns 卡片信息,不存在则返回null
|
|
27
34
|
*/
|
|
28
35
|
getCardByName(name: string): Promise<Card | null>;
|
|
29
36
|
/**
|
|
30
|
-
*
|
|
31
|
-
* @param uid
|
|
32
|
-
* @param code
|
|
33
|
-
* @param name
|
|
34
|
-
* @param defaultServerId 默认服务器
|
|
35
|
-
* @returns 创建成功后包含自动填充
|
|
37
|
+
* 创建一张新卡片
|
|
38
|
+
* @param uid - 用户ID
|
|
39
|
+
* @param code - 卡片卡号
|
|
40
|
+
* @param name - 卡片名称
|
|
41
|
+
* @param defaultServerId - 默认服务器ID(若没有默认服务器则为0)
|
|
42
|
+
* @returns 创建成功后包含自动填充ID等字段的完整对象
|
|
36
43
|
*/
|
|
37
44
|
createCard(uid: number, code: string, name: string, defaultServerId?: number): Promise<Card>;
|
|
38
45
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* @param id
|
|
42
|
-
* @param partial
|
|
46
|
+
* 更新卡片信息
|
|
47
|
+
* 可更新 code、name、defaultServerId
|
|
48
|
+
* @param id - 卡片ID
|
|
49
|
+
* @param partial - 要更新的字段
|
|
50
|
+
* @returns 无返回值的Promise
|
|
43
51
|
*/
|
|
44
52
|
updateCard(id: number, partial: Partial<Omit<Card, 'id'>>): Promise<void>;
|
|
45
53
|
/**
|
|
46
54
|
* 删除卡片
|
|
47
|
-
* @param id 卡片
|
|
55
|
+
* @param id - 卡片ID
|
|
56
|
+
* @returns 无返回值的Promise
|
|
48
57
|
*/
|
|
49
58
|
removeCard(id: number): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* 根据用户ID获取默认卡片
|
|
61
|
+
* @param uid - 用户ID
|
|
62
|
+
* @returns 用户设置的默认卡片,若不存在则返回null
|
|
63
|
+
*/
|
|
64
|
+
getDefaultCardByUid(uid: number): Promise<Card | null>;
|
|
50
65
|
}
|
|
@@ -7,55 +7,77 @@ export declare class ServerService {
|
|
|
7
7
|
constructor(ctx: Context);
|
|
8
8
|
/**
|
|
9
9
|
* 获取所有服务器列表
|
|
10
|
+
* @returns 服务器列表
|
|
10
11
|
*/
|
|
11
12
|
getAllServers(): Promise<Server[]>;
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @param uid
|
|
15
|
-
* @returns
|
|
14
|
+
* 根据用户ID获取服务器列表
|
|
15
|
+
* @param uid - 用户ID
|
|
16
|
+
* @returns 该用户绑定的服务器完整信息列表
|
|
16
17
|
*/
|
|
17
18
|
getServersByUid(uid: number): Promise<Server[]>;
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @param cid
|
|
21
|
-
* @returns
|
|
20
|
+
* 根据频道ID获取服务器列表
|
|
21
|
+
* @param cid - 频道ID
|
|
22
|
+
* @returns 该频道绑定的服务器完整信息列表
|
|
22
23
|
*/
|
|
23
24
|
getServersByCid(cid: string): Promise<Server[]>;
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
+
* 根据服务器ID获取服务器信息
|
|
27
|
+
* @param id - 服务器ID
|
|
28
|
+
* @returns 服务器信息,不存在则返回null
|
|
26
29
|
*/
|
|
27
30
|
getServerById(id: number): Promise<Server | null>;
|
|
28
31
|
/**
|
|
29
32
|
* 根据名称查找服务器
|
|
33
|
+
* @param name - 服务器名称
|
|
34
|
+
* @returns 服务器信息,不存在则返回null
|
|
30
35
|
*/
|
|
31
36
|
getServerByName(name: string): Promise<Server | null>;
|
|
32
37
|
/**
|
|
33
38
|
* 根据类型筛选服务器
|
|
39
|
+
* @param type - 服务器类型
|
|
40
|
+
* @returns 筛选后的服务器列表
|
|
34
41
|
*/
|
|
35
42
|
getServersByType(type: TServer): Promise<Server[]>;
|
|
36
43
|
/**
|
|
37
44
|
* 创建一个新的服务器记录并关联到用户
|
|
38
|
-
* @param serverData 要插入的数据
|
|
39
|
-
* @param uid
|
|
45
|
+
* @param serverData - 要插入的数据(不含ID)
|
|
46
|
+
* @param uid - 用户ID
|
|
40
47
|
* @returns 插入后的完整数据
|
|
41
48
|
*/
|
|
42
49
|
createServerForUser(serverData: Omit<Server, 'id'>, uid: number): Promise<Server>;
|
|
43
50
|
/**
|
|
44
51
|
* 创建一个新的服务器记录并关联到频道
|
|
45
|
-
* @param serverData 要插入的数据
|
|
46
|
-
* @param cid
|
|
52
|
+
* @param serverData - 要插入的数据(不含ID)
|
|
53
|
+
* @param cid - 频道ID
|
|
47
54
|
* @returns 插入后的完整数据
|
|
48
55
|
*/
|
|
49
56
|
createServerForChannel(serverData: Omit<Server, 'id'>, cid: string): Promise<Server>;
|
|
50
57
|
/**
|
|
51
58
|
* 更新服务器记录
|
|
52
|
-
* @param id 服务器
|
|
53
|
-
* @param partial 要更新的字段
|
|
59
|
+
* @param id - 服务器ID
|
|
60
|
+
* @param partial - 要更新的字段
|
|
61
|
+
* @returns 无返回值的Promise
|
|
54
62
|
*/
|
|
55
63
|
updateServer(id: number, partial: Partial<Omit<Server, 'id'>>): Promise<void>;
|
|
56
64
|
/**
|
|
57
65
|
* 删除服务器记录
|
|
58
|
-
* @param id 服务器
|
|
66
|
+
* @param id - 服务器ID
|
|
67
|
+
* @returns 无返回值的Promise
|
|
59
68
|
*/
|
|
60
69
|
removeServer(id: number): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* 根据用户ID获取默认服务器
|
|
72
|
+
* @param uid - 用户ID
|
|
73
|
+
* @returns 用户设置的默认服务器,若不存在则返回null
|
|
74
|
+
*/
|
|
75
|
+
getDefaultServerByUid(uid: number): Promise<Server | null>;
|
|
76
|
+
/**
|
|
77
|
+
* 根据频道ID获取默认服务器
|
|
78
|
+
* @param platform - 平台标识
|
|
79
|
+
* @param cid - 频道ID
|
|
80
|
+
* @returns 频道设置的默认服务器,若不存在则返回null
|
|
81
|
+
*/
|
|
82
|
+
getDefaultServerByCid(platform: string, cid: string): Promise<Server | null>;
|
|
61
83
|
}
|
|
@@ -3,21 +3,25 @@ export declare class UserService {
|
|
|
3
3
|
private ctx;
|
|
4
4
|
constructor(ctx: Context);
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @param uid
|
|
8
|
-
* @param serverId
|
|
6
|
+
* 更新用户的默认服务器ID
|
|
7
|
+
* @param uid - 用户ID
|
|
8
|
+
* @param serverId - 服务器ID
|
|
9
|
+
* @returns 无返回值的Promise
|
|
9
10
|
*/
|
|
10
11
|
updateUserDefaultServer(uid: number, serverId: number): Promise<void>;
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @param uid
|
|
14
|
-
* @param cardId
|
|
13
|
+
* 更新用户的默认卡片ID
|
|
14
|
+
* @param uid - 用户ID
|
|
15
|
+
* @param cardId - 卡片ID
|
|
16
|
+
* @returns 无返回值的Promise
|
|
15
17
|
*/
|
|
16
18
|
updateUserDefaultCard(uid: number, cardId: number): Promise<void>;
|
|
17
19
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
20
|
+
* 更新频道的默认服务器ID
|
|
21
|
+
* @param platform - 平台标识
|
|
22
|
+
* @param cid - 频道ID
|
|
23
|
+
* @param serverId - 服务器ID
|
|
24
|
+
* @returns 无返回值的Promise
|
|
21
25
|
*/
|
|
22
26
|
updateChannelDefaultServer(platform: string, cid: string, serverId: number): Promise<void>;
|
|
23
27
|
}
|
package/lib/core/utils/card.d.ts
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 将 e-Amusement 卡号(16 个十六进制字符,对应 8 字节)转换为 KONAMI ID(16字符,从 ALPHABET 中取值)
|
|
3
|
-
* @param uid e-Amusement 卡号(十六进制字符串,必须为 16 位,大写或小写皆可)
|
|
3
|
+
* @param uid - e-Amusement 卡号(十六进制字符串,必须为 16 位,大写或小写皆可)
|
|
4
4
|
* @returns KONAMI ID 字符串
|
|
5
|
+
* @throws 当卡号前缀无效、长度不是16位或解析后不是8字节时抛出异常
|
|
5
6
|
*/
|
|
6
7
|
export declare function toKonamiId(uid: string): string;
|
|
7
8
|
/**
|
|
8
9
|
* 将 KONAMI ID(16字符)转换回 e-Amusement 卡号(16 个十六进制字符)
|
|
9
|
-
* @param konamiId KONAMI ID 字符串
|
|
10
|
+
* @param konamiId - KONAMI ID 字符串
|
|
10
11
|
* @returns e-Amusement 卡号(16 位十六进制字符串,大写)
|
|
12
|
+
* @throws 当 KONAMI ID 格式无效、长度不是16位、校验和不匹配等情况时抛出异常
|
|
11
13
|
*/
|
|
12
14
|
export declare function toUid(konamiId: string): string;
|
|
13
15
|
/**
|
|
14
|
-
* 判断给定的字符串是 UID、KONAMI ID
|
|
15
|
-
* @param input 待判断的字符串
|
|
16
|
-
* @returns "uid" 表示 e-Amusement UID, "konamiid" 表示 KONAMI ID, "invalid"
|
|
16
|
+
* 判断给定的字符串是 UID、KONAMI ID 还是非法字符串
|
|
17
|
+
* @param input - 待判断的字符串
|
|
18
|
+
* @returns "uid" 表示 e-Amusement UID, "konamiid" 表示 KONAMI ID, "invalid" 表示非法字符串
|
|
17
19
|
*/
|
|
18
20
|
export declare function classifyCardId(input: string): "uid" | "konamiid" | "invalid";
|
|
19
21
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @param input 用户输入的卡号
|
|
22
|
-
* @returns
|
|
22
|
+
* 处理用户输入的卡号
|
|
23
|
+
* @param input - 用户输入的卡号
|
|
24
|
+
* @returns 删去空格的全大写字符串,并转换特殊字符(I→1, O/Q→0, V→U)
|
|
23
25
|
*/
|
|
24
26
|
export declare function processInputCardCode(input: string): string;
|
package/lib/core/utils/role.d.ts
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { Session } from 'koishi';
|
|
2
2
|
import { CoreConfig } from '../../types/config';
|
|
3
|
+
/**
|
|
4
|
+
* 检查是否具有权限
|
|
5
|
+
* @param perms - 权限布尔值列表
|
|
6
|
+
* @returns 如果任一权限为true则返回true
|
|
7
|
+
*/
|
|
3
8
|
export declare function hasPermission(...perms: boolean[]): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 检查用户是否为插件管理员
|
|
11
|
+
* @param session - 会话对象
|
|
12
|
+
* @param config - 核心配置
|
|
13
|
+
* @returns 用户是否为管理员
|
|
14
|
+
*/
|
|
4
15
|
export declare function isPluginAdmin(session: Session, config: CoreConfig): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 检查用户是否为群组管理员
|
|
18
|
+
* @param session - 会话对象
|
|
19
|
+
* @returns 用户是否为群组管理员
|
|
20
|
+
*/
|
|
5
21
|
export declare function isGuildAdmin(session: Session): boolean;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Context } from 'koishi';
|
|
2
2
|
import { IDrawer } from '../types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* 基础绘图类,为所有绘图器提供通用功能
|
|
5
5
|
*/
|
|
6
6
|
export declare abstract class BaseDrawer implements IDrawer {
|
|
7
7
|
ctx: Context;
|
|
8
8
|
constructor(ctx: Context);
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @param canvas
|
|
12
|
-
* @param compression
|
|
13
|
-
* @returns
|
|
10
|
+
* 压缩图片缓冲区
|
|
11
|
+
* @param canvas - 要压缩的canvas对象
|
|
12
|
+
* @param compression - 压缩选项
|
|
13
|
+
* @returns 压缩后的缓冲区
|
|
14
14
|
*/
|
|
15
15
|
protected compressImage(canvas: any, compression?: {
|
|
16
16
|
lossless: boolean;
|
|
@@ -4,5 +4,11 @@ export declare class DrawerFactory {
|
|
|
4
4
|
private ctx;
|
|
5
5
|
private drawerInstances;
|
|
6
6
|
constructor(ctx: Context);
|
|
7
|
+
/**
|
|
8
|
+
* 根据绘图类型获取绘图实例,如果不存在则创建新实例
|
|
9
|
+
* @param drawerType - 绘图类型(游戏类型或核心类型)
|
|
10
|
+
* @returns 对应的绘图实例
|
|
11
|
+
* @throws 当请求不支持的绘图类型时抛出异常
|
|
12
|
+
*/
|
|
7
13
|
getDrawer(drawerType: TGame | 'core'): IDrawer;
|
|
8
14
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { Context } from 'koishi';
|
|
2
2
|
import { BaseDrawer } from '../BaseDrawer';
|
|
3
|
+
/**
|
|
4
|
+
* Core 绘图类,提供 Core 图像生成功能
|
|
5
|
+
*/
|
|
3
6
|
export declare class CoreDrawer extends BaseDrawer {
|
|
4
7
|
ctx: Context;
|
|
5
8
|
constructor(ctx: Context);
|
|
6
9
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @param options
|
|
9
|
-
* @param compression
|
|
10
|
-
* @returns
|
|
10
|
+
* 生成通用图像
|
|
11
|
+
* @param options - 图像生成配置选项
|
|
12
|
+
* @param compression - 压缩选项
|
|
13
|
+
* @returns 包含图像数据的Buffer
|
|
11
14
|
*/
|
|
12
15
|
generateImage(options?: {
|
|
13
16
|
width?: number;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { Context } from 'koishi';
|
|
2
2
|
import { BaseDrawer } from '../BaseDrawer';
|
|
3
|
+
/**
|
|
4
|
+
* IIDX绘图类,提供IIDX游戏相关图像生成功能
|
|
5
|
+
*/
|
|
3
6
|
export declare class IIDXDrawer extends BaseDrawer {
|
|
4
7
|
ctx: Context;
|
|
5
8
|
constructor(ctx: Context);
|
|
6
9
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @param options
|
|
9
|
-
* @param compression
|
|
10
|
-
* @returns
|
|
10
|
+
* 生成IIDX游戏数据图像
|
|
11
|
+
* @param options - 图像生成配置选项
|
|
12
|
+
* @param compression - 压缩选项
|
|
13
|
+
* @returns 包含图像数据的Buffer
|
|
11
14
|
*/
|
|
12
15
|
generateImage(options?: {
|
|
13
16
|
width?: number;
|
|
@@ -23,7 +26,13 @@ export declare class IIDXDrawer extends BaseDrawer {
|
|
|
23
26
|
quality?: number;
|
|
24
27
|
}): Promise<Buffer>;
|
|
25
28
|
/**
|
|
26
|
-
*
|
|
29
|
+
* 绘制段位信息
|
|
30
|
+
* @param ctx - Canvas上下文
|
|
31
|
+
* @param centerX - 中心X坐标
|
|
32
|
+
* @param y - 起始Y坐标
|
|
33
|
+
* @param sp_dan - sp 段位
|
|
34
|
+
* @param dp_dan - dp 段位
|
|
35
|
+
* @param textColor - 文字颜色
|
|
27
36
|
*/
|
|
28
37
|
private drawRankingInfo;
|
|
29
38
|
}
|
package/lib/drawer/index.d.ts
CHANGED
|
@@ -7,7 +7,22 @@ export declare class DrawerManager {
|
|
|
7
7
|
private factory;
|
|
8
8
|
private logger;
|
|
9
9
|
private constructor();
|
|
10
|
+
/**
|
|
11
|
+
* 获取绘图管理器实例
|
|
12
|
+
* @param ctx - Koishi上下文
|
|
13
|
+
* @returns 绘图管理器的唯一实例
|
|
14
|
+
*/
|
|
10
15
|
static getInstance(ctx: Context): DrawerManager;
|
|
11
|
-
|
|
16
|
+
/**
|
|
17
|
+
* 根据插件类型获取对应的绘图实例
|
|
18
|
+
* @param pluginType - 插件类型
|
|
19
|
+
* @returns 对应的绘图实例
|
|
20
|
+
*/
|
|
21
|
+
getDrawer(pluginType: TGame | 'core'): import("../types").IDrawer;
|
|
12
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* 应用函数,初始化插件
|
|
25
|
+
* @param ctx - Koishi上下文
|
|
26
|
+
* @param config - 应用配置
|
|
27
|
+
*/
|
|
13
28
|
export declare function apply(ctx: Context, config: AppConfig): void;
|
|
@@ -2,14 +2,17 @@ import { Context } from 'koishi';
|
|
|
2
2
|
import { BaseDrawer } from '../BaseDrawer';
|
|
3
3
|
import { SDVXScore } from '../../games/sdvx/types';
|
|
4
4
|
import { SDVXConfig } from '../../types/config';
|
|
5
|
+
/**
|
|
6
|
+
* SDVX绘图类,提供SDVX游戏相关图像生成功能
|
|
7
|
+
*/
|
|
5
8
|
export declare class SDVXDrawer extends BaseDrawer {
|
|
6
9
|
ctx: Context;
|
|
7
10
|
constructor(ctx: Context);
|
|
8
11
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @param options
|
|
11
|
-
* @param compression
|
|
12
|
-
* @returns
|
|
12
|
+
* 生成SDVX最近成绩图像
|
|
13
|
+
* @param options - 图像生成配置选项
|
|
14
|
+
* @param compression - 压缩选项
|
|
15
|
+
* @returns 包含图像数据的Buffer
|
|
13
16
|
*/
|
|
14
17
|
generateRecentImage(options: {
|
|
15
18
|
score: SDVXScore;
|
|
@@ -19,10 +22,10 @@ export declare class SDVXDrawer extends BaseDrawer {
|
|
|
19
22
|
lossless: boolean;
|
|
20
23
|
}): Promise<Buffer>;
|
|
21
24
|
/**
|
|
22
|
-
*
|
|
23
|
-
* @param options
|
|
24
|
-
* @param compression
|
|
25
|
-
* @returns
|
|
25
|
+
* 生成SDVX Volforce图像
|
|
26
|
+
* @param options - 图像生成配置选项
|
|
27
|
+
* @param compression - 压缩选项
|
|
28
|
+
* @returns 包含图像数据的Buffer
|
|
26
29
|
*/
|
|
27
30
|
generateVFImage(options: {
|
|
28
31
|
scores: SDVXScore[];
|
|
@@ -32,7 +35,12 @@ export declare class SDVXDrawer extends BaseDrawer {
|
|
|
32
35
|
lossless: boolean;
|
|
33
36
|
}): Promise<Buffer>;
|
|
34
37
|
/**
|
|
35
|
-
*
|
|
38
|
+
* 在画布上绘制成绩卡片
|
|
39
|
+
* @param ctx - Canvas上下文
|
|
40
|
+
* @param scores - 成绩数组
|
|
41
|
+
* @param cardBgImage - 卡片背景图像
|
|
42
|
+
* @param loadImage - 图像加载函数
|
|
43
|
+
* @param config - SDVX配置
|
|
36
44
|
*/
|
|
37
45
|
private drawScoreCards;
|
|
38
46
|
/**
|
|
@@ -5,6 +5,17 @@ export declare class MusicService {
|
|
|
5
5
|
private static instance;
|
|
6
6
|
private sdvx_data_url;
|
|
7
7
|
private constructor();
|
|
8
|
+
/**
|
|
9
|
+
* 获取 MusicService 实例
|
|
10
|
+
* @param config - SDVX 配置对象
|
|
11
|
+
* @returns MusicService 实例
|
|
12
|
+
*/
|
|
8
13
|
static getInstance(config: SDVXConfig): MusicService;
|
|
14
|
+
/**
|
|
15
|
+
* 获取音乐信息
|
|
16
|
+
* @param ctx - Koishi 上下文对象
|
|
17
|
+
* @param musicIds - 音乐 ID 数组
|
|
18
|
+
* @returns 音乐信息数组
|
|
19
|
+
*/
|
|
9
20
|
getMusic(ctx: Context, musicIds: number[]): Promise<SDVXMusic[]>;
|
|
10
21
|
}
|
|
@@ -2,17 +2,21 @@ import { SDVXScore } from '../types';
|
|
|
2
2
|
export declare class ScoreService {
|
|
3
3
|
private static instance;
|
|
4
4
|
private constructor();
|
|
5
|
+
/**
|
|
6
|
+
* 获取 ScoreService 实例
|
|
7
|
+
* @returns ScoreService 实例
|
|
8
|
+
*/
|
|
5
9
|
static getInstance(): ScoreService;
|
|
6
10
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @param scores
|
|
9
|
-
* @returns
|
|
11
|
+
* 按 Volforce 降序排序分数
|
|
12
|
+
* @param scores - 待排序的 SDVX 分数数组
|
|
13
|
+
* @returns 按 Volforce 降序排序的新数组
|
|
10
14
|
*/
|
|
11
15
|
sortByVolforce(scores: SDVXScore[]): SDVXScore[];
|
|
12
16
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @param scores
|
|
15
|
-
* @returns
|
|
17
|
+
* 获取前 50 名分数(包括并列)
|
|
18
|
+
* @param scores - 待处理的 SDVX 分数数组
|
|
19
|
+
* @returns 包含最高 Volforce 值的分数数组(如果存在并列,可能超过 50 个)
|
|
16
20
|
*/
|
|
17
21
|
getBest50(scores: SDVXScore[]): SDVXScore[];
|
|
18
22
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDVX 用户档案接口
|
|
3
|
+
*/
|
|
1
4
|
export interface SDVXProfile {
|
|
2
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* SDVX 分数记录接口
|
|
8
|
+
*/
|
|
3
9
|
export interface SDVXScore {
|
|
4
10
|
music: {
|
|
5
11
|
music_id: number;
|
|
@@ -22,8 +28,17 @@ export interface SDVXScore {
|
|
|
22
28
|
music_data: SDVXMusic;
|
|
23
29
|
difficulty_data: SDVXMusicDifficulty;
|
|
24
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* SDVX 分数等级类型
|
|
33
|
+
*/
|
|
25
34
|
export type SDVXGrade = 'S' | 'AAA+' | 'AAA' | 'AA+' | 'AA' | 'A+' | 'A' | 'B' | 'C' | 'D';
|
|
35
|
+
/**
|
|
36
|
+
* SDVX 通关类型
|
|
37
|
+
*/
|
|
26
38
|
export type SDVXClearType = 'S-PUC' | 'PUC' | 'UC' | 'HC' | 'NC' | 'PLAYED' | 'NO PLAY';
|
|
39
|
+
/**
|
|
40
|
+
* SDVX 音乐难度数据接口
|
|
41
|
+
*/
|
|
27
42
|
export interface SDVXMusicDifficulty {
|
|
28
43
|
difstr: string;
|
|
29
44
|
difnum: number;
|
|
@@ -53,6 +68,9 @@ export interface SDVXMusicDifficulty {
|
|
|
53
68
|
chart_url: string;
|
|
54
69
|
mirror_chart_url: string;
|
|
55
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* SDVX 音乐数据接口
|
|
73
|
+
*/
|
|
56
74
|
export interface SDVXMusic {
|
|
57
75
|
id: number;
|
|
58
76
|
label: string;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { SDVXGrade, SDVXClearType, SDVXScore } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* @param raw_score
|
|
5
|
-
* @returns
|
|
3
|
+
* 计算 Volforce 值
|
|
4
|
+
* @param raw_score - API 返回的分数对象
|
|
5
|
+
* @returns 计算后的 Volforce 值
|
|
6
6
|
*/
|
|
7
7
|
export declare function calculateVolforce(raw_score: SDVXScore): number;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @param grade
|
|
11
|
-
* @returns
|
|
9
|
+
* 获取指定等级的系数
|
|
10
|
+
* @param grade - 要获取系数的等级
|
|
11
|
+
* @returns 等级系数
|
|
12
12
|
*/
|
|
13
13
|
export declare function getGradeFactor(grade: SDVXGrade): number;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @param clearType
|
|
17
|
-
* @returns
|
|
15
|
+
* 获取指定通关类型的系数
|
|
16
|
+
* @param clearType - 要获取系数的通关类型
|
|
17
|
+
* @returns 通关类型系数
|
|
18
18
|
*/
|
|
19
19
|
export declare function getClearFactor(clearType: SDVXClearType): number;
|