File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626 'disconnect-prompt-yes-button' : (706 , 394 ),
2727 'disconnect-button' : (1210 , 725 ),
2828 'game-message-close-button' : (806 , 412 ),
29+ 'map-briefing-eor-item' : (750 , 85 ),
2930 'join-game-button' : (1210 , 725 ),
3031 'spawnpoint-deselect' : (250 , 50 ),
3132 'suicide-button' : (469 , 459 )
8283 'disconnect-prompt-yes-button' : (885 , 487 ),
8384 'disconnect-button' : (1468 , 906 ),
8485 'game-message-close-button' : (1002 , 501 ),
86+ 'map-briefing-eor-item' : (938 , 97 ),
8587 'join-game-button' : (1468 , 906 ),
8688 'spawnpoint-deselect' : (250 , 50 ),
8789 'suicide-button' : (497 , 455 )
Original file line number Diff line number Diff line change @@ -345,6 +345,29 @@ def is_map_briefing_visible(self) -> bool:
345345 image_ops = [(ImageOperation .invert , None )]
346346 )
347347
348+ def open_map_briefing (self ) -> bool :
349+ # Don't block any OCR regions
350+ mouse_reset (self .game_window )
351+
352+ if self .is_map_briefing_visible ():
353+ return True
354+
355+ # Cannot open map briefing unless join game button is visible
356+ if not self .is_join_game_button_visible ():
357+ return False
358+
359+ # Move cursor onto map briefing header and click
360+ mouse_move_to_game_window_coord (self .game_window , self .resolution , 'map-briefing-eor-item' )
361+ time .sleep (.2 )
362+ mouse_click_in_game_window (self .game_window , legacy = True )
363+
364+ time .sleep (.5 )
365+
366+ # Move cursor back to default position
367+ mouse_reset (self .game_window )
368+
369+ return self .is_map_briefing_visible ()
370+
348371 def is_spawn_menu_visible (self ) -> bool :
349372 histogram = histogram_screenshot_region (
350373 self .game_window ,
Original file line number Diff line number Diff line change @@ -584,6 +584,21 @@ def run():
584584 cc .update_game_phase (GamePhase .betweenRounds )
585585 gis .round_end_reset ()
586586 continue
587+
588+ """
589+ When server "rotates" on the same map, we enter the loading state and reset the map details.
590+ However, the map briefing is not opened automatically. So unless we open it manually, we never see the
591+ map briefing and thus cannot detect the map.
592+ """
593+ if gim .is_join_game_button_visible ():
594+ logger .info ('Join game button is visible but map briefing is not, opening map briefing' )
595+ if not gim .open_map_briefing ():
596+ logger .error ('Failed to open map briefing, attempting to join game and queuing reconnect' )
597+ # We need to join the game, else the ESC press to open the menu will join the game instead of
598+ # opening the menu
599+ gim .join_game ()
600+ gis .set_spectator_on_server (False )
601+ continue
587602 time .sleep (3 )
588603 elif default_camera_view_visible and gis .round_spawned () and \
589604 iterations_on_default_camera_view == 0 :
You can’t perform that action at this time.
0 commit comments