Ejemplo n.º 1
0
def flip_bomb(SW, SH):
    mid_x = SW // 2
    mid_y = SH // 2
    win_util.click(SW - 100, 100, btn="right")
    sleep(0.5)
    win_util.click(mid_x, mid_y + (mid_y // 8))
    sleep(0.2)
    win_util.mouse_down(mid_x, mid_y, btn="right")
    sleep(0.5)
    win_util.mouse_move(SW - int(SW / 4.4), mid_y + (mid_y // 9))
    sleep(0.5)
Ejemplo n.º 2
0
def solve_needy_discharge(image, mod_pos):
    if not needy_features.is_active(image):
        log("Needy Discharge is not active.", config.LOG_DEBUG,
            "Needy Discharge")
        return
    mod_x, mod_y = mod_pos
    time_to_drain = needy_discharge_solver.solve(image)
    x_top, y_top = mod_x + 230, mod_y + 92

    win_util.mouse_move(x_top, y_top)
    win_util.mouse_down(x_top, y_top)
    sleep(time_to_drain)
    win_util.mouse_up(x_top, y_top)
Ejemplo n.º 3
0
def solve_needy_discharge(image, mod_pos, time_started):
    if not needy_features.is_active(image):
        log("Needy Discharge is not active.", config.LOG_DEBUG, "Needy Discharge")
        return
    mod_x, mod_y = mod_pos
    time_spent = get_time_spent(time_started)
    x_top, y_top = mod_x + 230, mod_y + 92

    win_util.mouse_move(x_top, y_top)
    win_util.mouse_down(x_top, y_top)
    sleep_time = 1 + (time_spent / 5)
    sleep(sleep_time)
    win_util.mouse_up(x_top, y_top)
Ejemplo n.º 4
0
def solve_button(image, mod_pos, side_features, character_model, duration):
    mod_x, mod_y = mod_pos
    hold = button_solver.solve(image, side_features, character_model)
    button_x, button_y = mod_x + 125, mod_y + 175
    if not hold:
        log(f"Tapping button.", config.LOG_DEBUG, "Button")
        win_util.click(button_x, button_y)
        sleep(0.5)
    else:
        log(f"Holding button...", config.LOG_DEBUG, "Button")
        win_util.mouse_move(button_x, button_y)
        win_util.mouse_down(button_x, button_y)
        sleep(0.9)  # 48 frames until strip lights up.
        SC, _, _ = screenshot_module()
        image = convert_to_cv2(SC)
        pixel = (184, 255)
        release_time = button_solver.get_release_time(image, pixel)
        log(f"Release button at {release_time}", config.LOG_DEBUG, "Button")
        release_mouse_at(release_time, duration, button_x, button_y)
Ejemplo n.º 5
0
def inspect_bomb(num_modules=None):
    sw, sh = win_util.get_screen_size()
    mid_x = sw // 2
    mid_y = sh // 2
    win_util.click(mid_x, mid_y + (mid_y // 8))
    sleep(0.5)
    # Inspect front of bomb.
    front_img = screenshot(460, 220, 1000, 640)
    sleep(0.2)
    # Rotate bomb.
    win_util.mouse_down(mid_x, mid_y, btn="right")
    sleep(0.2)
    # Inspect right side.
    right_img = inspect_side(sw - int(sw / 2.74), mid_y + int(mid_y / 8), 755,
                             60, 480, 900)
    # Inspect left side.
    left_img = inspect_side(int(sw / 2.76), mid_y + int(mid_y / 8), 755, 60,
                            480, 900)
    # Inspect top side.
    top_img = inspect_side(int(sw / 2.75), sh, 720, 0, 480, sh)
    # Inspect bottom side.
    bottom_img = inspect_side(int(sw / 2.75), 0, 720, 0, 480, sh)
    # Inspect back of bomb.
    win_util.mouse_up(mid_x, mid_y, btn="right")
    sleep(0.5)
    return_tupl = (front_img, left_img, right_img, top_img, bottom_img)
    if num_modules is None or num_modules > 5:
        flip_bomb(sw, sh)
        back_img = screenshot(460, 220, 1000, 640)
        sleep(0.4)
        win_util.mouse_up(mid_x, mid_y, btn="right")
        return_tupl = (back_img, ) + return_tupl
    else:
        win_util.click(200, 200, btn="right")
        sleep(0.4)
        win_util.click(mid_x, mid_y + (mid_y // 8))
        sleep(0.5)
    return return_tupl