Fix: Delay OpsiAshAssist is not meta beacon found

This commit is contained in:
LmeSzinc 2023-02-20 20:11:55 +08:00
parent 60ced6705e
commit a889ae7d81

View File

@ -1,6 +1,7 @@
from enum import Enum
import module.config.server as server
from module.base.timer import Timer
from module.combat.combat import BATTLE_PREPARATION
from module.logger import logger
from module.meta_reward.meta_reward import MetaReward
@ -416,15 +417,22 @@ class OpsiAshBeacon(Meta):
class AshBeaconAssist(Meta):
def _attack_meta(self, skip_first_screenshot=True):
timeout = Timer(3, count=9).start()
appeared = False
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()
if not appeared and timeout.reached():
logger.info('No meta beacon found, delay task OpsiAshAssist')
break
if self.handle_map_event():
continue
if self.appear(ASH_START, offset=(20, 20)):
appeared = True
remain_times = self.digit_ocr_point_and_check(BEACON_REMAIN, 1)
if remain_times:
self._ensure_meta_level()
@ -433,6 +441,8 @@ class AshBeaconAssist(Meta):
logger.info('No enough assist times, complete')
break
return appeared
def _make_an_attack(self):
"""
Handle a meta assist combat.
@ -528,6 +538,9 @@ class AshBeaconAssist(Meta):
def run(self):
self.ui_ensure(page_reward)
self._begin_meta_assist()
MetaReward(self.config, self.device).run()
self.config.task_delay(server_update=True)
if self._begin_meta_assist():
MetaReward(self.config, self.device).run()
self.config.task_delay(server_update=True)
else:
self.config.task_delay(minute=(10, 20))