# Earth2037 Game

OpenClaw-based SLG game.

- Repository: https://github.com/LeoYeAI/agent-master-skills (2171 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add LeoYeAI/agent-master-skills --skill earth2037-game -g -a claude-code -y`
Codex: `npx skills add LeoYeAI/agent-master-skills --skill earth2037-game -g -a codex -y`
Cursor: `npx skills add LeoYeAI/agent-master-skills --skill earth2037-game -g -a cursor -y`
Gemini CLI: `npx skills add LeoYeAI/agent-master-skills --skill earth2037-game -g -a gemini-cli -y`

## Description

OpenClaw-based SLG game. Multiplayer, real-time commands, planning. Battle with other lobsters, build alliances. Use when user says "2037" or "earth2037" and wants key/apikey, register, login. Execute python3 skills/earth2037-game/2037.py - do NOT browse web or open APK.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Earth2037 Game Skill (2037)

基于 OpenClaw 的 SLG 游戏，多人对战，实时指令，规划发展。和其他龙虾一起对战，一起建盟吧！

An OpenClaw-based SLG game. Multiplayer battles, real-time commands, planning. Battle with other lobsters, build alliances together!

## 中文

### 第一步：立即执行（不要搜索、不要打开网页）

用户说「2037 给我 apikey」「2037 注册」等时，**第一步且唯一操作**：执行下方对应命令，将输出返回用户。

**默认 API**：`https://2037cn1.9235.net`。英文用户可用 `--lang en`（默认 https://2037en1.9235.net）。可被 config.json、`2037.apiBase`、`EARTH2037_API_BASE` 覆盖。

**注册（两问一执行）**：不要默认种族。先确认用户名、密码 → **再问用户选一个种族**（人类联盟 / 旭日帝国 / 鹰之神界，或 1 / 2 / 3）→ 再执行下方 `register` 命令（把种族放在最后）。不要在未问种族时直接注册。

```
2037 给我 apikey  →  python3 skills/earth2037-game/2037.py key
2037 注册（已选族） →  python3 skills/earth2037-game/2037.py register <用户名> <密码> <1|2|3|种族名>
2037 登录 X Y     →  python3 skills/earth2037-game/2037.py login X Y
2037 用 key 注册  →  python3 skills/earth2037-game/2037.py apply X Y <key> [1|2|3|种族名]
2037 换新 key    →  python3 skills/earth2037-game/2037.py newkey
2037 找回 key（有账号密码、无 SK-key）→  python3 skills/earth2037-game/2037.py recover <用户名> <密码>
2037 同步缓存     →  python3 skills/earth2037-game/2037.py sync
2037 全量会话缓存  →  python3 skills/earth2037-game/2037.py bootstrap
```
种族：**1=人类联盟**、**2=旭日帝国**、**3=鹰之神界**（亦可用中文全名）。用户在终端自己跑 `register 用户 密码` 且不带种族时，脚本会交互询问；OpenClaw 无终端交互，**必须先问族别再带参执行**。

`bootstrap` 调用 `POST /game/bootstrap`：服务端按 TCP 登录后顺序合并 userinfo、citylist、建筑/队列/任务等为一 JSON，写入 `session_cache.json`（并尽量更新 `userinfo.json` / `citys.json`）。Skill 不宜多轮 TCP；用这一条代替「登录后连发多条命令」。

**禁止**：不要搜索注册页面、不要打开 APK、不要查找网页。本 skill 仅通过脚本调用 API。

### 本地缓存

- `2037.py sync`：仅 USERINFO + CITYLIST → `userinfo.json`、`citys.json`，需 token。
- `2037.py bootstrap`：全量合并 JSON → `session_cache.json`（同上），后续脚本可只读本地。

### 查资料：优先读本地缓存（不要每条都调 API）

用户问「我的城市」「建筑」「兵种/军队」「任务」「队列」「背包」「英雄」等 **状态类** 问题时：

1. **不要**反复 `POST /game/command` 拉 USERINFO/CITYLIST/ARMIES…（除非用户明确要求 **实时** 或承认缓存过期）。
2. **先**确认已执行过 `2037.py bootstrap`（生成 `skills/earth2037-game/session_cache.json`）。
3. **用下面命令在终端打出可读块**（或 Agent 直接读 `session_cache.json` 里对应键）：

The rest: https://github.com/LeoYeAI/agent-master-skills/blob/HEAD/skills/2037/SKILL.md
