diff --git a/resource/tasks.json b/resource/tasks.json index f87b2ebd1f..238bc28075 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -6800,6 +6800,29 @@ ], "postDelay": 500 }, + "BattleQuickFormationFilter-Trust": { + "action": "ClickSelf", + "roi": [ + 1010, + 70, + 35, + 580 + ], + "postDelay": 500, + "next": [ + "BattleQuickFormationFilter-Click2" + ] + }, + "BattleQuickFormationFilter-Click2": { + "action": "ClickSelf", + "roi": [ + 1125, + 60, + 150, + 600 + ], + "postDelay": 500 + }, "BattleQuickFormationFilterClose": { "algorithm": "JustReturn", "action": "ClickRect", @@ -6811,6 +6834,15 @@ ], "postDelay": 500 }, + "BattleQuickFormationTrustIcon": { + "templThreshold": 0.9, + "roi": [ + 360, + 280, + 735, + 360 + ] + }, "BattleQuickFormationRole-All": { "baseTask": "BattleQuickFormationRole", "roi": [ diff --git a/resource/template/BattleQuickFormationFilter-Click2.png b/resource/template/BattleQuickFormationFilter-Click2.png new file mode 100644 index 0000000000..17756d6d6d Binary files /dev/null and b/resource/template/BattleQuickFormationFilter-Click2.png differ diff --git a/resource/template/BattleQuickFormationFilter-Trust.png b/resource/template/BattleQuickFormationFilter-Trust.png new file mode 100644 index 0000000000..e30454433f Binary files /dev/null and b/resource/template/BattleQuickFormationFilter-Trust.png differ diff --git a/resource/template/BattleQuickFormationTrustIcon.png b/resource/template/BattleQuickFormationTrustIcon.png new file mode 100644 index 0000000000..04804e1317 Binary files /dev/null and b/resource/template/BattleQuickFormationTrustIcon.png differ diff --git a/src/MaaCore/Task/Interface/CopilotTask.cpp b/src/MaaCore/Task/Interface/CopilotTask.cpp index c2d133cc7c..e1a4ba1215 100644 --- a/src/MaaCore/Task/Interface/CopilotTask.cpp +++ b/src/MaaCore/Task/Interface/CopilotTask.cpp @@ -70,6 +70,7 @@ bool asst::CopilotTask::set_params(const json::value& params) bool with_formation = params.get("formation", false); m_formation_task_ptr->set_enable(with_formation); + m_formation_task_ptr->set_add_trust(params.get("add_trust", false)); std::string support_unit_name = params.get("support_unit_name", std::string()); m_formation_task_ptr->set_support_unit_name(std::move(support_unit_name)); diff --git a/src/MaaCore/Task/Miscellaneous/BattleFormationTask.cpp b/src/MaaCore/Task/Miscellaneous/BattleFormationTask.cpp index 9ef91b048a..b7216c0734 100644 --- a/src/MaaCore/Task/Miscellaneous/BattleFormationTask.cpp +++ b/src/MaaCore/Task/Miscellaneous/BattleFormationTask.cpp @@ -10,6 +10,7 @@ #include "Task/ProcessTask.h" #include "Utils/ImageIo.hpp" #include "Utils/Logger.hpp" +#include "Vision/MultiMatcher.h" #include "Vision/TemplDetOCRer.h" void asst::BattleFormationTask::append_additional_formation(AdditionalFormation formation) @@ -22,6 +23,11 @@ void asst::BattleFormationTask::set_support_unit_name(std::string name) m_support_unit_name = std::move(name); } +void asst::BattleFormationTask::set_add_trust(bool add_trust) +{ + m_add_trust = add_trust; +} + void asst::BattleFormationTask::set_data_resource(DataResource resource) { m_data_resource = resource; @@ -70,7 +76,9 @@ bool asst::BattleFormationTask::_run() } add_additional(); - + if (m_add_trust) { + add_trust_operators(); + } confirm_selection(); // 借一个随机助战 @@ -85,6 +93,7 @@ bool asst::BattleFormationTask::_run() bool asst::BattleFormationTask::add_additional() { + // (但是干员名在除开获取时间的情况下都会被遮挡,so ? LogTraceFunction; if (m_additional.empty()) { @@ -128,6 +137,46 @@ bool asst::BattleFormationTask::add_additional() return true; } +bool asst::BattleFormationTask::add_trust_operators() +{ + LogTraceFunction; + + if (need_exit()) { + return false; + } + + ProcessTask(*this, { "BattleQuickFormationFilter" }).run(); + // 双击信赖 + ProcessTask(*this, { "BattleQuickFormationFilter-Trust" }).run(); + ProcessTask(*this, { "BattleQuickFormationFilterClose" }).run(); + + // 重置职能,保证处于最左 + click_role_table(battle::Role::Caster); + click_role_table(battle::Role::Unknown); + int append_count = 12 - m_operators_in_formation; + int failed_count = 0; + while (!need_exit() && append_count > 0 && failed_count < 3) { + MultiMatcher matcher(ctrler()->get_image()); + matcher.set_task_info("BattleQuickFormationTrustIcon"); + if (!matcher.analyze() || matcher.get_result().size() == 0) { + failed_count++; + } + else { + failed_count = 0; + for (const auto& trust_icon : matcher.get_result()) { + // 匹配完干员左下角信赖表,将roi偏移到整个干员标 + ctrler()->click(trust_icon.rect.move({ 20, -225, 110, 250 })); + if (--append_count <= 0 || need_exit()) { + break; + } + } + } + swipe_page(); + } + + return append_count == 0; +} + bool asst::BattleFormationTask::select_random_support_unit() { return ProcessTask(*this, { "BattleSupportUnitFormation" }).run(); @@ -289,6 +338,7 @@ bool asst::BattleFormationTask::parse_formation() groups = &SSSCopilot.get_data().groups; } + m_operators_in_formation = 0; for (const auto& [name, opers_vec] : *groups) { if (opers_vec.empty()) { continue; @@ -303,6 +353,7 @@ bool asst::BattleFormationTask::parse_formation() // for unknown, will use { "BattleQuickFormationRole-All", "BattleQuickFormationRole-All-OCR" } m_formation[same_role ? role : battle::Role::Unknown].emplace_back(opers_vec); + m_operators_in_formation++; } callback(AsstMsg::SubTaskExtraInfo, info); diff --git a/src/MaaCore/Task/Miscellaneous/BattleFormationTask.h b/src/MaaCore/Task/Miscellaneous/BattleFormationTask.h index 0448cb43f1..1112b40026 100644 --- a/src/MaaCore/Task/Miscellaneous/BattleFormationTask.h +++ b/src/MaaCore/Task/Miscellaneous/BattleFormationTask.h @@ -25,6 +25,7 @@ namespace asst void append_additional_formation(AdditionalFormation formation); void set_support_unit_name(std::string name); + void set_add_trust(bool add_trust); enum class DataResource { @@ -37,8 +38,10 @@ namespace asst using OperGroup = std::vector; virtual bool _run() override; - + // 追加附加干员(按部署费用等小分类) bool add_additional(); + // 补充刷信赖的干员,从最小的开始 + bool add_trust_operators(); bool enter_selection_page(); bool select_opers_in_cur_page(std::vector& groups); @@ -53,6 +56,10 @@ namespace asst std::string m_stage_name; std::unordered_map> m_formation; + // 编队中干员个数 + int m_operators_in_formation = 0; + // 是否需要追加信赖干员 + bool m_add_trust = false; std::string m_support_unit_name; DataResource m_data_resource = DataResource::Copilot; std::vector m_additional; diff --git a/src/MaaWpfGui/Main/AsstProxy.cs b/src/MaaWpfGui/Main/AsstProxy.cs index 1bc09d0ac9..a465231f7a 100644 --- a/src/MaaWpfGui/Main/AsstProxy.cs +++ b/src/MaaWpfGui/Main/AsstProxy.cs @@ -1792,15 +1792,17 @@ namespace MaaWpfGui.Main /// /// 作业 JSON 的文件路径,绝对、相对路径均可。 /// 是否进行 “快捷编队”。 + /// 是否追加信赖干员 /// 任务类型 /// 任务重复执行次数 /// 是否成功。 - public bool AsstStartCopilot(string filename, bool formation, string type, int loop_times) + public bool AsstStartCopilot(string filename, bool formation, bool add_trust, string type, int loop_times) { var task_params = new JObject { ["filename"] = filename, ["formation"] = formation, + ["add_trust"] = add_trust, ["loop_times"] = loop_times, }; AsstTaskId id = AsstAppendTaskWithEncoding(type, task_params); diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml index 28cd5dffc0..5fb22f19a3 100644 --- a/src/MaaWpfGui/Res/Localizations/en-us.xaml +++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml @@ -438,8 +438,9 @@ The video aspect ratio needs to be 16:9 without interference factors such as bla An error occurred, the like failed. : < Thanks for the likes!\nThe comment section is already open on the web page, please feel free to leave your comment! Auto Squad - Loop Times 「Favourite」 marked operators cannot be recognized at this time + Add low-trust operators + Loop Times Start Video Link diff --git a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml index 48cc148b67..0b530d0563 100644 --- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml +++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml @@ -429,8 +429,9 @@ エラーが発生しました、いいねに失敗しました。 : < 感謝と評価!\nウェブページには既にコメント欄が開放されており、あなたのコメントを心待ちにしています! 自動編成 - ループ回数 自動編成では、一時的に「戦術要員」オペレーターを認識できません + 信頼性の低いオペレーターを追加する + ループ回数 開始 映像へのハイパーリンク diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml index 9da0827039..728849fe9d 100644 --- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml +++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml @@ -441,8 +441,9 @@ OF-1을 해금하지 않았다면 선택하지 말아 주세요. 오류로 인해 평가에 실패했습니다 : < 감사합니다!\n웹사이트에 댓글을 남길 수도 있으니 의견을 남겨 주세요! 자동 편성 - 반복 횟수 자동 편성은 '선호' 오퍼레이터를 인식할 수 없습니다 + 신뢰도가 낮은 운영자 추가 + 반복 횟수 시작 영상 링크 diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index efed7f68a5..095f85f5c0 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -442,8 +442,9 @@ 出现错误,评价失败 : < 感谢评价!\n网页已经开放评论区,欢迎前往留下你的评论! 自动编队 - 循环次数 自动编队暂时无法识别「特别关注」的干员 + 补充低信赖干员 + 循环次数 开始 视频链接 diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml index 14d861340d..a0a4238abc 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml @@ -441,8 +441,9 @@ 出現錯誤,評價失敗 : < 感謝評價!\n網頁已經開放評論區,歡迎前往留下你的評論! 自動編隊 - 循環次數 自動編隊暫時無法辨識「特別關注」的幹員 + 補充低信賴幹員 + 循環次數 開始 影片連結 diff --git a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs index eac117dbe7..857797c0f2 100644 --- a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs @@ -462,6 +462,17 @@ namespace MaaWpfGui.ViewModels.UI set => SetAndNotify(ref _form, value); } + private bool _addTrust; + + /// + /// Gets or sets a value indicating whether to use auto-formation. + /// + public bool AddTrust + { + get => _addTrust; + set => SetAndNotify(ref _addTrust, value); + } + public bool Loop { get; set; } private int _loopTimes = int.Parse(ConfigurationHelper.GetValue(ConfigurationKeys.CopilotLoopTimes, "1")); @@ -517,7 +528,7 @@ namespace MaaWpfGui.ViewModels.UI AddLog(errMsg, UiLogColor.Error); } - bool ret = Instances.AsstProxy.AsstStartCopilot(IsDataFromWeb ? TempCopilotFile : Filename, Form, _taskType, + bool ret = Instances.AsstProxy.AsstStartCopilot(IsDataFromWeb ? TempCopilotFile : Filename, Form, AddTrust, _taskType, Loop ? LoopTimes : 1); if (ret) { diff --git a/src/MaaWpfGui/Views/UI/CopilotView.xaml b/src/MaaWpfGui/Views/UI/CopilotView.xaml index 12dc4e0c1f..de98422c54 100644 --- a/src/MaaWpfGui/Views/UI/CopilotView.xaml +++ b/src/MaaWpfGui/Views/UI/CopilotView.xaml @@ -70,15 +70,30 @@ Content="{DynamicResource SelectTheFile}" IsEnabled="{Binding Idle}" ToolTip="{DynamicResource SelectTheFileTip}" /> - + + + + + + + + + +