Skip to content

Commit

Permalink
Fix: #329
Browse files Browse the repository at this point in the history
  • Loading branch information
moesnow committed Sep 12, 2024
1 parent eada83d commit b7ae1ee
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion assets/docs/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 更新日志

## v2.5.2
## v2.5.3

### 新功能
- 支持 2.5 版本新增关卡
Expand All @@ -11,6 +11,7 @@

### 修复
- 部分文字 OCR 识别异常
- 支援功能在高分屏下异常 [#329](https://github.com/moesnow/March7thAssistant/issues/329)
- 修复拟造花萼(赤)错行 [#328](https://github.com/moesnow/March7thAssistant/issues/328)
- 延长逐光捡金等待场景加载的时间 [#322](https://github.com/moesnow/March7thAssistant/issues/322)
- 优化饰品提取开始挑战的逻辑 [#325](https://github.com/moesnow/March7thAssistant/issues/325)
Expand Down
1 change: 1 addition & 0 deletions tasks/game/starrailcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,4 @@ def check_resolution_ratio(self, target_width: int, target_height: int) -> None:
time.sleep(2)
else:
self.log_debug(f"游戏分辨率: {window_width}x{window_height}")
self.log_debug(f"桌面分辨率: {screen_width}x{screen_height}")
10 changes: 5 additions & 5 deletions tasks/power/character.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ def find_and_select_support(type):
@staticmethod
def find_character_and_click(key, value, width, height):
"""查找支援角色并点击"""
crop = (40.0 / 1920, 152.0 / 1080, 531.0 / 1920, 809.0 / 1080)
matchs = auto.find_element("./assets/images/share/character/" + key + ".png", "image_with_multiple_targets", 0.8,
max_retries=1, scale_range=0.9, crop=(40.0 / 1920, 152.0 / 1080, 531.0 / 1920, 809.0 / 1080))
max_retries=1, scale_range=0.9, crop=crop, relative=True)
for match in matchs:
crop_new = (match[1][0] / width, match[0][1] / height, 402.0 / 1920, 43.0 / 1080)
if value == "" or auto.find_element(value, "text", crop=crop_new, include=True):
x, y = auto.calculate_click_position(match)
auto.mouse_click(x, y)
top_right = (match[1][0] + width * crop[0], match[0][1] + height * crop[1])
crop_new = (top_right[0] / width, top_right[1] / height, 402.0 / 1920, 43.0 / 1080)
if value == "" or auto.click_element(value, "text", crop=crop_new, include=True):
time.sleep(1)
return True
return False
Expand Down
4 changes: 2 additions & 2 deletions tasks/power/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ def func(): return auto.click_element(("传送", "进入", "追踪"), "min_dista
return False
# 验证传送是否成功
if "饰品提取" in instance_type:
if not auto.find_element(instance_name, "text", max_retries=60, include=True, crop=(591.0 / 1920, 98.0 / 1080, 594.0 / 1920, 393.0 / 1080)):
if not auto.find_element(instance_name, "text", max_retries=120, include=True, crop=(591.0 / 1920, 98.0 / 1080, 594.0 / 1920, 393.0 / 1080)):
Base.send_notification_with_screenshot(cfg.notify_template['InstanceNotCompleted'].format(error="传送可能失败"))
return False
else:
if not auto.find_element(instance_name.replace("2", ""), "text", max_retries=60, include=True, crop=(1172.0 / 1920, 5.0 / 1080, 742.0 / 1920, 636.0 / 1080)):
if not auto.find_element(instance_name.replace("2", ""), "text", max_retries=120, include=True, crop=(1172.0 / 1920, 5.0 / 1080, 742.0 / 1920, 636.0 / 1080)):
Base.send_notification_with_screenshot(cfg.notify_template['InstanceNotCompleted'].format(error="传送可能失败"))
return False

Expand Down
4 changes: 2 additions & 2 deletions tasks/power/power.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ def process_ornament(instance_type, instance_name, power):
time.sleep(1)

# 需要判断是否有可用存档
if auto.find_element("无可用存档", "text", max_retries=2, crop=(688.0 / 1920, 289.0 / 1080, 972.0 / 1920, 369.0 / 1080), include=True):
if auto.find_element("无可用存档", "text", crop=(688.0 / 1920, 289.0 / 1080, 972.0 / 1920, 369.0 / 1080), include=True):
# 刷差分宇宙存档
if Universe.start(nums=1, save=False, category="divergent"):
# 验证存档
screen.change_to('guide3')
auto.click_element(instance_type, "text", crop=instance_type_crop)
# 等待界面完全停止
time.sleep(1)
if auto.find_element("无可用存档", "text", max_retries=2, crop=(688.0 / 1920, 289.0 / 1080, 972.0 / 1920, 369.0 / 1080), include=True):
if auto.find_element("无可用存档", "text", crop=(688.0 / 1920, 289.0 / 1080, 972.0 / 1920, 369.0 / 1080), include=True):
log.error("暂无可用存档")
return
else:
Expand Down

0 comments on commit b7ae1ee

Please sign in to comment.