diff --git a/config.py b/config.py index 3da9171..c1758af 100644 --- a/config.py +++ b/config.py @@ -107,9 +107,9 @@ config = { 'require_bg': True }, 'window_size': { - 'width': 800, + 'width': 820, 'height': 600, - 'min_width': 800, + 'min_width': 820, 'min_height': 600, }, 'supported_resolution': { @@ -130,15 +130,16 @@ config = { 'default': { 'github': 'https://github.com/ok-oldking/ok-wuthering-waves', 'discord': 'https://discord.gg/vVyCatEBgA', + 'sponsor': 'https://patreon.com/ok_oldking?utm_medium=unknown&utm_source=join_link&utm_campaign=creatorshare_creator&utm_content=copyLink', 'share': 'Download OK-WW from https://github.com/ok-oldking/ok-wuthering-waves/releases/latest', - 'faq': 'https://github.com/ok-oldking/ok-wuthering-waves/blob/master/README_en.md' + 'faq': 'https://github.com/ok-oldking/ok-wuthering-waves/blob/master/README.md' }, 'zh_CN': { 'github': 'https://github.com/ok-oldking/ok-wuthering-waves', 'discord': 'https://discord.gg/vVyCatEBgA', + 'sponsor': 'https://afdian.com/a/ok-oldking', 'share': 'OK-WW 夸克网盘下载:https://pan.quark.cn/s/75b55ef72a34 GitHub下载: https://github.com/ok-oldking/ok-wuthering-waves/releases/latest', - 'qq_group': 'https://qm.qq.com/q/ufUCrCEq6A', - 'faq': 'https://g-frfh1513.coding.net/public/ok-wuthering-waves/ok-wuthering-waves/git/files', + 'faq': 'https://cnb.cool/ok-oldking/ok-wuthering-waves/-/blob/master/README_cn.md', }, }, 'about': """ diff --git a/src/combat/CombatCheck.py b/src/combat/CombatCheck.py index b6b8699..a4475b5 100644 --- a/src/combat/CombatCheck.py +++ b/src/combat/CombatCheck.py @@ -28,6 +28,7 @@ class CombatCheck(BaseWWTask): self.last_in_realm_not_combat = 0 self._last_liberation = 0 self.target_enemy_time_out = 3 + self.combat_end_condition = None @property def in_liberation(self): @@ -119,6 +120,8 @@ class CombatCheck(BaseWWTask): if self.has_target(): self.last_in_realm_not_combat = 0 return True + if self.combat_end_condition is not None and self.combat_end_condition(): + return self.reset_to_false(recheck=True, reason='end condition reached') if self.target_enemy(wait=True): logger.debug(f'retarget enemy succeeded') return True diff --git a/src/task/BaseCombatTask.py b/src/task/BaseCombatTask.py index 5797f8c..8b60de5 100644 --- a/src/task/BaseCombatTask.py +++ b/src/task/BaseCombatTask.py @@ -114,9 +114,6 @@ class BaseCombatTask(CombatCheck): break self.combat_end() self.wait_in_team_and_world(time_out=10) - self.sleep(1) - self.middle_click() - self.sleep(1) def run_in_circle_to_find_echo(self, circle_count=3): directions = ['w', 'a', 's', 'd'] diff --git a/src/task/BaseWWTask.py b/src/task/BaseWWTask.py index 75ff027..9509fe1 100644 --- a/src/task/BaseWWTask.py +++ b/src/task/BaseWWTask.py @@ -155,24 +155,24 @@ class BaseWWTask(BaseTask): if not echos: if no_echo_start == 0: no_echo_start = time.time() - elif time.time() - no_echo_start > 1.5: + elif time.time() - no_echo_start > 3: self.log_debug(f'walk front to_echo, no echos found, break') break - continue + next_direction = 'w' else: no_echo_start = 0 - echo = echos[0] - center_distance = echo.center()[0] - self.width_of_screen(0.5) - threshold = 0.05 if not last_direction else 0.15 - if abs(center_distance) < self.height_of_screen(threshold): - if echo.y + echo.height > self.height_of_screen(0.65): - next_direction = 's' + echo = echos[0] + center_distance = echo.center()[0] - self.width_of_screen(0.5) + threshold = 0.05 if not last_direction else 0.15 + if abs(center_distance) < self.height_of_screen(threshold): + if echo.y + echo.height > self.height_of_screen(0.65): + next_direction = 's' + else: + next_direction = 'w' + elif center_distance > 0: + next_direction = 'd' else: - next_direction = 'w' - elif center_distance > 0: - next_direction = 'd' - else: - next_direction = 'a' + next_direction = 'a' last_direction = self._walk_direction(last_direction, next_direction) self._stop_last_direction(last_direction) @@ -438,7 +438,7 @@ class BaseWWTask(BaseTask): result = self.executor.ocr_lib(image, use_det=True, use_cls=False, use_rec=True) self.logger.info(f'ocr_result {result}') - def find_echos(self, threshold=0.6): + def find_echos(self, threshold=0.46): """ Main function to load ONNX model, perform inference, draw bounding boxes, and display the output image. diff --git a/src/task/FarmEchoTask.py b/src/task/FarmEchoTask.py index 3a1e458..3ec08d2 100644 --- a/src/task/FarmEchoTask.py +++ b/src/task/FarmEchoTask.py @@ -26,6 +26,7 @@ class FarmEchoTask(WWOneTimeTask, BaseCombatTask): self.config_type["Boss"] = {'type': "drop_down", 'options': ['Hecate', 'Dreamless', 'Jue', 'Fleurdelys']} self.icon = FluentIcon.ALBUM + self.combat_end_condition = self.find_echos self.add_exit_after_config() def run(self): @@ -56,13 +57,13 @@ class FarmEchoTask(WWOneTimeTask, BaseCombatTask): self.combat_once() logger.info(f'farm echo move {self.config.get("Boss")} yolo_find_echo') - dropped = self.yolo_find_echo()[0] + dropped = self.yolo_find_echo(turn=False)[0] self.incr_drop(dropped) self.sleep(0.5) self.send_key('esc', after_sleep=0.5) self.wait_click_feature('confirm_btn_hcenter_vcenter', relative_x=-1, raise_if_not_found=True, post_action=lambda: self.send_key('esc', after_sleep=1), - settle_time=2) + settle_time=1) self.wait_in_team_and_world(time_out=120) self.sleep(2) diff --git a/src/task/FarmWorldBossTask.py b/src/task/FarmWorldBossTask.py index 43ecbe8..2599e08 100644 --- a/src/task/FarmWorldBossTask.py +++ b/src/task/FarmWorldBossTask.py @@ -44,6 +44,7 @@ class FarmWorldBossTask(WWOneTimeTask, BaseCombatTask): self.config_type["Entrance Direction"] = {'type': "drop_down", 'options': ['Forward', 'Backward']} self.crownless_pos = (0.9, 0.4) self.icon = FluentIcon.GLOBE + self.combat_end_condition = self.find_echos self.add_exit_after_config() # not current in use because not stable, right now using one click to scroll down @@ -90,7 +91,7 @@ class FarmWorldBossTask(WWOneTimeTask, BaseCombatTask): self.sleep(5) logger.info(f'farm echo move forward walk_until_f to find echo') - dropped = self.yolo_find_echo()[0] + dropped = self.yolo_find_echo(turn=False)[0] self.incr_drop(dropped) if count < 2: diff --git a/tests/TestEcho.py b/tests/TestEcho.py index d54588f..476073b 100644 --- a/tests/TestEcho.py +++ b/tests/TestEcho.py @@ -14,12 +14,14 @@ class TestEcho(TaskTestCase): def test_find_echo(self): self.set_image('tests/images/echo.png') - echos = self.task.find_echo() + echos = self.task.find_echos() + self.task.log_info('Found1 {} echos'.format(len(echos))) self.assertEqual(1, len(echos)) time.sleep(1) self.task.screenshot('echo1', show_box=True) self.set_image('tests/images/echo2.png') - echos = self.task.find_echo() + echos = self.task.find_echos() + self.task.log_info('Found2 {} echos'.format(len(echos))) time.sleep(1) self.task.screenshot('echo2', show_box=True) self.assertEqual(1, len(echos)) diff --git a/tests/images/echo.png b/tests/images/echo.png index 7998b37..698ff96 100644 Binary files a/tests/images/echo.png and b/tests/images/echo.png differ diff --git a/tests/images/echo2.png b/tests/images/echo2.png index 349bd3a..07c53f3 100644 Binary files a/tests/images/echo2.png and b/tests/images/echo2.png differ