koishi-plugin-cchess 1.3.0 → 1.4.0
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/index.d.ts +1 -1
- package/lib/index.js +19 -19
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context, Schema } from 'koishi';
|
|
2
2
|
export declare const name = "cchess";
|
|
3
|
-
export declare const usage = "## \u4F7F\u7528\n\n`cchess.\u5F00\u59CB` \u5373\u53EF\u5165\u5EA7\uFF0C\u53CC\u65B9\u5C31\u4F4D\u540E\u81EA\u52A8\u5F00\u5C40\uFF1B`cchess.\u5F00\u59CB \u4EBA\u673A` \u76F4\u63A5\u6311\u6218\u76AE\u5361\u9C7C\u3002\u7740\u6CD5\u53EF\u76F4\u63A5\u53D1\u9001\uFF0C\u4F8B\u5982 `\u70AE\u4E8C\u5E73\u4E94` \u6216 `b2e2`\u3002\n\n\u6094\u68CB\u8BF7\u6C42\u9001\u51FA\u540E\uFF0C\u5BF9\u65B9\u65E0\u9700\u5E26\u6307\u4EE4\u524D\u7F00\uFF0C\u76F4\u63A5\u56DE\u590D `\u540C\u610F` \u6216 `\u62D2\u7EDD` \u5373\u53EF\u8868\u51B3\u3002\n\n## \u6307\u4EE4\n\n| \u6307\u4EE4 | \u8BF4\u660E |\n| --- | --- |\n| `cchess.\u5F00\u59CB [\u7EA2/\u9ED1] [\u4EBA\u4EBA/\u4EBA\u673A]` | \u5165\u5EA7\u5E76\u5F00\u5C40\uFF0C\u53CC\u65B9\u5C31\u4F4D\u540E\u81EA\u52A8\u5F00\u6218 |\n| `cchess.\u5F00\u59CB <FEN>` | \u6446\u8C31\uFF0C\u5BFC\u5165\u5C40\u9762\u540E\u518D `cchess.\u5F00\u59CB` \u5373\u53EF |\n| `cchess.\u6094\u68CB [\u540C\u610F/\u62D2\u7EDD]` | \u8BF7\u6C42\u6094\u68CB\uFF0C\u4E5F\u53EF\u76F4\u63A5\u56DE\u590D\u540C\u610F\u6216\u62D2\u7EDD\u8868\u51B3 |\n| `cchess.\u8BA4\u8F93` | \u8BA4\u8F93 |\n| `cchess.\u7ED3\u675F` | \
|
|
3
|
+
export declare const usage = "## \u4F7F\u7528\n\n`cchess.\u5F00\u59CB` \u5373\u53EF\u5165\u5EA7\uFF0C\u53CC\u65B9\u5C31\u4F4D\u540E\u81EA\u52A8\u5F00\u5C40\uFF1B`cchess.\u5F00\u59CB \u4EBA\u673A` \u76F4\u63A5\u6311\u6218\u76AE\u5361\u9C7C\u3002\u7740\u6CD5\u53EF\u76F4\u63A5\u53D1\u9001\uFF0C\u4F8B\u5982 `\u70AE\u4E8C\u5E73\u4E94` \u6216 `b2e2`\u3002\n\n\u6094\u68CB\u8BF7\u6C42\u9001\u51FA\u540E\uFF0C\u5BF9\u65B9\u65E0\u9700\u5E26\u6307\u4EE4\u524D\u7F00\uFF0C\u76F4\u63A5\u56DE\u590D `\u540C\u610F` \u6216 `\u62D2\u7EDD` \u5373\u53EF\u8868\u51B3\u3002\n\n## \u6307\u4EE4\n\n| \u6307\u4EE4 | \u8BF4\u660E |\n| --- | --- |\n| `cchess.\u5F00\u59CB [\u7EA2/\u9ED1] [\u4EBA\u4EBA/\u4EBA\u673A]` | \u5165\u5EA7\u5E76\u5F00\u5C40\uFF0C\u53CC\u65B9\u5C31\u4F4D\u540E\u81EA\u52A8\u5F00\u6218 |\n| `cchess.\u5F00\u59CB <FEN>` | \u6446\u8C31\uFF0C\u5BFC\u5165\u5C40\u9762\u540E\u518D `cchess.\u5F00\u59CB` \u5373\u53EF |\n| `cchess.\u6094\u68CB [\u540C\u610F/\u62D2\u7EDD]` | \u8BF7\u6C42\u6094\u68CB\uFF0C\u4E5F\u53EF\u76F4\u63A5\u56DE\u590D\u540C\u610F\u6216\u62D2\u7EDD\u8868\u51B3 |\n| `cchess.\u8BA4\u8F93` | \u8BA4\u8F93\u5E76\u7ED3\u675F\u5BF9\u5C40 |\n| `cchess.\u7ED3\u675F` | \u7ED3\u675F\u5F53\u524D\u5BF9\u5C40 |\n| `cchess.\u68CB\u7EE9 [@\u67D0\u4EBA/\u699C] [\u80DC\u573A/\u8F93\u573A] [\u4EBA\u6570]` | \u67E5\u8BE2\u6218\u7EE9\u6216\u6392\u884C\u699C |\n| `cchess.\u67E5\u770B\u4E91\u5E93\u6B8B\u5C40 [DTM/DTC]` | \u67E5\u8BE2\u4E91\u5E93\u6B8B\u5C40\u7EDF\u8BA1 |";
|
|
4
4
|
export declare const inject: string[];
|
|
5
5
|
export interface Config {
|
|
6
6
|
boardSkin: string;
|
package/lib/index.js
CHANGED
|
@@ -257,23 +257,23 @@ var usage = `## 使用
|
|
|
257
257
|
| \`cchess.开始 [红/黑] [人人/人机]\` | 入座并开局,双方就位后自动开战 |
|
|
258
258
|
| \`cchess.开始 <FEN>\` | 摆谱,导入局面后再 \`cchess.开始\` 即可 |
|
|
259
259
|
| \`cchess.悔棋 [同意/拒绝]\` | 请求悔棋,也可直接回复同意或拒绝表决 |
|
|
260
|
-
| \`cchess.认输\` |
|
|
261
|
-
| \`cchess.结束\` |
|
|
262
|
-
| \`cchess.棋绩 [@某人/榜] [胜场/输场] [人数]\` |
|
|
263
|
-
| \`cchess.查看云库残局 [DTM/DTC]\` |
|
|
260
|
+
| \`cchess.认输\` | 认输并结束对局 |
|
|
261
|
+
| \`cchess.结束\` | 结束当前对局 |
|
|
262
|
+
| \`cchess.棋绩 [@某人/榜] [胜场/输场] [人数]\` | 查询战绩或排行榜 |
|
|
263
|
+
| \`cchess.查看云库残局 [DTM/DTC]\` | 查询云库残局统计 |`;
|
|
264
264
|
var inject = ["database", "canvas"];
|
|
265
265
|
var pieceSkins = ["棋弈无限图形棋子", "云库木制棋子", "刘炳森红黑牛角隶书棋子", "木制棋子", "本纹隶书棋子", "银灰将军体棋子", "棋弈无限红绿正棋子", "棋弈无限红绿棋子", "棋天大圣棋子", "棋者象棋棋子", "楷书玉石棋子", "水墨青瓷棋子", "牛皮纸华康金文棋子", "皮卡鱼棋子", "红蓝祥隶棋子", "红黑精典无阴影棋子", "红黑精典棋子", "行书玉石棋子", "象甲棋子", "金属棋子篆体棋子", "镌刻华彩棋子", "鹏飞红黑棋子", "鹏飞经典棋子", "鹏飞绿龙棋子", "龙腾四海棋子"];
|
|
266
266
|
var boardSkins = ["棋弈无限红绿棋盘", "一鸣惊人棋盘", "三星堆棋盘", "云库木制棋盘", "云心鹤眼棋盘", "兰亭集序无字棋盘", "兰亭集序棋盘", "凤舞九天棋盘", "卯兔添福棋盘", "叱咤风云棋盘", "君临天下棋盘", "壁画古梦棋盘", "大闹天宫棋盘", "天山共色棋盘", "女神之约棋盘", "小吕飞刀棋盘", "山海绘卷棋盘", "护眼绿棋盘", "星河璀璨棋盘", "木制棋盘", "本纹隶书白棋盘", "本纹隶书黑棋盘", "桃花源记棋盘", "棋天大圣棋盘", "棋天无大圣棋盘", "武侠江湖棋盘", "水墨青瓷棋盘", "清悠茶道棋盘", "游园惊梦棋盘", "牛转乾坤棋盘", "玉石太极棋盘", "皓月无痕棋盘", "皮卡鱼棋盘", "盲棋神迹棋盘", "空城计棋盘", "竹波烟雨棋盘", "经典木棋盘棋盘", "绿色棋盘", "象甲2023棋盘", "象甲征程棋盘", "象甲重燃棋盘", "金牛降世棋盘", "金虎贺岁棋盘", "金虎贺岁(王天一签名版)棋盘", "鎏金岁月棋盘", "霸王别姬棋盘", "鸿门宴棋盘", "鹏飞红黑棋盘", "鹏飞经典棋盘", "鹏飞绿龙棋盘", "龙腾天坛棋盘"];
|
|
267
267
|
var Config = import_koishi.Schema.object({
|
|
268
268
|
boardSkin: import_koishi.Schema.union(boardSkins).default("象甲2023棋盘").description(`棋盘皮肤。`),
|
|
269
269
|
pieceSkin: import_koishi.Schema.union(pieceSkins).default("象甲棋子").description(`棋子皮肤。`),
|
|
270
|
-
allowFreePieceMovementInHumanMachineMode: import_koishi.Schema.boolean().default(false).description(
|
|
270
|
+
allowFreePieceMovementInHumanMachineMode: import_koishi.Schema.boolean().default(false).description(`人机模式下,允许所有人自由移动棋子,开启后可以不入座直接开始人机对局。`),
|
|
271
271
|
defaultEngineThinkingDepth: import_koishi.Schema.number().min(0).max(100).default(10).description(`默认引擎思考深度,越高 AI 棋力越强,耗时也越长(小于 1 时按 1 计算)。由于 Nodejs 不支持 SIMD,所以不建议设置过高。`),
|
|
272
|
-
defaultMaxLeaderboardEntries: import_koishi.Schema.number().min(0).default(10).description(
|
|
273
|
-
retractDelay: import_koishi.Schema.number().min(0).default(0).description(
|
|
272
|
+
defaultMaxLeaderboardEntries: import_koishi.Schema.number().min(0).default(10).description(`排行榜默认显示的人数。`),
|
|
273
|
+
retractDelay: import_koishi.Schema.number().min(0).default(0).description(`自动撤回延迟(秒),0 表示不撤回。`),
|
|
274
274
|
imgScale: import_koishi.Schema.number().min(1).default(1).description(`图片分辨率倍率。`),
|
|
275
|
-
imageType: import_koishi.Schema.union(["png", "jpeg", "webp"]).default("png").description(
|
|
276
|
-
isChessImageWithOutlineEnabled: import_koishi.Schema.boolean().default(true).description(
|
|
275
|
+
imageType: import_koishi.Schema.union(["png", "jpeg", "webp"]).default("png").description(`发送的图片格式。`),
|
|
276
|
+
isChessImageWithOutlineEnabled: import_koishi.Schema.boolean().default(true).description(`给棋盘图片加上坐标外框。关闭后出图明显更快,但没有外框,玩起来可能会比较累。`)
|
|
277
277
|
});
|
|
278
278
|
var RULE = "━━━━━━━━━━━━━━";
|
|
279
279
|
var SIDE_ICONS = { 红方: "🔴", 黑方: "⚫" };
|
|
@@ -459,10 +459,10 @@ function apply(ctx, config) {
|
|
|
459
459
|
}
|
|
460
460
|
await handleMove(session, moveOperation);
|
|
461
461
|
});
|
|
462
|
-
ctx.command("cchess", "
|
|
462
|
+
ctx.command("cchess", "中国象棋 · 楚河汉界").action(async ({ session }) => {
|
|
463
463
|
await session.execute(`cchess -h`);
|
|
464
464
|
});
|
|
465
|
-
ctx.command("cchess.开始 [args:text]", "
|
|
465
|
+
ctx.command("cchess.开始 [args:text]", "入座并开局").usage("可选阵营「红」「黑」与对手「人人」「人机」;直接粘贴 FEN 串则按摆谱处理。").example("cchess.开始 红 人机").action(async ({ session }, args) => {
|
|
466
466
|
const { username, userId, channelId } = session;
|
|
467
467
|
await updateNameInPlayerRecord(userId, username);
|
|
468
468
|
const gameRecord = await getGameRecord(channelId);
|
|
@@ -545,7 +545,7 @@ function apply(ctx, config) {
|
|
|
545
545
|
image: await renderBoard(channelId)
|
|
546
546
|
}));
|
|
547
547
|
});
|
|
548
|
-
ctx.command("cchess.结束", "
|
|
548
|
+
ctx.command("cchess.结束", "结束当前对局").action(async ({ session }) => {
|
|
549
549
|
const { username, userId, channelId } = session;
|
|
550
550
|
await updateNameInPlayerRecord(userId, username);
|
|
551
551
|
const gameRecord = await getGameRecord(channelId);
|
|
@@ -579,7 +579,7 @@ function apply(ctx, config) {
|
|
|
579
579
|
icon: "⏳",
|
|
580
580
|
title: "棋局正在推演",
|
|
581
581
|
at: username,
|
|
582
|
-
body: ["
|
|
582
|
+
body: ["上一着棋尚未结算,稍候片刻。"]
|
|
583
583
|
}));
|
|
584
584
|
}
|
|
585
585
|
busyChannels.add(channelId);
|
|
@@ -691,7 +691,7 @@ function apply(ctx, config) {
|
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
693
|
__name(handleMove, "handleMove");
|
|
694
|
-
ctx.command("cchess.悔棋 [decision:string]", "
|
|
694
|
+
ctx.command("cchess.悔棋 [decision:string]", "请求悔棋或答复对方").usage("请求送出后,对方直接回复「同意」或「拒绝」即可表决,无需指令前缀。").action(async ({ session }, decision) => {
|
|
695
695
|
const { username, userId, channelId } = session;
|
|
696
696
|
await updateNameInPlayerRecord(userId, username);
|
|
697
697
|
if (decision) {
|
|
@@ -763,7 +763,7 @@ function apply(ctx, config) {
|
|
|
763
763
|
tips: ["对方回复「同意」或「拒绝」即可表决"]
|
|
764
764
|
}));
|
|
765
765
|
});
|
|
766
|
-
ctx.command("cchess.认输", "
|
|
766
|
+
ctx.command("cchess.认输", "认输并结束对局").action(async ({ session }) => {
|
|
767
767
|
const { username, userId, channelId } = session;
|
|
768
768
|
await updateNameInPlayerRecord(userId, username);
|
|
769
769
|
const gameRecord = await getGameRecord(channelId);
|
|
@@ -795,7 +795,7 @@ function apply(ctx, config) {
|
|
|
795
795
|
});
|
|
796
796
|
return await sendMessage(session, message);
|
|
797
797
|
});
|
|
798
|
-
ctx.command("cchess.查看云库残局 [type:string]", "
|
|
798
|
+
ctx.command("cchess.查看云库残局 [type:string]", "查询云库残局统计").usage("参数可填「DTM」或「DTC」,缺省为 DTM。").action(async ({ session }, type) => {
|
|
799
799
|
const { username, userId } = session;
|
|
800
800
|
await updateNameInPlayerRecord(userId, username);
|
|
801
801
|
const isDtc = /dtc/i.test(type ?? "");
|
|
@@ -806,7 +806,7 @@ function apply(ctx, config) {
|
|
|
806
806
|
body: isDtc ? ["DTC:距吃子的步数统计。", "https://www.chessdb.cn/egtb_info.html"] : ["DTM:距将死的步数统计。", "https://www.chessdb.cn/egtb_info_dtm.html"]
|
|
807
807
|
}));
|
|
808
808
|
});
|
|
809
|
-
ctx.command("cchess.棋绩 [args:text]", "
|
|
809
|
+
ctx.command("cchess.棋绩 [args:text]", "查询战绩或排行榜").usage("带「榜」看排行榜,@ 某人可查看对方战绩。").action(async ({ session }, args) => {
|
|
810
810
|
let { userId, username } = session;
|
|
811
811
|
await updateNameInPlayerRecord(userId, username);
|
|
812
812
|
const text = (args ?? "").trim();
|
|
@@ -890,7 +890,7 @@ function apply(ctx, config) {
|
|
|
890
890
|
icon: "⚠️",
|
|
891
891
|
title: "你尚未入座",
|
|
892
892
|
at: username,
|
|
893
|
-
body: ["
|
|
893
|
+
body: ["先入座,才好落子。"],
|
|
894
894
|
tips: ["发送「cchess.开始」入座"]
|
|
895
895
|
});
|
|
896
896
|
}
|
|
@@ -900,7 +900,7 @@ function apply(ctx, config) {
|
|
|
900
900
|
icon: "⏳",
|
|
901
901
|
title: "皮卡鱼正在推演",
|
|
902
902
|
at: username,
|
|
903
|
-
body: ["
|
|
903
|
+
body: ["引擎正在计算局面,稍候再试。"]
|
|
904
904
|
});
|
|
905
905
|
}
|
|
906
906
|
__name(analyzingPanel, "analyzingPanel");
|