<commit_before>__author__ = '<NAME>'

from utility.mouse import *
from utility.screen import *
from utility.logconfig import *
import argparse
import os.path
from loa import *

script_dir = os.path.dirname(os.path.realpath(__file__))

parser = argparse.ArgumentParser(description='Click Ready whenever it appears.',
                                 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--debug', action='store_true', help="""
Enable debug mode, extra details will be added to log file.
""")
args = parser.parse_args()

loglevel = VERBOSE
if args.debug:
    loglevel = logging.DEBUG
logconfig('ready', loglevel)


game = LeagueOfAngels()

ready_button = Image.open(script_dir + '/misc/Ready.png')


while True:
    logging.log(VERBOSE, "Searching for Ready button...")
    game.mouse_move(0, 0)
    time.sleep(0.100)
    ready_pos = game.image_find(ready_button, 132, 435, xorient=Orient.Right, radius=1,
                                threshold=200000, great_threshold=200000)
    if ready_pos.x != -1:
        logging.info("Ready button found ({},{}), clicking ready.".format(ready_pos.xoffset, ready_pos.yoffset))
        game.click(ready_pos.x + 40, ready_pos.y)
    time.sleep(5.0)<commit_msg>Only move mouse if it's likely to be causing a tooltip.  Also move it back after done checking for Ready button.<commit_after>__author__ = '<NAME>'

from utility.mouse import *
from utility.screen import *
from utility.logconfig import *
import argparse
import os.path
from loa import *

script_dir = os.path.dirname(os.path.realpath(__file__))

parser = argparse.ArgumentParser(description='Click Ready whenever it appears.',
                                 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--debug', action='store_true', help="""
Enable debug mode, extra details will be added to log file.
""")
args = parser.parse_args()

loglevel = VERBOSE
if args.debug:
    loglevel = logging.DEBUG
logconfig('ready', loglevel)


game = LeagueOfAngels()

ready_button = Image.open(script_dir + '/misc/Ready.png')


while True:
    logging.log(VERBOSE, "Searching for Ready button...")
    # Check if mouse is over ready button and if so move it aside to get rid of tooltip.
    mousex, mousey = game.mouse_get(xorient=Orient.Right)
    moved = False
    if abs(mousex - 132) < 100 and abs(mousey - 435) < 100:
        moved = True
        game.mouse_move(0, 0)
        time.sleep(0.100)
    ready_pos = game.image_find(ready_button, 132, 435, xorient=Orient.Right, radius=1,
                                threshold=200000, great_threshold=200000)
    if ready_pos.x != -1:
        logging.info("Ready button found ({},{}), clicking ready.".format(ready_pos.xoffset, ready_pos.yoffset))
        game.click(ready_pos.x + 40, ready_pos.y)
    if moved:
        game.mouse_move(mousex, mousey, xorient=Orient.Right)
    time.sleep(5.0)
{'fraction_non_alphanumeric': 0.11600688468158347, 'fraction_numerical': 0.024784853700516352, 'mean_word_length': 3.463901689708141, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '689865', 'n_tokens_mistral': 956, 'n_tokens_neox': 892, 'n_words': 231}