mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-20 02:55:38 +08:00
perf: 优化部分插件判断
This commit is contained in:
@@ -9,7 +9,7 @@ bool asst::FightTimesPlugin::verify(AsstMsg msg, const json::value& details) con
|
||||
return false;
|
||||
}
|
||||
|
||||
return !inited && details.at("details").at("task").as_string().ends_with("StartButton1");
|
||||
return !inited && details.get("details", "task", "").ends_with("StartButton1");
|
||||
}
|
||||
|
||||
bool asst::FightTimesPlugin::_run()
|
||||
|
||||
@@ -19,7 +19,7 @@ bool asst::MedicineCounterPlugin::verify(AsstMsg msg, const json::value& details
|
||||
return false;
|
||||
}
|
||||
|
||||
return details.at("details").at("task").as_string().ends_with("UseMedicine");
|
||||
return details.get("details", "task", "").ends_with("UseMedicine");
|
||||
}
|
||||
|
||||
bool asst::MedicineCounterPlugin::_run()
|
||||
@@ -128,7 +128,7 @@ std::optional<asst::MedicineCounterPlugin::MedicineResult> asst::MedicineCounter
|
||||
static const auto& expiring_task = Task.get("MedicineExpiringTime");
|
||||
|
||||
auto match_result = multi_matcher.get_result();
|
||||
sort_by_horizontal_(match_result);// 排序以保证结果为从左到右
|
||||
sort_by_horizontal_(match_result); // 排序以保证结果为从左到右
|
||||
for (const auto& result : match_result) {
|
||||
auto using_rect = result.rect.move(using_count_task->rect_move);
|
||||
auto inventory_rect = result.rect.move(inventory_task->rect_move);
|
||||
|
||||
@@ -12,11 +12,11 @@ bool asst::SanityBeforeStagePlugin::verify(AsstMsg msg, const json::value& detai
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string task = details.at("details").at("task").as_string();
|
||||
const std::string task = details.get("details", "task", "");
|
||||
if (task.ends_with("StartButton1")) {
|
||||
return true;
|
||||
}
|
||||
else if (task.ends_with("Stop") && details.at("pre_task").as_string().ends_with("StartButton1")) {
|
||||
else if (task.ends_with("Stop") && details.get("pre_task", "").ends_with("StartButton1")) {
|
||||
// 次数达限
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ bool asst::StageDropsTaskPlugin::verify(AsstMsg msg, const json::value& details)
|
||||
if (msg != AsstMsg::SubTaskCompleted || details.get("subtask", std::string()) != "ProcessTask") {
|
||||
return false;
|
||||
}
|
||||
const std::string task = details.at("details").at("task").as_string();
|
||||
const std::string task = details.get("details", "task", "");
|
||||
if (task == "Fight@EndOfAction") {
|
||||
int64_t last_start_time = status()->get_number(LastStartTimeKey).value_or(0);
|
||||
int64_t last_recognize_flag = status()->get_number(RecognitionRestrictionsKey).value_or(0);
|
||||
|
||||
@@ -16,13 +16,7 @@ bool asst::StageQueueMissionCompletedPlugin::verify(AsstMsg msg, const json::val
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string task = details.at("details").at("task").as_string();
|
||||
if (task == ("StageQueue@EndOfAction")) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return details.get("details", "task", "") == "StageQueue@EndOfAction";
|
||||
}
|
||||
|
||||
void asst::StageQueueMissionCompletedPlugin::set_drop_stats(std::unordered_map<std::string, int> drop_stats)
|
||||
|
||||
@@ -12,7 +12,7 @@ bool asst::RoguelikeSettlementTaskPlugin::verify(AsstMsg msg, const json::value&
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto task_name = details.at("details").at("task").as_string();
|
||||
const auto task_name = details.get("details", "task", "");
|
||||
if (task_name.ends_with("Roguelike@GamePass")) {
|
||||
m_game_pass = true;
|
||||
return m_config->get_mode() == RoguelikeMode::Exp;
|
||||
|
||||
Reference in New Issue
Block a user