def __init__(self, state=None): PyMouseEvent.__init__(self) self._sp = screen_pixel.screen_pixel() self._state = state self._first_click = True # [Trying to account for differences in OSX/Windows]: if sys.platform == 'darwin': self._y_offset = 0 #-40 #-80 #-75 ??? else: self._y_offset = -30 if state == 'mouse_actionbar': print( '[Go click your fishing_pole on your actionbar! Come back here!]' ) self._yield_skills = self.yield_actionbar_skills() elif state == 'scanarea' or state == 'health' or state == 'login': print( '[Calibrating {0}: Click at the top-left of the area, then click on the lower-right area you want to scan.]' .format(state)) elif state == 'tooltip': self._sp.capture() self._nemo = self._sp._numpy print( 'Click at the top-left of the tooltip, then again on the lower-right of the tooltip.]' ) else: print('[mouse_calibrator started without state]') sys.exit(1)
def __init__(self, state=None): PyMouseEvent.__init__(self) self._sp = screen_pixel.screen_pixel() self._state = state # [Trying to account for differences in OSX/Windows]: if sys.platform == 'darwin': self._y_offset = -80 #-75 ??? else: self._y_offset = -30 if state == 'mouse_actionbar': print( '[Go click your fishing_pole on your actionbar! Come back here!]' ) self._yield_skills = self.yield_actionbar_skills() elif state == 'scanarea' or state == 'health' or state == 'login': print( '[Calibrating {0}: Click at the top-left of the area, && drag to lower-right and release click.]' .format(state)) self._sp.capture() self._nemo = self._sp._numpy # [Windows might need this at 50% in WoW too?]: if sys.platform == 'darwin': self._nemo = self._sp.resize_image(self._nemo, scale_percent=50) cv2.imshow('Calibrate {0}'.format(state), self._nemo) cv2.moveWindow('Calibrate {0}'.format(state), 0, 0) elif state == 'tooltip': print( 'Click at the top-left of the tooltip, && drag to lower-right and release.]' ) self._sp.capture( ) #Capture so we can get width/height, pass in the numpy array: self._nemo = self._sp.grab_rect( { "x": int(self._sp._width / 2), "y": int(self._sp._height / 2) }, { "x": int(self._sp._width), "y": int(self._sp._height) }, mod=1, nemo=self._sp._numpy) cv2.imshow('Calibrate Tooltip', self._nemo) cv2.moveWindow('Calibrate Tooltip', 0, 0) else: print('[mouse_calibrator started without state]') sys.exit(1)
def __init__(self, file_name=None, save_npz=False): self._action_items = [] self._action_memory = [] self._save_npz = save_npz self._file_name = file_name self._sp = screen_pixel.screen_pixel() self._omni = omni_listener.omni_listener(self) # [Get screen info]: (Can Wrap action_items[] with header in save_sequence so we can use this info for replay normalization(?)) (_os, _resolution, _retina) = self._sp._get_screen_info() self._OS = _os self._RETINA = _retina self._RESOLUTION = _resolution print('_OS: {0}'.format(_os)) print('_RETINA: {0}'.format(_retina)) print('_RESOLUTION: {0}'.format(_resolution))
def __init__(self): self.sp = screen_pixel.screen_pixel() self.pa = pyaudio.PyAudio() self.setup_audio()