@zhin.js/plugin-tic-tac-toe 1.0.24 → 1.1.2
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/commands/ttt/{[[action]].js → [[action]]/index.js} +2 -2
- package/commands/ttt/{[[action]].ts → [[action]]/index.ts} +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/middlewares/{ttt-alias.js → ttt-alias/index.js} +2 -2
- package/middlewares/{ttt-alias.ts → ttt-alias/index.ts} +2 -2
- package/middlewares/{ttt-choice.js → ttt-choice/index.js} +4 -4
- package/middlewares/{ttt-choice.ts → ttt-choice/index.ts} +4 -4
- package/package.json +11 -7
- package/plugin.js +3 -3
- package/src/index.ts +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
2
|
import { defineCommand } from 'zhin.js/command';
|
|
3
3
|
import { messageFromCommandInput, normalizeTttAction } from '@zhin.js/game-kit';
|
|
4
|
-
import { TTT_HELP, runTttCommand } from "
|
|
5
|
-
import { resolveGameServices } from "
|
|
4
|
+
import { TTT_HELP, runTttCommand } from "../../../lib/ttt-command.js";
|
|
5
|
+
import { resolveGameServices } from "../../../lib/runtime-store.js";
|
|
6
6
|
export default defineCommand({
|
|
7
7
|
description: 'Tic Tac Toe',
|
|
8
8
|
params: { action: { type: 'string', default: '' } },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineCommand } from 'zhin.js/command';
|
|
2
2
|
import { messageFromCommandInput, normalizeTttAction } from '@zhin.js/game-kit';
|
|
3
|
-
import { TTT_HELP, runTttCommand } from '
|
|
4
|
-
import { resolveGameServices } from '
|
|
3
|
+
import { TTT_HELP, runTttCommand } from '../../../src/ttt-command.js';
|
|
4
|
+
import { resolveGameServices } from '../../../src/runtime-store.js';
|
|
5
5
|
|
|
6
6
|
export default defineCommand({
|
|
7
7
|
description: 'Tic Tac Toe',
|
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export { TTT_HELP } from './ttt-command.js';
|
|
|
2
2
|
export { gameServicesToken, resolveGameServices } from './runtime-store.js';
|
|
3
3
|
/**
|
|
4
4
|
* 已由 plugin.ts 接线:commands/ 命令、middlewares/ 文本与选项中间件、
|
|
5
|
-
*
|
|
5
|
+
* 游戏大厅 Game capability、过期会话 cron(scheduleHostToken)、
|
|
6
6
|
* host DatabaseHost(databaseHostToken)。仍未接:interactive 按钮回调。
|
|
7
7
|
*/
|
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { TTT_HELP } from './ttt-command.js';
|
|
|
2
2
|
export { gameServicesToken, resolveGameServices } from './runtime-store.js';
|
|
3
3
|
/**
|
|
4
4
|
* 已由 plugin.ts 接线:commands/ 命令、middlewares/ 文本与选项中间件、
|
|
5
|
-
*
|
|
5
|
+
* 游戏大厅 Game capability、过期会话 cron(scheduleHostToken)、
|
|
6
6
|
* host DatabaseHost(databaseHostToken)。仍未接:interactive 按钮回调。
|
|
7
7
|
*/
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
2
|
import { defineGameCommandAliasMiddleware, isTttAction, messageFromCommandInput, normalizeTttAction, } from '@zhin.js/game-kit';
|
|
3
|
-
import { TTT_HELP, runTttCommand } from "
|
|
4
|
-
import { resolveGameServices } from "
|
|
3
|
+
import { TTT_HELP, runTttCommand } from "../../lib/ttt-command.js";
|
|
4
|
+
import { resolveGameServices } from "../../lib/runtime-store.js";
|
|
5
5
|
export default defineGameCommandAliasMiddleware({
|
|
6
6
|
aliases: ['井字棋', 'ttt'],
|
|
7
7
|
async run(action, input, context) {
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
messageFromCommandInput,
|
|
5
5
|
normalizeTttAction,
|
|
6
6
|
} from '@zhin.js/game-kit';
|
|
7
|
-
import { TTT_HELP, runTttCommand } from '
|
|
8
|
-
import { resolveGameServices } from '
|
|
7
|
+
import { TTT_HELP, runTttCommand } from '../../src/ttt-command.js';
|
|
8
|
+
import { resolveGameServices } from '../../src/runtime-store.js';
|
|
9
9
|
|
|
10
10
|
export default defineGameCommandAliasMiddleware({
|
|
11
11
|
aliases: ['井字棋', 'ttt'],
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
2
|
import { defineMiddleware } from 'zhin.js/middleware';
|
|
3
3
|
import { channelKey, messageFromCommandInput, parseChoicePayload, resolveGameTextPayload, } from '@zhin.js/game-kit';
|
|
4
|
-
import { resolveGameServices } from "
|
|
5
|
-
import { buildFallbackMap, TTT_PREFIX, parseTttPayload } from "
|
|
6
|
-
import { parseBoard } from "
|
|
7
|
-
import { handleMove, restartFromTerminal } from "
|
|
4
|
+
import { resolveGameServices } from "../../lib/runtime-store.js";
|
|
5
|
+
import { buildFallbackMap, TTT_PREFIX, parseTttPayload } from "../../lib/board-view.js";
|
|
6
|
+
import { parseBoard } from "../../lib/engine.js";
|
|
7
|
+
import { handleMove, restartFromTerminal } from "../../lib/game-flow.js";
|
|
8
8
|
/**
|
|
9
9
|
* 文本入口:按钮 payload(`ttt:session:0-8` 或 `ttt:session:restart`)
|
|
10
10
|
* 与裸数字 fallback(按空格 1-9 编号落子,对应视图『落子:回复数字 1-9(仅空格)』)。
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
parseChoicePayload,
|
|
7
7
|
resolveGameTextPayload,
|
|
8
8
|
} from '@zhin.js/game-kit';
|
|
9
|
-
import { resolveGameServices } from '
|
|
10
|
-
import { buildFallbackMap, TTT_PREFIX, parseTttPayload } from '
|
|
11
|
-
import { parseBoard } from '
|
|
12
|
-
import { handleMove, restartFromTerminal } from '
|
|
9
|
+
import { resolveGameServices } from '../../src/runtime-store.js';
|
|
10
|
+
import { buildFallbackMap, TTT_PREFIX, parseTttPayload } from '../../src/board-view.js';
|
|
11
|
+
import { parseBoard } from '../../src/engine.js';
|
|
12
|
+
import { handleMove, restartFromTerminal } from '../../src/game-flow.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* 文本入口:按钮 payload(`ttt:session:0-8` 或 `ttt:session:restart`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/plugin-tic-tac-toe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Zhin.js 跨平台井字棋 (Plugin Runtime)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
],
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@zhin.js/core": "1.
|
|
28
|
-
"@zhin.js/game-kit": "
|
|
27
|
+
"@zhin.js/core": "1.1.37",
|
|
28
|
+
"@zhin.js/game-kit": "1.1.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"typescript": "^6.0.3",
|
|
32
32
|
"vitest": "^4.1.10",
|
|
33
|
-
"zhin.js": "
|
|
33
|
+
"zhin.js": "1.1.2"
|
|
34
34
|
},
|
|
35
35
|
"repository": {
|
|
36
36
|
"type": "git",
|
|
@@ -58,14 +58,18 @@
|
|
|
58
58
|
{
|
|
59
59
|
"package": "@zhin.js/middleware",
|
|
60
60
|
"api": "^1.0.0"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"package": "@zhin.js/game-kit",
|
|
64
|
+
"api": "^1.0.0"
|
|
61
65
|
}
|
|
62
66
|
],
|
|
63
67
|
"plugins": []
|
|
64
68
|
},
|
|
65
69
|
"peerDependencies": {
|
|
66
|
-
"@zhin.js/command": "1.
|
|
67
|
-
"@zhin.js/middleware": "1.
|
|
68
|
-
"zhin.js": "
|
|
70
|
+
"@zhin.js/command": "^1.1.1",
|
|
71
|
+
"@zhin.js/middleware": "^1.1.1",
|
|
72
|
+
"zhin.js": "^1.1.2"
|
|
69
73
|
},
|
|
70
74
|
"peerDependenciesMeta": {
|
|
71
75
|
"@zhin.js/command": {
|
package/plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
-
import { defineGamePlugin,
|
|
2
|
+
import { defineGamePlugin, plainTextFromSendContent, } from '@zhin.js/game-kit';
|
|
3
3
|
import { outboundHostToken } from 'zhin.js';
|
|
4
4
|
import { defineHostTables } from "./lib/models.js";
|
|
5
5
|
import { gameServicesToken } from "./lib/runtime-store.js";
|
|
@@ -66,12 +66,12 @@ export default defineGamePlugin({
|
|
|
66
66
|
content,
|
|
67
67
|
})));
|
|
68
68
|
};
|
|
69
|
-
const disposeTurn =
|
|
69
|
+
const disposeTurn = services.session.events.on('turn:change', async (event) => {
|
|
70
70
|
if (event.gameId === 'ttt' && event.session.status === 'active') {
|
|
71
71
|
await notify(event.session, false);
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
|
-
const disposeEnd =
|
|
74
|
+
const disposeEnd = services.session.events.on('game:end', async (event) => {
|
|
75
75
|
if (event.gameId === 'ttt')
|
|
76
76
|
await notify(event.session, true);
|
|
77
77
|
});
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,6 @@ export { gameServicesToken, resolveGameServices } from './runtime-store.js';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 已由 plugin.ts 接线:commands/ 命令、middlewares/ 文本与选项中间件、
|
|
6
|
-
*
|
|
6
|
+
* 游戏大厅 Game capability、过期会话 cron(scheduleHostToken)、
|
|
7
7
|
* host DatabaseHost(databaseHostToken)。仍未接:interactive 按钮回调。
|
|
8
8
|
*/
|