diff --git a/resource/tasks.json b/resource/tasks.json index 4c3258e427..495f64e7d7 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -2585,30 +2585,26 @@ 100 ] }, - "InfrastClueNew": { + "InfrastClueSelfNew": { "template": "ClueNew.png", "action": "clickSelf", "roi": [ - 1000, - 0, - 280, - 720 + 1150, + 100, + 130, + 80 ], - "maxTimes": 2, - "cache": false, "rectMove": [ -45, 15, 60, 60 ], - "templThreshold": 0.8, "next": [ - "GetClue1", - "GetClue2" + "GetSelfClue" ] }, - "GetClue1": { + "GetSelfClue": { "template": "GetClue1.png", "action": "clickSelf", "roi": [ @@ -2618,12 +2614,31 @@ 80 ], "next": [ - "InfrastClueNew", - "CloseCluePage" - ], - "rearDelay": 2000 + "InfrastClueFriendNew", + "CloseCluePage", + "ReceptionFlag" + ] }, - "GetClue2": { + "InfrastClueFriendNew": { + "template": "ClueNew.png", + "action": "clickSelf", + "roi": [ + 1150, + 220, + 130, + 80 + ], + "rectMove": [ + -45, + 15, + 60, + 60 + ], + "next": [ + "GetFriendClue" + ] + }, + "GetFriendClue": { "template": "GetClue2.png", "action": "clickSelf", "roi": [ @@ -2633,9 +2648,8 @@ 120 ], "next": [ - "InfrastClueNew" - ], - "rearDelay": 2000 + "ReceptionFlag" + ] }, "CloseCluePage": { "template": "CloseCluePage.png", @@ -2647,20 +2661,49 @@ 120 ], "next": [ - "InfrastClueNew" + "CloseCluePage", + "SendClueFlag", + "InfrastClueFriendNew", + "ReceptionFlag" + ] + }, + "SendClueFlag": { + "action": "doNothing", + "doc": "这里识别的是自己的线索的new:如果获取完自己的线索、再获取完好友送的线索,自己的线索new还亮着,则说明自己的线索没获取成功,即线索满了", + "next": [ + "SendClues" ], - "rearDelay": 1000 + "roi": [ + 1150, + 100, + 130, + 80 + ], + "template": "ClueNew.png" }, "UnlockClues": { "template": "UnlockClues.png", "action": "clickSelf", + "templThreshold": 0.95, "roi": [ - 480, + 200, 600, - 460, + 700, 120 ], - "rearDelay": 5000 + "rearDelay": 5000, + "next": [ + "InfrastBottomLeftTab" + ] + }, + "ReceptionFlag": { + "action": "doNothing", + "roi": [ + 350, + 0, + 200, + 100 + ] }, "EndOfClueExchange": { "cache": false, @@ -2683,7 +2726,9 @@ 180, 80 ], - "rearDelay": 3000 + "next": [ + "ReceptionFlag" + ] }, "SendClues": { "action": "clickSelf", @@ -2731,6 +2776,7 @@ "ClueGiveTo1st": { "template": "ClusCanBeSent.png", "action": "doNothing", + "cache": false, "maskRange": [ 1, 255 @@ -2762,6 +2808,7 @@ "ClueGiveTo2nd": { "template": "ClusCanBeSent.png", "action": "doNothing", + "cache": false, "maskRange": [ 1, 255 @@ -2793,6 +2840,7 @@ "ClueGiveTo3rd": { "template": "ClusCanBeSent.png", "action": "doNothing", + "cache": false, "maskRange": [ 1, 255 @@ -2824,6 +2872,7 @@ "ClueGiveTo4th": { "template": "ClusCanBeSent.png", "action": "doNothing", + "cache": false, "maskRange": [ 1, 255 @@ -2859,10 +2908,14 @@ 16, 41, 41 + ], + "next": [ + "InfrastClueSelfNew" ] }, "ClueGiveToNextPage": { "action": "clickSelf", + "templThreshold": 0.95, "roi": [ 1184, 655, diff --git a/resource/template/ReceptionFlag.png b/resource/template/ReceptionFlag.png new file mode 100644 index 0000000000..1d3420193a Binary files /dev/null and b/resource/template/ReceptionFlag.png differ diff --git a/src/MeoAssistant/InfrastReceptionTask.cpp b/src/MeoAssistant/InfrastReceptionTask.cpp index 844bf4d59a..a6f92bd5a7 100644 --- a/src/MeoAssistant/InfrastReceptionTask.cpp +++ b/src/MeoAssistant/InfrastReceptionTask.cpp @@ -25,12 +25,13 @@ bool asst::InfrastReceptionTask::_run() enter_facility(FacilityName, 0); click_bottomleft_tab(); - close_end_prompt(); - harvest_clue(); + close_end_of_clue_exchange(); + + get_clue(); if (need_exit()) { return false; } - proc_clue(); + use_clue(); if (need_exit()) { return false; } @@ -44,25 +45,19 @@ bool asst::InfrastReceptionTask::_run() return true; } -bool asst::InfrastReceptionTask::close_end_prompt() +bool asst::InfrastReceptionTask::close_end_of_clue_exchange() { - LogTraceFunction; - - ProcessTask task_temp(*this, { "EndOfClueExchange" }); - task_temp.set_retry_times(5); + ProcessTask task_temp(*this, { "ReceptionFlag", "EndOfClueExchange" }); return task_temp.run(); } -bool asst::InfrastReceptionTask::harvest_clue() +bool asst::InfrastReceptionTask::get_clue() { - LogTraceFunction; - - ProcessTask task_temp(*this, { "InfrastClueNew" }); - task_temp.set_retry_times(5); + ProcessTask task_temp(*this, { "InfrastClueSelfNew", "InfrastClueFriendNew", "ReceptionFlag" }); return task_temp.run(); } -bool asst::InfrastReceptionTask::proc_clue() +bool asst::InfrastReceptionTask::use_clue() { LogTraceFunction; const static std::string clue_vacancy = "InfrastClueVacancy"; @@ -70,22 +65,13 @@ bool asst::InfrastReceptionTask::proc_clue() "No1", "No2", "No3", "No4", "No5", "No6", "No7" }; - proc_vacancy(); - - // 开启线索交流,“解锁线索” - cv::Mat image = Ctrler.get_image(); - MatchImageAnalyzer unlock_analyzer(image); - const auto unlock_task_ptr = std::dynamic_pointer_cast( - Task.get("UnlockClues")); - unlock_analyzer.set_task_info(*unlock_task_ptr); - if (unlock_analyzer.analyze()) { - Ctrler.click(unlock_analyzer.get_result().rect); - sleep(unlock_task_ptr->rear_delay); - click_bottomleft_tab(); - proc_vacancy(); - image = Ctrler.get_image(); + proc_clue_vacancy(); + if (unlock_clue_exchange()) { + proc_clue_vacancy(); } + cv::Mat image = Ctrler.get_image(); + // 所有的空位分析一次,看看还缺哪些线索 InfrastClueVacancyImageAnalyzer vacancy_analyzer(image); vacancy_analyzer.set_to_be_analyzed(clue_suffix); @@ -109,7 +95,7 @@ bool asst::InfrastReceptionTask::proc_clue() return true; } -bool asst::InfrastReceptionTask::proc_vacancy() +bool asst::InfrastReceptionTask::proc_clue_vacancy() { LogTraceFunction; const static std::string clue_vacancy = "InfrastClueVacancy"; @@ -147,6 +133,13 @@ bool asst::InfrastReceptionTask::proc_vacancy() return true; } +bool asst::InfrastReceptionTask::unlock_clue_exchange() +{ + ProcessTask task(*this, { "UnlockClues" }); + task.set_retry_times(2); + return task.run(); +} + bool asst::InfrastReceptionTask::send_clue() { ProcessTask task(*this, { "SendClues" }); @@ -203,19 +196,3 @@ bool asst::InfrastReceptionTask::shift() click_confirm_button(); return true; } - -bool asst::InfrastReceptionTask::swipe_to_the_bottom_of_clue_list_on_the_right() -{ - LogTraceFunction; - static Rect begin_rect = Task.get("InfrastClueOnTheRightSwipeBegin")->specific_rect; - static Rect end_rect = Task.get("InfrastClueOnTheRightSwipeEnd")->specific_rect; - static int duration = Task.get("InfrastClueOnTheRightSwipeBegin")->pre_delay; - static int extra_delay = Task.get("InfrastClueOnTheRightSwipeBegin")->rear_delay; - static int loop_times = Task.get("InfrastClueOnTheRightSwipeBegin")->max_times; - - for (int i = 0; i != loop_times; ++i) { - Ctrler.swipe(begin_rect, end_rect, duration, true, 0, false); - } - sleep(extra_delay); - return false; -} diff --git a/src/MeoAssistant/InfrastReceptionTask.h b/src/MeoAssistant/InfrastReceptionTask.h index c129cf1bc8..5392128b85 100644 --- a/src/MeoAssistant/InfrastReceptionTask.h +++ b/src/MeoAssistant/InfrastReceptionTask.h @@ -15,12 +15,12 @@ namespace asst virtual bool _run() override; private: - bool close_end_prompt(); - bool harvest_clue(); - bool proc_clue(); - bool proc_vacancy(); + bool close_end_of_clue_exchange(); + bool get_clue(); + bool use_clue(); + bool proc_clue_vacancy(); + bool unlock_clue_exchange(); bool send_clue(); bool shift(); - bool swipe_to_the_bottom_of_clue_list_on_the_right(); }; }