From b867d4e15594b989c4196e772af5efc6e0cbdbf3 Mon Sep 17 00:00:00 2001 From: Shawnsdaddy Date: Wed, 4 Oct 2023 21:50:17 -0700 Subject: [PATCH 1/2] =?UTF-8?q?#205=20=E8=87=AA=E5=AE=9A=E4=B9=89=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E6=97=B6=E6=9C=BA=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arknights_mower/solvers/base_schedule.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/arknights_mower/solvers/base_schedule.py b/arknights_mower/solvers/base_schedule.py index b6f2bbf47..42491f3c9 100644 --- a/arknights_mower/solvers/base_schedule.py +++ b/arknights_mower/solvers/base_schedule.py @@ -365,7 +365,8 @@ def plan_metadata(self): __plan[__room][self.op_data.operators[x].index] = x if __time < datetime.now(): __time = datetime.now() if __time != datetime.max: - self.tasks.append(SchedulerTask(time=__time, task_plan=__plan, meta_data=','.join(__type))) + self.tasks.append(SchedulerTask(time=__time, task_type=TaskTypes.SHIFT_ON, task_plan=__plan, + meta_data=','.join(__type))) else: self.op_data.reset_dorm_time() self.error = True @@ -406,7 +407,7 @@ def plan_metadata(self): if _time < datetime.now(): _time = datetime.now() self.tasks.append( SchedulerTask(time=_time if not short_rest else (datetime.now() + timedelta(hours=0.5)), - task_plan=_plan, + task_plan=_plan, task_type=TaskTypes.SHIFT_ON, meta_data=','.join(_type))) else: logger.debug("检测到时间数据不存在") @@ -441,6 +442,8 @@ def infra_main(self): elif self.task.type == TaskTypes.CLUE_PARTY: self.party_time = None self.skip(['planned', 'collect_notification']) + if self.tasks[0].type in [TaskTypes.SHIFT_ON, TaskTypes.SHIFT_OFF]: + self.backup_plan_solver() del self.tasks[0] except Exception as e: logger.exception(e) @@ -745,15 +748,15 @@ def plan_solver(self): except Exception as e: logger.exception(e) # 如果下个 普通任务 >5 分钟则补全宿舍 - logger.debug('tasks:' + str(self.tasks)) + logger.debug('tasks:' + str(self.tasks)) if find_next_task(self.tasks, datetime.now() + timedelta(seconds=300)) is not None: logger.info("5分钟内有其他任务,跳过宿舍纠错") return - if self.agent_get_mood() is None: - self.backup_plan_solver() + self.agent_get_mood() def backup_plan_solver(self): try: + changed = False index = -1 if self.op_data.backup_plans: for idx, bp in enumerate(self.op_data.backup_plans): @@ -767,11 +770,15 @@ def backup_plan_solver(self): if task: self.tasks.append(SchedulerTask(task_plan=task)) index = idx + changed = True break if valid: index = idx # 不满足条件且为其他排班表,则切换回来 if index == -1 and self.op_data.plan_name != "default_plan": self.op_data.swap_plan(index, refresh=True) + changed = True + if changed: + self.agent_get_mood() except Exception as e: logger.exception(e) From 2d174364d283cb50983ccb0539e066a394bdf827 Mon Sep 17 00:00:00 2001 From: Shawnsdaddy Date: Wed, 4 Oct 2023 22:20:05 -0700 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A1=A5=E8=B4=A7=E9=A2=91=E7=8E=87?= =?UTF-8?q?=E5=92=8Cmaa=E7=9B=B8=E5=90=8C=E5=A2=9E=E5=8A=A0=E5=AE=B9?= =?UTF-8?q?=E9=94=99=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arknights_mower/solvers/base_schedule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arknights_mower/solvers/base_schedule.py b/arknights_mower/solvers/base_schedule.py index 42491f3c9..66026e9e9 100644 --- a/arknights_mower/solvers/base_schedule.py +++ b/arknights_mower/solvers/base_schedule.py @@ -484,7 +484,7 @@ def infra_main(self): logger.info(f"记录本次无人机使用时间为:{datetime.now()}") self.drone_time = datetime.now() if self.reload_room is not None and ( - self.reload_time is None or self.reload_time < datetime.now() - timedelta(hours=24)): + self.reload_time is None or self.reload_time < datetime.now() - timedelta(hours=self.maa_config['maa_execution_gap'])): self.reload() logger.info(f"记录本次补货时间为:{datetime.now()}") self.todo_task = True