def meow_is_sunday(self): """ datetime argument is the next server update of, today's run. So check for Monday's weekday value (0) rather than Sunday's weekday value (6) Returns: bool: """ return get_server_next_update( self.config.Scheduler_ServerUpdate).weekday() == 0
def meow_train(self): """ Performs both retrieving a trained meowfficer and queuing meowfficer boxes for training Pages: in: page_meowfficer out: page_meowfficer """ # Retrieve capacity to determine whether able to collect current, remain, total = MEOWFFICER_CAPACITY.ocr(self.device.image) logger.attr('Meowfficer_capacity_remain', remain) # Helper variables is_sunday = get_server_next_update( self.config.Scheduler_ServerUpdate).weekday() == 0 collected = False # Enter MEOWFFICER_TRAIN window self.ui_click(MEOWFFICER_TRAIN_ENTER, check_button=MEOWFFICER_TRAIN_START, additional=self.meow_additional, retry_wait=3, skip_first_screenshot=True) # If today is Sunday, then collect all remainder otherwise just collect one # Once collected, should be back in MEOWFFICER_TRAIN window if remain > 0: collected = self.meow_collect(is_sunday) # FIll queue to full if # - Attempted to collect but failed, # indicating in progress or completely # empty # - Today is Sunday # Once queued, should be back in MEOWFFICER_TRAIN window if (remain > 0 and not collected) or is_sunday: self.meow_queue() self.ui_click(MEOWFFICER_GOTO_DORM, check_button=MEOWFFICER_TRAIN_ENTER, appear_button=MEOWFFICER_TRAIN_START, offset=None) return collected
def handle_night_commission(self, daily_trigger='21:00', threshold=30): """ Args: daily_trigger (int): Time for commission refresh. threshold (int): Seconds around refresh time. Returns: bool: If handled. """ update = get_server_next_update(daily_trigger=daily_trigger) now = datetime.now() diff = (update.timestamp() - now.timestamp()) % 86400 if threshold < diff < 86400 - threshold: return False if GET_MISSION.match(self.image, offset=True): logger.info('Night commission appear.') self.click(GET_MISSION) return True return False