Exemplo n.º 1
0
def upgrade_gem(empowered, choose_gem):
    handle = win32gui.FindWindow('D3 Main Window Class', 'Diablo III')
    if handle:
        upgrade = transform_coordinates(handle, 280, 550)

        if not choose_gem:
            first_gem = transform_coordinates(handle, 100, 640)
            send_mouse(handle, 'LM', first_gem[0], first_gem[1])
            sleep(0.1)
        try:
            if not empowered:
                for i in range(4):
                    print("gemup " + str(i))
                    if i == 3:
                        send_key(handle, 't')
                    send_mouse(handle, 'LM', upgrade[0], upgrade[1])
                    macro_sleep(1.8)
            else:
                for i in range(5):
                    print("gemup emp " + str(i))
                    if i == 4:
                        send_key(handle, 't')
                    send_mouse(handle, 'LM', upgrade[0], upgrade[1])
                    macro_sleep(1.8)
        except StopMacro:
            pass
Exemplo n.º 2
0
def leave_game():
    handle = win32gui.FindWindow('D3 Main Window Class', 'Diablo III')
    if handle:
        leave = transform_coordinates(handle, 230, 475)

        send_key(handle, 'esc')
        send_mouse(handle, 'LM', leave[0], leave[1])
Exemplo n.º 3
0
def drop_inventory(spare_columns):
    handle = win32gui.FindWindow('D3 Main Window Class', 'Diablo III')
    if handle:
        item = transform_coordinates(handle, 1875, 585, rel='right')
        step = transform_coordinates(handle, 50, 50)
        x, y = win32gui.ScreenToClient(handle, win32api.GetCursorPos())

        send_key(handle, 'c')
        for i in range(6):
            for j in range(10 - spare_columns):
                send_mouse(handle, 'LM', item[0] - j * step[0], item[1] + i * step[1])
                send_mouse(handle, 'LM', x, y)
        send_key(handle, 'c')
Exemplo n.º 4
0
def skill_macro(keys, delays):
    global is_running
    global timers
    handle = win32gui.FindWindow('D3 Main Window Class', 'Diablo III')
    print(is_running)
    if handle and not is_running:
        is_running = True
        for i, (hotkey, delay) in enumerate(zip(keys, delays)):
            if hotkey and delay:
                if i < 4:
                    timers.append(
                        RepeatedTimer(delay / 100,
                                      lambda x=hotkey: send_key(handle, x)))
                elif i == 4:
                    # ggf. press shift
                    x, y = win32gui.ScreenToClient(handle,
                                                   win32api.GetCursorPos())
                    timers.append(
                        RepeatedTimer(delay / 100,
                                      lambda: send_mouse(handle, 'LM', x, y)))
                elif i == 5:
                    x, y = win32gui.ScreenToClient(handle,
                                                   win32api.GetCursorPos())
                    timers.append(
                        RepeatedTimer(delay / 100,
                                      lambda: send_mouse(handle, 'RM', x, y)))
        [t.start() for t in timers]
    elif is_running:
        [t.stop() for t in timers]
        timers = []
        is_running = False
Exemplo n.º 5
0
def port_town(act):
    handle = win32gui.FindWindow('D3 Main Window Class', 'Diablo III')
    if handle:
        act_coords = map_act_coords_by_act(act)
        town_coords = map_town_coords_by_act(act)

        bw_map = transform_coordinates(handle, 895, 125, rel='middle')
        act = transform_coordinates(handle, act_coords[0], act_coords[1], rel='middle')
        town = transform_coordinates(
            handle, town_coords[0], town_coords[1], rel='middle'
        )

        send_key(handle, 'm')
        send_mouse(handle, 'LM', bw_map[0], bw_map[1])
        send_mouse(handle, 'LM', act[0], act[1])
        send_mouse(handle, 'LM', town[0], town[1])
Exemplo n.º 6
0
def tpA2Temple():
    handle = win32gui.FindWindow('D3 Main Window Class', 'Diablo III')
    if handle:
        # open map
        send_key(handle, 'm')
        sleep(0.2)
        # reduce map
        map = transform_coordinates(handle, 895, 130)
        send_mouse(handle, 'LM', map[0], map[1])
        sleep(0.2)
        # select A2
        map = transform_coordinates(handle, 1090, 520)
        send_mouse(handle, 'LM', map[0], map[1])
        sleep(0.2)
        # select temple bounty
        map = transform_coordinates(handle, 1430, 380)
        send_mouse(handle, 'LM', map[0], map[1])
Exemplo n.º 7
0
def tpa1HoA1():
    handle = win32gui.FindWindow('D3 Main Window Class', 'Diablo III')
    if handle:
        # open map
        send_key(handle, 'm')
        sleep(0.2)
        # reduce map
        map = transform_coordinates(handle, 895, 130)
        send_mouse(handle, 'LM', map[0], map[1])
        sleep(0.2)
        # select A1
        map = transform_coordinates(handle, 740, 620)
        send_mouse(handle, 'LM', map[0], map[1])
        sleep(0.2)
        # select HoA1
        map = transform_coordinates(handle, 467, 380)
        send_mouse(handle, 'LM', map[0], map[1])
Exemplo n.º 8
0
def swap_armor(items):
    handle = win32gui.FindWindow('D3 Main Window Class', 'Diablo III')
    if handle:
        item_coords = []
        for i in range(items):
            item_coords.append(
                transform_coordinates(handle, 1425, 580 + i * 100,
                                      rel='right'))

        send_key(handle, 'c')
        for i, coords in enumerate(item_coords):
            if i == 1:
                send_key_down(handle, 'alt')
                send_mouse(handle, 'RM', coords[0], coords[1])
                send_key_up(handle, 'alt')
            else:
                send_mouse(handle, 'RM', coords[0], coords[1])
        send_key(handle, 'c')
Exemplo n.º 9
0
def upgrade_gem(screenshot, handle):
    x1, y1, x2, y2 = win32gui.GetClientRect(handle)
    uhrsi = os.path.join(wd, f'./images/{x2 - x1}_{y2 - y1}/urhsi.png')
    x1, y1 = transform_coordinates(handle, 220, 30)
    x2, y2 = transform_coordinates(handle, 300, 100)
    img = crop_image(screenshot, x1, y1, x2, y2)
    if image_search(uhrsi, img, precision=0.8):
        x1, y1, x2, y2 = win32gui.GetClientRect(handle)
        images_to_find = [
            os.path.join(
                wd, f'./images/{x2 - x1}_{y2 - y1}/urhsi_upgrade_{i}.png')
            for i in range(1, 6)
        ]
        x1, y1 = transform_coordinates(handle, 270, 530)
        x2, y2 = transform_coordinates(handle, 355, 560)
        upgrade = transform_coordinates(handle, 280, 550)

        upgrade_img = crop_image(screenshot, x1, y1, x2, y2)

        if image_search(images_to_find[4], upgrade_img, precision=0.95):
            send_mouse(handle, 'LM', upgrade[0], upgrade[1])
            print('Found 5 Upgrades left!')
        elif image_search(images_to_find[3], upgrade_img, precision=0.95):
            send_mouse(handle, 'LM', upgrade[0], upgrade[1])
            print('Found 4 Upgrades Left!')
        elif image_search(images_to_find[2], upgrade_img, precision=0.95):
            send_mouse(handle, 'LM', upgrade[0], upgrade[1])
            #send_key(handle, 't')
            print('Found 3 Upgrades Left!')
        elif image_search(images_to_find[1], upgrade_img, precision=0.95):
            send_mouse(handle, 'LM', upgrade[0], upgrade[1])
            send_key(handle, 't')
            print('Found 2 Upgrades Left!')
        elif image_search(images_to_find[0], upgrade_img, precision=0.95):
            send_mouse(handle, 'LM', upgrade[0], upgrade[1])
            send_key(handle, 't')
            print('Found 1 Upgrades Left!')
Exemplo n.º 10
0
def lower_difficulty():
    handle = win32gui.FindWindow('D3 Main Window Class', 'Diablo III')
    if handle:
        lower = transform_coordinates(handle, 1700, 400, rel='right')

        send_key(handle, 'esc')
        for i in range(19):
            send_mouse(handle, 'LM', lower[0], lower[1])
            send_key(handle, 'enter')
        send_key(handle, 'esc')
Exemplo n.º 11
0
def salvage(spare_columns):
    handle = win32gui.FindWindow('D3 Main Window Class', 'Diablo III')
    if handle:
        menu = transform_coordinates(handle, 517, 480)
        anvil = transform_coordinates(handle, 165, 295)
        item = transform_coordinates(handle, 1875, 585, rel='right')
        step = transform_coordinates(handle, 50, 50)

        send_mouse(handle, 'LM', menu[0], menu[1])  # Salvage Menu
        send_mouse(handle, 'LM', anvil[0], anvil[1])  # Click Salvage Button
        for i in range(6):
            for j in range(10 - spare_columns):
                send_mouse(handle, 'LM', item[0] - j * step[0], item[1] + i * step[1])
                send_key(handle, 'enter')
                send_key(handle, 'enter')
        send_key(handle, 'esc')