Exemple #1
0
def null_click():
    """
    Envoi un clic aléatoirement sur la fenêtre hors interface de sorte à ce
    que ça n'entraine aucune action
    """
    min_x = screen_infos('nc_min_x')
    max_x = screen_infos('nc_max_x')
    min_y = screen_infos('nc_min_y')
    max_y = screen_infos('nc_max_y')

    random_click(min_x, max_x, min_y, max_y)
Exemple #2
0
def end_of_scroll():
    """
    Détecte si on atteind le bas de l'hdv
    """
    temp_img_name = 'images/check_if_bottom.png'
    # Capture du pixel
    x_pixel = screen_infos('x_pixel')
    y_pixel = screen_infos('y_pixel')
    screen_rectangle(temp_img_name, x_pixel, y_pixel, 1, 1)

    # Vérification de la teinte du pixel
    img_scroll = Image.open(temp_img_name)
    pix_scroll = list(img_scroll.getdata())
    r = pix_scroll[0][0]
    is_bottom = r > 50

    return is_bottom
Exemple #3
0
def lot_price_treatment(start_y):
    """
    Fonction à appeler quand une ressource est cliquée pour récupérer
    son prix de lot.
    """
    image_name = 'images/lot_price.png'

    # Capture du prix de lot
    start_x = screen_infos('lot_price_start_x')
    width = screen_infos('lot_price_width')
    height = screen_infos('parsing_height')
    screen_rectangle(image_name, start_x, start_y, width, height)

    # Récupération du prix à ajouter dans la base de données
    lot_price = price_treatment(image_name)

    return lot_price
Exemple #4
0
def name_treatment(start_y):
    """
    Fonction à appeler quand une ressource est cliquée pour récupérer son nom.
    """
    image_name = 'images/ressource_name.png'

    # Capture du nom de la ressource
    start_x = screen_infos('name_start_x')
    width = screen_infos('name_width')
    height = screen_infos('parsing_height')
    screen_rectangle(image_name, start_x, start_y, width, height)

    # Extraction du nom de la ressource
    result_path = change_colors(image_name)
    ressource_name = data_extract(result_path)

    return ressource_name
Exemple #5
0
def lot_number_treatment(start_y):
    """
    Fonction à appeler quand une ressource est cliquée pour récupérer
    son numéro de lot.
    """
    image_name = 'images/lot_number.png'

    # Capture du nombre de lot
    start_x = screen_infos('lot_number_start_x')
    width = screen_infos('lot_number_width')
    height = screen_infos('parsing_height')
    screen_rectangle(image_name, start_x, start_y, width, height)

    # Récupération de l'information du lot
    result_path = change_colors(image_name)
    raw_lot_number = data_extract(result_path)

    # Récupère le nombre du lot et renvoi 0 si pas bon
    lot_number = lot_parsing(raw_lot_number)

    return lot_number
Exemple #6
0
def open_rune_shop():
    """
    Permet d'ouvrir l'hôtel de vente des runes de brakmar et de le préparer
    pour la récupération des prix des runes
    """
    # Permet d'avoir des cliques souris adéquats
    change_pixelisation()

    # Placement de la souris sur l'hôtel de vente
    mickey = mouse.Controller()
    brak_rune_x = screen_infos('brak_rune_x')
    brak_rune_y = screen_infos('brak_rune_y')
    mickey.position = (brak_rune_x, brak_rune_y)
    # Clique
    mickey.click(mouse.Button.left)
    time.sleep(tempo_infos('shop_tempo'))

    # Placement de la souris sur la tickbox pour l'affichage des runes
    rune_box_x = screen_infos('rune_box_x')
    rune_box_y = screen_infos('rune_box_y')
    mickey.position = (rune_box_x, rune_box_y)
    # Clique
    mickey.click(mouse.Button.left)
    time.sleep(tempo_infos('shop_tempo'))
Exemple #7
0
def ressource_click(position):
    """
    Envoi un clic aléatoirement sur la fênetre de la ressource à la position
    indiquée
    """
    min_x = screen_infos('rc_min_x')
    max_x = screen_infos('rc_max_x')
    min_y = screen_infos('rc_min_y') + position * screen_infos('line_height')
    max_y = screen_infos('rc_max_y') + position * screen_infos('line_height')

    random_click(min_x, max_x, min_y, max_y)
Exemple #8
0
def get_start_y(position):
    """
    Renvoi l'ordonnee de la position voulue dans l'hdv
    """
    return screen_infos('start_y') + position * screen_infos('line_height')