Skip to content

Commit

Permalink
保存跑单截图
Browse files Browse the repository at this point in the history
  • Loading branch information
Shawnsdaddy committed Oct 9, 2024
1 parent a3e851d commit 171e10e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
10 changes: 8 additions & 2 deletions arknights_mower/solvers/base_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
11 changes: 1 addition & 10 deletions arknights_mower/utils/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
# 如果干员有心情上限,则按比例修改休息时间
Expand All @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions arknights_mower/utils/recognize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 6 additions & 3 deletions auto_get_res_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 171e10e

Please sign in to comment.