diff --git a/MeoAssistance/include/Assistance.h b/MeoAssistance/include/Assistance.h index b2a7b73636..3b3cdaab49 100644 --- a/MeoAssistance/include/Assistance.h +++ b/MeoAssistance/include/Assistance.h @@ -43,7 +43,7 @@ namespace asst { bool set_param(const std::string& type, const std::string& param, const std::string& value); - static constexpr int MatchTaskRetryTimesDefault = 60; + static constexpr int MatchTaskRetryTimesDefault = 20; static constexpr int OpenRecruitTaskRetyrTimesDefault = 5; private: diff --git a/MeoAssistance/src/Assistance.cpp b/MeoAssistance/src/Assistance.cpp index 66d303901f..78308f22de 100644 --- a/MeoAssistance/src/Assistance.cpp +++ b/MeoAssistance/src/Assistance.cpp @@ -159,7 +159,7 @@ void Assistance::start_match_task(const std::string& task, int retry_times, bool if (block) { lock = std::unique_lock(m_mutex); - clear_exec_times(); + //clear_exec_times(); m_identify_ptr->clear_cache(); } @@ -218,10 +218,10 @@ void Assistance::stop(bool block) if (block) { // ⲿ lock = std::unique_lock(m_mutex); - clear_exec_times(); } decltype(m_tasks_queue) empty; m_tasks_queue.swap(empty); + clear_exec_times(); m_identify_ptr->clear_cache(); } diff --git a/MeoAsstGui/MainWindow.xaml.cs b/MeoAsstGui/MainWindow.xaml.cs index ea17735adf..4f5a34569f 100644 --- a/MeoAsstGui/MainWindow.xaml.cs +++ b/MeoAsstGui/MainWindow.xaml.cs @@ -42,6 +42,9 @@ namespace MeoAsstGui private IntPtr p_asst; private RecruitWindow recruitWindow; + private int retry_times = 0; + private int retry_limits = 2; + public enum AsstMsg { /* Error Msg */ @@ -85,6 +88,7 @@ namespace MeoAsstGui { case AsstMsg.TaskCompleted: { + retry_times = 0; string task_name = detail["name"].ToString(); if (task_name == "StartButton2") { @@ -136,9 +140,29 @@ namespace MeoAsstGui case AsstMsg.TaskError: { string task_chain = detail["task_chain"].ToString(); - if (task_chain == "SanityBegin" || task_chain == "VisitBegin") + if (task_chain == "SanityBegin") { - label_status.Content = "出现错误,已停止运行"; + // 出错了会重试两次,再不行就算了 + if (retry_times >= retry_limits) + { + retry_times = 0; + label_status.Content = "出现错误,已停止运行"; + break; + } + ++retry_times; + button_Click_startSanity(null, null); + } + else if (task_chain == "VisitBegin") + { + // 出错了会重试两次,再不行就算了 + if (retry_times >= retry_limits) + { + retry_times = 0; + label_status.Content = "出现错误,已停止运行"; + break; + } + ++retry_times; + button_Click_visit(null, null); } } break; diff --git a/resource/config.json b/resource/config.json index e1af3e3686..3ab0bcb44a 100644 --- a/resource/config.json +++ b/resource/config.json @@ -242,7 +242,8 @@ "StartButton2", "PRTS", "UseMedicine", - "UseStone" + "UseStone", + "ClickCorner" ] }, "UsePrts": { @@ -287,12 +288,34 @@ "templThreshold": 0, "type": "printWindow", "next": [ - "Random" + "ClickCorner" ] }, - "Random": { + "ClickCorner": { + "ClickCorner_Doc": "点击右下角,既不会点到掉落物品,又能点到蓝色开始按钮的一块位置。1、2是一样的,3的next没有ClickCorner了,之所以分三个就是为了最多点三次,而不是循环跑起来,一直命中ClickCorner", "template": "", "templThreshold": 0, + "preDelay": 2000, + "type": "clickRect", + "specificArea": [ + 1100, + 700, + 150, + 30 + ], + "next": [ + "Loading", + "StartButton1", + "StartButton2", + "UseMedicine", + "UseStone", + "ClickCorner2" + ] + }, + "ClickCorner2": { + "template": "", + "preDelay": 2000, + "templThreshold": 0, "type": "clickRect", "specificArea": [ 1100, @@ -306,7 +329,26 @@ "StartButton2", "UseMedicine", "UseStone", - "Random" + "ClickCorner3" + ] + }, + "ClickCorner3": { + "template": "", + "preDelay": 2000, + "templThreshold": 0, + "type": "clickRect", + "specificArea": [ + 1100, + 700, + 150, + 30 + ], + "next": [ + "Loading", + "StartButton1", + "StartButton2", + "UseMedicine", + "UseStone" ] }, "Loading": { @@ -368,7 +410,7 @@ "Loading" ], "next": [ - "Random" + "ClickCorner" ] }, "VisitBegin": {