mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 02:10:21 +08:00
feat.新增无人机 for 巫恋任务插件,优化部分函数调用方式
This commit is contained in:
@@ -65,27 +65,30 @@ void asst::AbstractTask::clear_plugin() noexcept
|
||||
|
||||
json::value asst::AbstractTask::basic_info() const
|
||||
{
|
||||
// typeid.name() 结果可能和编译器有关,所以这里使用正则尽可能保证结果正确。
|
||||
// 但还是不能完全保证,如果不行的话建议 override
|
||||
static std::regex regex("[a-zA-Z]+Task");
|
||||
std::smatch match_obj;
|
||||
std::string class_name = typeid(*this).name();
|
||||
std::string task_name;
|
||||
if (std::regex_search(class_name, match_obj, regex)) {
|
||||
task_name = match_obj[0].str();
|
||||
}
|
||||
else {
|
||||
task_name = class_name;
|
||||
}
|
||||
if (m_basic_info_cache.empty()) {
|
||||
std::string class_name = typeid(*this).name();
|
||||
std::string task_name;
|
||||
// typeid.name() 结果可能和编译器有关,所以这里使用正则尽可能保证结果正确。
|
||||
// 但还是不能完全保证,如果不行的话建议 override
|
||||
std::regex regex("[a-zA-Z]+Task");
|
||||
std::smatch match_obj;
|
||||
if (std::regex_search(class_name, match_obj, regex)) {
|
||||
task_name = match_obj[0].str();
|
||||
}
|
||||
else {
|
||||
task_name = class_name;
|
||||
}
|
||||
|
||||
return json::object{
|
||||
{ "taskchain", m_task_chain },
|
||||
{ "class", class_name },
|
||||
{ "subtask", task_name },
|
||||
{ "details", json::object() }
|
||||
//{ "CurRetryTimes", m_cur_retry },
|
||||
//{ "MaxRetryTimes", m_retry_times }
|
||||
};
|
||||
m_basic_info_cache = json::object{
|
||||
{ "taskchain", m_task_chain },
|
||||
{ "class", class_name },
|
||||
{ "subtask", task_name },
|
||||
{ "details", json::object() }
|
||||
//{ "CurRetryTimes", m_cur_retry },
|
||||
//{ "MaxRetryTimes", m_retry_times }
|
||||
};
|
||||
}
|
||||
return m_basic_info_cache;
|
||||
}
|
||||
|
||||
json::value asst::AbstractTask::basic_info_with_what(std::string what) const
|
||||
|
||||
Reference in New Issue
Block a user