From a3bae167ad46b5fe3a750c9a8427beb72c565e93 Mon Sep 17 00:00:00 2001 From: veadex <65024689+veadex@users.noreply.github.com> Date: Wed, 25 Sep 2024 18:22:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BE=9D=E8=B5=96=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=97=A5=E5=B8=B8=E5=87=BA=E5=87=BB=E6=B5=81?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autowsgr/__init__.py | 2 +- autowsgr/fight/common.py | 8 ++++++-- autowsgr/fight/normal_fight.py | 5 +++-- autowsgr/game/expedition.py | 1 + autowsgr/game/game_operation.py | 2 +- autowsgr/timer/controllers/android_controller.py | 4 ++-- requirements.txt | 1 - 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/autowsgr/__init__.py b/autowsgr/__init__.py index d5667694..0fd800b4 100644 --- a/autowsgr/__init__.py +++ b/autowsgr/__init__.py @@ -1 +1 @@ -__version__ = "1.0.0.0" +__version__ = "1.0.0.1" diff --git a/autowsgr/fight/common.py b/autowsgr/fight/common.py index ccf08a87..1056fd60 100644 --- a/autowsgr/fight/common.py +++ b/autowsgr/fight/common.py @@ -500,14 +500,18 @@ def _make_decision(self, *args, **kwargs) -> str: # =============== 战斗中通用的操作 =============== def _SL(self): + self.timer.logger.debug("正在执行SL操作") # 重置地图节点信息 - self.timer.port.chapter = None - self.timer.port.map = None + self.reset_chapter_map() self.timer.restart() self.timer.go_main_page() self.timer.set_page("main_page") + def reset_chapter_map(self): + self.timer.port.chapter = None + self.timer.port.map = None + class DecisionBlock: """地图上一个节点的决策模块""" diff --git a/autowsgr/fight/normal_fight.py b/autowsgr/fight/normal_fight.py index 674febb2..609285f1 100644 --- a/autowsgr/fight/normal_fight.py +++ b/autowsgr/fight/normal_fight.py @@ -270,8 +270,9 @@ def _enter_fight(self, *args, **kwargs): self.timer.port.map = self.map # if not hasattr(self, "level_checked"): self.timer.wait_images( - [self.Info.map_image] + [IMG.identify_images["fight_prepare_page"]] - ) != None + [self.Info.map_image] + [IMG.identify_images["fight_prepare_page"]], + timeout=3, + ) self._go_fight_prepare_page() MoveTeam(self.timer, self.fleet_id) if ( diff --git a/autowsgr/game/expedition.py b/autowsgr/game/expedition.py index abc0eca1..d5e3ca96 100644 --- a/autowsgr/game/expedition.py +++ b/autowsgr/game/expedition.py @@ -38,6 +38,7 @@ def run(self, force=False): bool: 是否进行了远征操作 """ self.update(force=force) + self.timer.logger.debug("尚未有已完成的远征任务") if self.is_ready: self.timer.goto_game_page("expedition_page") flag = try_to_get_expedition(self.timer) diff --git a/autowsgr/game/game_operation.py b/autowsgr/game/game_operation.py index 4b596ef6..38db346e 100644 --- a/autowsgr/game/game_operation.py +++ b/autowsgr/game/game_operation.py @@ -243,7 +243,7 @@ def quick_repair( def get_rewards(timer: Timer): """检查任务情况,如果可以领取奖励则领取""" - timer.goto_game_page("main_page") + timer.go_main_page() if not timer.check_pixel((694, 457), bgr_color=(45, 89, 255)): return "no" timer.goto_game_page("mission_page") diff --git a/autowsgr/timer/controllers/android_controller.py b/autowsgr/timer/controllers/android_controller.py index 0d36d7b5..7572b46b 100644 --- a/autowsgr/timer/controllers/android_controller.py +++ b/autowsgr/timer/controllers/android_controller.py @@ -120,7 +120,7 @@ def relative_click(self, x, y, times=1, delay=0.5, enable_subprocess=False): self.shell(f"input tap {str(x)} {str(y)}") time.sleep(delay * self.config.DELAY) - def click(self, x, y, times=1, delay=0.1, enable_subprocess=False, *args, **kwargs): + def click(self, x, y, times=1, delay=0.3, enable_subprocess=False, *args, **kwargs): """点击模拟器相对坐标 (x,y). Args: x,y:相对横坐标 (相对 960x540 屏幕) @@ -423,7 +423,7 @@ def click_images(self, images, must_click=False, timeout=0, delay=0.5): Returns: bool:如果找到图片返回匹配位置,未找到则返回None """ - return self.click_image(images, must_click, timeout) + return self.click_image(images, must_click, timeout, delay) def log_screen( self, diff --git a/requirements.txt b/requirements.txt index 489069cd..2129041b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,6 @@ opencv-python==4.5.4.60 paddleocr==2.8.1 paddlepaddle==2.6.1 pre-commit -python-bidi==0.4.2 thefuzz wheel loguru