From 171e10e6f6252d6fdf26f280a4b7338e30cc5ba6 Mon Sep 17 00:00:00 2001 From: Shawnsdaddy Date: Tue, 8 Oct 2024 23:35:50 -0700 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E8=B7=91=E5=8D=95=E6=88=AA?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arknights_mower/solvers/base_schedule.py | 10 ++++++++-- arknights_mower/utils/operators.py | 11 +---------- arknights_mower/utils/recognize.py | 4 ++-- auto_get_res_new.py | 9 ++++++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/arknights_mower/solvers/base_schedule.py b/arknights_mower/solvers/base_schedule.py index b55af36f..f4ff8734 100644 --- a/arknights_mower/solvers/base_schedule.py +++ b/arknights_mower/solvers/base_schedule.py @@ -127,7 +127,6 @@ def run(self) -> None: if len(self.tasks) > 0: # 找到时间最近的一次单个任务 self.task = self.tasks[0] - logger.debug(f"当前任务: {str(self.task)}") else: self.task = None if self.task is not None and datetime.now() < self.task.time: @@ -150,6 +149,7 @@ def run(self) -> None: self.initialize_operators() self.op_data.correct_dorm() self.backup_plan_solver(PlanTriggerTiming.BEGINNING) + logger.debug("当前任务: " + ("||".join([str(t) for t in self.tasks]))) return super().run() def transition(self) -> None: @@ -1460,7 +1460,6 @@ def plan_solver(self): except Exception as e: logger.exception(e) # 如果下个 普通任务 >5 分钟则补全宿舍 - logger.debug("tasks: " + ("||".join([str(t) for t in self.tasks]))) if self.find_next_task(datetime.now() + timedelta(seconds=15)): logger.info("有其他任务,跳过宿舍纠错") return @@ -2532,6 +2531,12 @@ def choose_agent( right_swipe = 0 last_special_filter = "功能类后勤" self.switch_arrange_order(3, "true") + elif agent and agent[0] in self.op_data.operators: + ag = self.op_data.operators[agent[0]] + if ag.is_resting(): + self.detail_filter(自定义设施=True) + last_special_filter = "自定义设施" + self.switch_arrange_order(3, "true") changed, ret = self.scan_agent(agent) if changed: selected.extend(changed) @@ -3088,6 +3093,7 @@ def agent_arrange(self, plan: tp.BasePlan, get_time=False): if not self.waiting_solver(): return self.recog.update() + self.recog.save_screencap("run_order") # 接受当前订单 while ( self.find("order_ready", scope=((450, 675), (600, 750))) is not None diff --git a/arknights_mower/utils/operators.py b/arknights_mower/utils/operators.py index 3f586ae7..b5e85ea3 100644 --- a/arknights_mower/utils/operators.py +++ b/arknights_mower/utils/operators.py @@ -472,15 +472,9 @@ def update_detail(self, name, mood, current_room, current_index, update_time=Fal def refresh_dorm_time(self, room, index, agent): for idx, dorm in enumerate(self.dorm): - # Filter out resting priority low - # if idx >= self.config.max_resting_count: - # break if dorm.position[0] == room and dorm.position[1] == index: - # 如果人为高效组,则记录时间 _name = agent["agent"] - if _name in self.operators.keys() and ( - self.operators[_name].is_high() or self.config.free_room - ): + if _name in self.operators.keys() or _name in agent_list: dorm.name = _name _agent = self.operators[_name] # 如果干员有心情上限,则按比例修改休息时间 @@ -493,9 +487,6 @@ def refresh_dorm_time(self, room, index, agent): dorm.time = _agent.time_stamp + timedelta(seconds=sec_remaining) else: dorm.time = agent["time"] - elif _name in agent_list: - dorm.name = _name - dorm.time = agent["time"] break def correct_dorm(self): diff --git a/arknights_mower/utils/recognize.py b/arknights_mower/utils/recognize.py index c3e5aaff..ffa681b5 100644 --- a/arknights_mower/utils/recognize.py +++ b/arknights_mower/utils/recognize.py @@ -97,8 +97,8 @@ def color(self, x: int, y: int) -> tp.Pixel: @deprecated def save_screencap(self, folder): - del folder # 兼容2024.05旧版接口 - save_screenshot(self.screencap) + # del folder # 兼容2024.05旧版接口 + save_screenshot(self.screencap, folder) def detect_index_scene(self) -> bool: res = loadres("index_nav", True) diff --git a/auto_get_res_new.py b/auto_get_res_new.py index 946fa734..c62b0151 100644 --- a/auto_get_res_new.py +++ b/auto_get_res_new.py @@ -131,9 +131,12 @@ def 添加干员(self): 干员头像路径 = f"./ArknightsGameResource/avatar/{干员代码}.png" 目标路径 = f"./ui/public/avatar/{干员数据['name']}.webp" print(f"{干员名}: {干员代码}") - - png_image = Image.open(干员头像路径) - png_image.save(目标路径, "WEBP") + try: + png_image = Image.open(干员头像路径) + png_image.save(目标路径, "WEBP") + except Exception as ex: + print("头像读取失败") + print(ex) 干员_名称列表.sort(key=len) with open("./arknights_mower/data/agent.json", "w", encoding="utf-8") as f: json.dump(干员_名称列表, f, ensure_ascii=False)