Skip to content

LeoYeAI/agent-master-skills / skills/2037

earth2037-game

Verified

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.

FileKindSize
2037.pyscript13.7 KB
MAP_FOR_AI.mdmarkdown3.7 KB
SKILL.mdskill md20.3 KB
_meta.jsonconfig442 B
build_ops.pyscript5.5 KB
cache.pyscript13.2 KB
chat_ops.pyscript4.5 KB
config.jsonconfig145 B
maps_util.pyscript4.8 KB
march_ops.pyscript3.4 KB

march_ops.py

View on GitHub
#!/usr/bin/env python3
"""
出征 / 打野 — 通过 GameSkillAPI 调用 ADDCOMBATQUEUE。
打野目标为绿洲(FieldType=0)时常用 marchType=256(AttackWilderness)。
粮耗 upkeep 可由服务端校验;脚本可先粗略填 0 或由你传入。
"""
from __future__ import annotations

import argparse
import json
import os
import sys
import time


def _import_game():
    base = os.path.dirname(os.path.abspath(__file__))
    if base not in sys.path:
        sys.path.insert(0, base)
    from cache import _game_command, _get_token, _load_config
    return _game_command, _get_token, _load_config


def _expand_troops(spec: str) -> str:
    """
    spec: "43:35" -> "43:35_0_0_0";已是 "43:35_0_0_0" 则原样;
    多段用 | 连接: "43:35|44:10"
    """
    parts = []
    for seg in spec.split("|"):
        seg = seg.strip()
        if not seg:
            continue
        if "_" not in seg:
            arm, qty = seg.split(":", 1)
            parts.append(f"{arm.strip()}:{qty.strip()}_0_0_0")
        else:
            parts.append(seg)
    return "|".join(parts)


def _net_date_ms(ms: int, offset: str = "+0800") -> str:
    return f"/Date({ms}{offset})/"


def main():
    gc, get_token, load_cfg = _import_game()
    ap = argparse.ArgumentParser(description="Earth2037 出征(HTTP ADDCOMBATQUEUE)")
    ap.add_argument("--api-base", dest="api_base", default=os.environ.get("EARTH2037_API_BASE", "").strip() or None)

    sub = ap.add_subparsers(dest="mode", required=True)
    p_w = sub.add_parser("attack-oasis", help="打野:marchType=256,目标 tile 为绿洲")
    p_w.add_argument("--from", dest="from_city", type=int, required=True)
    p_w.add_argument("--to", dest="to_city", type=int, required=True)
    p_w.add_argument("--troops", required=True, help="如 43:35 或 43:35_0_0_0,多种用 |")
    p_w.add_argument("--march-type", type=int, default=256, help="默认 256=打野")
    p_w.add_argument("--hero", type=int, default=0)
    p_w.add_argument("--upkeep", type=int, default=0)
    p_w.add_argument("--in-seconds", type=int, default=120, help="到达时间=现在+秒数(粗算,仍可能被服端校正)")
    p_w.add_argument("--resources", default="0|0|0|0")

    p_j = sub.add_parser("raw-json", help="args 整段为 CombatQueue JSON")
    p_j.add_argument("json_one_line")

    args = ap.parse_args()
    api = (args.api_base or load_cfg()).rstrip("/")
    token = get_token()
    if not token:
        print("❌ 需要 EARTH2037_TOKEN 或 config.json token", file=sys.stderr)
        sys.exit(1)

    if args.mode == "attack-oasis":
        ms = int(time.time() * 1000) + args.in_seconds * 1000
        body = {
            "fromCityID": args.from_city,
            "toCityID": args.to_city,
            "marchType": args.march_type,
            "troops": _expand_troops(args.troops),
            "resources": args.resources,
            "heroID": args.hero,
            "spyIntoType": 0,
            "arrivalTime": _net_date_ms(ms),
            "completed": False,
            "id": 0,
            "upkeep": args.upkeep,
        }
        line = json.dumps(body, separators=(",", ":"), ensure_ascii=False)
    else:
        line = args.json_one_line.strip()

    try:
        out = gc(api, token, "ADDCOMBATQUEUE", line)
    except Exception as e:
        print(f"❌ {e}", file=sys.stderr)
        sys.exit(1)
    print(out)


if __name__ == "__main__":
    main()
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall