mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 02:10:21 +08:00
feat: SSS#2 YostarEN implementation (#7346)
This commit is contained in:
@@ -41,6 +41,7 @@ bool asst::SSSDropRewardsTaskPlugin::_run()
|
||||
std::vector<DropRecruitment> opers;
|
||||
for (const auto& result : analyzer.get_result()) {
|
||||
if (SSSCopilot.get_data().blacklist.contains(result.text)) {
|
||||
Log.info("Operator is blacklisted:", result.text);
|
||||
continue;
|
||||
}
|
||||
auto role = BattleData.get_role(result.text);
|
||||
@@ -48,18 +49,23 @@ bool asst::SSSDropRewardsTaskPlugin::_run()
|
||||
.ocr_res = result, .role = role == Role::Unknown ? std::nullopt : std::optional<Role>(role) });
|
||||
}
|
||||
|
||||
bool operSelect = false;
|
||||
for (const std::string& name : SSSCopilot.get_data().order_of_drops) {
|
||||
auto role = get_role_type(name);
|
||||
bool is_role = role != Role::Unknown;
|
||||
auto iter = ranges::find_if(opers, [&](const DropRecruitment& props) {
|
||||
return (is_role && props.role) ? *props.role == role : props.ocr_res.text == name;
|
||||
auto iter = ranges::find_if(opers, [&](const auto& props) {
|
||||
auto role = get_role_type(name);
|
||||
return (role != Role::Unknown && props.role) ? *props.role == role : props.ocr_res.text == name;
|
||||
});
|
||||
if (iter != opers.cend()) {
|
||||
ctrler()->click(iter->ocr_res.rect);
|
||||
sleep(Task.get("SSSDropRecruitmentOCR")->post_delay);
|
||||
operSelect = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!operSelect) {
|
||||
Log.warn("No operator selected. Bypassing blacklist...");
|
||||
ctrler()->click(opers.at(0).ocr_res.rect);
|
||||
}
|
||||
|
||||
return ProcessTask(*this, { "SSSDropRecruitmentConfirm" }).set_retry_times(5).run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user