grinders-farm 0.3.2 → 0.3.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/README.md +211 -17
- package/SKILL.md +152 -9
- package/dist/scripts/generate-demo-farm-image.d.ts +2 -0
- package/dist/scripts/generate-demo-farm-image.d.ts.map +1 -0
- package/dist/scripts/generate-demo-farm-image.js +54 -0
- package/dist/scripts/generate-demo-farm-image.js.map +1 -0
- package/docs/images/demo-farm.png +0 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -1,32 +1,224 @@
|
|
|
1
1
|
# 🌿 Grinder's Farm
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="docs/images/demo-farm.png" alt="Grinder's Farm — 4×5 pixel farm grid (four crops, multiple growth stages)" width="444" />
|
|
5
|
+
</p>
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
<p align="center"><sub>Demo render · Rows A–D: carrot, potato, tomato, pumpkin · Columns: early → mature growth</sub></p>
|
|
8
|
+
<p align="center"><sub>示意图 · 行 A–D:胡萝卜、土豆、番茄、南瓜 · 列:生长阶段由早到晚</sub></p>
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
**Languages:** [English](#english) · [中文](#中文)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## English
|
|
15
|
+
|
|
16
|
+
A lightweight pixel-art farm sim: plant, water, harvest, sell, and fulfill orders.
|
|
17
|
+
Play in the **terminal** (CLI only) or in **OpenClaw** chat (Telegram, WebChat, etc.).
|
|
18
|
+
|
|
19
|
+
### What you need (new users)
|
|
20
|
+
|
|
21
|
+
| Requirement | Why |
|
|
22
|
+
|---|---|
|
|
23
|
+
| **Node.js** (includes `npm`) | Runs the game and installs packages from npm. |
|
|
24
|
+
| **OpenClaw CLI + Gateway** | Only if you play **in chat**. The Gateway must be running so `/farm` reaches the plugin. |
|
|
25
|
+
|
|
26
|
+
### What each package does
|
|
27
|
+
|
|
28
|
+
| Package | Role |
|
|
29
|
+
|---|---|
|
|
30
|
+
| **`grinders-farm`** | The game + CLI. Provides `grinders-farm` (interactive) and `grinders-farm-oneshot` (one command). **Required** for both terminal and OpenClaw. |
|
|
31
|
+
| **`openclaw-plugin-grinders-farm`** | OpenClaw integration: registers the `/farm` slash command and the `grinders_farm` tool. **Required** for chat play. |
|
|
32
|
+
| **ClawHub skill `grinders-farm`** (optional) | Helps the **agent** map natural language to `grinders_farm` commands. Not required if you only use `/farm ...` manually. |
|
|
33
|
+
|
|
34
|
+
### Two ways to play
|
|
35
|
+
|
|
36
|
+
- **Terminal only** — no OpenClaw, no plugin, no skill:
|
|
37
|
+
`npm install -g grinders-farm` → run `grinders-farm` and type commands at the prompt (`farm`, `help`, …).
|
|
38
|
+
|
|
39
|
+
- **OpenClaw chat** — install **both** npm packages, **restart the Gateway**, then use `/farm …` in a channel (see Quick start). Optionally install the skill so the agent understands free-form chat.
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
- 4×5 grid, start with 50G
|
|
44
|
+
- Order system (bonus rewards)
|
|
45
|
+
- Dynamic market prices (supply feedback)
|
|
46
|
+
- Multi-channel push (Telegram, WebChat, etc.)
|
|
47
|
+
- Text view + PNG farm image
|
|
48
|
+
|
|
49
|
+
### Quick start (OpenClaw chat)
|
|
50
|
+
|
|
51
|
+
Do these **in order**:
|
|
52
|
+
|
|
53
|
+
1. **Install the game CLI** (always required):
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm install -g grinders-farm
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
2. **Install the OpenClaw plugin** (registers `/farm` and the tool):
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
openclaw plugins install openclaw-plugin-grinders-farm --dangerously-force-unsafe-install
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
3. **Restart the OpenClaw Gateway** so the plugin loads (required after install or upgrade).
|
|
66
|
+
|
|
67
|
+
4. *(Optional)* **Install the ClawHub skill** if you want natural-language play via the agent:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
openclaw skills install grinders-farm
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
5. **Bind each chat channel**
|
|
74
|
+
|
|
75
|
+
In every channel where you want pushes, send once:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
/farm farm
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
6. **Auto-advance** (optional)
|
|
82
|
+
|
|
83
|
+
```text
|
|
84
|
+
/farm start
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
- One in-game day advances every **20 minutes**
|
|
88
|
+
- Pushes fan out to all bound channels
|
|
89
|
+
|
|
90
|
+
Stop:
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
/farm stop
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Check it works:** `openclaw plugins inspect grinders-farm` should show `Status: loaded` and a recent version. If `/farm` does nothing, confirm the Gateway was restarted after installing the plugin.
|
|
97
|
+
|
|
98
|
+
### Commands
|
|
99
|
+
|
|
100
|
+
| Command | Description |
|
|
101
|
+
|---|---|
|
|
102
|
+
| `farm` / `status` | View farm |
|
|
103
|
+
| `plant <crop> <pos>` | Plant (e.g. `plant carrot A1`) |
|
|
104
|
+
| `water [pos]` | Water one cell or all |
|
|
105
|
+
| `harvest [pos]` | Harvest one cell or all ready crops |
|
|
106
|
+
| `shop` | Shop |
|
|
107
|
+
| `sell` | Sell inventory |
|
|
108
|
+
| `inventory` / `inv` | Inventory |
|
|
109
|
+
| `start` | Start auto-advance + push |
|
|
110
|
+
| `stop` | Stop auto-advance |
|
|
111
|
+
| `reset` | New game |
|
|
112
|
+
| `help` | Help |
|
|
113
|
+
|
|
114
|
+
### Crops
|
|
115
|
+
|
|
116
|
+
| Crop | Days | Seed | Base sell |
|
|
117
|
+
|---|---:|---:|---:|
|
|
118
|
+
| 🥕 Carrot | 5 | 5G | 11G |
|
|
119
|
+
| 🥔 Potato | 7 | 8G | 22G |
|
|
120
|
+
| 🍅 Tomato | 6 | 9G | 24G |
|
|
121
|
+
| 🎃 Pumpkin | 8 | 12G | 34G |
|
|
122
|
+
|
|
123
|
+
### Push & channels
|
|
124
|
+
|
|
125
|
+
- Bindings: `~/.grinders-farm/openclaw-deliveries.json`
|
|
126
|
+
- After `/farm start`, pushes go to all bound targets
|
|
127
|
+
- WebChat uses `chat.inject`; other channels use `openclaw message send`
|
|
128
|
+
|
|
129
|
+
### Local data
|
|
130
|
+
|
|
131
|
+
| Path | Purpose |
|
|
132
|
+
|---|---|
|
|
133
|
+
| `~/.grinders-farm/farm.json` | Save game |
|
|
134
|
+
| `~/.grinders-farm/farm.png` | Latest PNG |
|
|
135
|
+
| `~/.grinders-farm/auto.pid` / `auto.config.json` | Auto worker |
|
|
136
|
+
| `~/.grinders-farm/auto.log` | Auto log |
|
|
137
|
+
| `~/.grinders-farm/image-server.json` | Image server metadata |
|
|
138
|
+
|
|
139
|
+
### Development
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
npm install
|
|
143
|
+
npm run generate-tiles
|
|
144
|
+
npm run build
|
|
145
|
+
npm run dev
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Plugin package:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
cd openclaw-plugin
|
|
152
|
+
npm install
|
|
153
|
+
npm run build
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### License
|
|
157
|
+
|
|
158
|
+
MIT
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## 中文
|
|
163
|
+
|
|
164
|
+
轻量像素农场游戏:种地、浇水、收获、卖货、接订单。
|
|
165
|
+
可在**终端**单独玩,也可在 **OpenClaw** 聊天里玩(Telegram、WebChat 等)。
|
|
166
|
+
|
|
167
|
+
### 你需要什么(新用户)
|
|
168
|
+
|
|
169
|
+
| 条件 | 说明 |
|
|
170
|
+
|---|---|
|
|
171
|
+
| **Node.js**(含 `npm`) | 运行游戏并从 npm 安装包。 |
|
|
172
|
+
| **已安装 OpenClaw 且 Gateway 在跑** | 仅在**聊天里**玩时需要;否则 `/farm` 到不了插件。 |
|
|
173
|
+
|
|
174
|
+
### 各个包是干什么的
|
|
175
|
+
|
|
176
|
+
| 包 | 作用 |
|
|
177
|
+
|---|---|
|
|
178
|
+
| **`grinders-farm`** | 游戏本体 + CLI,提供 `grinders-farm`(交互)和 `grinders-farm-oneshot`(单次命令)。**终端与 OpenClaw 都需要。** |
|
|
179
|
+
| **`openclaw-plugin-grinders-farm`** | OpenClaw 集成:注册 `/farm` 斜杠命令和 `grinders_farm` 工具。**只在聊天里玩时需要。** |
|
|
180
|
+
| **ClawHub skill `grinders-farm`**(可选) | 帮**智能体**把自然语言映射成 `grinders_farm` 命令。若你**只手动打** `/farm ...`,可以不装。 |
|
|
181
|
+
|
|
182
|
+
### 两种玩法
|
|
183
|
+
|
|
184
|
+
- **只玩终端**:不需要 OpenClaw、不需要插件、不需要 skill。
|
|
185
|
+
`npm install -g grinders-farm` → 运行 `grinders-farm`,在提示符下输入命令(`farm`、`help` 等)。
|
|
186
|
+
|
|
187
|
+
- **在 OpenClaw 里玩**:需要**两个 npm 包都装**,装完插件后**重启 Gateway**,再在频道里用 `/farm …`(见下文「3 分钟上手」)。需要自然语言时可再装 skill。
|
|
188
|
+
|
|
189
|
+
### 这款游戏有什么
|
|
190
|
+
|
|
191
|
+
- 4×5 农田网格,开局 50G
|
|
9
192
|
- 订单系统(完成后有额外奖励)
|
|
10
193
|
- 动态市场价格(卖得多会有压价反馈)
|
|
11
194
|
- 多渠道自动推送(Telegram / WebChat 等)
|
|
12
195
|
- 文本农场视图 + PNG 像素图
|
|
13
196
|
|
|
14
|
-
|
|
197
|
+
### 3 分钟上手(OpenClaw 聊天)
|
|
198
|
+
|
|
199
|
+
请**按顺序**做:
|
|
15
200
|
|
|
16
|
-
|
|
201
|
+
1. **安装主游戏 CLI**(始终需要):
|
|
17
202
|
|
|
18
203
|
```bash
|
|
19
204
|
npm install -g grinders-farm
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
2. **安装 OpenClaw 插件**(注册 `/farm` 与工具):
|
|
208
|
+
|
|
209
|
+
```bash
|
|
20
210
|
openclaw plugins install openclaw-plugin-grinders-farm --dangerously-force-unsafe-install
|
|
21
211
|
```
|
|
22
212
|
|
|
23
|
-
|
|
213
|
+
3. **重启 OpenClaw Gateway**(装完或升级插件后必须,否则命令不生效)。
|
|
214
|
+
|
|
215
|
+
4. *(可选)* **安装 ClawHub skill**,让智能体能听懂自然语言:
|
|
24
216
|
|
|
25
217
|
```bash
|
|
26
218
|
openclaw skills install grinders-farm
|
|
27
219
|
```
|
|
28
220
|
|
|
29
|
-
|
|
221
|
+
5. **在聊天里绑定渠道**
|
|
30
222
|
|
|
31
223
|
在你希望收到推送的每个频道里,先发一次:
|
|
32
224
|
|
|
@@ -34,13 +226,13 @@ openclaw skills install grinders-farm
|
|
|
34
226
|
/farm farm
|
|
35
227
|
```
|
|
36
228
|
|
|
37
|
-
|
|
229
|
+
6. **开始自动推进**(可选)
|
|
38
230
|
|
|
39
231
|
```text
|
|
40
232
|
/farm start
|
|
41
233
|
```
|
|
42
234
|
|
|
43
|
-
- 固定每 20
|
|
235
|
+
- 固定每 **20 分钟**推进一天
|
|
44
236
|
- 自动推送到所有已绑定频道
|
|
45
237
|
|
|
46
238
|
停止自动推进:
|
|
@@ -49,7 +241,9 @@ openclaw skills install grinders-farm
|
|
|
49
241
|
/farm stop
|
|
50
242
|
```
|
|
51
243
|
|
|
52
|
-
|
|
244
|
+
**自检:** 执行 `openclaw plugins inspect grinders-farm`,应看到 `Status: loaded` 与较新版本。若 `/farm` 没反应,先确认装插件后是否已重启 Gateway。
|
|
245
|
+
|
|
246
|
+
### 命令速查
|
|
53
247
|
|
|
54
248
|
| 命令 | 说明 |
|
|
55
249
|
|---|---|
|
|
@@ -65,7 +259,7 @@ openclaw skills install grinders-farm
|
|
|
65
259
|
| `reset` | 重开一局 |
|
|
66
260
|
| `help` | 查看帮助 |
|
|
67
261
|
|
|
68
|
-
|
|
262
|
+
### 作物一览
|
|
69
263
|
|
|
70
264
|
| 作物 | 成熟天数 | 种子价 | 基础售价 |
|
|
71
265
|
|---|---:|---:|---:|
|
|
@@ -74,20 +268,20 @@ openclaw skills install grinders-farm
|
|
|
74
268
|
| 🍅 Tomato | 6 | 9G | 24G |
|
|
75
269
|
| 🎃 Pumpkin | 8 | 12G | 34G |
|
|
76
270
|
|
|
77
|
-
|
|
271
|
+
### 游戏循环建议
|
|
78
272
|
|
|
79
273
|
1. 先看 `shop`,根据现金和订单选种子
|
|
80
274
|
2. `plant` 后每天 `water`
|
|
81
275
|
3. 成熟后 `harvest`,再 `sell`
|
|
82
276
|
4. 利用订单奖励和市场反馈,滚动扩大收益
|
|
83
277
|
|
|
84
|
-
|
|
278
|
+
### 推送与渠道说明
|
|
85
279
|
|
|
86
280
|
- 绑定文件:`~/.grinders-farm/openclaw-deliveries.json`
|
|
87
281
|
- 执行 `/farm start` 后,自动 fan-out 到所有已绑定目标
|
|
88
282
|
- WebChat 走 `chat.inject`,消息渠道走 `openclaw message send`
|
|
89
283
|
|
|
90
|
-
|
|
284
|
+
### 本地数据文件
|
|
91
285
|
|
|
92
286
|
| 路径 | 用途 |
|
|
93
287
|
|---|---|
|
|
@@ -97,7 +291,7 @@ openclaw skills install grinders-farm
|
|
|
97
291
|
| `~/.grinders-farm/auto.log` | 自动推进日志 |
|
|
98
292
|
| `~/.grinders-farm/image-server.json` | 图片服务元数据 |
|
|
99
293
|
|
|
100
|
-
|
|
294
|
+
### 开发者
|
|
101
295
|
|
|
102
296
|
```bash
|
|
103
297
|
npm install
|
|
@@ -114,6 +308,6 @@ npm install
|
|
|
114
308
|
npm run build
|
|
115
309
|
```
|
|
116
310
|
|
|
117
|
-
|
|
311
|
+
### License
|
|
118
312
|
|
|
119
313
|
MIT
|
package/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: grinders-farm
|
|
3
|
-
description: "
|
|
3
|
+
description: "Requires grinders-farm CLI + openclaw-plugin-grinders-farm before use. Maps intents to grinders_farm. 使用前需先安装 grinders-farm 与 openclaw-plugin-grinders-farm。"
|
|
4
4
|
metadata: { "openclaw": { "emoji": "🌾", "requires": { "bins": ["npx"] } } }
|
|
5
5
|
command-dispatch: tool
|
|
6
6
|
command-tool: grinders_farm
|
|
@@ -9,9 +9,152 @@ disable-model-invocation: false
|
|
|
9
9
|
|
|
10
10
|
# Grinder's Farm
|
|
11
11
|
|
|
12
|
+
**Languages:** [English](#english) · [中文](#中文)
|
|
13
|
+
|
|
14
|
+

|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## English
|
|
19
|
+
|
|
20
|
+
This skill maps user chat into **exactly one** `grinders_farm` tool call.
|
|
21
|
+
|
|
22
|
+
### Prerequisites (install before this skill works)
|
|
23
|
+
|
|
24
|
+
The `grinders_farm` tool is provided by the game CLI and the OpenClaw plugin. **Install both from npm first**, then install this skill from ClawHub:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install -g grinders-farm
|
|
28
|
+
openclaw plugins install openclaw-plugin-grinders-farm --dangerously-force-unsafe-install
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Restart the OpenClaw Gateway after installing the plugin. Without these packages, `/farm` and `grinders_farm` will not run.
|
|
32
|
+
|
|
33
|
+
### Install this skill (optional but recommended for NL)
|
|
34
|
+
|
|
35
|
+
After the two packages above:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
openclaw skills install grinders-farm
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### How users play (after setup)
|
|
42
|
+
|
|
43
|
+
- **Slash commands (always works once the plugin is loaded):** in Telegram / WebChat / etc., send
|
|
44
|
+
`/farm <command>` — examples: `/farm farm`, `/farm plant carrot A1`, `/farm help`.
|
|
45
|
+
The part after `/farm` is the same command string you would pass to `grinders-farm-oneshot`.
|
|
46
|
+
- **Natural language (this skill):** when the skill is installed and the agent is allowed to use tools, the user can say things like “plant carrot at A4”; you should map that to `grinders_farm` with `command: "plant carrot A4"`.
|
|
47
|
+
- **This skill does not replace the plugin or the `grinders-farm` package** — it only helps choose the right tool arguments.
|
|
48
|
+
|
|
49
|
+
### Rules
|
|
50
|
+
|
|
51
|
+
1. While playing the farm, always use the `grinders_farm` tool.
|
|
52
|
+
2. Do not use shell/exec/cargo or other execution paths.
|
|
53
|
+
3. Do not only explain—execute (unless the user explicitly says not to).
|
|
54
|
+
4. Crops only: `carrot` `potato` `tomato` `pumpkin`.
|
|
55
|
+
5. Plot labels: `A1`–`D5` (rows A–D, columns 1–5).
|
|
56
|
+
|
|
57
|
+
### Allowed commands
|
|
58
|
+
|
|
59
|
+
- `farm`
|
|
60
|
+
- `plant <crop> <pos>`
|
|
61
|
+
- `water [pos]`
|
|
62
|
+
- `harvest [pos]`
|
|
63
|
+
- `shop`
|
|
64
|
+
- `sell`
|
|
65
|
+
- `inventory`
|
|
66
|
+
- `start`
|
|
67
|
+
- `stop`
|
|
68
|
+
- `reset`
|
|
69
|
+
- `help`
|
|
70
|
+
|
|
71
|
+
### Intent mapping (priority)
|
|
72
|
+
|
|
73
|
+
1. **Auto-advance**
|
|
74
|
+
- "start auto" / "enable auto" → `start`
|
|
75
|
+
- "stop auto" / "disable auto" → `stop`
|
|
76
|
+
2. **Plant**
|
|
77
|
+
- plant intent + crop + position → `plant <crop> <pos>`
|
|
78
|
+
3. **Water**
|
|
79
|
+
- water + position → `water <pos>`
|
|
80
|
+
- water only → `water`
|
|
81
|
+
4. **Harvest**
|
|
82
|
+
- harvest + position → `harvest <pos>`
|
|
83
|
+
- harvest only → `harvest`
|
|
84
|
+
5. **Trade / info**
|
|
85
|
+
- shop → `shop`
|
|
86
|
+
- sell → `sell`
|
|
87
|
+
- inventory → `inventory`
|
|
88
|
+
6. **Reset / help**
|
|
89
|
+
- reset → `reset`
|
|
90
|
+
- help → `help`
|
|
91
|
+
7. **Fallback**
|
|
92
|
+
- farm-related but unclear → `farm`
|
|
93
|
+
|
|
94
|
+
### Output
|
|
95
|
+
|
|
96
|
+
1. Prefer the tool’s text as-is.
|
|
97
|
+
2. If there is a markdown table, output it without wrapping in a code fence.
|
|
98
|
+
3. Keep image URLs as plain clickable links (no backticks).
|
|
99
|
+
4. On failure: return the error first, then one example command.
|
|
100
|
+
|
|
101
|
+
### Examples
|
|
102
|
+
|
|
103
|
+
- "plant carrot at A4" → `command: "plant carrot A4"`
|
|
104
|
+
- "show farm" → `command: "farm"`
|
|
105
|
+
- "water all" → `command: "water"`
|
|
106
|
+
- "harvest A2" → `command: "harvest A2"`
|
|
107
|
+
- "start auto" → `command: "start"`
|
|
108
|
+
- "stop auto" → `command: "stop"`
|
|
109
|
+
|
|
110
|
+
### OpenClaw notes
|
|
111
|
+
|
|
112
|
+
- Plugin: `openclaw-plugin-grinders-farm`
|
|
113
|
+
- Run `/farm farm` once per channel to bind delivery.
|
|
114
|
+
- `/farm start` auto-advances (one day every **20 minutes**).
|
|
115
|
+
- `/farm stop` stops auto-advance.
|
|
116
|
+
|
|
117
|
+
### Local state files
|
|
118
|
+
|
|
119
|
+
- `~/.grinders-farm/farm.json`
|
|
120
|
+
- `~/.grinders-farm/farm.png`
|
|
121
|
+
- `~/.grinders-farm/auto.log`
|
|
122
|
+
- `~/.grinders-farm/openclaw-deliveries.json`
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 中文
|
|
127
|
+
|
|
12
128
|
此 Skill 的目标只有一个:把用户输入映射成**唯一明确**的 `grinders_farm` 命令并执行。
|
|
13
129
|
|
|
14
|
-
|
|
130
|
+
### 先决条件(使用本 skill 前必须先装)
|
|
131
|
+
|
|
132
|
+
`grinders_farm` 工具由**主游戏 CLI** 与 **OpenClaw 插件**一起提供。请**先全局安装这两个 npm 包**,再从 ClawHub 安装本 skill:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
npm install -g grinders-farm
|
|
136
|
+
openclaw plugins install openclaw-plugin-grinders-farm --dangerously-force-unsafe-install
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
安装插件后请**重启 OpenClaw Gateway**。若未安装上述包,`/farm` 与 `grinders_farm` 无法运行。
|
|
140
|
+
|
|
141
|
+
### 再安装本 skill(想用自然语言时)
|
|
142
|
+
|
|
143
|
+
两个 npm 包装好后,再执行:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
openclaw skills install grinders-farm
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 用户怎么玩(装好之后)
|
|
150
|
+
|
|
151
|
+
- **斜杠命令(插件加载后可用):** 在 Telegram / WebChat 等里发
|
|
152
|
+
`/farm <子命令>`,例如 `/farm farm`、`/farm plant carrot A1`、`/farm help`。
|
|
153
|
+
`/farm` 后面这一段,与传给 `grinders-farm-oneshot` 的参数一致。
|
|
154
|
+
- **自然语言(本 skill):** 用户说「在 A4 种胡萝卜」时,应映射为 `grinders_farm`,`command: "plant carrot A4"`。
|
|
155
|
+
- **本 skill 不能替代插件和主包** —— 只负责把聊天意图转成正确 tool 参数。
|
|
156
|
+
|
|
157
|
+
### 必须遵守
|
|
15
158
|
|
|
16
159
|
1. 用户在玩农场时,必须调用 `grinders_farm` tool。
|
|
17
160
|
2. 不用 shell/exec/cargo 等其它执行路径。
|
|
@@ -19,7 +162,7 @@ disable-model-invocation: false
|
|
|
19
162
|
4. 作物只允许:`carrot` `potato` `tomato` `pumpkin`。
|
|
20
163
|
5. 坐标格式固定:`A1`~`D5`(行 A-D,列 1-5)。
|
|
21
164
|
|
|
22
|
-
|
|
165
|
+
### 命令白名单(仅这些)
|
|
23
166
|
|
|
24
167
|
- `farm`
|
|
25
168
|
- `plant <crop> <pos>`
|
|
@@ -33,7 +176,7 @@ disable-model-invocation: false
|
|
|
33
176
|
- `reset`
|
|
34
177
|
- `help`
|
|
35
178
|
|
|
36
|
-
|
|
179
|
+
### 意图映射(按优先级匹配)
|
|
37
180
|
|
|
38
181
|
命中后立即执行,不要多重猜测。
|
|
39
182
|
|
|
@@ -58,14 +201,14 @@ disable-model-invocation: false
|
|
|
58
201
|
7. **兜底**
|
|
59
202
|
- 农场相关但不够明确 -> `farm`
|
|
60
203
|
|
|
61
|
-
|
|
204
|
+
### 输出规则(避免歧义)
|
|
62
205
|
|
|
63
206
|
1. 工具返回内容优先,尽量原样呈现。
|
|
64
207
|
2. 若含 markdown 表格,原样输出,不包代码块。
|
|
65
208
|
3. 若含图片 URL,保持纯链接可点击,不加反引号。
|
|
66
209
|
4. 命令失败时:先返回错误原文,再给一条可执行示例命令。
|
|
67
210
|
|
|
68
|
-
|
|
211
|
+
### 标准示例
|
|
69
212
|
|
|
70
213
|
- “在 A4 种胡萝卜” -> `command: "plant carrot A4"`
|
|
71
214
|
- “看农场” -> `command: "farm"`
|
|
@@ -74,14 +217,14 @@ disable-model-invocation: false
|
|
|
74
217
|
- “开自动” -> `command: "start"`
|
|
75
218
|
- “停自动” -> `command: "stop"`
|
|
76
219
|
|
|
77
|
-
|
|
220
|
+
### OpenClaw 使用要点
|
|
78
221
|
|
|
79
222
|
- 插件:`openclaw-plugin-grinders-farm`
|
|
80
223
|
- 先在每个目标频道执行一次 `/farm farm` 完成绑定
|
|
81
|
-
- 执行 `/farm start` 开始自动推进(固定 20
|
|
224
|
+
- 执行 `/farm start` 开始自动推进(固定 **20 分钟**/天)
|
|
82
225
|
- 执行 `/farm stop` 停止自动推进
|
|
83
226
|
|
|
84
|
-
|
|
227
|
+
### 本地状态文件
|
|
85
228
|
|
|
86
229
|
- `~/.grinders-farm/farm.json`
|
|
87
230
|
- `~/.grinders-farm/farm.png`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-demo-farm-image.d.ts","sourceRoot":"","sources":["../../scripts/generate-demo-farm-image.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders a showcase farm PNG: all four crops × main growth stages on the 4×5 grid.
|
|
3
|
+
* Output: docs/images/demo-farm.png (for README / SKILL screenshots).
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from "node:fs";
|
|
6
|
+
import * as path from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import { createNewFarm, ensureFarmState } from "../src/game/farm.js";
|
|
9
|
+
import { getCropDef } from "../src/game/crops.js";
|
|
10
|
+
import { renderFarmImage } from "../src/render/image-renderer.js";
|
|
11
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const repoRoot = path.resolve(__dirname, "..");
|
|
13
|
+
function makeCrop(cropId, wateredDays, watered) {
|
|
14
|
+
const def = getCropDef(cropId);
|
|
15
|
+
return {
|
|
16
|
+
cropId,
|
|
17
|
+
wateredDays,
|
|
18
|
+
watered,
|
|
19
|
+
requiredWaterDays: def.growthDays,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
async function main() {
|
|
23
|
+
const state = ensureFarmState(createNewFarm());
|
|
24
|
+
state.day = 7;
|
|
25
|
+
state.gold = 128;
|
|
26
|
+
const crops = ["carrot", "potato", "tomato", "pumpkin"];
|
|
27
|
+
// Row A–D: one crop type per row; columns 1–5: seed → sprout → growing1 → growing2 → ready
|
|
28
|
+
for (let row = 0; row < 4; row++) {
|
|
29
|
+
const id = crops[row];
|
|
30
|
+
const req = getCropDef(id).growthDays;
|
|
31
|
+
const stages = [
|
|
32
|
+
{ wd: 0, w: row % 2 === 0 },
|
|
33
|
+
{ wd: Math.max(1, Math.floor(req / 6)), w: true },
|
|
34
|
+
{ wd: Math.floor(req / 3), w: true },
|
|
35
|
+
{ wd: Math.floor((2 * req) / 3), w: true },
|
|
36
|
+
{ wd: req, w: true },
|
|
37
|
+
];
|
|
38
|
+
for (let col = 0; col < 5; col++) {
|
|
39
|
+
const s = stages[col];
|
|
40
|
+
state.grid[row][col].crop = makeCrop(id, s.wd, s.w);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const out = await renderFarmImage(state);
|
|
44
|
+
const dir = path.join(repoRoot, "docs", "images");
|
|
45
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
46
|
+
const dest = path.join(dir, "demo-farm.png");
|
|
47
|
+
fs.copyFileSync(out, dest);
|
|
48
|
+
console.log(`Wrote ${dest}`);
|
|
49
|
+
}
|
|
50
|
+
main().catch((e) => {
|
|
51
|
+
console.error(e);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=generate-demo-farm-image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-demo-farm-image.js","sourceRoot":"","sources":["../../scripts/generate-demo-farm-image.ts"],"names":[],"mappings":"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"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "grinders-farm",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "A pixel-art farm simulation game — plant, water, harvest, and sell crops",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"dist/",
|
|
10
10
|
"assets/tiles/",
|
|
11
|
+
"docs/images/",
|
|
11
12
|
"src/notify/notify.json.example",
|
|
12
13
|
"README.md",
|
|
13
14
|
"SKILL.md",
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
"daemon": "tsx src/adapters/daemon.ts",
|
|
24
25
|
"auto-worker": "tsx src/adapters/auto-worker.ts",
|
|
25
26
|
"generate-tiles": "tsx scripts/generate-tiles.ts",
|
|
27
|
+
"generate-demo-farm": "tsx scripts/generate-demo-farm-image.ts",
|
|
26
28
|
"start": "node dist/src/adapters/terminal.js",
|
|
27
29
|
"sync-skill": "node scripts/sync-skill.mjs",
|
|
28
30
|
"prepack": "npm run build"
|