{"id":13429700,"url":"https://github.com/ArknightsAutoHelper/ArknightsAutoHelper","last_synced_at":"2025-03-16T04:31:09.261Z","repository":{"id":37017739,"uuid":"184413685","full_name":"ArknightsAutoHelper/ArknightsAutoHelper","owner":"ArknightsAutoHelper","description":"Arknights Auto Helper based on ADB and Python   |  基于python的明日方舟护肝助手","archived":false,"fork":false,"pushed_at":"2023-06-05T08:24:45.000Z","size":31674,"stargazers_count":1204,"open_issues_count":61,"forks_count":184,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-04-28T03:38:12.062Z","etag":null,"topics":["adb","arknights","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ArknightsAutoHelper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-05-01T12:35:11.000Z","updated_at":"2024-04-25T11:17:32.000Z","dependencies_parsed_at":"2024-01-16T01:25:38.992Z","dependency_job_id":"d8c98937-1098-4be2-9cf6-9bc99b0a47ea","html_url":"https://github.com/ArknightsAutoHelper/ArknightsAutoHelper","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArknightsAutoHelper%2FArknightsAutoHelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArknightsAutoHelper%2FArknightsAutoHelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArknightsAutoHelper%2FArknightsAutoHelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArknightsAutoHelper%2FArknightsAutoHelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArknightsAutoHelper","download_url":"https://codeload.github.com/ArknightsAutoHelper/ArknightsAutoHelper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826788,"owners_count":20354220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adb","arknights","python"],"created_at":"2024-07-31T02:00:43.887Z","updated_at":"2025-03-16T04:31:04.728Z","avatar_url":"https://github.com/ArknightsAutoHelper.png","language":"Python","readme":"# ![icon](webgui2/public/carrot.png) Arknights Auto Helper\n\n明日方舟辅助脚本\n\n功能说明：\n\n* 自动重复刷图，使用理智药、~~碎石~~\n    * 识别掉落物品，上传企鹅物流数据统计\n* 自动选图（从主界面开始到关卡信息界面）\n* 自动领取任务奖励\n* 公开招募识别\n\n## 0x01 运行须知\n\n### 二进制包（Windows）\n\n⬇️ 从 Releases 中下载 [二进制包启动器](https://github.com/ArknightsAutoHelper/ArknightsAutoHelper/releases/tag/bootstrapper-release)。\n\n首次运行启动器时，将从 GitHub 下载通过 Actions 打包的最新代码及运行环境，请保持网络畅通。\n\n运行 `akhelper.exe --update` 或 `akhelper-gui.exe --update` 可更新到最新版本。如果最新版本存在问题，可尝试从 [Actions](https://github.com/ArknightsAutoHelper/ArknightsAutoHelper/actions) 中下载 90 天内的旧版本覆盖 `.bootstrapper` 目录内的对应文件。\n\n### 从源代码安装\n\n\u003e ⚠ **不建议使用 GitHub 的 Download ZIP 功能下载源码包**：这样做会丢失版本信息，且不便于后续更新。\n\n请参考 [wiki/从源代码安装]。\n\n###  环境与分辨率\n\u003e 💡 由于游戏内文字渲染机制问题，分辨率过低可能影响识别效果，建议分辨率高度 1080 或以上。\n\n大部分功能可以自适应分辨率（宽高比不小于 16:9，即`宽度≥高度×16/9`），作者测试过的分辨率有 \u003cspan style=\"opacity: 0.5\"\u003e1280x720、1440x720、\u003c/span\u003e1920x1080、2160x1080。\n\n### ADB 连接\n\n请确认 `adb devices` 中列出了目标模拟器/设备：\n```console\n$ adb devices\nemulator-5554   device\n```\n如何连接 ADB 请参考各模拟器的文档、论坛等资源。\n\n如果 `adb devices` 中列出了目标模拟器/设备，但脚本不能正常连接，或遇到其他问题，请尝试使用[最新的 ADB 工具](https://developer.android.google.cn/studio/releases/platform-tools)。\n\n#### 常见问题\n\n##### ADB server 相关\n\n* 部分模拟器（如 MuMu、BlueStacks）需要自行启动 ADB server。\n* 部分模拟器（如 MuMu、BlueStacks Hyper-V）不使用标准模拟器 ADB 端口，ADB server 无法自动探测，需要另行 adb connect。\n* 部分模拟器（如夜神）会频繁使用自带的旧版本 ADB 挤掉用户自行启动的新版 ADB。\n\n可以参阅[配置说明](#额外设置)以配置自动解决以上问题。\n\n##### 其他\n\n* 部分非 VMM 模拟器（声称“不需要开启 VT”，如 MuMu 星云引擎）不提供 ADB 接口。\n\n### **额外设置**\n\n关于额外设置请移步到 [config/config-template.yaml](config/config-template.yaml) 中查看\n\n#### **日志说明**\n运行日志（文本）采用```import logging```在log目录下生成**ArknightsAutoHelper.log**推荐用Excel打开，分割符号为“!”\n\n相关配置文件在```config```目录下的**logging.yaml**，由于过于复杂 ~~其实也没确定理解的对不对~~ 这里请自行研究，欢迎讨论\n\n日志目前启动按照时间自动备份功能，间隔为一天一次，保留最多7份。\n\n图像识别日志为 `log/*.html`，相应识别模块初始化时会清空原有内容。\n\n多开时日志文件名会出现实例 ID，如 `ArknightsAutoHelper.1.log`。\n\n**报告 issue 时，建议附上日志以便定位问题。**\n\n## 0x02 ArknightsHelper GUI 启动\n\u003e 💡 Windows：如果您按照 [wiki/从源代码安装] 配置了 venv，则可以通过双击 `启动GUI.bat` 调用。\n```console\n$ python3 akhelper-gui.pyw\n```\n\nWeb GUI 将在一下第一个可用的浏览器环境中打开：\n\n* 内嵌浏览器\n* Google Chrome、Chromium、Microsoft Edge 的 PWA 模式*\n* 系统默认浏览器*\n\n\u003csmall\u003e* 使用外部浏览器时，HTTP 服务器将在最后一个连接关闭后 3 分钟内退出。\u003c/small\u003e\n\n## 0x03 ArknightsHelper 命令行启动\n\n\u003e 💡 Windows：命令行功能在 Windows 10 1607 (build 14393) 及以上版本上体验最佳。非简体中文系统可能无法在 Windows 命令行窗口中正确显示简体中文文字，可尝试使用 Windows Terminal。\n\n### 命令行启动说明\n\u003e 💡 Windows：如果您按照 [wiki/从源代码安装] 配置了 venv，则可以通过双击 `整合工具箱(新).bat` 调用。\n```console\n$ python3 akhelper.py\nusage: akhelper.py command [command args]\n    connect [connector type] [connector args ...]\n        连接到设备\n        支持的设备类型：\n        connect adb [serial or tcpip endpoint]\n    quick [+-rR[N]] [n]\n        重复挑战当前画面关卡特定次数或直到理智不足\n        +r/-r 是否自动回复理智，最多回复 N 次\n        +R/-R 是否使用源石回复理智（需要同时开启 +r）\n    auto [+-rR[N]] TARGET_DESC [TARGET_DESC]...\n        按顺序挑战指定关卡。\n        TARGET_DESC 可以是：\n            1-7 10      特定主线、活动关卡（1-7）10 次\n            grass       一键长草: 检查库存中最少的蓝材料, 然后去 aog 上推荐的地图刷材料\n            plan        执行刷图计划: 使用 arkplanner 命令创建刷图计划。执行过程会自动更新计划进度。\n    recruit [tags ...]\n        公开招募识别/计算，不指定标签则从截图中识别\n    collect\n        收集每日任务和每周任务奖励\n    record\n        操作记录模块，使用 record --help 查看帮助。\n    riic \u003csubcommand\u003e\n        基建功能（开发中）\n        riic collect\n        收取制造站及贸易站\n        riic shift \u003croom\u003e \u003coperator1\u003e \u003coperator2\u003e ...\n        指定干员换班\n        room: B101 B102 B103 B201 B202 B203 B301 B302 B303 dorm1 dorm2 dorm3 dorm4 meeting workshop office\n    arkplanner\n        输入材料需求创建刷图计划。使用 auto plan 命令执行刷图计划。\n```\n\n命令可使用前缀（首字母）缩写（类似 Linux iproute2），交互模式下只需输入对应命令名称即可，如：\n\n```console\n$ python3 akhelper.py q 5\n\n$ python3 akhelper.py i\nakhelper\u003e q 5\n    ...\nakhelper\u003e c\n```\n\n### 简略战斗模块\n\n快速启动模块需要手动选关。到如下画面，活动关卡你也可以这么刷。\n\n\\* 该模块可以自适应分辨率\n\n![TIM截图20190513101009.png-1013.8kB][1]\n\n```bash\npython3 akhelper.py quick 99\n# 重复刷当前画面关卡 99 次，也可以不指定次数\npython3 akhelper.py quick -r\n# 重复刷当前画面关卡，禁用自动回复理智（直到理智不足停止）\npython3 akhelper.py quick +r5\n# 重复刷当前画面关卡，启用自动回复理智，最多回复 5 次\npython3 akhelper.py quick +rR 99\n# 重复刷当前画面关卡 99 次，启用自动回复理智，启用碎石回复理智\n```\n\n*注意*\n\n* 该模块会识别当前理智和关卡理智消耗，理智不足时会自动停止或补充理智（需在配置中启用）\n* 理论上该模块比完整的模块稳定并且不容易被系统检测。并且该模块所有的点击序列都是随机化的，不容易被检测\n\n\n### 主战斗模块\n\n1. 主战斗模块可以从几乎任何位置（理论上有返回键的页面）开始任务序列。\n\n\\* 该模块支持主线章节大部分关卡。\n\n```bash\npython3 akhelper.py auto   5-1 2   5-2 3\n# 按顺序刷 5-1 关卡 2 次，5-2 关卡 3 次\n```\n\n### 通过输入所需材料数量创建刷图计划并执行\n\n`arkplanner` 命令可以通过企鹅物流的接口, 根据输入的材料创建刷图计划 (支持自动获取当前库存):\n\n```\n# 缓存将在第一次启动脚本时创建, 如果没有新的地图或材料, 这个缓存没必要更新.\n是否刷新企鹅物流缓存(缓存时间: ....)[y/N]:\n材料列表：\n序号: 0, 材料等级: 3, 名称: 赤金\n序号: 1, 材料等级: 3, 名称: 提纯源岩\n...\n...\n# 需要 10 个提纯源岩\n材料序号/需求数量(输入为空时结束):1/10\n材料序号/需求数量(输入为空时结束):\n\n# 默认 n, 输入 y 将自动读取游戏中的库存, 并加入到刷图计划的计算中\n是否获取当前库存材料数量(y,N):y\n\n刷图计划:\n关卡 [...] 次数 2\n...\n预计消耗理智: ...\n刷图计划已保存至: config/plan.json\n```\n\n`auto plan` 文件将从上一步生成的 config/plan.json 获取并执行刷图计划. \n\n如果当前的理智不足以完成刷图计划, 将保存已经刷图的次数, 并在下次运行时恢复.\n\n如果完成刷图计划后, 当前的理智可能还有剩余，可以使用其他命令消耗剩余理智（如使用脚本连续运行命令）。\n\n## 0x04 ArknightsHelper 自定义脚本启动\n\n请参考 [scripting_example.pyi](scripting_example.pyi) 编写自定义脚本。\n\n## 0x05 已知问题\n\n* 自动选关功能：点击随机偏移范围大小固定，且与分辨率无关\n* 某些情况下，物品、数量识别会出错\n\n## 0x06 自定义开发与TODO\n\n如果您已经有一定的 Python 基础，可以通过 [wiki 中的开发文档](https://github.com/ArknightsAutoHelper/ArknightsAutoHelper/wiki/Development-%23-1.-Getting-Started)快速上手。\n\n### 关于一些常见的问题\n\n#### 1. 分辨率/模拟器/路径问题\n\n☞ [环境与分辨率](#环境与分辨率)\n\n#### 2. 我想跑一些别的关卡，但是提示我关卡不支持。\n\n这些关卡可以通过 quick 命令来启动。\n\n#### 3. OCR 模块可以不装嚒？\n\n~~最好安装，在之后的版本迭代中会对没有OCR依赖的用户越来越不友好~~不可以。\n\n#### 4. 我不会python|我电脑里没装Python，我能用这个嚒？\n\n可以使用[二进制包](#二进制包windows)\n\n#### 5. 之后会收费么？\n\n不会，该项目一直开源。实际上作者还有别的事情要做，代码可能突然会有一段时间不更新了。欢迎来pull代码以及加群\n\n#### 6. ~~关于mumu模拟器的adb在哪里的问题~~【目前已经解决】\n\n☞ [常见问题](#常见问题)\n\n#### 7. 我想将这个脚本适配到其他服务器\n\n☞ [Porting to Another Server](https://github.com/ArknightsAutoHelper/ArknightsAutoHelper/wiki/Porting-to-Another-Server)\n\n### 自定义开发与更多功能\n\n详情请联系作者或者提出你的issue！祝大家玩的愉快\n\n欢迎来加开发者QQ 2454225341 或加入QQ群 757689154 [Telegram 群（有简单防爬虫验证）](https://t.me/+fBBb553wouM5MWM1)\n\n  [1]: http://static.zybuluo.com/shaobaobaoer/7ifp1acn3an7a3z23t96owt1/TIM%E6%88%AA%E5%9B%BE20190530114456.png\n  [2]: http://static.zybuluo.com/shaobaobaoer/860t36w2ygsvet6sxn3lv3ty/TIM%E5%9B%BE%E7%89%8720190612102050.png\n  [3]: http://static.zybuluo.com/shaobaobaoer/14ufv5gx72buoo1vyaa9jmgy/qrcode_1558871927006.jpg\n  [wiki/从源代码安装]: https://github.com/ArknightsAutoHelper/ArknightsAutoHelper/wiki/%E4%BB%8E%E6%BA%90%E4%BB%A3%E7%A0%81%E5%AE%89%E8%A3%85","funding_links":[],"categories":["护肝类","Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FArknightsAutoHelper%2FArknightsAutoHelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FArknightsAutoHelper%2FArknightsAutoHelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FArknightsAutoHelper%2FArknightsAutoHelper/lists"}