# Dota 2 助手 (Dota 2 Assistant) Windows 上的 Dota 2 英雄选择与出装推荐 Overlay 应用。实时读取游戏状态,在 BP 阶段提供英雄克制推荐,游戏中提供出装建议。 ## 功能 - **选将阶段 (BP)**: 根据对方已选英雄,通过 OpenDota 数据推荐克制英雄 - **游戏中**: 根据当前英雄推荐各阶段最优出装路线 - **游戏内 Overlay**: 透明悬浮窗叠加在 Dota 2 之上,支持鼠标穿透 - **本地缓存**: 英雄/物品数据缓存 24 小时,减少 API 请求 ## 安装 ### 依赖 - Windows 10/11 - Dota 2 (Steam) - Visual Studio C++ 构建工具 (用于编译) ### 编译 ```powershell # 安装 Rust (如果未安装) winget install Rustlang.Rustup # 克隆并编译 git clone cd dota2-assistant cargo build --release ``` ### 配置 Dota 2 GSI 运行安装脚本 (需要知道 Dota 2 安装路径): ```powershell .\install_gsi.ps1 # 或指定自定义路径: .\install_gsi.ps1 -DotaPath "D:\Steam\steamapps\common\dota 2 beta" ``` ### 手动配置 1. 将 `config\gamestate_integration_assistant.cfg` 复制到: ``` \steamapps\common\dota 2 beta\game\dota\cfg\gamestate_integration\ ``` 2. 在 Steam 中给 Dota 2 添加启动参数: `-gamestateintegration` 3. 将 Dota 2 设置为**无边框窗口 (Borderless Window)** 模式 ## 使用 1. 先启动 `dota2-assistant.exe` 2. 再启动 Dota 2 3. 进入游戏后 Overlay 会自动出现 4. 按 **F12** 切换显示/隐藏 ## 架构 ``` Dota 2 Game (GSI) │ HTTP POST (每 0.5 秒) ▼ GSI HTTP Server (axum, :3000) │ ▼ State Manager (Arc>) │ ├──► 推荐引擎 ──► OpenDota API ──► SQLite 缓存 │ └──► egui Overlay UI (主线程, GLFW 透明窗口) ``` ## 注意事项 - **VAC 安全**: 仅使用 GSI 官方接口 + 透明窗口技术,不涉及内存读取或 DLL 注入 - **GSI 限制**: 只能获取玩家自己可见的信息(不能读取对方未展示的选择) - **网络依赖**: 首次运行需联网拉取英雄数据,之后可离线使用缓存 ## 技术栈 | 组件 | 技术 | |------|------| | 语言 | Rust | | 异步运行时 | tokio | | Overlay UI | egui_overlay 0.9 (GLFW + egui 0.29) | | GSI 服务器 | axum 0.7 | | API 客户端 | reqwest 0.12 | | 本地缓存 | rusqlite (SQLite, bundled) | | 数据源 | OpenDota API (免费) |