2026-01-22 19:07:09 +08:00
|
|
|
from module.handler.enemy_searching import EnemySearchingHandler as EnemySearchingHandler_
|
2022-09-25 01:40:49 +08:00
|
|
|
from module.logger import logger
|
2022-10-04 11:33:55 +08:00
|
|
|
from module.os.assets import MAP_GOTO_GLOBE_FOG
|
2023-04-09 00:12:54 +08:00
|
|
|
from module.os_handler.assets import AUTO_SEARCH_REWARD, IN_MAP, ORDER_ENTER
|
2020-12-23 18:48:41 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class EnemySearchingHandler(EnemySearchingHandler_):
|
|
|
|
|
def is_in_map(self):
|
2024-06-05 01:15:32 +08:00
|
|
|
if IN_MAP.match_luma(self.device.image, offset=(200, 5)):
|
2023-01-16 22:15:07 +08:00
|
|
|
return True
|
2024-12-09 16:09:34 +08:00
|
|
|
if self.match_template_color(MAP_GOTO_GLOBE_FOG, offset=(5, 5)):
|
2023-01-16 22:15:07 +08:00
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
return False
|
2022-09-25 01:40:49 +08:00
|
|
|
|
2026-01-22 19:07:09 +08:00
|
|
|
def wait_os_map_buttons(self):
|
2022-09-25 01:40:49 +08:00
|
|
|
"""
|
|
|
|
|
When entering a os map, radar and buttons slide out from the right.
|
|
|
|
|
Wait until they slide to the final position.
|
|
|
|
|
"""
|
2026-01-22 19:07:09 +08:00
|
|
|
for _ in self.loop(timeout=1):
|
2022-09-25 01:40:49 +08:00
|
|
|
if self.appear(ORDER_ENTER, offset=(20, 20)):
|
|
|
|
|
break
|
2023-04-09 00:12:54 +08:00
|
|
|
# A game bug that AUTO_SEARCH_REWARD from the last cleared zone popups
|
|
|
|
|
if self.appear_then_click(AUTO_SEARCH_REWARD, offset=(50, 50), interval=3):
|
|
|
|
|
continue
|
2026-01-22 19:07:09 +08:00
|
|
|
else:
|
|
|
|
|
logger.warning('wait_os_map_buttons timeout, assume waited')
|