-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui_module.py
More file actions
121 lines (98 loc) · 3.18 KB
/
gui_module.py
File metadata and controls
121 lines (98 loc) · 3.18 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import pygetwindow as gw
import pyautogui
import cv2
import numpy as np
import time
window_title = '原神'
app_window = gw.getWindowsWithTitle(window_title)[0]
x_window, y_window, width, height = app_window.left, app_window.top, app_window.width, app_window.height
def screenshot():
shot = pyautogui.screenshot(region=(x_window, y_window, width, height))
image_np = np.array(shot)
img = cv2.cvtColor(image_np, cv2.COLOR_RGB2BGR)
image = img[29:930, 8:1608]
return image
def sure():
"""
点击确认按钮
"""
x = x_window + 789
y = y_window + 789
pyautogui.click(x, y, clicks=1, button='left')
print('INFO:已点击')
def clean():
time.sleep(1)
pyautogui.click(797 + x_window, 443 + y_window, clicks=2, button='left')
def end():
print('INFO:将结束本回合')
time.sleep(2)
pyautogui.click(64 + x_window, 445 + y_window, clicks=1, button='left')
time.sleep(1)
pyautogui.click(169 + x_window, 445 + y_window, clicks=1, button='left')
time.sleep(5)
def harmony(t):
"""
调和手牌
"""
for _ in range(t):
x1 = 840 + x_window
y1 = 900 + y_window
x2 = 1551 + x_window
y2 = 499 + y_window
pyautogui.click(797 + x_window, 443 + y_window, clicks=2, button='left')
time.sleep(0.5)
pyautogui.click(x1, y1, clicks=2, button='left')
pyautogui.mouseDown()
time.sleep(0.5)
pyautogui.mouseUp()
pyautogui.click(x1, y1, clicks=1, button='left')
pyautogui.moveTo(x2, y2, duration=0.1)
pyautogui.mouseUp()
pyautogui.click(x2, y2, clicks=2, button='left')
time.sleep(1)
pyautogui.mouseDown()
pyautogui.mouseUp()
print('INFO:已调和')
time.sleep(1)
x = x_window + 789
y = y_window + 789
pyautogui.click(x, y, clicks=1, button='left')
print('INFO:已点击')
time.sleep(1)
clean()
def click_dice(where: list[bool]):
"""
点击重投骰子
"""
screenshot()
dices = [(318, 504), (318, 695), (318, 878), (318, 1067), (523, 504), (523, 695), (523, 878), (523, 1067)]
for num, point in enumerate(where):
if point:
y1, x1 = dices[num]
y = y_window + y1
x = x_window + x1
pyautogui.click(x, y, clicks=1, button='left')
time.sleep(0.05)
print('INFO:已点击')
sure()
def click_skill(what): # 123技能
skill_x = [1316, 1423, 1500]
pyautogui.click(skill_x[what - 1] + x_window, 807 + y_window, clicks=1, button='left')
time.sleep(0.5)
pyautogui.mouseDown()
time.sleep(0.5)
pyautogui.mouseUp()
def change(who):
change_x = [619, 791, 972]
if who <= 2:
pyautogui.click(change_x[who] + x_window, 626 + y_window, clicks=1, button='left')
time.sleep(1.4)
pyautogui.moveTo(1519 + x_window, 798 + y_window, duration=0.1)
pyautogui.mouseDown()
time.sleep(0.35)
pyautogui.mouseUp()
pyautogui.mouseDown()
time.sleep(0.35)
pyautogui.mouseUp()
clean()
time.sleep(5)