mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-04-26 09:37:13 +08:00
Merge pull request #58 from LmeSzinc/master
Fix: Timezone awareness of handle_night_commission
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from datetime import datetime, time
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from module.device.app import AppControl
|
||||
from module.device.control import Control
|
||||
@@ -19,10 +19,11 @@ class Device(Screenshot, Control, AppControl):
|
||||
Returns:
|
||||
bool: If handled.
|
||||
"""
|
||||
update = self.config.get_server_last_update(since=(hour,))
|
||||
now = datetime.now().time()
|
||||
if now < time(hour - 1, 59, 60 - threshold):
|
||||
if now < (update - timedelta(seconds=threshold)).time():
|
||||
return False
|
||||
if now > time(hour, 0, threshold):
|
||||
if now > (update + timedelta(seconds=threshold)).time():
|
||||
return False
|
||||
|
||||
if GET_MISSION.match(self.image, offset=True):
|
||||
|
||||
@@ -124,20 +124,7 @@ class ExerciseCombat(HpDaemon, OpponentChoose, ExerciseEquipment):
|
||||
|
||||
def _preparation_quit(self):
|
||||
logger.info('Preparation quit')
|
||||
quit_timer = Timer(1)
|
||||
|
||||
while 1:
|
||||
self.device.screenshot()
|
||||
|
||||
# End
|
||||
if self._in_exercise():
|
||||
break
|
||||
|
||||
if quit_timer.reached() and self.appear(BACK_ARROW):
|
||||
# self.device.sleep(1)
|
||||
self.device.click(BACK_ARROW)
|
||||
quit_timer.reset()
|
||||
continue
|
||||
self.ui_back(check_button=self._in_exercise, appear_button=BATTLE_PREPARATION)
|
||||
|
||||
def _combat(self, opponent):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user