Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. import win32api, win32con, random
  2. import keyboard
  3. from time import sleep
  4. import _thread
  5. global skip
  6.  
  7. gX = 1535
  8. gY = 1369
  9.  
  10. clickBound = (.04, .06)
  11. destroySleep = (1.4, 1.6)
  12.  
  13. def rightClick(x,y):
  14. win32api.SetCursorPos((x,y))
  15. sleep(random.uniform(0.06,0.08))
  16. win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN,x,y,0,0)
  17. sleep(random.uniform(0.02,0.04))
  18. win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP,x,y,0,0)
  19.  
  20. def click(x,y):
  21. win32api.SetCursorPos((x,y))
  22. sleep(random.uniform(0.06,0.08))
  23. win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
  24. sleep(random.uniform(0.02,0.04))
  25. win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
  26.  
  27. def on_triggered():
  28. global skip
  29. print("Triggered!")
  30. if skip:
  31. keyboard.release('1')
  32. skip = False
  33. else:
  34. skip = True
  35. keyboard.press('1')
  36.  
  37. def addOrSubtractRandomly(base, delta):
  38. if random.randint(0,1):
  39. return base + random.randint(0, delta)
  40. else:
  41. return base - random.randint(0, delta)
  42.  
  43.  
  44.  
  45. def keyboardReader():
  46. keyboard.wait('esc')
  47.  
  48. def pressOne():
  49. while(True):
  50. sleep(0.1)
  51. keyboard.press('1')
  52.  
  53.  
  54. keyboard.add_hotkey('q', on_triggered)
  55. skip = True
  56.  
  57. # print("Press ESC to stop.")
  58. # keyboard.wait('esc')
  59.  
  60. _thread.start_new_thread(keyboardReader, ())
  61. _thread.start_new_thread(pressOne, ())
  62.  
  63. first = True
  64.  
  65. #starting state door closed inventory full, servant talking
  66.  
  67. while True:
  68. if not skip:
  69. ## left click
  70. if first:
  71. sleep(1)
  72. first = False
  73.  
  74. click(gX,gY)
  75. sleep(random.uniform(2, 2.5))
  76. #right click
  77. rightClick(gX,gY)
  78. sleep(random.uniform(clickBound[0], clickBound[1]))
  79. #left click
  80. click(gX,gY)
  81. sleep(random.uniform(destroySleep[0], destroySleep[1]))
  82. #wait
  83.  
  84. #right click
  85. rightClick(gX,gY)
  86. #left click
  87. sleep(random.uniform(clickBound[0], clickBound[1]))
  88. click(gX,gY)
  89. sleep(random.uniform(1.8, 2.15))
  90.  
  91. #right click
  92. rightClick(gX,gY)
  93. sleep(random.uniform(clickBound[0], clickBound[1]))
  94. #left click
  95. click(gX,gY)
  96. sleep(random.uniform(destroySleep[0], destroySleep[1]))
  97. #wait
  98.  
  99. #right click
  100. rightClick(gX,gY)
  101. #left click
  102. sleep(random.uniform(clickBound[0], clickBound[1]))
  103. click(gX,gY)
  104. sleep(random.uniform(6.2, 7.6))
  105.  
  106.  
  107. #wait
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement