Skip to content

Commit 2aeb5b7

Browse files
committed
更新
1 parent 6183f30 commit 2aeb5b7

File tree

12 files changed

+122
-51
lines changed

12 files changed

+122
-51
lines changed

assets/main_window/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version": "v2.3.0"}
1+
{"version": "v2.3.0.1"}

multithread/run.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ def install_ocr(self):
9090
temp_path = join(env.workdir, "cache")
9191
temp_name = basename(env.OCR.exe_name + ".zip")
9292
load_path = join(temp_path, temp_name)
93-
_load = ("https://gitee.com/api/v5/repos/huixinghen/SucroseGameAssistant/"
94-
"releases?page=1&per_page=20")
93+
_load = "https://github.moeyy.xyz/"
9594
response = requests.get(_load, timeout=10)
9695
if response.status_code == 200:
9796
urlretrieve(env.OCR.load_url, load_path)
-113 Bytes
Binary file not shown.
63 Bytes
Binary file not shown.
501 Bytes
Binary file not shown.

task/snow/daily.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ def snow_daily(self):
144144
wait_text("升", (869, 323, 1051, 408))
145145
self.indicate("武器升级一次")
146146
click_pic(r"assets\snow\picture\home.png", zone=(1504, 0, 1771, 117))
147-
click_pic(r"assets\snow\picture\home.png", zone=(1504, 0, 1771, 117))
148147
wait(500)
149148
if self.task["领取日常"]:
150149
click_text("任务", (1440, 311, 1555, 403))

task/snow/fight.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ def snow_fight(self):
4040
if "无" not in pt and pt:
4141
click((401, 451))
4242
wait(600)
43-
click((1285, 729))
44-
wait(600)
43+
click_to_text((1285, 729), "选择", (843, 512, 1099, 565))
4544
click_change((1356, 837), (1257, 804, 1413, 864))
4645
wait_text("获得道具", (809, 40, 1113, 147))
4746
press_to_text("esc", "任务", (1458, 330, 1529, 379))
@@ -53,8 +52,7 @@ def snow_fight(self):
5352
click_change((1055, 35), (1031, 17, 1078, 53))
5453
click((669, 454))
5554
wait(600)
56-
click((1285, 729))
57-
wait(600)
55+
click_to_text((1285, 729), "选择", (843, 512, 1099, 565))
5856
click_change((1356, 837), (1257, 804, 1413, 864))
5957
wait_text("获得道具", (809, 40, 1113, 147))
6058
press_to_text("esc", "任务", (1458, 330, 1529, 379))

task/snow/main.py

Lines changed: 93 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,15 @@ def snow_launch(self):
6060
if name == "snow_launcher.exe":
6161
env.soft.set_path(_path)
6262
env.soft.set_hwnd_find(1, "wailsWindow", "尘白禁区启动器")
63+
_value = env.soft.run(fls=False)
64+
_laucher = 1
65+
env.soft.compile_resolution = (1280, 748)
6366
elif name == "SeasunGame.exe":
6467
env.soft.set_path(_path)
6568
env.soft.set_hwnd_find(1, "Qt5159QWindowIcon", "西山居启动器-尘白禁区")
69+
_value = env.soft.run(fls=False)
70+
_laucher = 2
71+
env.soft.compile_resolution = (1280, 768)
6672
else:
6773
self.indicate("尘白禁区,无效启动路径")
6874
raise ValueError("尘白禁区:无效启动路径")
@@ -71,8 +77,6 @@ def snow_launch(self):
7177
raise ValueError("尘白禁区:无效启动路径")
7278
# 启动游戏
7379
for u in range(2):
74-
_value = env.soft.run(fls=False)
75-
env.soft.compile_resolution = (1280, 749)
7680
# env.soft.get_window_information(False)
7781
env.mode(3)
7882
if _value == 1:
@@ -88,7 +92,7 @@ def snow_launch(self):
8892
env.soft.foreground()
8993
wait(1000)
9094

91-
if self.task["预下载"]:
95+
if self.task["预下载"] and _laucher == 1:
9296
_value = ocr((781, 585, 950, 734))
9397
if "下" in _value:
9498
click_change((879, 668), (559, 317, 713, 391))
@@ -98,7 +102,7 @@ def snow_launch(self):
98102
wait(500)
99103
else:
100104
self.indicate("暂无预下载")
101-
if self.lauch_prepare():
105+
if self.lauch_prepare(_laucher):
102106
for p in range(10): # 0, "UnrealWindow", "尘白禁区"
103107
_h = find_hwnd((0, "UnrealWindow", "尘白禁区"))
104108
if _h:
@@ -120,43 +124,95 @@ def snow_launch(self):
120124
# wait(500)
121125
# click_text("开始游戏", (1004, 646, 1151, 701))
122126
# wait(500)
123-
raise RuntimeError("尘白禁区:启动超时")
127+
env.soft.kill()
128+
env.soft.run(fls=False)
129+
# raise RuntimeError("尘白禁区:启动超时")
124130
raise RuntimeError("尘白禁区:启动异常")
125131

126-
def lauch_prepare(self):
127-
for i in range(120):
128-
if find_hwnd((0, "UnrealWindow", "尘白禁区")):
129-
return True
130-
_value = ocr((1004, 646, 1151, 701))
131-
if "开始游戏" in _value:
132-
click_change((1073, 673), (1004, 646, 1151, 701))
133-
wait(5000)
134-
return True
135-
elif "获取更新" in _value:
136-
if self.task["更新"]:
137-
click_change((1073, 673), (718, 476, 821, 536))
138-
click_change((750, 499), (718, 476, 821, 536))
132+
def lauch_prepare(self, _laucher):
133+
if _laucher == 1:
134+
error = 0
135+
for i in range(120):
136+
if find_hwnd((0, "UnrealWindow", "尘白禁区")):
137+
return True
138+
_value = ocr((1004, 646, 1151, 701))[0]
139+
if "开始游戏" in _value:
140+
click_change((1073, 673), (1004, 646, 1151, 701))
141+
wait(5000)
142+
return True
143+
elif "获取更新" in _value:
144+
if self.task["更新"]:
145+
click_change((1073, 673), (718, 476, 821, 536))
146+
click_change((750, 499), (718, 476, 821, 536))
147+
error = 0
148+
else:
149+
self.indicate("尘白禁区:需要更新,当前未勾选自动更新,终止任务")
150+
raise RuntimeError("尘白禁区:需要更新,当前未勾选自动更新,终止任务")
151+
elif "检查更新" in _value:
152+
for t in range(180):
153+
_v = ocr((1004, 646, 1151, 701))
154+
if "检查更新" in _v:
155+
wait(2000)
156+
else:
157+
break
158+
# _value1 = ocr((578, 465, 749, 549), sc)
159+
# _value2 = ocr((1004, 646, 1151, 701), sc)
160+
# del sc
161+
# if "确定" in _value1:
162+
# click_change((639, 499), (578, 465, 749, 549))
163+
else:
164+
raise RuntimeError("尘白禁区:更新超时")
165+
elif "更新中" in _value:
166+
pos = wait_text("开始游戏", (1004, 646, 1151, 701), (2000, 100))
167+
click_change(pos, (1004, 646, 1151, 701))
168+
wait(5000)
169+
return True
139170
else:
140-
self.indicate("尘白禁区:需要更新,当前未勾选自动更新,终止任务")
141-
raise RuntimeError("尘白禁区:需要更新,当前未勾选自动更新,终止任务")
142-
elif "检查更新" in _value:
143-
for t in range(180):
144-
_value = ocr((578, 465, 749, 549))
145-
if "确定" in _value:
146-
click_change((639, 499), (578, 465, 749, 549))
147-
return False
171+
error += 1
172+
if error >= 5:
173+
print(_value)
174+
print(env.soft.frame, env.soft.zoom)
175+
print(screenshot((1004, 646, 1151, 701)))
176+
raise RuntimeError("尘白禁区:未知错误")
177+
wait(2000)
178+
return False
179+
elif _laucher == 2:
180+
error = 0
181+
for i in range(120):
182+
if find_hwnd((0, "UnrealWindow", "尘白禁区")):
183+
return True
184+
_value = ocr((966, 693, 1200, 750))[0]
185+
if "开始游戏" in _value:
186+
click_change((1087, 720), (966, 693, 1200, 750))
187+
wait(5000)
188+
return True
189+
elif "更新" in _value:
190+
if self.task["更新"]:
191+
click_change((1087, 720), (966, 693, 1200, 750))
192+
for t in range(180):
193+
_v = ocr((966, 693, 1200, 750))
194+
if "正在更新" in _v:
195+
wait(2000)
196+
else:
197+
break
198+
# _value1 = ocr((578, 465, 749, 549), sc)
199+
# _value2 = ocr((1004, 646, 1151, 701), sc)
200+
# del sc
201+
# if "确定" in _value1:
202+
# click_change((639, 499), (578, 465, 749, 549))
203+
else:
204+
raise RuntimeError("尘白禁区:更新超时")
205+
206+
else:
207+
self.indicate("尘白禁区:需要更新,当前未勾选自动更新,终止任务")
208+
raise RuntimeError("尘白禁区:需要更新,当前未勾选自动更新,终止任务")
209+
else:
210+
error += 1
211+
if error >= 5:
212+
print(env.soft.frame, env.soft.zoom)
213+
print(screenshot((1004, 646, 1151, 701)))
214+
raise RuntimeError("尘白禁区:未知错误")
148215
wait(2000)
149-
raise RuntimeError("尘白禁区:更新超时")
150-
elif "更新中" in _value:
151-
pos = wait_text("开始游戏", (1004, 646, 1151, 701), (2000, 100))
152-
click_change(pos, (1004, 646, 1151, 701))
153-
wait(5000)
154-
return True
155-
else:
156-
print(env.soft.frame, env.soft.zoom)
157-
print(screenshot((1004, 646, 1151, 701)))
158-
raise RuntimeError("尘白禁区:未知错误")
159-
return False
160216

161217
def snow_log(self, second: int):
162218
# 登录&进入游戏

tools/keymouse.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ def click(self, xy):
3030
if (x, y) != (0, 0):
3131
x, y = self.axis_change(x, y)
3232
SetCursorPos((x, y))
33+
sleep(0.01)
3334
mouse_event(2, x, y)
35+
sleep(0.01)
3436
mouse_event(4, x, y)
37+
sleep(0.01)
3538

3639
def drag(self, pos, mov):
3740
xp, yp = self.axis_change(pos[0], pos[1])

tools/ocr/check_ocr.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ class OCR:
66
def __init__(self):
77
if CPUFeature["AVX2"]:
88
self.exe_name = "PaddleOCR-json_v.1.3.1(simplify)"
9-
self.load_url = ""
9+
self.load_url = ("https://github.moeyy.xyz/"
10+
"https://github.com/Kin-L/SucroseGameAssistant/releases/download/ocr/"
11+
"PaddleOCR-json_v.1.3.1.simplify.zip")
1012
self.exe_path = r"3rd_package\PaddleOCR-json_v.1.3.1(simplify)\PaddleOCR-json.exe"
1113
logger.debug("CPU 支持 AVX2 指令集,使用 PaddleOCR-json")
1214
else:
1315
self.exe_name = "RapidOCR-json_v0.2.0(simplify)"
14-
self.load_url = ""
16+
self.load_url = ("https://github.moeyy.xyz/"
17+
"https://github.com/Kin-L/SucroseGameAssistant/releases/download/ocr/"
18+
"RapidOCR-json_v0.2.0.simplify.zip")
1519
self.exe_path = r"3rd_package\RapidOCR-json_v0.2.0(simplify)\RapidOCR-json.exe"
1620
logger.debug("CPU 不支持 AVX2 指令集,使用 RapidOCR-json")
1721
if not isfile(join(env.workdir, self.exe_path)):

0 commit comments

Comments
 (0)