Skip to content

Commit

Permalink
问题修复
Browse files Browse the repository at this point in the history
  • Loading branch information
Shasnow committed Jan 13, 2025
1 parent 66a569e commit 62da3bd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
10 changes: 4 additions & 6 deletions StarRailAssistant/core/SRAssistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@ def trailblazer_profile(self):
"""Mission trailblaze profile"""
logger.info("执行任务:签证奖励")
if click("res/img/more_with_something.png"):
moveRel(20, 0)
if click("res/img/trailblazer_profile_finished.png"):
if click("res/img/assistance_reward.png"):
time.sleep(2)
Expand Down Expand Up @@ -887,11 +886,8 @@ def daily_training_reward(self):
logger.info("没有可领取的奖励")
press_key("esc")
else:
while True:
if click("res/img/daily_reward.png"):
moveRel(0, -80)
else:
break
while click("res/img/daily_reward.png"):
moveRel(0,50)
if click("res/img/daily_train_reward.png"):
time.sleep(2)
press_key("esc", presses=2, interval=2)
Expand Down Expand Up @@ -1047,6 +1043,8 @@ def divergent_universe(self, times: int):
if not click("res/img/launch_differential_universe.png"):
logger.error("发生错误,错误编号22")
return False
if check("res/img/close.png",max_time=5):
press_key("esc")
if check("res/img/equation_select.png", max_time=10):
click_point(*get_screen_center())
click("res/img/ensure2.png")
Expand Down
16 changes: 9 additions & 7 deletions StarRailAssistant/utils/SRAOperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ def _get_screenshot(cls, title: str = ""):
win = matching_windows[0]
win.activate()
region = (win.left, win.top, win.width, win.height)
# region = cls._screenshot_region_calculate(region)
region = cls._screenshot_region_calculate(region)
pillow_img = pyscreeze.screenshot(region=region)
# pillow_img.show()
# return cls._image_resize(pillow_img)
return pillow_img
return cls._image_resize(pillow_img)
# return pillow_img

@classmethod
def _image_resize(cls, pillow_image: Image):
Expand All @@ -99,9 +99,9 @@ def _location_calculator(cls, x, y):
cls.location_proportion = width / 1920
return x * cls.location_proportion, y * cls.location_proportion
else:
# cls.location_proportion = 1 / cls.screenshot_proportion
# return x * cls.location_proportion + cls.area_left, y * cls.location_proportion + cls.area_top
return x, y
cls.location_proportion = 1 / cls.screenshot_proportion
return x * cls.location_proportion + cls.area_left, y * cls.location_proportion + cls.area_top
# return x, y

@classmethod
def _locator(cls, img_path, x_add=0, y_add=0, title="崩坏:星穹铁道") -> tuple[int, int]:
Expand All @@ -112,7 +112,8 @@ def _locator(cls, img_path, x_add=0, y_add=0, title="崩坏:星穹铁道") ->
if cls.cloud:
location = pyautogui.locate(img, cls._get_screenshot(), confidence=cls.confidence)
else:
location = pyautogui.locateOnWindow(img, title, confidence=cls.confidence)
# location = pyautogui.locateOnWindow(img, title, confidence=cls.confidence)
location = pyautogui.locate(img,cls._get_screenshot(title),confidence=cls.confidence)
x, y = pyautogui.center(location)
x += x_add
y += y_add
Expand Down Expand Up @@ -395,3 +396,4 @@ def wait_battle_end(cls) -> bool:
continue
except pyscreeze.PyScreezeException:
continue

8 changes: 7 additions & 1 deletion res/ui/main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ li.checked::marker { content: "\2612"; }
<rect>
<x>0</x>
<y>0</y>
<width>650</width>
<width>735</width>
<height>576</height>
</rect>
</property>
Expand Down Expand Up @@ -1120,6 +1120,12 @@ li.checked::marker { content: &quot;\2612&quot;; }
<property name="whatsThis">
<string>置信度越大对图片精度要求越高</string>
</property>
<property name="minimum">
<double>0.010000000000000</double>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
Expand Down

0 comments on commit 62da3bd

Please sign in to comment.