def press_play(): find_and_click_on('/play.png', .85, s.region_maker(.4, .02, .17, .05), "Play button pressed", None, amount_of_clicks=2)
def press_play_again(): find_and_click_on('/play_again_1.png', .85, s.region_maker(.445, .915, .04, .04), '"Play again" pressed', '/play_again_2.png', third_pic='/play_again_3.png')
def check(): while getattr(error_checker_thread, "do_run", True): time.sleep(5) try: gameplay.check_for('/quit.png', .7, screen.region_maker(.34, .56, .31, .13), Fore.YELLOW + "\nError occurred\n", handle) except TypeError: pass
def start_search(): find_and_click_on('/small_start.png', .8, s.region_maker(.38, .835, .22, .13), "Searching game...", '/small_start_1.png')
def close_lobby(): find_and_click_on('/party.png', .85, s.region_maker(.345, .155, .16, .09), "Lobby closed")
def select_game_mode(): find_and_click_on('/deathmatch.png', .75, s.region_maker(.51, .08, .125, .05), "Game mode selected")
def skip_stats(): find_and_click_on('/skip.png', .8, s.region_maker(.41, .81, .15, .1), "Stats skipped") time.sleep(0.5)
def simulate(enable_simulation): global simulate_buying_thread, is_in_match, match_start_time is_in_match = True err.error_checker_thread.do_run = False try: check_for('/quit.png', .7, s.region_maker(.34, .56, .31, .13), Fore.YELLOW + "\nError occurred\n", err.handle) except TypeError: pass time.sleep(settings.average_match_load_time + 15) match_start_time = datetime.now() simulate_buying_thread = threading.Thread(name="simulation", target=simulate_buying, args=(), daemon=True) simulate_buying_thread.start() simulate_buying_thread.do_run = True k.press_button('b') time.sleep(random.uniform(0, .35)) buy_gun(pistols[random.randint(0, 2)], .85) time.sleep(random.uniform(0, .35)) k.press_button('b') # Approximately after 45 seconds game counts you as an inactive player while True: if enable_simulation: simulate_movements() # simulate_shooting() time.sleep(settings.checks_refresh_rate) # check if did not close buy window # check_for('/buy.png', .7, s.region_maker(.39, .42, .2, .2), None, k.press_button, 'b') # check for errors try: check_for('/quit.png', .7, s.region_maker(.34, .56, .31, .13), Fore.YELLOW + "\nError occurred\n", err.handle) except TypeError: pass # check inactivity # check_for('/skip.png', .95, s.region_maker(.39, .255, .22, .12b), None, buy) # check for end of the match check_for( '/skip.png', .7, s.region_maker(.4, .8, .17, .2), "\n" + Fore.CYAN + ordinals.parse(stats.matches_played + 1) + Fore.LIGHTGREEN_EX + " match has ended", close_threads) if not is_in_match: menu.skip_stats() break # check for end of the match #2 check_for( '/match_end.png', .9, s.region_maker(.4, .25, .16, .2), "\n" + Fore.CYAN + ordinals.parse(stats.matches_played + 1) + Fore.LIGHTGREEN_EX + " match has ended", close_threads) if not is_in_match: break