feat.检测到EX关卡时,则停止继续刷理智

https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/325
This commit is contained in:
MistEO
2022-04-06 22:59:29 +08:00
parent 5ef2016e7c
commit facebef5b1
7 changed files with 36 additions and 7 deletions

View File

@@ -56,8 +56,8 @@ bool asst::GeneralConfiger::parse(const json::value& json)
emulator_info.adb.release = adb_json.at("release").as_string();
//emulator_info.adb.pullscreen = adb_json.at("pullscreen").as_string();
m_emulators_info.emplace(name, std::move(emulator_info));
m_emulators_info[name] = std::move(emulator_info);
}
return true;
}
}

View File

@@ -73,7 +73,7 @@ namespace asst
}
void set_emulator_info(std::string name, EmulatorInfo emu)
{
m_emulators_info.emplace(std::move(name), std::move(emu));
m_emulators_info[std::move(name)] = std::move(emu);
}
void set_emulator_path(std::string name, std::string path)
{

View File

@@ -1,4 +1,4 @@
#include "ProcessTask.h"
#include "ProcessTask.h"
#include <chrono>
#include <random>
@@ -57,13 +57,13 @@ asst::ProcessTask& asst::ProcessTask::set_tasks(std::vector<std::string> tasks_n
ProcessTask& asst::ProcessTask::set_times_limit(std::string name, int limit)
{
m_times_limit.emplace(std::move(name), limit);
m_times_limit[std::move(name)] = limit;
return *this;
}
ProcessTask& asst::ProcessTask::set_rear_delay(std::string name, int delay)
{
m_rear_delay.emplace(std::move(name), delay);
m_rear_delay[std::move(name)] = delay;
return *this;
}

View File

@@ -54,6 +54,8 @@ bool asst::StageDropsTaskPlugin::_run()
}
drop_info_callback();
check_stage_valid();
auto upload_future = std::async(
std::launch::async,
std::bind(&StageDropsTaskPlugin::upload_to_penguin, this));
@@ -191,3 +193,25 @@ void asst::StageDropsTaskPlugin::upload_to_penguin()
callback(AsstMsg::SubTaskCompleted, info);
}
bool asst::StageDropsTaskPlugin::check_stage_valid()
{
LogTraceFunction;
std::string stage_code = m_cur_drops.get("stage", "stageCode", std::string());
if (stage_code.find("-EX-") != std::string::npos) {
json::value info = basic_info();
info["subtask"] = "CheckStageValid";
info["why"] = "EX关卡";
callback(AsstMsg::SubTaskError, info);
m_cast_ptr->set_times_limit("StartButton1", 0)
.set_times_limit("StartButton2", 0)
.set_times_limit("MedicineConfirm", 0)
.set_times_limit("StoneConfirm", 0);
return true;
}
return true;
}

View File

@@ -25,6 +25,7 @@ namespace asst
bool recognize_drops();
void drop_info_callback();
void set_startbutton_delay();
bool check_stage_valid();
void upload_to_penguin();
static constexpr int64_t RecognizationTimeOffset = 20;

View File

@@ -47,5 +47,5 @@ const cv::Mat asst::TemplResource::get_templ(const std::string& key) const noexc
void asst::TemplResource::emplace_templ(std::string key, cv::Mat templ)
{
m_templs.emplace(std::move(key), std::move(templ));
m_templs[std::move(key)] = std::move(templ);
}

View File

@@ -243,6 +243,10 @@ namespace MeoAsstGui
case "ReportToPenguinStats":
mainModel.AddLog("上传企鹅数据错误", "darkred");
break;
case "CheckStageValid":
mainModel.AddLog("EX 关卡,已停止", "darkred");
break;
}
}