diff --git a/README.md b/README.md
index 81ac7292a7..793e88c4e0 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
-# MeoAssistantArknights
+# MaaAssistantArknights
@@ -12,15 +12,15 @@
-A Game Assistant for Arknights
+MAA 的意思是 MAA Assistant Arknights
-一款明日方舟游戏小助手,简称 MAA
+一款明日方舟游戏小助手
基于图像识别技术,一键完成全部日常任务!
@@ -43,8 +43,8 @@ A Game Assistant for Arknights
## 下载地址
-[稳定版](https://github.com/MistEO/MeoAssistantArknights/releases/latest)
-[测试版](https://github.com/MistEO/MeoAssistantArknights/releases)
+[稳定版](https://github.com/MaaAssistantArknights/MaaAssistantArknights/releases/latest)
+[测试版](https://github.com/MaaAssistantArknights/MaaAssistantArknights/releases)
## 使用说明
@@ -70,7 +70,7 @@ A Game Assistant for Arknights
## 关联项目
-- 全新 GUI: [MeoAsstElectronUI](https://github.com/MaaAssistantArknights/MeoAsstElectronUI) (正在开发中)
+- 全新 GUI: [MaaAsstElectronUI](https://github.com/MaaAssistantArknights/MaaAsstElectronUI) (正在开发中)
- 更新服务器: [MaaDownloadServer](https://github.com/MaaAssistantArknights/MaaDownloadServer)(正在开发中)
## 致谢
@@ -120,12 +120,13 @@ A Game Assistant for Arknights
### API
-- [C 接口](https://github.com/MistEO/MeoAssistantArknights/blob/dev/include/AsstCaller.h)
-- [Python 接口](https://github.com/MistEO/MeoAssistantArknights/wiki/Python-%E6%8E%A5%E5%8F%A3)
-- [Golang 接口](https://github.com/MistEO/MeoAssistantArknights/wiki/Golang-%E6%8E%A5%E5%8F%A3) 已停止维护 orz
+- [C 接口](include/AsstCaller.h):[集成示例](tools/TestCaller/main.cpp)
+- [Python 接口](src/Python/asst.py):[集成示例](src/Python/sample.py)
+- [Golang 接口](src/Golang/maa/):[集成示例](src/Golang/cli.go)(已停止维护 orz)
- [集成文档](docs/集成文档.md) 龟速更新中_(:з」∠)_
- [回调消息协议](docs/回调消息协议.md)
- [任务流程协议](docs/任务流程协议.md)
+- [自动抄作业协议](docs/战斗流程协议.md) 功能正在开发中 ✿✿ヽ(°▽°)ノ✿
## 声明
diff --git a/resource/tasks.json b/resource/tasks.json
index 82189f8487..82c53a1d7d 100644
--- a/resource/tasks.json
+++ b/resource/tasks.json
@@ -437,8 +437,8 @@
]
},
"StartButton2": {
- "action": "ClickSelf",
- "rearDelay": 20000,
+ "action": "lickSelf",
+ "rearDelay": 40000,
"roi": [
1000,
350,
@@ -1826,7 +1826,7 @@
"text": [
"可收获",
"订单交付",
- "信赖"
+ "员信赖"
],
"action": "ClickSelf",
"roi": [
diff --git a/src/MeoAssistant/Controller.cpp b/src/MeoAssistant/Controller.cpp
index dfa52f2b64..bcbb7e0122 100644
--- a/src/MeoAssistant/Controller.cpp
+++ b/src/MeoAssistant/Controller.cpp
@@ -173,7 +173,7 @@ void asst::Controller::pipe_working_proc()
m_cmd_queue.pop();
cmd_queue_lock.unlock();
// todo 判断命令是否执行成功
- call_command(cmd);
+ call_command(cmd, 20 * 1000);
++m_completed_id;
}
//else if (!m_thread_idle) { // 队列中没有任务,又不是闲置的时候,就去截图
@@ -195,14 +195,22 @@ void asst::Controller::pipe_working_proc()
}
}
-std::optional> asst::Controller::call_command(const std::string & cmd)
+std::optional> asst::Controller::call_command(const std::string & cmd, int64_t timeout)
{
LogTraceFunction;
+ std::vector pipe_data;
+
static std::mutex pipe_mutex;
std::unique_lock pipe_lock(pipe_mutex);
- std::vector pipe_data;
+ auto start_time = std::chrono::steady_clock::now();
+ auto check_timeout = [&]() -> bool {
+ return timeout &&
+ timeout < std::chrono::duration_cast(
+ std::chrono::steady_clock::now() - start_time)
+ .count();
+ };
#ifdef _WIN32
PROCESS_INFORMATION process_info = { 0 }; // 进程信息结构体
@@ -220,10 +228,12 @@ std::optional> asst::Controller::call_command(const s
pipe_data.insert(pipe_data.end(), m_pipe_buffer.get(), m_pipe_buffer.get() + read_num);
}
}
- } while (::WaitForSingleObject(process_info.hProcess, 0) == WAIT_TIMEOUT);
+ } while (::WaitForSingleObject(process_info.hProcess, 0) == WAIT_TIMEOUT && !check_timeout());
DWORD exit_ret = 255;
- ::GetExitCodeProcess(process_info.hProcess, &exit_ret);
+ if (!check_timeout()) {
+ ::GetExitCodeProcess(process_info.hProcess, &exit_ret);
+ }
::CloseHandle(process_info.hProcess);
::CloseHandle(process_info.hThread);
@@ -259,7 +269,7 @@ std::optional> asst::Controller::call_command(const s
pipe_data.insert(pipe_data.end(), m_pipe_buffer.get(), m_pipe_buffer.get() + read_num);
read_num = read(m_pipe_out[PIPE_READ], m_pipe_buffer.get(), PipeBuffSize);
};
- } while (::waitpid(m_child, &exit_ret, WNOHANG) == 0);
+ } while (::waitpid(m_child, &exit_ret, WNOHANG) == 0 && !check_timeout());
}
else {
// failed to create child process
@@ -354,9 +364,9 @@ void asst::Controller::random_delay() const
Log.trace("random_delay |", rand_delay, "ms");
std::this_thread::sleep_for(std::chrono::milliseconds(rand_delay));
}
-}
-
-void asst::Controller::clear_info() noexcept
+}
+
+void asst::Controller::clear_info() noexcept
{
m_adb = decltype(m_adb)();
m_uuid.clear();
diff --git a/src/MeoAssistant/Controller.h b/src/MeoAssistant/Controller.h
index 745f25938d..3d3c697b16 100644
--- a/src/MeoAssistant/Controller.h
+++ b/src/MeoAssistant/Controller.h
@@ -59,7 +59,7 @@ namespace asst
private:
void pipe_working_proc();
- std::optional> call_command(const std::string& cmd);
+ std::optional> call_command(const std::string& cmd, int64_t timeout = 0);
int push_cmd(const std::string& cmd);
using DecodeFunc = std::function&)>;
diff --git a/src/MeoAssistant/InfrastConfiger.cpp b/src/MeoAssistant/InfrastConfiger.cpp
index babb495a17..fc67284ad5 100644
--- a/src/MeoAssistant/InfrastConfiger.cpp
+++ b/src/MeoAssistant/InfrastConfiger.cpp
@@ -201,6 +201,7 @@ bool asst::InfrastConfiger::parse(const json::value& json)
}
group.optional.emplace_back(std::move(comb));
}
+ group.allow_external = group_json.get("allowExternal", false);
group_vec.emplace_back(std::move(group));
}
m_skills_groups.emplace(facility_name, std::move(group_vec));
diff --git a/src/MeoAssistant/InfrastProductionTask.cpp b/src/MeoAssistant/InfrastProductionTask.cpp
index 0e9efcbc06..2e49ab3199 100644
--- a/src/MeoAssistant/InfrastProductionTask.cpp
+++ b/src/MeoAssistant/InfrastProductionTask.cpp
@@ -410,8 +410,9 @@ bool asst::InfrastProductionTask::optimal_calc()
// 允许外部的话,就把单个干员凑进来
if (group.allow_external) {
for (size_t i = cur_combs.size(); i != cur_max_num_of_opers; ++i) {
- cur_combs.emplace_back(cur_available_opers.at(i));
- cur_efficient += cur_available_opers.at(i).efficient.at(m_product);
+ size_t index = i - cur_combs.size();
+ cur_combs.emplace_back(cur_available_opers.at(index));
+ cur_efficient += cur_available_opers.at(index).efficient.at(m_product);
}
}
else { // 否则这个组合人不够,就不可用了