-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquickGrab.py
96 lines (81 loc) · 2.13 KB
/
quickGrab.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import ImageGrab
import os
import time
import win32api
import win32con
import ImageOps
from numpy import *
class cord:
load_career = (670, 465)
start_battle = (795, 670)
arena_1 = (140, 90)
arena_2 = (140, 200)
arena_3 = (140, 310)
arena_4 = (140, 420)
arena_5 = (140, 530)
arena_6 = (365, 90)
arena_7 = (365, 200)
arena_8 = (365, 310)
arena_9 = (365, 420)
arena_10 = (365, 530)
save_game = (870, 565)
#GLobals
#--------
x_pad = 469
y_pad = 128
def screenGrab():
box = (x_pad+1,y_pad+1,x_pad+960,y_pad+720)
im = ImageGrab.grab(box)
im.save(os.getcwd() + '\\full_snap__' + str(int(time.time())) +
'.png', 'PNG')
def screenJack():
box = (x_pad+1,y_pad+1,x_pad+960,y_pad+720)
im = ImageGrab.grab(box)
#im.save(os.getcwd() + '\\full_snap__' + str(int(time.time())) +
#'.png', 'PNG')
return im
def grab():
box = (x_pad + 1,y_pad+1,x_pad+960,y_pad+720)
im = ImageOps.grayscale(ImageGrab.grab(box))
a = array(im.getcolors())
a = a.sum()
print a
return a
def leftClick():
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
time.sleep(.1)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
print "Click." #completely optional. But nice for debugging purposes.
def leftDown():
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
time.sleep(.1)
print 'left Down'
def leftUp():
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
time.sleep(.1)
print 'left release'
def mousePos(cord):
win32api.SetCursorPos((x_pad + cord[0], y_pad + cord[1]))
def get_cords():
x,y = win32api.GetCursorPos()
x = x - x_pad
y = y - y_pad
print x,y
def startGame():
#location of first menu
mousePos(cord.load_career)
leftClick()
time.sleep(3)
mousePos(cord.start_battle)
leftClick()
time.sleep(3)
mousePos(cord.arena_2)
leftClick()
time.sleep(3)
def main():
time.sleep(5)
win32api.mouse_event(win32con.MOUSEEVENTF_WHEEL,0,0,-1060)
time.sleep(3)
startGame()
if __name__ == '__main__':
main()