Skip to content

Commit 1b46c62

Browse files
authored
Merge pull request #18 from medicinemelancholy:pr6
优化70jjb,寻路失败添加重开,复位使用wait_until实现
2 parents ef102ac + 27ab997 commit 1b46c62

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

src/tasks/Auto70jjbTask.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ def do_run(self):
8686
self.walk_to_aim()
8787
win32gui.SendMessage(self.hwnd.hwnd, win32con.WM_KEYUP, 0xA4, 0)
8888
_wave_start = time.time()
89+
self.current_wave = -1
90+
while self.current_wave == -1 and time.time() - _wave_start < 2:
91+
self.get_wave_info()
92+
self.sleep(0.2)
93+
if self.current_wave == -1:
94+
self.log_info('未正确到达任务地点')
95+
self.open_in_mission_menu()
96+
self.sleep(0.5)
8997
elif _status == Mission.CONTINUE:
9098
self.log_info('任务继续')
9199
self.wait_until(self.in_team, time_out=30)
@@ -127,13 +135,21 @@ def wait_hint(self, x1, y1, x2, y2, hint, timeout=2):
127135
def reset_and_transport(self):
128136
self.open_in_mission_menu()
129137
self.sleep(0.8)
130-
self.click(0.73, 0.92, after_sleep=0.8)
131-
self.click(0.35, 0.03, after_sleep=0.8)
138+
self.wait_until(lambda: self.find_next_hint(0.05, 0.01, 0.09, 0.05, r'设置'),
139+
post_action=self.click(0.73, 0.92, after_sleep=0.5),
140+
time_out=2)
141+
self.wait_until(lambda: self.find_next_hint(0.06, 0.29, 0.12, 0.33, r'重置位置'),
142+
post_action=self.click(0.35, 0.03, after_sleep=0.5),
143+
time_out=2)
132144
self.move_mouse_to_safe_position()
133-
self.click(0.60, 0.32)
145+
self.wait_until(lambda: self.find_next_hint(0.57, 0.54, 0.62, 0.58, r'确定'),
146+
post_action=self.click(0.60, 0.32, after_sleep=0.5),
147+
time_out=2)
134148
self.move_back_from_safe_position()
135-
self.sleep(0.8)
136-
self.click(0.59, 0.56, after_sleep=1)
149+
self.wait_until(self.in_team,
150+
post_action=self.click(0.59, 0.56, after_sleep=0.5),
151+
time_out=2)
152+
137153

138154
def walk_to_aim(self):
139155
if self.find_next_hint(0.18,0.52,0.23,0.55,r'保护目标'):

0 commit comments

Comments
 (0)