0
0
mirror of https://github.com/ok-oldking/ok-wuthering-waves.git synced 2025-04-24 08:25:16 +00:00

减少声骸拾取战斗结束等待

增加声骸识别概率
拾取声骸不再转向
This commit is contained in:
firedcto@gmail.com 2025-04-17 08:59:33 +08:00
parent 2e4e5dc86d
commit fe780c6ab4
9 changed files with 32 additions and 27 deletions

View File

@ -107,9 +107,9 @@ config = {
'require_bg': True 'require_bg': True
}, },
'window_size': { 'window_size': {
'width': 800, 'width': 820,
'height': 600, 'height': 600,
'min_width': 800, 'min_width': 820,
'min_height': 600, 'min_height': 600,
}, },
'supported_resolution': { 'supported_resolution': {
@ -130,15 +130,16 @@ config = {
'default': { 'default': {
'github': 'https://github.com/ok-oldking/ok-wuthering-waves', 'github': 'https://github.com/ok-oldking/ok-wuthering-waves',
'discord': 'https://discord.gg/vVyCatEBgA', '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', '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': { 'zh_CN': {
'github': 'https://github.com/ok-oldking/ok-wuthering-waves', 'github': 'https://github.com/ok-oldking/ok-wuthering-waves',
'discord': 'https://discord.gg/vVyCatEBgA', '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', '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://cnb.cool/ok-oldking/ok-wuthering-waves/-/blob/master/README_cn.md',
'faq': 'https://g-frfh1513.coding.net/public/ok-wuthering-waves/ok-wuthering-waves/git/files',
}, },
}, },
'about': """ 'about': """

View File

@ -28,6 +28,7 @@ class CombatCheck(BaseWWTask):
self.last_in_realm_not_combat = 0 self.last_in_realm_not_combat = 0
self._last_liberation = 0 self._last_liberation = 0
self.target_enemy_time_out = 3 self.target_enemy_time_out = 3
self.combat_end_condition = None
@property @property
def in_liberation(self): def in_liberation(self):
@ -119,6 +120,8 @@ class CombatCheck(BaseWWTask):
if self.has_target(): if self.has_target():
self.last_in_realm_not_combat = 0 self.last_in_realm_not_combat = 0
return True 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): if self.target_enemy(wait=True):
logger.debug(f'retarget enemy succeeded') logger.debug(f'retarget enemy succeeded')
return True return True

View File

@ -114,9 +114,6 @@ class BaseCombatTask(CombatCheck):
break break
self.combat_end() self.combat_end()
self.wait_in_team_and_world(time_out=10) 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): def run_in_circle_to_find_echo(self, circle_count=3):
directions = ['w', 'a', 's', 'd'] directions = ['w', 'a', 's', 'd']

View File

@ -155,24 +155,24 @@ class BaseWWTask(BaseTask):
if not echos: if not echos:
if no_echo_start == 0: if no_echo_start == 0:
no_echo_start = time.time() 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') self.log_debug(f'walk front to_echo, no echos found, break')
break break
continue next_direction = 'w'
else: else:
no_echo_start = 0 no_echo_start = 0
echo = echos[0] echo = echos[0]
center_distance = echo.center()[0] - self.width_of_screen(0.5) center_distance = echo.center()[0] - self.width_of_screen(0.5)
threshold = 0.05 if not last_direction else 0.15 threshold = 0.05 if not last_direction else 0.15
if abs(center_distance) < self.height_of_screen(threshold): if abs(center_distance) < self.height_of_screen(threshold):
if echo.y + echo.height > self.height_of_screen(0.65): if echo.y + echo.height > self.height_of_screen(0.65):
next_direction = 's' next_direction = 's'
else:
next_direction = 'w'
elif center_distance > 0:
next_direction = 'd'
else: else:
next_direction = 'w' next_direction = 'a'
elif center_distance > 0:
next_direction = 'd'
else:
next_direction = 'a'
last_direction = self._walk_direction(last_direction, next_direction) last_direction = self._walk_direction(last_direction, next_direction)
self._stop_last_direction(last_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) result = self.executor.ocr_lib(image, use_det=True, use_cls=False, use_rec=True)
self.logger.info(f'ocr_result {result}') 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. Main function to load ONNX model, perform inference, draw bounding boxes, and display the output image.

View File

@ -26,6 +26,7 @@ class FarmEchoTask(WWOneTimeTask, BaseCombatTask):
self.config_type["Boss"] = {'type': "drop_down", 'options': ['Hecate', 'Dreamless', 'Jue', 'Fleurdelys']} self.config_type["Boss"] = {'type': "drop_down", 'options': ['Hecate', 'Dreamless', 'Jue', 'Fleurdelys']}
self.icon = FluentIcon.ALBUM self.icon = FluentIcon.ALBUM
self.combat_end_condition = self.find_echos
self.add_exit_after_config() self.add_exit_after_config()
def run(self): def run(self):
@ -56,13 +57,13 @@ class FarmEchoTask(WWOneTimeTask, BaseCombatTask):
self.combat_once() self.combat_once()
logger.info(f'farm echo move {self.config.get("Boss")} yolo_find_echo') 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.incr_drop(dropped)
self.sleep(0.5) self.sleep(0.5)
self.send_key('esc', after_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, 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), 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.wait_in_team_and_world(time_out=120)
self.sleep(2) self.sleep(2)

View File

@ -44,6 +44,7 @@ class FarmWorldBossTask(WWOneTimeTask, BaseCombatTask):
self.config_type["Entrance Direction"] = {'type': "drop_down", 'options': ['Forward', 'Backward']} self.config_type["Entrance Direction"] = {'type': "drop_down", 'options': ['Forward', 'Backward']}
self.crownless_pos = (0.9, 0.4) self.crownless_pos = (0.9, 0.4)
self.icon = FluentIcon.GLOBE self.icon = FluentIcon.GLOBE
self.combat_end_condition = self.find_echos
self.add_exit_after_config() self.add_exit_after_config()
# not current in use because not stable, right now using one click to scroll down # 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) self.sleep(5)
logger.info(f'farm echo move forward walk_until_f to find echo') 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) self.incr_drop(dropped)
if count < 2: if count < 2:

View File

@ -14,12 +14,14 @@ class TestEcho(TaskTestCase):
def test_find_echo(self): def test_find_echo(self):
self.set_image('tests/images/echo.png') 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)) self.assertEqual(1, len(echos))
time.sleep(1) time.sleep(1)
self.task.screenshot('echo1', show_box=True) self.task.screenshot('echo1', show_box=True)
self.set_image('tests/images/echo2.png') 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) time.sleep(1)
self.task.screenshot('echo2', show_box=True) self.task.screenshot('echo2', show_box=True)
self.assertEqual(1, len(echos)) self.assertEqual(1, len(echos))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 MiB

After

Width:  |  Height:  |  Size: 9.4 MiB