diff --git a/arknights_mower/solvers/base_schedule.py b/arknights_mower/solvers/base_schedule.py index f4ff8734..1dd41389 100644 --- a/arknights_mower/solvers/base_schedule.py +++ b/arknights_mower/solvers/base_schedule.py @@ -409,6 +409,7 @@ def plan_metadata(self): if "dorm" in t.meta_data: planned_index.extend([int(w[4:]) for w in t.meta_data.split(",")]) _time = datetime.max + min_resting_time = datetime.max _plan = {} _type = [] # 第一个心情低的且小于3 则只休息半小时 @@ -435,6 +436,15 @@ def plan_metadata(self): is not None ): short_rest = True + if not short_rest: + for x in self.total_agent: + if ( + not x.workaholic + and not x.exhaust_require + and x.room not in ["factory", "train"] + ): + min_resting_time = min(min_resting_time, x.predict_exhaust()) + logger.debug(f"预测最低休息时间为:{min_resting_time}") low_priority = [] for idx, dorm in enumerate(self.op_data.dorm): logger.debug(f"开始计算{dorm}") @@ -447,6 +457,7 @@ def plan_metadata(self): # 如果是rest in full,则新增单独任务.. if ( _name in self.op_data.operators.keys() + and self.op_data.operators[_name].is_high() and self.op_data.operators[_name].rest_in_full ): __plan = {} @@ -566,6 +577,7 @@ def plan_metadata(self): # 生成单个任务 if len(_plan.items()) > 0: if _time != datetime.max: + _time = min(_time, min_resting_time) _time -= timedelta(minutes=8) if _time < datetime.now(): _time = datetime.now() @@ -3092,12 +3104,18 @@ def agent_arrange(self, plan: tp.BasePlan, get_time=False): if self.scene() in self.waiting_scene: if not self.waiting_solver(): return - self.recog.update() - self.recog.save_screencap("run_order") + wait = 0 + while self.find("order_ready", scope=((450, 675), (600, 750))) is None: + if wait > 6: + break + self.recog.update() + self.sleep(0.5) + wait += 1 # 接受当前订单 while ( self.find("order_ready", scope=((450, 675), (600, 750))) is not None ): + self.recog.save_screencap("run_order") self.tap((self.recog.w * 0.25, self.recog.h * 0.25), interval=0.5) if self.drone_room is None or ( self.drone_room == room and room in self.op_data.run_order_rooms diff --git a/arknights_mower/utils/log.py b/arknights_mower/utils/log.py index 9e96045a..9ef6ad78 100644 --- a/arknights_mower/utils/log.py +++ b/arknights_mower/utils/log.py @@ -116,5 +116,5 @@ def save_screenshot(img: bytes, sub_folder=None) -> None: if sub_folder: sub_folder_path = Path(screenshot_folder) / sub_folder sub_folder_path.mkdir(parents=True, exist_ok=True) - filename = f"{sub_folder}/{filename}" + filename = f"{sub_folder}/{datetime.now().strftime('%Y%m%d%H%M%S')}.jpg" screenshot_queue.put((img, filename)) diff --git a/arknights_mower/utils/scheduler_task.py b/arknights_mower/utils/scheduler_task.py index 447d362c..eb4c731a 100644 --- a/arknights_mower/utils/scheduler_task.py +++ b/arknights_mower/utils/scheduler_task.py @@ -190,7 +190,7 @@ def try_add_release_dorm(plan, time, op_data, tasks): not v.is_high() and v.current_mood() < v.upper_limit and v.current_room == "" - and v.name not in op_data.free_blacklist + and v.name not in op_data.config.free_blacklist ): heapq.heappush( waiting_list, diff --git a/ui/src/components/TaskDialog.vue b/ui/src/components/TaskDialog.vue index fa12ee86..319aaf8b 100644 --- a/ui/src/components/TaskDialog.vue +++ b/ui/src/components/TaskDialog.vue @@ -76,6 +76,7 @@ async function saveTasks() { task_type: task_type.value, meta_data: '' } + var data = [] if (task_type.value == '技能专精') { task.meta_data = skill_level.value + '' task.plan = {} @@ -84,7 +85,7 @@ async function saveTasks() { upgrade_support.value[0].half_off = half_off.value // 如果第一个不是1技能,则更新 是否减半 } else upgrade_support.value[0].half_off = false - const data = deepcopy(upgrade_support.value) + data = deepcopy(upgrade_support.value) for (const value of data) { if (!value.swap) { value.swap_name = value.name @@ -92,10 +93,7 @@ async function saveTasks() { } delete value.swap } - } else { - var data = [] } - const req = { task, upgrade_support: data } msg.value = (await axios.post(`${import.meta.env.VITE_HTTP_URL}/task`, req)).data if (msg.value != '添加任务成功!') {