mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-26 13:57:53 +08:00
Fix: Handle mysteries in strategy_open()
This commit is contained in:
@@ -44,7 +44,7 @@ class MysteryHandler(StrategyHandler, EnemySearchingHandler):
|
|||||||
if button is None or area_cross_area(button.button, MYSTERY_ITEM.area, threshold=5):
|
if button is None or area_cross_area(button.button, MYSTERY_ITEM.area, threshold=5):
|
||||||
button = MYSTERY_ITEM
|
button = MYSTERY_ITEM
|
||||||
|
|
||||||
if self.appear(GET_ITEMS_1):
|
if self.appear(GET_ITEMS_1, offset=5):
|
||||||
logger.attr('Mystery', 'Get item')
|
logger.attr('Mystery', 'Get item')
|
||||||
if drop:
|
if drop:
|
||||||
drop.add(self.device.image)
|
drop.add(self.device.image)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import numpy as np
|
from module.combat.assets import GET_ITEMS_1
|
||||||
|
|
||||||
from module.handler.assets import *
|
from module.handler.assets import *
|
||||||
from module.handler.info_handler import InfoHandler
|
from module.handler.info_handler import InfoHandler
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
@@ -25,28 +24,39 @@ class StrategyHandler(InfoHandler):
|
|||||||
fleet_1_formation_fixed = False
|
fleet_1_formation_fixed = False
|
||||||
fleet_2_formation_fixed = False
|
fleet_2_formation_fixed = False
|
||||||
|
|
||||||
def strategy_open(self):
|
def strategy_open(self, skip_first_screenshot=True):
|
||||||
logger.info('Strategy open')
|
logger.info('Strategy open')
|
||||||
while 1:
|
while 1:
|
||||||
if self.appear(IN_MAP, interval=5) and not self.appear(STRATEGY_OPENED, offset=120):
|
if skip_first_screenshot:
|
||||||
self.device.click(STRATEGY_OPEN)
|
skip_first_screenshot = False
|
||||||
|
else:
|
||||||
|
self.device.screenshot()
|
||||||
|
|
||||||
if self.appear(STRATEGY_OPENED, offset=120):
|
if self.appear(STRATEGY_OPENED, offset=120):
|
||||||
break
|
break
|
||||||
|
|
||||||
self.device.screenshot()
|
if self.appear(IN_MAP, interval=5) and not self.appear(STRATEGY_OPENED, offset=120):
|
||||||
|
self.device.click(STRATEGY_OPEN)
|
||||||
|
continue
|
||||||
|
|
||||||
def strategy_close(self):
|
# Handle missed mysteries
|
||||||
|
if self.appear_then_click(GET_ITEMS_1, offset=5):
|
||||||
|
continue
|
||||||
|
|
||||||
|
def strategy_close(self, skip_first_screenshot=True):
|
||||||
logger.info('Strategy close')
|
logger.info('Strategy close')
|
||||||
while 1:
|
while 1:
|
||||||
|
if skip_first_screenshot:
|
||||||
|
skip_first_screenshot = False
|
||||||
|
else:
|
||||||
|
self.device.screenshot()
|
||||||
|
|
||||||
if self.appear_then_click(STRATEGY_OPENED, offset=120, interval=5):
|
if self.appear_then_click(STRATEGY_OPENED, offset=120, interval=5):
|
||||||
pass
|
continue
|
||||||
|
|
||||||
if not self.appear(STRATEGY_OPENED, offset=120):
|
if not self.appear(STRATEGY_OPENED, offset=120):
|
||||||
break
|
break
|
||||||
|
|
||||||
self.device.screenshot()
|
|
||||||
|
|
||||||
def strategy_set_execute(self, formation_index=None, sub_view=None, sub_hunt=None):
|
def strategy_set_execute(self, formation_index=None, sub_view=None, sub_hunt=None):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ class Camera(MapOperation):
|
|||||||
logger.warning('Perspective error caused by info bar')
|
logger.warning('Perspective error caused by info bar')
|
||||||
self.handle_info_bar()
|
self.handle_info_bar()
|
||||||
return False
|
return False
|
||||||
elif self.appear(GET_ITEMS_1):
|
elif self.appear(GET_ITEMS_1, offset=5):
|
||||||
logger.warning('Perspective error caused by get_items')
|
logger.warning('Perspective error caused by get_items')
|
||||||
self.handle_mystery()
|
self.handle_mystery()
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user