diff options
Diffstat (limited to 'bot.py')
-rw-r--r-- | bot.py | 90 |
1 files changed, 90 insertions, 0 deletions
@@ -0,0 +1,90 @@ | |||
1 | # from pyautogui import * | ||
2 | import pyautogui | ||
3 | from time import sleep | ||
4 | |||
5 | |||
6 | def move(_pos, _now): | ||
7 | if _pos == 'left' and _now == 'left': | ||
8 | pyautogui.typewrite(['left']) | ||
9 | pyautogui.typewrite(['left']) | ||
10 | elif _pos == 'left' and _now == 'right': | ||
11 | pyautogui.typewrite(['right']) | ||
12 | pyautogui.typewrite(['right']) | ||
13 | elif _pos == 'right' and _now == 'right': | ||
14 | pyautogui.typewrite(['right']) | ||
15 | pyautogui.typewrite(['right']) | ||
16 | elif _pos == 'right' and _now == 'left': | ||
17 | pyautogui.typewrite(['left']) | ||
18 | pyautogui.typewrite(['left']) | ||
19 | |||
20 | width, height = pyautogui.size() | ||
21 | width *= 0.5 | ||
22 | pyautogui.moveTo(333, 600) | ||
23 | pyautogui.click() | ||
24 | |||
25 | posY = [360, 260, 160] | ||
26 | posX = [276, 398] | ||
27 | |||
28 | q = ['left', 'left', 'left'] | ||
29 | |||
30 | im = pyautogui.screenshot(region=(0, 0, width, height)) | ||
31 | l0 = im.getpixel((posX[0], posY[0])) | ||
32 | l1 = im.getpixel((posX[0], posY[1])) | ||
33 | l2 = im.getpixel((posX[0], posY[2])) | ||
34 | |||
35 | r0 = im.getpixel((posX[1], posY[0])) | ||
36 | r1 = im.getpixel((posX[1], posY[1])) | ||
37 | r2 = im.getpixel((posX[1], posY[2])) | ||
38 | |||
39 | if l0[0] == 161 and l0[1] == 116 and l0[2] == 56: | ||
40 | q[0] = 'right' | ||
41 | pos = 'right' | ||
42 | else: | ||
43 | pos = 'left' | ||
44 | if l1[0] == 161 and l1[1] == 116 and l1[2] == 56: | ||
45 | q[1] = 'right' | ||
46 | if l2[0] == 161 and l2[1] == 116 and l2[2] == 56: | ||
47 | q[2] = 'right' | ||
48 | |||
49 | qlen = 3 | ||
50 | |||
51 | while True: | ||
52 | if qlen == 3: | ||
53 | now = q[0] | ||
54 | move(pos, now) | ||
55 | now = q[1] | ||
56 | move(pos, now) | ||
57 | now = q[2] | ||
58 | move(pos, now) | ||
59 | qlen = 0 | ||
60 | elif qlen == 0: | ||
61 | im = pyautogui.screenshot(region=(0, 0, width, height)) | ||
62 | l0 = im.getpixel((posX[0], posY[0])) | ||
63 | l1 = im.getpixel((posX[0], posY[1])) | ||
64 | l2 = im.getpixel((posX[0], posY[2])) | ||
65 | |||
66 | r0 = im.getpixel((posX[1], posY[0])) | ||
67 | r1 = im.getpixel((posX[1], posY[1])) | ||
68 | r2 = im.getpixel((posX[1], posY[2])) | ||
69 | |||
70 | if l0[0] == 161 and l0[1] == 116 and l0[2] == 56: | ||
71 | q[0] = 'right' | ||
72 | else: | ||
73 | q[0] = 'left' | ||
74 | if l1[0] == 161 and l1[1] == 116 and l1[2] == 56: | ||
75 | q[1] = 'right' | ||
76 | else: | ||
77 | q[1] = 'left' | ||
78 | if l2[0] == 161 and l2[1] == 116 and l2[2] == 56: | ||
79 | q[2] = 'right' | ||
80 | else: | ||
81 | q[2] = 'left' | ||
82 | |||
83 | now = q[0] | ||
84 | move(pos, now) | ||
85 | now = q[1] | ||
86 | move(pos, now) | ||
87 | now = q[2] | ||
88 | move(pos, now) | ||
89 | |||
90 | sleep(0.095) | ||