dustyroo

Untitled

Mar 29th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.60 KB | None | 0 0
  1. from time import sleep
  2. from random import uniform, randint
  3. from keyboard import wait, send, add_hotkey
  4. from pyautogui import pixelMatchesColor, keyDown, keyUp, moveRel, position, click, alert, typewrite
  5. import threading
  6.  
  7. fail_safe = 0
  8. shut_down = 0
  9. on_off = 0
  10. click_one = 1
  11. click_two = 1
  12. move_one = 1
  13. time_to_wait = uniform(0.12, 0.16)
  14. chat_sell = 0
  15. look_chance = 60#%
  16. move_chance = 50#%
  17.  
  18. def toggle():
  19. global on_off
  20. global fail_safe
  21. first_cord, second_cord = position()
  22. if pixelMatchesColor(first_cord, second_cord, (0, 0, 0), tolerance=20) is True:
  23. fail_safe = 1
  24. print('STAY SAFE!')
  25. if pixelMatchesColor(first_cord, second_cord, (37, 0, 18), tolerance=10) is True:
  26. if on_off == 0:
  27. on_off = 1
  28. print('Script toggled OFF!')
  29. sleep(2)
  30. elif on_off == 1:
  31. on_off = 0
  32. print('Script toggled back ON!')
  33. sleep(2)
  34. else:
  35. return
  36.  
  37. def chat():
  38. global chat_sell
  39. if on_off == 0:
  40. if chat_sell >= 500:
  41. send('.')
  42. typewrite(' /market Buying Lapis/blocks $3k, hay $600, BeetRoots $128, Normal Clay $225, Xp, selling Vote Crates all @ /as tp 52 !', interval=0.07)
  43. send('enter')
  44. chat_sell = 0
  45. chat_sell += 1
  46. print('AD: '+str(500-chat_sell))
  47. else:
  48. return
  49.  
  50. def look():
  51. if on_off == 0:
  52. first_cord, second_cord = position()
  53. if pixelMatchesColor(first_cord, second_cord, (95, 95, 0), tolerance=20) is True or pixelMatchesColor(first_cord, second_cord, (148, 148, 0), tolerance=30) is True:
  54. moveRel(-50,0, duration=0.17)
  55. elif pixelMatchesColor(first_cord, second_cord, (0, 89, 0), tolerance=30) is True or pixelMatchesColor(first_cord, second_cord, (0, 45, 0), tolerance=30) is True:
  56. moveRel(40,0, duration=0.17)
  57. elif pixelMatchesColor(first_cord, second_cord, (46, 0, 93), tolerance=20) is True or pixelMatchesColor(first_cord, second_cord, (36, 0, 72), tolerance=20) is True:
  58. moveRel(-110,0, duration=0.17)
  59. elif pixelMatchesColor(first_cord, second_cord, (178, 89, 0), tolerance=20) is True or pixelMatchesColor(first_cord, second_cord, (197, 98, 0), tolerance=20) is True:
  60. moveRel(110,0, duration=0.17)
  61. else:
  62. return
  63. else:
  64. return
  65.  
  66. def attack():
  67. global click_two
  68. global click_one
  69. if on_off == 0:
  70. first_cord, second_cord = position()
  71. if pixelMatchesColor(first_cord, second_cord, (186, 112, 186), tolerance=20) is True or pixelMatchesColor(first_cord, second_cord, (135, 81, 135), tolerance=30) is True:
  72. chance = randint(1, 100)
  73. if chance >= look_chance:
  74. #print('Hit Chance ='+ str(chance))
  75. if click_two == 1:
  76. click()
  77. moveRel(3,2, duration=0.1)
  78. click_two = 2
  79. else:
  80. if click_two == 2:
  81. click()
  82. moveRel(-3,-2, duration=0.1)
  83. click_two = 1
  84. elif click_one == 1:
  85. click()
  86. moveRel(-40,3, duration=0.17)
  87. click_one = 2
  88. else:
  89. if click_one == 2:
  90. click()
  91. moveRel(40,-3, duration=0.17)
  92. click_one = 1
  93. else:
  94. return
  95. else:
  96. return
  97.  
  98. def move():
  99. global move_one
  100. if on_off == 0:
  101. first_cord, second_cord = position()
  102. if pixelMatchesColor(first_cord, second_cord, (169, 56, 93), tolerance=20) is True or pixelMatchesColor(first_cord, second_cord, (90, 18, 90), tolerance=30) is True or pixelMatchesColor(first_cord, second_cord, (203, 76, 127), tolerance=20) is True:
  103. chance = randint(1, 100)
  104. if chance >= move_chance:
  105. #print('Move Chance ='+ str(chance))
  106. if move_one == 1:
  107. keyDown('a')
  108. send('backspace')
  109. sleep(time_to_wait)
  110. keyUp('a')
  111. move_one = 2
  112. elif move_one == 2:
  113. keyDown('d')
  114. send('backspace')
  115. sleep(time_to_wait)
  116. keyUp('d')
  117. move_one = 1
  118. else:
  119. return
  120. else:
  121. return
  122.  
  123. while fail_safe == 0:
  124. shut_down += 1
  125. toggle()
  126. #chat()
  127. look()
  128. attack()
  129. move()
  130. if shut_down > 669:
  131. fail_safe = 1
Add Comment
Please, Sign In to add comment