From d54d5359e8438190e7ce6eb9ac2a92ad7d0e8b8e Mon Sep 17 00:00:00 2001 From: Llloooggg Date: Sun, 12 Mar 2023 05:53:25 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BB=D0=BE=D0=B3=D0=B3=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B2=20=D0=BF=D1=80=D0=BE=D1=86?= =?UTF-8?q?=D0=B5=D1=81=D1=81=20=D0=B4=D0=BE=D0=B1=D1=8B=D1=87=D0=B8=20?= =?UTF-8?q?=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D1=89=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8E=20=D0=BA=20=D0=BF=D0=BE=D0=BB=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 86a2f01..3b6392b 100644 --- a/main.py +++ b/main.py @@ -208,10 +208,18 @@ def get_cors_by_unique_name(boxes_frame, name): def go_to_minefield(): global screenshot + logging.info("Перемещение к месту добычи: начато") while True: screenshot = get_screenshot() boxes_frame = get_boxes(screenshot) - target = get_targets(boxes_frame, "belt", x_delta=150).sample().iloc[0] + target = get_targets(boxes_frame, "belt", x_delta=150) + if target.empty: + logging.warning( + "Перемещение к месту добычи: потенциальные цели не найдены" + ) + continue + + target = target.sample().iloc[0] click_mouse(target.cent_x, target.cent_y, right=True, runaway=False) @@ -221,21 +229,27 @@ def go_to_minefield(): if get_cors_by_unique_name( boxes_frame, "look" ): # защита при ошибочном состоянии + logging.warning( + "Перемещение к месту добычи: цель добычи уже зафиксирована" + ) return warp_cor = get_cors_by_unique_name(boxes_frame, "warp") if warp_cor: click_mouse(warp_cor[0], warp_cor[1]) + logging.info("Перемещение к месту добычи: перемещене корабля") return def start_mine(): global screenshot + logging.info("Добыча: начата") while True: screenshot = get_screenshot() boxes_frame = get_boxes(screenshot) target = get_targets(boxes_frame, "(veldspar)|(scordite)").iloc[0] if target.empty: + logging.warning("Добыча: потенциальные цели не найдены") continue click_mouse(target.cent_x, target.cent_y, True) @@ -252,10 +266,12 @@ def start_mine(): pg.press("f1") time.sleep(random.uniform(0.1, 1)) pg.press("f2") + logging.info("Добыча: цель добычи найдена") return approach_cor = get_cors_by_unique_name(boxes_frame, "approach") if approach_cor: click_mouse(approach_cor[0], approach_cor[1]) + logging.info("Добыча: цель сближения найдена") time.sleep(random.uniform(20, 25)) # решение через сдвиг # click_mouse(target.cent_x + 40, target.cent_y + 20, runaway=False)