@@ -145,27 +145,28 @@ def quit_mission(self, timeout=0):
145145 self .wait_until (lambda : not self .in_team (), time_out = action_timeout , raise_if_not_found = True )
146146
147147 def give_up_mission (self , timeout = 0 ):
148+ def is_mission_start_iface ():
149+ return self .find_retry_btn () or self .find_bottom_start_btn () or self .find_big_bottom_start_btn ()
150+
148151 action_timeout = self .action_timeout if timeout == 0 else timeout
149152 box = self .box_of_screen_scaled (2560 , 1440 , 1301 , 776 , 1365 , 841 , name = "give_up_mission" , hcenter = True )
150- self .open_in_mission_menu ()
151153
152- self .wait_until (
153- condition = lambda : self .find_start_btn (box = box ),
154- post_action = lambda : self .click_relative (0.95 , 0.91 , after_sleep = 0.25 ),
155- time_out = action_timeout ,
156- raise_if_not_found = True ,
157- )
158- self .sleep (0.5 )
159- self .wait_until (
160- condition = lambda : not self .find_start_btn (box = box ),
161- post_action = lambda : self .click_box (self .find_start_btn (box = box ), after_sleep = 0.25 ),
162- time_out = action_timeout ,
163- raise_if_not_found = True ,
164- )
165- self .wait_until (
166- condition = lambda : self .find_retry_btn () or self .find_bottom_start_btn () or self .find_big_bottom_start_btn (),
167- time_out = action_timeout ,
168- )
154+ if self .open_in_mission_menu (time_out = 10 , raise_if_not_found = False ):
155+ self .wait_until (
156+ condition = lambda : self .find_start_btn (box = box ),
157+ post_action = lambda : self .click_relative (0.95 , 0.91 , after_sleep = 0.25 ),
158+ time_out = action_timeout ,
159+ raise_if_not_found = True ,
160+ )
161+ self .sleep (0.5 )
162+ self .wait_until (
163+ condition = lambda : not self .find_start_btn (box = box ),
164+ post_action = lambda : self .click_box (self .find_start_btn (box = box ), after_sleep = 0.25 ),
165+ time_out = action_timeout ,
166+ raise_if_not_found = True ,
167+ )
168+
169+ self .wait_until (condition = is_mission_start_iface , time_out = 60 , raise_if_not_found = True )
169170
170171 def continue_mission (self , timeout = 0 ):
171172 if self .in_team ():
@@ -182,12 +183,15 @@ def continue_mission(self, timeout=0):
182183 return True
183184
184185 def choose_drop_rate (self , timeout = 0 ):
186+ def click_drop_rate_btn ():
187+ if (box := self .find_drop_rate_btn ()):
188+ self .click_box (box , after_sleep = 0.25 )
185189 action_timeout = self .action_timeout if timeout == 0 else timeout
186190 self .sleep (0.5 )
187191 self .choose_drop_rate_item ()
188192 self .wait_until (
189193 condition = lambda : not self .find_drop_item () and not self .find_drop_item (800 ),
190- post_action = lambda : self . click_box ( self . find_drop_rate_btn (), after_sleep = 0.25 ) ,
194+ post_action = click_drop_rate_btn ,
191195 time_out = action_timeout ,
192196 raise_if_not_found = True ,
193197 )
@@ -427,27 +431,34 @@ def handle_mission_interface(self, stop_func=lambda: False):
427431 self .check_for_monthly_card ()
428432
429433 if self .find_letter_reward_btn ():
434+ self .log_info ("处理任务界面: 选择密函奖励" )
430435 self .choose_letter_reward ()
431436 return
432437
433438 if self .find_letter_interface ():
439+ self .log_info ("处理任务界面: 选择密函" )
434440 self .choose_letter ()
435441 return self .get_return_status ()
436442 elif self .find_drop_item () or self .find_drop_item (800 ):
443+ self .log_info ("处理任务界面: 选择委托手册" )
437444 self .choose_drop_rate ()
438445 return self .get_return_status ()
439446
440447 if self .find_retry_btn () or self .find_bottom_start_btn () or self .find_big_bottom_start_btn ():
448+ self .log_info ("处理任务界面: 开始任务" )
441449 self .start_mission ()
442450 self .mission_status = Mission .START
443451 return
444452 elif self .find_continue_btn ():
445453 if stop_func ():
454+ self .log_info ("处理任务界面: 终止任务" )
446455 return Mission .STOP
456+ self .log_info ("处理任务界面: 继续任务" )
447457 self .continue_mission ()
448458 self .mission_status = Mission .CONTINUE
449459 return
450460 elif self .find_esc_menu ():
461+ self .log_info ("处理任务界面: 放弃任务" )
451462 self .give_up_mission ()
452463 return Mission .GIVE_UP
453464 return False
0 commit comments