def logout(riot_connection, league_connection): ''' Logs out from the client ''' logging.info('Logging out') league_connection.delete('/lol-rso-auth/v1/session') res = riot_connection.get('/rso-auth/v1/authorization') if res.status_code == 404: kill_process(LEAGUE_CLIENT_PROCESS)
def start_macro(self): ''' Starts the main batch process ''' options = self.get_options() self.builder.get_object('start')['state'] = 'disabled' kill_process(LEAGUE_CLIENT_PROCESS) kill_process(RIOT_CLIENT_PROCESS) for idx, account in enumerate(self.accounts): tree = self.builder.get_object('accounts') child_id = tree.get_children()[idx] tree.focus(child_id) tree.selection_set(child_id) try: self.macro.do_macro(options, *account) except AuthenticationFailureException: logging.info('Account %s has invalid credentials', account[0]) except ConsentRequiredException: logging.info('Account %s needs consent', account[0]) progress = (idx + 1) * 100 // len(self.accounts) self.builder.get_object('progress')['value'] = progress self.builder.get_object('start')['state'] = 'normal'
def check_incidents(self): ''' Checks for incidents and handles it forever ''' while True: window_list = [window.title for window in get_windows()] for title in GAME_ERROR_TITLES: if title in window_list: self.logger.log( f'Bad window title found: {title}. Killing League of Legends.exe...' ) self.increment_count() kill_game(self.settings) for title in LEAGUE_CLIENT_ERROR_TITLES: if title in window_list: self.logger.log( f'Bad window title found: {title}. Killing LeagueClient.exe...' ) self.increment_count() kill_league_client(self.settings) for title in CSRSS_ERROR_TITILES: if title in window_list: self.logger.log( f'Bad window title found: {title}. Closing the {title} window...' ) self.increment_count() close_window_by_title(title) if is_running(self.settings.bug_splat_process): self.logger.log( f'BugSplat found, killing {self.settings.bug_splat_process}...' ) self.increment_count() kill_process(self.settings.bug_splat_process) if is_running('Werfault.exe'): self.logger.log(f'Werfault.exe found, killing Werfault.exe...') self.increment_count() kill_process('Werfault.exe') time.sleep(5)
def kill_game(settings): ''' Kills the game ''' kill_process(settings.game_process)
def kill_riot_client(settings): ''' Kills the riot client ''' kill_process(settings.riot_client_process) kill_process(settings.riot_client_crash_handler_process) kill_process(settings.riot_client_ux_process) kill_process(settings.riot_client_ux_render_process)
def kill_league_client(settings): ''' Kills the league client ''' kill_process(settings.league_client_process) kill_process(settings.league_client_ux_process) kill_process(settings.league_client_ux_render_process)