feat: SSS#2 YostarEN implementation (#7346)

This commit is contained in:
David
2023-11-19 00:27:19 +01:00
committed by GitHub
parent 1c75e9df48
commit c09d19191e
16 changed files with 3777 additions and 30 deletions

View File

@@ -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();
}