-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainBot.py
executable file
·69 lines (48 loc) · 1.36 KB
/
mainBot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import time
from PIL import ImageGrab,ImageOps
import pyautogui
from numpy import *
blackMode = False
last =0
class Cordinates():
replayBtn = (1452, 824)
dinoCore = (522, 200, 552, 225)
colorChecker = (100, 150, 150, 200)
def isLightMode():
captureBox = (Cordinates.colorChecker[0], Cordinates.colorChecker[1], Cordinates.colorChecker[2], Cordinates.colorChecker[3])
image = ImageGrab.grab(captureBox)
grayImage = ImageOps.grayscale(image)
a = array(grayImage.getcolors())
print(a.sum())
if(a.sum() == 2755):
return True
else:
return False
def restartGame():
pyautogui.click(Cordinates.replayBtn)
def pressSpace():
pyautogui.keyDown('space')
time.sleep(0.01)
print('jump')
pyautogui.keyUp('space')
def imageGrab():
captureBox = (Cordinates.dinoCore[0], Cordinates.dinoCore[1], Cordinates.dinoCore[2], Cordinates.dinoCore[3])
image = ImageGrab.grab(captureBox)
grayImage = ImageOps.grayscale(image)
a = array(grayImage.getcolors())
if(isLightMode() == False):
print(a.sum())
return a.sum()
time.sleep(4)
# restartGame()
# restartGame()
# time.sleep(1)
while True:
if (isLightMode()):
if (imageGrab() != 1005):
print("lolL")
pressSpace()
else:
if (imageGrab() != 750):
print("lolD")
pressSpace()