Beispiel #1
0
 def watch_screen(self):
     while True:
         handle = win32gui.FindWindow('D3 Main Window Class', 'Diablo III')
         if (
             handle
             and win32gui.GetForegroundWindow() == handle
             and any(
                 (
                     self.settings.special['auto_start'],
                     self.settings.special['auto_open'],
                     self.settings.special['auto_gamble'],
                     self.settings.special['auto_upgrade_gem'],
                     self.settings.special['auto_accept_gr'],
                 )
             )
             and not self.paused
         ):
             try:
                 screenshot = get_image(handle)
                 if self.settings.special['auto_start']:
                     Thread(
                         target=screen_search.start_game, args=(screenshot, handle)
                     ).start()
                 if self.settings.special['auto_open']:
                     Thread(
                         target=screen_search.open_rift,
                         args=(
                             screenshot,
                             handle,
                             self.settings.special['auto_open_option'],
                         ),
                     ).start()
                 if self.settings.special['auto_gamble']:
                     Thread(
                         target=screen_search.gamble,
                         args=(
                             screenshot,
                             handle,
                             self.settings.special['gamble_item'],
                         ),
                     ).start()
                 if self.settings.special['auto_accept_gr']:
                     Thread(
                         target=screen_search.accept_gr, args=(screenshot, handle)
                     ).start()
                 if self.settings.special['auto_upgrade_gem']:
                     Thread(
                         target=screen_search.upgrade_gem, args=(screenshot, handle)
                     ).start()
             except:
                 print('Handle not found or sth')
         sleep(0.3)
Beispiel #2
0
def reforge_ancient_primal(speed):
    handle = win32gui.FindWindow('D3 Main Window Class', 'Diablo III')

    stop = False
    nmax = 1000

    try:
        if handle:
            while not stop and nmax > 0:

                if interrupt_key():
                    break

                nmax = nmax - 1

                item = transform_coordinates(handle, 1425, 580, rel='right')
                fill = transform_coordinates(handle, 710, 840)
                trans = transform_coordinates(handle, 250, 830)
                bw = transform_coordinates(handle, 580, 850)
                fw = transform_coordinates(handle, 850, 850)

                send_mouse(handle, 'RM', item[0], item[1])  # Item
                sleepSpeedConv(speed)
                send_mouse(handle, 'LM', fill[0], fill[1])  # Fill
                sleepSpeedConv(speed)
                send_mouse(handle, 'LM', trans[0], trans[1])  # Transmute
                sleepSpeedConv(speed)
                send_mouse(handle, 'LM', bw[0], bw[1])  # Backwards
                sleepSpeedConv(speed)
                send_mouse(handle, 'LM', fw[0], fw[1])  # Forth
                sleepSpeedConv(speed)
                send_mouse(handle, 'RM', item[0], item[1])  # Item
                sleepSpeedConv(speed)
                send_mousemove(handle, item[0], item[1])  # Hover
                sleep(0.1)

                # screenshot
                screenshot = get_image(handle)
                if foundAncient(screenshot, handle) or foundPrimal(
                        screenshot, handle):
                    stop = True
    except StopMacro:
        pass