def sendMouseRightClickEx(self, x=300, y=300, count=1, shift=False, sleep=300): lparam = win32api.MAKELONG(x, y) if not shift: win32api.PostMessage(self.hwnd, win32con.WM_RBUTTONDOWN, win32con.VK_RBUTTON, lparam) win32api.PostMessage(self.hwnd, win32con.WM_RBUTTONUP, win32con.VK_RBUTTON, lparam) return win32api.PostMessage(self.hwnd, win32con.WM_KEYDOWN, win32con.VK_SHIFT, 0) for a in range(count): win32api.PostMessage(self.hwnd, win32con.WM_RBUTTONDOWN, win32con.VK_RBUTTON, lparam) win32api.PostMessage(self.hwnd, win32con.WM_RBUTTONUP, win32con.VK_RBUTTON, lparam) libs.rSleep(300) win32api.PostMessage(self.hwnd, win32con.WM_KEYUP, win32con.VK_SHIFT, 0) if shift: wparam = win32con.MK_SHIFT | win32con.MK_RBUTTON else: wparam = win32con.MK_RBUTTON for a in range(count): win32api.PostMessage(self.hwnd, win32con.WM_RBUTTONDOWN, wparam, lparam) win32api.PostMessage(self.hwnd, win32con.WM_RBUTTONUP, wparam, lparam) libs.sleep(sleep)
def __sendMouseLeftClick(self, x=300, y=300, count=1, shift=False): lparam = win32api.MAKELONG(x, y) if shift: wparam = win32con.MK_SHIFT | win32con.MK_LBUTTON else: wparam = win32con.MK_LBUTTON for a in range(count): win32api.PostMessage(self.hwnd, win32con.WM_LBUTTONDOWN, wparam, lparam) win32api.PostMessage(self.hwnd, win32con.WM_LBUTTONUP, wparam, lparam) libs.rSleep(300)
def sendMouseLeftClickEx(self, x, y, count=1, shift=False, sleep=300): lparam = win32api.MAKELONG(x, y) if not shift: win32api.PostMessage(self.hwnd, win32con.WM_LBUTTONDOWN, win32con.VK_LBUTTON, lparam) win32api.PostMessage(self.hwnd, win32con.WM_LBUTTONUP, win32con.VK_LBUTTON, lparam) return win32api.PostMessage(self.hwnd, win32con.WM_KEYDOWN, win32con.VK_SHIFT, 0) for a in range(count): win32api.PostMessage(self.hwnd, win32con.WM_LBUTTONDOWN, win32con.VK_LBUTTON, lparam) win32api.PostMessage(self.hwnd, win32con.WM_LBUTTONUP, win32con.VK_LBUTTON, lparam) libs.rSleep(300) win32api.PostMessage(self.hwnd, win32con.WM_KEYUP, win32con.VK_SHIFT, 0)
def sendMouseLeftClick2(self): #(388, 236) class POINT(Structure): _fields_ = [("x", c_ulong), ("y", c_ulong)] #byref(pt) pt = POINT() pt.x = 126 #396 pt.y = 225 #233 pt2 = POINT() pt.x = 0 pt.y = 0 #lparam = win32api.MAKELONG(388, 236) lparam = win32api.MAKELONG(0, 0) lparam2 = win32api.MAKELONG(126, 225) libs.rSleep(300) #win32api.PostMessage(self.hwnd, win32con.WM_NCLBUTTONDOWN, win32con.HTCLIENT, pt) #win32api.PostMessage(self.hwnd, win32con.WM_NCLBUTTONUP, win32con.HTCLIENT, pt) # windll.user32.PostMessageA(self.hwnd, win32con.WM_NCLBUTTONDOWN, win32con.VK_LBUTTON, pt) # windll.user32.PostMessageA(self.hwnd, win32con.WM_NCLBUTTONUP, win32con.VK_LBUTTON, pt) # win32api.PostMessage(self.hwnd, win32con.WM_NCMOUSEMOVE, win32con.HTCLIENT, pt) # win32api.PostMessage(self.hwnd, win32con.WM_MOUSEMOVE, win32con.MK_LBUTTON, lparam2) # win32api.PostMessage(self.hwnd, win32con.WM_LBUTTONDOWN, win32con.VK_LBUTTON, lparam2) # win32api.PostMessage(self.hwnd, win32con.WM_LBUTTONUP, win32con.VK_LBUTTON, lparam2) # win32api.PostMessage(self.hwnd, win32con.WM_MOUSEO, win32con.VK_LBUTTON, lparam2) # win32api.PostMessage(self.hwnd, win32con.WM_LBUTTONUP, win32con.VK_LBUTTON, lparam2) x, y = self._getDesktopCoordinate(126, 225) self.setCursorPos(396, 233) libs.rSleep(200) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
def _into_start_point(self): if self.isInMenu(): libs.rSleep(300) self.clickContinueGameButton() return libs.rSleep(300) self.exit() if self.waitMenu(): libs.rSleep(300) self.clickContinueGameButton() return
def exit(self): self.ctl.sendESC() libs.rSleep(1800) self.ctl.clickLeft(397, 281)
def war(self): self.ctl.setCursorPos(790, 274) libs.sleep(300) self.ctl.sendKey("1") libs.rSleep(300) self.ctl.setCursorPos(326, 345) libs.rSleep(100) self.ctl.swingStandingLefta(8, 500) self.ctl.setCursorPos(497, 275) libs.sleep(100) self.ctl.swingStandingRighta(8, 500) self.ctl.sendKey("4") libs.rSleep(400) self.ctl.sendKey("2") libs.sleep(400) # Hero self.ctl.sendKey("3") libs.rSleep(400) self.ctl.sendKey("3") libs.rSleep(400) # Volcano self.ctl.clickMouseRightButton() libs.rSleep(400) self.ctl.clickMouseRightButton() self.ctl.swingStandingLefta(9, 500) self.ctl.swingStandingRighta(9, 500) self.ctl.sendKey("2") libs.rSleep(200) self.ctl.swingStandingLefta(11, 500) self.ctl.swingStandingRighta(11, 500) #pickItems() #imagePickItem() self.ctl.move(529, 232) libs.rSleep(1200) self.ctl.move(40, 374) libs.rSleep(1800) self.ctl.move(524, 195) libs.rSleep(1700)
def goFront(self): self.ctl.select(757, 123) libs.rSleep(2700) self.ctl.select(588, 241) libs.rSleep(1500) self.ctl.move(404, 367) libs.rSleep(800) self.ctl.move(789, 149) libs.rSleep(2400) self.ctl.move(782, 174) libs.rSleep(2400) #self.ctl.move(629, 201) self.ctl.move(580, 230) libs.rSleep(1800)
def exitToMenu(self): if self.isInMenu(): return self.ctl.sendESC() libs.rSleep(500) self.ctl.clickLeft(397, 281) return self.waitMenu()
def waitTown(self): for a in range(60): if self.isInTown(): return True libs.rSleep(500) return False
def waitMenu(self): for a in range(60): if self.isInMenu(): return True libs.rSleep(500) return False
def select(self, x, y): self.setCursorPos(x,y) libs.rSleep(300) self.sendMouse(x, y)