koishi-plugin-mcdle 0.0.7 → 0.1.1
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/LICENSE-APACHE +178 -0
- package/LICENSE-MIT +25 -0
- package/lib/index.d.ts +5 -2
- package/lib/index.js +1396 -312
- package/lib/view.d.ts +69 -0
- package/package.json +64 -51
- package/readme.md +23 -0
package/lib/view.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/** 把字符画转成内联 SVG。`shape-rendering=crispEdges` 保证像素边缘不被抗锯齿糊掉。 */
|
|
2
|
+
export declare function px(name: string, size?: number, cls?: string): string;
|
|
3
|
+
export type Mode = 'mob' | 'item' | 'block';
|
|
4
|
+
export interface ModeMeta {
|
|
5
|
+
name: string;
|
|
6
|
+
icon: string;
|
|
7
|
+
/** 主色,用于卡片高亮与徽记 */
|
|
8
|
+
accent: string;
|
|
9
|
+
/** 该模式下的图片是否为小尺寸像素贴图(决定缩放算法) */
|
|
10
|
+
pixelArt: boolean;
|
|
11
|
+
tagline: string;
|
|
12
|
+
total: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const MODES: Record<Mode, ModeMeta>;
|
|
15
|
+
/** 每种模式下参与比对的字段及其展示顺序(数值在前、标签在后、版本收尾)。 */
|
|
16
|
+
export declare const FIELDS: Record<Mode, string[]>;
|
|
17
|
+
export declare function fieldLabel(key: string): string;
|
|
18
|
+
export declare function fieldIcon(key: string): string;
|
|
19
|
+
/** 把原始字段值翻译成中文展示值,数组字段保留逐项结构以便高亮命中项。 */
|
|
20
|
+
export declare function displayValues(key: string, raw: any): {
|
|
21
|
+
text: string;
|
|
22
|
+
raw: string;
|
|
23
|
+
}[];
|
|
24
|
+
export type Status = 'true' | 'mixed' | 'false' | 'false_up' | 'false_down' | 'unknown';
|
|
25
|
+
export declare const STATUS_META: Record<Status, {
|
|
26
|
+
cls: string;
|
|
27
|
+
icon: string;
|
|
28
|
+
label: string;
|
|
29
|
+
emoji: string;
|
|
30
|
+
}>;
|
|
31
|
+
export declare function statusOf(guess: any, key: string): Status;
|
|
32
|
+
export interface ShellOptions {
|
|
33
|
+
accent: string;
|
|
34
|
+
/** 固定卡片宽度;棋盘类卡片省略此项,按列数自适应 */
|
|
35
|
+
width?: number;
|
|
36
|
+
}
|
|
37
|
+
export declare function esc(s: any): string;
|
|
38
|
+
export interface BoardOptions {
|
|
39
|
+
mode: Mode;
|
|
40
|
+
guesses: any[];
|
|
41
|
+
/** 已锁定字段数 / 总字段数,用于进度条 */
|
|
42
|
+
tip?: string;
|
|
43
|
+
}
|
|
44
|
+
export declare function boardCard(opts: BoardOptions): string;
|
|
45
|
+
export declare function startCard(mode: Mode, played: number, limit: number): string;
|
|
46
|
+
export interface WinOptions {
|
|
47
|
+
mode: Mode;
|
|
48
|
+
answer: any;
|
|
49
|
+
attempts: number;
|
|
50
|
+
seconds: number;
|
|
51
|
+
username: string;
|
|
52
|
+
total: number;
|
|
53
|
+
played: number;
|
|
54
|
+
limit: number;
|
|
55
|
+
}
|
|
56
|
+
/** 把秒数说成人话;秒级以内也要有话说,异常才落到破折号。 */
|
|
57
|
+
export declare function formatDuration(seconds: number): string;
|
|
58
|
+
export declare function winCard(o: WinOptions): string;
|
|
59
|
+
export declare function helpCard(dailyLimit: number, allowRepeat: boolean): string;
|
|
60
|
+
export declare function introCard(dailyLimit: number): string;
|
|
61
|
+
export interface RankEntry {
|
|
62
|
+
username: string;
|
|
63
|
+
userId: string;
|
|
64
|
+
mob: number;
|
|
65
|
+
item: number;
|
|
66
|
+
block: number;
|
|
67
|
+
total: number;
|
|
68
|
+
}
|
|
69
|
+
export declare function rankCard(entries: RankEntry[], shown: number): string;
|
package/package.json
CHANGED
|
@@ -1,51 +1,64 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "koishi-plugin-mcdle",
|
|
3
|
-
"description": "Koishi 的 Minecraft 猜词游戏插件。根据 Minecraft 物品、生物和方块的属性特征,猜测正确的名称。",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"typings": "lib/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"lib",
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"plugin"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "koishi-plugin-mcdle",
|
|
3
|
+
"description": "Koishi 的 Minecraft 猜词游戏插件。根据 Minecraft 物品、生物和方块的属性特征,猜测正确的名称。",
|
|
4
|
+
"version": "0.1.1",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"typings": "lib/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib",
|
|
9
|
+
"LICENSE-APACHE",
|
|
10
|
+
"LICENSE-MIT"
|
|
11
|
+
],
|
|
12
|
+
"koishi": {
|
|
13
|
+
"service": {
|
|
14
|
+
"required": [
|
|
15
|
+
"database"
|
|
16
|
+
],
|
|
17
|
+
"optional": [
|
|
18
|
+
"puppeteer"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT OR Apache-2.0",
|
|
23
|
+
"author": "Nawyjx <3373167460@qq.com>",
|
|
24
|
+
"contributors": [
|
|
25
|
+
{
|
|
26
|
+
"name": "VincentZyu233",
|
|
27
|
+
"email": "1830540513zyu@gmail.com",
|
|
28
|
+
"url": "https://github.com/VincentZyu233"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"homepage": "https://www.npmjs.com/package/koishi-plugin-mcdle?activeTab=readme",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/araea/koishi-plugin-mcdle.git"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"koishi",
|
|
38
|
+
"plugin",
|
|
39
|
+
"chatbot",
|
|
40
|
+
"mcdle",
|
|
41
|
+
"minecraft",
|
|
42
|
+
"game",
|
|
43
|
+
"guess",
|
|
44
|
+
"wordle",
|
|
45
|
+
"猜词",
|
|
46
|
+
"游戏",
|
|
47
|
+
"我的世界",
|
|
48
|
+
"物品",
|
|
49
|
+
"生物",
|
|
50
|
+
"方块"
|
|
51
|
+
],
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"koishi": "^4.18.9",
|
|
54
|
+
"koishi-plugin-puppeteer": "^3.9.0"
|
|
55
|
+
},
|
|
56
|
+
"peerDependenciesMeta": {
|
|
57
|
+
"koishi-plugin-puppeteer": {
|
|
58
|
+
"optional": true
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"koishi-plugin-puppeteer": "^3.9.0"
|
|
63
|
+
}
|
|
64
|
+
}
|
package/readme.md
CHANGED
|
@@ -25,6 +25,29 @@ Koishi 的 Minecraft 猜词游戏插件。根据 Minecraft 物品、生物和方
|
|
|
25
25
|
| 🟥⬆️ | 答案更大 |
|
|
26
26
|
| 🟥⬇️ | 答案更小 |
|
|
27
27
|
|
|
28
|
+
部分匹配的字段里,**被点亮的那几个标签**就是与答案重合的值 —— 图片中高亮显示,
|
|
29
|
+
文本中用 `【】` 括起。
|
|
30
|
+
|
|
31
|
+
## 指令
|
|
32
|
+
|
|
33
|
+
| 指令 | 说明 |
|
|
34
|
+
|------|------|
|
|
35
|
+
| `mcdle` | 游戏简介与快速上手 |
|
|
36
|
+
| `mcdle.猜 [名称]` | 开始一局,或提交一次猜测 |
|
|
37
|
+
| `mcdle.猜` | 局中直接使用,回看当前棋盘 |
|
|
38
|
+
| `mcdle.帮助` | 完整玩法说明 |
|
|
39
|
+
| `mcdle.排行榜` | 群内战绩 |
|
|
40
|
+
| `mcdle.词库` | 全部候选词条 |
|
|
41
|
+
|
|
42
|
+
## 图片
|
|
43
|
+
|
|
44
|
+
安装 [puppeteer](https://www.npmjs.com/package/koishi-plugin-puppeteer) 服务后,
|
|
45
|
+
棋盘、开局、揭晓与排行榜都会渲染成像素风卡片:内联 SVG 像素图标、我的世界式的
|
|
46
|
+
方块斜角,不依赖任何外部字体或图片资源。
|
|
47
|
+
|
|
48
|
+
puppeteer 是**可选**依赖。未安装、渲染超时或截图失败时,都会自动回退到等价的
|
|
49
|
+
文本形态,玩法与信息量不受影响;配置项 `disableImages` 可以强制只用文本。
|
|
50
|
+
|
|
28
51
|
## 致谢
|
|
29
52
|
|
|
30
53
|
* [Koishi](https://koishi.chat/)
|