@@ -364,15 +364,21 @@ def _guild_operations_dispatch_execute(self, skip_first_screenshot=True):
364364 else :
365365 self .device .screenshot ()
366366
367- if self .appear (GUILD_DISPATCH_FLEET_UNFILLED , threshold = 20 , interval = 5 ):
367+ if self .appear (GUILD_DISPATCH_FLEET_UNFILLED , offset = ( 20 , 20 ), interval = 3 ):
368368 # Don't use offset here, because GUILD_DISPATCH_FLEET_UNFILLED only has a difference in colors
369369 # Use long interval because the game needs a few seconds to choose the ships
370370 self .device .click (GUILD_DISPATCH_RECOMMEND )
371371 continue
372- if not dispatched and self .appear_then_click (GUILD_DISPATCH_FLEET , threshold = 20 , interval = 5 ):
373- # Don't use offset here, because GUILD_DISPATCH_FLEET only has a difference in colors
372+ if not dispatched and self .appear (GUILD_DISPATCH_FLEET , offset = (20 , 20 ), interval = 3 ):
373+ # GUILD_DISPATCH_FLEET and GUILD_DISPATCH_FLEET_UNFILLED has same feature but different colors
374+ # check background blue for double check
375+ if self .image_color_count (GUILD_DISPATCH_FLEET , color = (82 , 93 , 221 ), threshold = 235 , count = 500 ):
376+ self .device .click (GUILD_DISPATCH_FLEET )
377+ else :
378+ self .interval_clear (GUILD_DISPATCH_FLEET )
374379 continue
375380 if self .handle_popup_confirm ('GUILD_DISPATCH' ):
381+ self .interval_clear (GUILD_DISPATCH_FLEET )
376382 dispatched = True
377383 continue
378384
@@ -381,13 +387,16 @@ def _guild_operations_dispatch_execute(self, skip_first_screenshot=True):
381387 # In first dispatch, it will show GUILD_DISPATCH_IN_PROGRESS
382388 logger .info ('Fleet dispatched, dispatch in progress' )
383389 break
384- if dispatched and self .appear (GUILD_DISPATCH_FLEET , threshold = 20 , interval = 0 ):
385- # In the rest of the dispatch, it will show GUILD_DISPATCH_FLEET
386- # We can't ensure that fleet has dispatched,
387- # because GUILD_DISPATCH_FLEET also shows after clicking recommend before dispatching
388- # _guild_operations_dispatch() will retry it if haven't dispatched
389- logger .info ('Fleet dispatched' )
390- break
390+ if dispatched and self .appear (GUILD_DISPATCH_FLEET , offset = (20 , 20 ), interval = 3 ):
391+ # GUILD_DISPATCH_FLEET and GUILD_DISPATCH_FLEET_UNFILLED has same feature but different colors
392+ # check background blue for double check
393+ if self .image_color_count (GUILD_DISPATCH_FLEET , color = (82 , 93 , 221 ), threshold = 235 , count = 500 ):
394+ # In the rest of the dispatch, it will show GUILD_DISPATCH_FLEET
395+ # We can't ensure that fleet has dispatched,
396+ # because GUILD_DISPATCH_FLEET still shows after clicking recommend before dispatching
397+ # _guild_operations_dispatch() will retry it if haven't dispatched
398+ logger .info ('Fleet dispatched' )
399+ break
391400
392401 def _guild_operations_dispatch_exit (self , skip_first_screenshot = True ):
393402 """
@@ -473,9 +482,8 @@ def _guild_operations_boss_preparation(self, az, skip_first_screenshot=True):
473482 if self .appear_then_click (GUILD_BOSS_ENTER , interval = 3 ):
474483 continue
475484
476- if self .appear (GUILD_DISPATCH_FLEET , threshold = 20 , interval = 3 ):
477- # Button does not appear greyed out even
478- # when empty fleet composition
485+ if self .appear (GUILD_DISPATCH_FLEET , offset = (20 , 20 ), interval = 3 ):
486+ # Button does not appear greyed out even when empty fleet composition
479487 if dispatch_count < 5 :
480488 self .device .click (GUILD_DISPATCH_FLEET )
481489 dispatch_count += 1
0 commit comments