diff --git a/MeoAssistance/include/Assistance.h b/MeoAssistance/include/Assistance.h index a736f0e3d0..43776862fa 100644 --- a/MeoAssistance/include/Assistance.h +++ b/MeoAssistance/include/Assistance.h @@ -28,19 +28,19 @@ namespace asst { std::optional catch_emulator(const std::string& emulator_name = std::string()); // 开始刷理智 - void start_sanity(); - // 开始访问好友基建 - void start_visit(); + bool start_sanity(); + // 开始访问基建 + bool start_visit(); // 开始公开招募操作 - void start_open_recruit(const std::vector& required_level, bool set_time = true); + bool start_open_recruit(const std::vector& required_level, bool set_time = true); // 开始基建换班任务 - void start_infrast(); + bool start_infrast(); // 开始匹配任务,调试用 - void start_match_task(const std::string& task, int retry_times = ProcessTaskRetryTimesDefault, bool block = true); + bool start_match_task(const std::string& task, int retry_times = ProcessTaskRetryTimesDefault, bool block = true); // 开始OCR测试,调试用 - void start_ocr_test_task(std::vector text_vec, bool need_click = false); + bool start_ocr_test_task(std::vector text_vec, bool need_click = false); void stop(bool block = true); diff --git a/MeoAssistance/include/AsstCaller.h b/MeoAssistance/include/AsstCaller.h index cd8dde0fa8..055010ca6d 100644 --- a/MeoAssistance/include/AsstCaller.h +++ b/MeoAssistance/include/AsstCaller.h @@ -14,7 +14,7 @@ extern "C" { MEOAPI_PORT asst::Assistance* AsstCreateEx(AsstCallback callback, void* custom_arg); MEOAPI_PORT void AsstDestory(asst::Assistance* p_asst); MEOAPI_PORT bool AsstCatchEmulator(asst::Assistance* p_asst); - MEOAPI_PORT void AsstStart(asst::Assistance* p_asst, const char* task); + MEOAPI_PORT bool AsstStart(asst::Assistance* p_asst, const char* task); MEOAPI_PORT void AsstStop(asst::Assistance* p_asst); MEOAPI_PORT bool AsstSetParam(asst::Assistance* p_asst, const char* type, const char* param, const char* value); MEOAPI_PORT bool AsstRunOpenRecruit(asst::Assistance* p_asst, const int required_level[], bool set_time); diff --git a/MeoAssistance/include/Version.h b/MeoAssistance/include/Version.h index 869f6ce41f..da751c3b89 100644 --- a/MeoAssistance/include/Version.h +++ b/MeoAssistance/include/Version.h @@ -1,5 +1,5 @@ #pragma once namespace asst { - constexpr static const char* Version = "release.beta.06.01"; + constexpr static const char* Version = "release.beta.06.03"; } \ No newline at end of file diff --git a/MeoAssistance/src/Assistance.cpp b/MeoAssistance/src/Assistance.cpp index 06bc0170fb..73dc8a02e2 100644 --- a/MeoAssistance/src/Assistance.cpp +++ b/MeoAssistance/src/Assistance.cpp @@ -143,23 +143,23 @@ std::optional Assistance::catch_emulator(const std::string& emulato } } -void asst::Assistance::start_sanity() +bool asst::Assistance::start_sanity() { - start_match_task("SanityBegin", ProcessTaskRetryTimesDefault); + return start_match_task("SanityBegin", ProcessTaskRetryTimesDefault); } -void asst::Assistance::start_visit() +bool asst::Assistance::start_visit() { - start_match_task("VisitBegin", ProcessTaskRetryTimesDefault); + return start_match_task("VisitBegin", ProcessTaskRetryTimesDefault); } -void Assistance::start_match_task(const std::string& task, int retry_times, bool block) +bool Assistance::start_match_task(const std::string& task, int retry_times, bool block) { DebugTraceFunction; DebugTrace("Start |", task, block ? "block" : "non block"); if (!m_thread_idle || !m_inited) { - return; + return false; } std::unique_lock lock; @@ -174,14 +174,16 @@ void Assistance::start_match_task(const std::string& task, int retry_times, bool m_thread_idle = false; m_condvar.notify_one(); + + return true; } -void Assistance::start_ocr_test_task(std::vector text_vec, bool need_click) +bool Assistance::start_ocr_test_task(std::vector text_vec, bool need_click) { DebugTraceFunction; if (!m_thread_idle || !m_inited) { - return; + return false; } std::unique_lock lock(m_mutex); @@ -192,14 +194,16 @@ void Assistance::start_ocr_test_task(std::vector text_vec, bool nee m_thread_idle = false; m_condvar.notify_one(); + + return true; } -void Assistance::start_open_recruit(const std::vector& required_level, bool set_time) +bool Assistance::start_open_recruit(const std::vector& required_level, bool set_time) { DebugTraceFunction; if (!m_thread_idle || !m_inited) { - return; + return false; } std::unique_lock lock(m_mutex); @@ -212,14 +216,16 @@ void Assistance::start_open_recruit(const std::vector& required_level, bool m_thread_idle = false; m_condvar.notify_one(); + + return true; } -void asst::Assistance::start_infrast() +bool asst::Assistance::start_infrast() { DebugTraceFunction; if (!m_thread_idle || !m_inited) { - return; + return false; } std::unique_lock lock(m_mutex); @@ -233,6 +239,8 @@ void asst::Assistance::start_infrast() m_thread_idle = false; m_condvar.notify_one(); + + return true; } void Assistance::stop(bool block) diff --git a/MeoAssistance/src/AsstCaller.cpp b/MeoAssistance/src/AsstCaller.cpp index e65172c73e..ec8182583d 100644 --- a/MeoAssistance/src/AsstCaller.cpp +++ b/MeoAssistance/src/AsstCaller.cpp @@ -73,12 +73,13 @@ bool AsstCatchEmulator(asst::Assistance* p_asst) } } -void AsstStart(asst::Assistance* p_asst, const char* task) +bool AsstStart(asst::Assistance* p_asst, const char* task) { if (p_asst == NULL) { + return false; } - p_asst->start_match_task(task, asst::Assistance::ProcessTaskRetryTimesDefault); + return p_asst->start_match_task(task, asst::Assistance::ProcessTaskRetryTimesDefault); } void AsstStop(asst::Assistance* p_asst) diff --git a/MeoAsstGui/MainWindow.xaml.cs b/MeoAsstGui/MainWindow.xaml.cs index 9f7986ab2d..ebc728b07a 100644 --- a/MeoAsstGui/MainWindow.xaml.cs +++ b/MeoAsstGui/MainWindow.xaml.cs @@ -21,7 +21,7 @@ namespace MeoAsstGui [DllImport("MeoAssistance.dll")] static private extern bool AsstCatchEmulator(IntPtr ptr); - [DllImport("MeoAssistance.dll")] static private extern void AsstStart(IntPtr ptr, string task); + [DllImport("MeoAssistance.dll")] static private extern bool AsstStart(IntPtr ptr, string task); [DllImport("MeoAssistance.dll")] static private extern void AsstStop(IntPtr ptr); @@ -113,7 +113,7 @@ namespace MeoAsstGui case AsstMsg.TaskStop: { string task_chain = detail["task_chain"].ToString(); - if (task_chain != "SanityBegin") + if (task_chain != "SanityBegin" && task_chain != "VisitBegin") { break; } @@ -154,7 +154,7 @@ namespace MeoAsstGui break; } ++retry_times; - button_Click_startSanity(null, null); + AsstStart(p_asst, "SanityBegin"); } else if (task_chain == "VisitBegin") { @@ -166,7 +166,7 @@ namespace MeoAsstGui break; } ++retry_times; - button_Click_visit(null, null); + AsstStart(p_asst, "VisitBegin"); } } break; @@ -206,8 +206,12 @@ namespace MeoAsstGui private void button_Click_startSanity(object sender, RoutedEventArgs e) { bool catched = AsstCatchEmulator(p_asst); + exec_times.Content = ""; catch_status.Content = "鎹曡幏妯℃嫙鍣ㄧ獥鍙o細" + catched; - AsstStart(p_asst, "SanityBegin"); + if (AsstStart(p_asst, "SanityBegin")) + { + exec_times.Content = ""; + } if (checkBox_useStone.IsChecked == true) { stone_times.Content = "宸茬鐭 0 涓"; @@ -263,7 +267,10 @@ namespace MeoAsstGui { bool catched = AsstCatchEmulator(p_asst); catch_status.Content = "鎹曡幏妯℃嫙鍣ㄧ獥鍙o細" + catched; - AsstStart(p_asst, "VisitBegin"); + if (AsstStart(p_asst, "VisitBegin")) + { + exec_times.Content = ""; + } } private void checkBox_maxTimes_Checked(object sender, RoutedEventArgs e) diff --git a/MeoAsstGui/MeoAsstGui.csproj b/MeoAsstGui/MeoAsstGui.csproj index 45c6b3189c..cdbc0666b5 100644 --- a/MeoAsstGui/MeoAsstGui.csproj +++ b/MeoAsstGui/MeoAsstGui.csproj @@ -29,7 +29,7 @@ false true 0 - 0.6.1.0 + 0.6.3.0 false true diff --git a/resource/config.json b/resource/config.json index 97aa6d04cb..c1fde97e61 100644 --- a/resource/config.json +++ b/resource/config.json @@ -146,6 +146,7 @@ "template": "StartButton2.png", "type": "clickSelf", "rearDelay": 20000, + "templThreshold": 0.95, "next": [ "StartButton2", "PRTS" @@ -163,10 +164,11 @@ ] }, "WaitAfterPRTS": { - "rearDelay": 5000, + "rearDelay": 3000, "algorithm": "justreturn", "type": "doNothing", "next": [ + "PRTS", "EndOfAction", "ClickCornerAfterPRTS" ] @@ -187,7 +189,8 @@ "StartButton1", "StartButton2", "UseMedicine", - "UseStone" + "UseStone", + "ClickCornerAfterPRTS" ] }, "EndOfAction": { @@ -213,12 +216,13 @@ "StartButton1", "StartButton2", "UseMedicine", - "UseStone" + "UseStone", + "EndOfAction" ] }, "Loading": { "template": "Loading.png", - "threshold": 0.8, + "templThreshold": 0.8, "type": "doNothing", "next": [ "StartButton1"