Esempio n. 1
0
def set_to_pause():
    if globals.go_flag == 0:
        globals.go_flag = 1
        utilities.set_status(globals.last_status)
    else:
        globals.go_flag = 0
        print("Bot paused.")
Esempio n. 2
0
def champ_select():
    utilities.set_status("In champion select...")
    for champion in list_of_champs:
        if attempt_to_click_on(champion, None):
            time.sleep(2)
            if attempt_to_click_on(pictures.lockin, None):
                return True
            else:
                return False
    return False
Esempio n. 3
0
def increment_games():
    globals.number_of_games_finished = globals.number_of_games_finished + 1
    if globals.number_of_games_finished == globals.number_of_games_to_play:
        utilities.set_status(
            "The bot successfully finished %d out of %d games!" %
            (globals.number_of_games_finished,
             globals.number_of_games_to_play))
    else:
        utilities.set_status("The bot finished %d out of %d games." %
                             (globals.number_of_games_finished,
                              globals.number_of_games_to_play))
Esempio n. 4
0
def restart_client():
    if utilities.is_client_open():
        utilities.set_status('Restarting client...')
        try:
            for proc in psutil.process_iter():
                if proc.name() == "LeagueClient.exe":
                    proc.kill()
                    break
        except Exception as e:
            print(e)
        while utilities.is_client_open():
            time.sleep(1)
    else:
        utilities.set_status('Starting client...')
    open_client()
Esempio n. 5
0
def client_stuck():
    utilities.set_status('Bot stuck.  Rebooting...')
    restart_client()
    utilities.set_status('Awaiting login...')
    await_login()
    globals.time_since_last_click = timer()
    utilities.set_status('Queueing for a game...')
Esempio n. 6
0
def run():
    utilities.set_status('Starting bot...')

    # If league is already in game, finish the game
    if utilities.is_league_in_game():
        complete_game()

    # Otherwise, restart client and wait for login
    else:
        restart_client()
        utilities.set_status('Awaiting login...')
        await_login()

        # Start queueing up
        globals.time_since_last_click = timer()
        utilities.set_status('Queueing for a game...')

    # Start loop
    while True:
        pause_if_needed()

        # If game has started, complete the game
        if utilities.is_league_in_game():
            complete_game()
            continue

        # Check for daily play rewards
        if attempt_to_click_on(pictures.daily_play, None, click=False):
            daily_play()

        # Check for level up rewards
        attempt_to_click_on(pictures.ok, None)

        # Check for clash notification
        attempt_to_click_on(pictures.clash, None)

        # Check if champ select bugged
        attempt_to_click_on(pictures.ok_champ_select_bug, None)

        # Check if we're in champ select
        if attempt_to_click_on(pictures.choose_champ,
                               regions.choose_champ,
                               click=False):
            champ_select()

        # Check for other buttons
        attempt_to_click_on(pictures.play_button, regions.play_button)
        attempt_to_click_on(pictures.party, regions.party_button)
        attempt_to_click_on(pictures.coop_vs_ai, regions.coop_vs_ai)
        attempt_to_click_on(pictures.intermediate_bots,
                            regions.intermediate_bots)
        attempt_to_click_on(pictures.confirm, regions.confirm)
        attempt_to_click_on(pictures.find_match, regions.find_match)
        attempt_to_click_on(pictures.accept, regions.accept)
        attempt_to_click_on(pictures.play_again, None)

        # If 2 minutes has elapsed without doing anything, restart client
        if did_timeout(120):
            client_stuck()
Esempio n. 7
0
def complete_game():
    utilities.set_status('Waiting for game to start...')

    # Wait until recall is visible, then we know we're in game
    while not attempt_to_click_on(
            pictures.recall, None, is_game=True, click=False):
        pause_if_needed()

    # Lock the screen once we're in game
    lock_screen()

    # Click mid
    utilities.set_status('Running it down mid...')
    game_flag = 1
    while game_flag:
        pause_if_needed()

        # If we're out of game
        if not utilities.is_league_in_game():
            game_flag = 0
            continue

        # Get the location of league window
        try:
            rect = utilities.get_game_coords()
        except Exception:
            continue
        x = rect[0] + 1260
        y = rect[1] + 592

        # Right click down mid every 1 second
        try:
            win32api.SetCursorPos((x, y))
            win32api.mouse_event(win32con.MOUSEEVENTF_MIDDLEDOWN, x, y, 0, 0)
            win32api.mouse_event(win32con.MOUSEEVENTF_MIDDLEUP, x, y, 0, 0)
            time.sleep(1)
        except Exception:
            continue

    # Once the game is finished
    increment_games()

    # Check to see if the bot is finished all games
    if globals.number_of_games_finished == globals.number_of_games_to_play:
        stop_bot()
        return

    # Skip honor
    globals.time_since_last_click = timer()
    while not attempt_to_click_on(pictures.skip_honor, None):
        if did_timeout(30):
            client_stuck()
            return
        time.sleep(1)

    # Requeue for another game
    utilities.set_status("Currently queueing for a game...")
Esempio n. 8
0
def complete_game():
    utilities.set_status('Waiting for game to start...')

    # Wait until recall button is visible, then we know we're in game
    while not attempt_to_click_on(
            pictures.recall, None, is_game=True, click=False):
        pause_if_needed()

    # Click mid
    utilities.set_status('Running it down mid...')
    while True:
        pause_if_needed()

        # If we're out of game
        if not utilities.is_league_in_game():
            break

        # If the camera isn't locked, lock it
        if attempt_to_click_on(pictures.lock_camera,
                               None,
                               is_game=True,
                               click=False):
            lock_screen()

        # Get the location of league window
        try:
            rect = utilities.get_game_coords()
        except Exception:
            continue
        x = rect[0] + 1260
        y = rect[1] + 592

        # Right click down mid every 3 seconds
        try:
            win32api.SetCursorPos((x, y))
            win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN, x, y, 0, 0)
            win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, x, y, 0, 0)
            time.sleep(3)
        except Exception:
            continue

    # Once the game is finished
    increment_games()

    # Skip honor
    globals.time_since_last_click = timer()
    while not attempt_to_click_on(pictures.skip_honor, None):
        if did_timeout(30):
            client_stuck()
            return
        time.sleep(1)

    # Requeue for another game
    utilities.set_status("Queueing for a game...")
Esempio n. 9
0
def increment_games():
    globals.number_of_games_finished = globals.number_of_games_finished + 1
    utilities.set_status("The bot has finished %d games." %
                         globals.number_of_games_finished)