mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-20 10:57:45 +08:00
Merge branch 'master' into dev
This commit is contained in:
25
README.md
25
README.md
@@ -2,7 +2,7 @@
|
||||
|
||||
<img alt="LOGO" src="https://user-images.githubusercontent.com/18511905/148931479-23aef436-2fc1-4c1e-84c9-bae17be710a5.png" width=360 height=270/>
|
||||
|
||||
# MeoAssistantArknights
|
||||
# MaaAssistantArknights
|
||||
|
||||
<br>
|
||||
<div>
|
||||
@@ -12,15 +12,15 @@
|
||||
<img alt="platform" src="https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-blueviolet">
|
||||
</div>
|
||||
<div>
|
||||
<img alt="license" src="https://img.shields.io/github/license/MistEO/MeoAssistantArknights">
|
||||
<img alt="commit" src="https://img.shields.io/github/commit-activity/m/MistEO/MeoAssistantArknights?color=%23ff69b4">
|
||||
<img alt="stars" src="https://img.shields.io/github/stars/MistEO/MeoAssistantArknights?style=social">
|
||||
<img alt="license" src="https://img.shields.io/github/license/MaaAssistantArknights/MaaAssistantArknights">
|
||||
<img alt="commit" src="https://img.shields.io/github/commit-activity/m/MaaAssistantArknights/MaaAssistantArknights?color=%23ff69b4">
|
||||
<img alt="stars" src="https://img.shields.io/github/stars/MaaAssistantArknights/MaaAssistantArknights?style=social">
|
||||
</div>
|
||||
<br>
|
||||
|
||||
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) 功能正在开发中 ✿✿ヽ(°▽°)ノ✿
|
||||
|
||||
## 声明
|
||||
|
||||
|
||||
@@ -437,8 +437,8 @@
|
||||
]
|
||||
},
|
||||
"StartButton2": {
|
||||
"action": "ClickSelf",
|
||||
"rearDelay": 20000,
|
||||
"action": "lickSelf",
|
||||
"rearDelay": 40000,
|
||||
"roi": [
|
||||
1000,
|
||||
350,
|
||||
@@ -1826,7 +1826,7 @@
|
||||
"text": [
|
||||
"可收获",
|
||||
"订单交付",
|
||||
"信赖"
|
||||
"员信赖"
|
||||
],
|
||||
"action": "ClickSelf",
|
||||
"roi": [
|
||||
|
||||
@@ -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<std::vector<unsigned char>> asst::Controller::call_command(const std::string & cmd)
|
||||
std::optional<std::vector<unsigned char>> asst::Controller::call_command(const std::string & cmd, int64_t timeout)
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
std::vector<uchar> pipe_data;
|
||||
|
||||
static std::mutex pipe_mutex;
|
||||
std::unique_lock<std::mutex> pipe_lock(pipe_mutex);
|
||||
|
||||
std::vector<uchar> pipe_data;
|
||||
auto start_time = std::chrono::steady_clock::now();
|
||||
auto check_timeout = [&]() -> bool {
|
||||
return timeout &&
|
||||
timeout < std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::steady_clock::now() - start_time)
|
||||
.count();
|
||||
};
|
||||
|
||||
#ifdef _WIN32
|
||||
PROCESS_INFORMATION process_info = { 0 }; // 进程信息结构体
|
||||
@@ -220,10 +228,12 @@ std::optional<std::vector<unsigned char>> 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<std::vector<unsigned char>> 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();
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace asst
|
||||
|
||||
private:
|
||||
void pipe_working_proc();
|
||||
std::optional<std::vector<unsigned char>> call_command(const std::string& cmd);
|
||||
std::optional<std::vector<unsigned char>> call_command(const std::string& cmd, int64_t timeout = 0);
|
||||
int push_cmd(const std::string& cmd);
|
||||
|
||||
using DecodeFunc = std::function<bool(const std::vector<uchar>&)>;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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 { // 否则这个组合人不够,就不可用了
|
||||
|
||||
Reference in New Issue
Block a user