Skip to content

Commit

Permalink
update recog before scan
Browse files Browse the repository at this point in the history
  • Loading branch information
Shawnsdaddy committed Dec 31, 2024
1 parent fb50712 commit ba07542
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
3 changes: 2 additions & 1 deletion arknights_mower/solvers/base_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def scan_agent(
):
try:
# 识别干员
self.recog.update()
while self.find("connecting"):
logger.info("等待网络连接")
self.sleep()
Expand Down Expand Up @@ -131,7 +132,7 @@ def swipe_left(self, right_swipe, special_filter):
else:
swipe_time = 2 if right_swipe == 3 else right_swipe
for i in range(swipe_time):
self.swipe_noinertia((650, 540), (1900, 0))
self.swipe_noinertia((650, 540), (2500, 0))
return 0

def profession_filter(self, profession=None):
Expand Down
4 changes: 3 additions & 1 deletion arknights_mower/solvers/base_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,8 @@ def run_order_solver(self):
)
for name in self.op_data.exhaust_agent:
op = self.op_data.operators[name]
if op.is_resting():
continue
if op.current_mood() <= op.lower_limit + 2:
if (
self.find_next_task(
Expand Down Expand Up @@ -2922,7 +2924,7 @@ def choose_agent(
interval=0,
)
right_swipe = skip_swipe_count
self.sleep(0.25)
self.sleep(1)
changed, ret = self.scan_agent(
agent, full_scan=last_special_filter == "ALL"
)
Expand Down
16 changes: 9 additions & 7 deletions arknights_mower/utils/scheduler_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,15 @@ def plan_metadata(op_data, tasks):


def try_reorder(op_data):
# 复制副本,防止原本的dorm错误触发纠错
dorm = copy.deepcopy(op_data.dorm)
# 如果当前高优有空位(非高优人员),则重新排序,正在休息的人逐个往前挤
vip = sum(1 for key in op_data.plan.keys() if key.startswith("dorm"))
logger.debug(f"当前vip个数{vip}")
if vip == 0:
return
ready_index = 0
for idx, room in enumerate(op_data.dorm):
for idx, room in enumerate(dorm):
logger.debug(room)
if not room.name:
continue
Expand All @@ -393,23 +395,23 @@ def try_reorder(op_data):
if idx == ready_index:
ready_index += 1
elif ready_index >= vip:
op_data.dorm[ready_index].name, room.name = (
dorm[ready_index].name, room.name = (
room.name,
op_data.dorm[ready_index].name,
dorm[ready_index].name,
)
room.time = None
ready_index += 1
elif op.operator_type == "high":
if idx != ready_index:
op_data.dorm[ready_index].name, room.name = (
dorm[ready_index].name, room.name = (
room.name,
op_data.dorm[ready_index].name,
dorm[ready_index].name,
)
room.time = None
ready_index += 1
plan = {}
logger.debug(f"更新房间信息{print(op_data.dorm)}")
for room in op_data.dorm:
logger.debug(f"更新房间信息{dorm}")
for room in dorm:
if room.name:
op = op_data.operators[room.name]
room_name, idx = room.position
Expand Down

0 comments on commit ba07542

Please sign in to comment.