mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-11 22:08:20 +08:00
Add: Support auto search in OS
- Add port mission assets - Move globe operations from map.py to operation_siren.py - Add match_appear_on
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from module.base.timer import Timer
|
||||
from module.combat.assets import *
|
||||
from module.exception import CampaignEnd
|
||||
from module.handler.assets import *
|
||||
from module.logger import logger
|
||||
from module.os_handler.assets import *
|
||||
@@ -137,3 +138,36 @@ class MapEventHandler(EnemySearchingHandler):
|
||||
# End
|
||||
if self.handle_os_in_map():
|
||||
break
|
||||
|
||||
def os_auto_search_quit(self):
|
||||
confirm_timer = Timer(1, count=2)
|
||||
while 1:
|
||||
self.device.screenshot()
|
||||
|
||||
if self.appear_then_click(AUTO_SEARCH_REWARD, offset=(20, 20), interval=1):
|
||||
confirm_timer.reset()
|
||||
continue
|
||||
|
||||
# End
|
||||
if self.is_in_map():
|
||||
if confirm_timer.reached():
|
||||
break
|
||||
else:
|
||||
confirm_timer.reset()
|
||||
|
||||
def handle_os_auto_search_map_option(self):
|
||||
"""
|
||||
Returns:
|
||||
bool: If clicked.
|
||||
"""
|
||||
if self.appear(AUTO_SEARCH_MAP_OPTION_OFF, offset=(5, 50), interval=3) \
|
||||
and AUTO_SEARCH_MAP_OPTION_OFF.match_appear_on(self.device.image):
|
||||
self.device.click(AUTO_SEARCH_MAP_OPTION_OFF)
|
||||
return True
|
||||
if self.appear(AUTO_SEARCH_MAP_OPTION_OFF, offset=(5, 50)) \
|
||||
and AUTO_SEARCH_MAP_OPTION_OFF.match_appear_on(self.device.image) \
|
||||
and self.info_bar_count() >= 2:
|
||||
raise CampaignEnd
|
||||
if self.appear(AUTO_SEARCH_REWARD, offset=(20, 20)):
|
||||
self.os_auto_search_quit()
|
||||
raise CampaignEnd
|
||||
|
||||
Reference in New Issue
Block a user