Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Shawnsdaddy committed Oct 17, 2024
1 parent a24e3d1 commit 8c401f3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
22 changes: 20 additions & 2 deletions arknights_mower/solvers/base_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 则只休息半小时
Expand All @@ -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}")
Expand All @@ -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 = {}
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion arknights_mower/utils/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
2 changes: 1 addition & 1 deletion arknights_mower/utils/scheduler_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 2 additions & 4 deletions ui/src/components/TaskDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand All @@ -84,18 +85,15 @@ 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
value.match = false
}
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 != '添加任务成功!') {
Expand Down

0 comments on commit 8c401f3

Please sign in to comment.