From c4262de86cbdb5d50e021caf6146c2a796dab0c2 Mon Sep 17 00:00:00 2001 From: MistEO Date: Fri, 24 Sep 2021 21:41:05 +0800 Subject: [PATCH] =?UTF-8?q?fix.=E5=AE=8C=E5=96=84=E6=94=B6=E5=8F=96?= =?UTF-8?q?=E4=BF=A1=E7=94=A8=E5=90=8E=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/tasks.json | 40 +++++++++++++++++++----- src/MeoAssistance/CreditShoppingTask.cpp | 7 ++++- src/MeoAssistance/ProcessTask.cpp | 6 ++++ 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/resource/tasks.json b/resource/tasks.json index 3841c91447..139ec3d0a1 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -93,7 +93,9 @@ }, "EndOfAction": { "algorithm": "OcrDetect", - "text": [ "行动结束" ], + "text": [ + "行动结束" + ], "preDelay": 3000, "action": "printWindow", "next": [ @@ -254,7 +256,9 @@ }, "VisitNextOcr": { "algorithm": "OcrDetect", - "text": [ "访问下位" ], + "text": [ + "访问下位" + ], "action": "clickSelf", "rearDelay": 3000, "identifyArea": [ @@ -311,7 +315,9 @@ }, "CreditStoreOcr": { "algorithm": "OcrDetect", - "text": [ "信用交易所" ], + "text": [ + "信用交易所" + ], "rearDelay": 1000, "action": "clickSelf", "next": [ @@ -322,13 +328,23 @@ "CollectCredit": { "template": "CollectCredit.png", "action": "clickSelf", + "next": [ + "ColseCollectCredit" + ] + }, + "ColseCollectCredit": { + "algorithm": "justReturn", + "action": "clickRand", "next": [ "Stop" ] }, "VisitLimited": { "algorithm": "OcrDetect", - "text": [ "今日参与", "已达上限" ], + "text": [ + "今日参与", + "已达上限" + ], "action": "doNothing", "identifyArea": [ 900, @@ -362,7 +378,12 @@ "template": "RecruitTimeReduce.png", "templThreshold": 0.89, "action": "clickRect", - "specificArea": [ 391, 279, 129, 44 ], + "specificArea": [ + 391, + 279, + 129, + 44 + ], "next": [ "Stop" ] @@ -530,7 +551,11 @@ }, "InfrastReward": { "algorithm": "OcrDetect", - "text": [ "可收获", "订单交付", "信赖" ], + "text": [ + "可收获", + "订单交付", + "信赖" + ], "rearDelay": 1000, "action": "clickSelf", "identifyArea": [ @@ -609,7 +634,6 @@ "template": "UavAssist-Trade.png", "action": "stop", "cache": false, - "next": [ - ] + "next": [] } } \ No newline at end of file diff --git a/src/MeoAssistance/CreditShoppingTask.cpp b/src/MeoAssistance/CreditShoppingTask.cpp index 5c39937de2..9cca31c063 100644 --- a/src/MeoAssistance/CreditShoppingTask.cpp +++ b/src/MeoAssistance/CreditShoppingTask.cpp @@ -77,6 +77,9 @@ bool asst::CreditShoppingTask::run() } for (const Rect& commodity_rect : need_to_buy) { + if (need_exit()) { + return false; + } m_controller_ptr->click(commodity_rect); sleep(1000); image = m_controller_ptr->get_image(); @@ -91,7 +94,9 @@ bool asst::CreditShoppingTask::run() } buy_it_rect = buy_it_res.rect; } - + if (need_exit()) { + return false; + } m_controller_ptr->click(buy_it_rect); sleep(1000); // 识别是否信用不足无法购买 diff --git a/src/MeoAssistance/ProcessTask.cpp b/src/MeoAssistance/ProcessTask.cpp index 5f1d910382..fb4b23292f 100644 --- a/src/MeoAssistance/ProcessTask.cpp +++ b/src/MeoAssistance/ProcessTask.cpp @@ -73,6 +73,12 @@ bool ProcessTask::run() case ProcessTaskAction::ClickSelf: exec_click_task(rect); break; + case ProcessTaskAction::ClickRand: + { + static const Rect full_rect(0, 0, Configer::WindowWidthDefault - 1, Configer::WindowHeightDefault - 1); + exec_click_task(full_rect); + + } break; case ProcessTaskAction::SwipeToTheLeft: case ProcessTaskAction::SwipeToTheRight: exec_swipe_task(task_info_ptr->action);