mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-20 10:57:45 +08:00
* fix: log rotate * chore: Auto update by pre-commit hooks [skip changelog] * fix: ubuntu * chore: Auto update by pre-commit hooks [skip changelog] * fix: counter * fix: ubuntu * fix: static lock * perf: type * perf: catch file error * fix: 修复size计算错误 * revert: 还原阈值为64mb * chore: Auto update by pre-commit hooks [skip changelog] * perf: 移除不必要的锁传递 * rft: 使用streambuf计数 * perf: rename & 移除未使用函数 * fix: platform diff * perf: init --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
#include "RoguelikeResetTaskPlugin.h"
|
|
|
|
#include "Utils/Logger.hpp"
|
|
|
|
bool asst::RoguelikeResetTaskPlugin::verify(AsstMsg msg, const json::value& details) const
|
|
{
|
|
if (msg != AsstMsg::SubTaskStart || details.get("subtask", std::string()) != "ProcessTask") {
|
|
return false;
|
|
}
|
|
|
|
if (!RoguelikeConfig::is_valid_theme(m_config->get_theme())) {
|
|
Log.error("Roguelike name doesn't exist!");
|
|
return false;
|
|
}
|
|
const std::string roguelike_name = m_config->get_theme() + "@";
|
|
const std::string& task = details.get("details", "task", "");
|
|
std::string_view task_view = task;
|
|
if (task_view.starts_with(roguelike_name)) {
|
|
task_view.remove_prefix(roguelike_name.length());
|
|
}
|
|
if (task_view == "Roguelike@StartExplore") {
|
|
return true;
|
|
}
|
|
else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
bool asst::RoguelikeResetTaskPlugin::_run()
|
|
{
|
|
for (const auto& plugin : m_task_ptr->get_plugins()) {
|
|
if (auto ptr = std::dynamic_pointer_cast<AbstractRoguelikeTaskPlugin>(plugin)) {
|
|
ptr->reset_in_run_variables();
|
|
}
|
|
}
|
|
m_config->clear();
|
|
return true;
|
|
}
|