mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-23 00:52:22 +00:00
Fix: 修复夜间委托捕捉
This commit is contained in:
parent
1c2db1ec26
commit
f9f0b59657
@ -136,7 +136,6 @@ python -m uiautomator2 init
|
||||
|
||||
- **GUI启动慢, uiautomator2启动慢**
|
||||
- **无法处理网络波动** 重连弹窗, 跳小黄鸡
|
||||
- **处理夜间委托的弹窗可能出错** 有捕捉, 但是可能会在一些奇怪的时间弹出来
|
||||
- **会显示绿脸黄脸红脸, 红脸出击确认** 这个是瓜游心情值更新BUG的锅了, 只要填对了`RECOVER_PER_HOUR` 和 `EMOTION_LIMIT` 就不会红脸出击, 或者保证一直处于经验加成状态.
|
||||
- **演习可能SL失败** 演习看的是屏幕上方的血槽, 血槽可能被立绘遮挡, 因此需要一定时间(默认1s)血量低于一定值(默认40%)才会触发SL. 一个血皮后排就有30%左右的血槽, 所以别以为在1s内被打掉40%是不可能的. 另外如果后排立绘过大且CD重叠严重, 建议增大确认时间(比如3s), 或者换皮肤, 这样可以减少误判.
|
||||
- **极少数情况下ADB和uiautomator2会抽风**
|
||||
|
@ -1,6 +1,5 @@
|
||||
from datetime import datetime, time
|
||||
|
||||
from module.base.timer import Timer
|
||||
from module.device.app import AppControl
|
||||
from module.device.control import Control
|
||||
from module.device.screenshot import Screenshot
|
||||
@ -9,7 +8,7 @@ from module.logger import logger
|
||||
|
||||
|
||||
class Device(Screenshot, Control, AppControl):
|
||||
def handle_night_commission(self, hour=21, threshold=5):
|
||||
def handle_night_commission(self, hour=21, threshold=30):
|
||||
"""
|
||||
Args:
|
||||
hour (int): Hour that night commission refresh.
|
||||
@ -24,35 +23,20 @@ class Device(Screenshot, Control, AppControl):
|
||||
if now > time(hour, 0, threshold):
|
||||
return False
|
||||
|
||||
logger.info('Handling night commission')
|
||||
wait = Timer(10)
|
||||
wait.start()
|
||||
|
||||
while 1:
|
||||
super().screenshot()
|
||||
|
||||
if GET_MISSION.appear_on(self.image):
|
||||
super().click(GET_MISSION)
|
||||
|
||||
if wait.reached():
|
||||
break
|
||||
|
||||
logger.info('Handle night commission finished')
|
||||
if GET_MISSION.match(self.image, offset=True):
|
||||
logger.info('Night commission appear.')
|
||||
self.click(GET_MISSION)
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def screenshot(self):
|
||||
"""
|
||||
Returns:
|
||||
PIL.Image.Image:
|
||||
"""
|
||||
self.handle_night_commission()
|
||||
return super().screenshot()
|
||||
|
||||
def click(self, button):
|
||||
self.handle_night_commission()
|
||||
return super().click(button)
|
||||
|
||||
def swipe(self, vector, box=(123, 159, 1193, 628), random_range=(0, 0, 0, 0), padding=15, duration=(0.1, 0.2)):
|
||||
self.handle_night_commission()
|
||||
return super().swipe(vector=vector, box=box, random_range=random_range, padding=padding, duration=duration)
|
||||
super().screenshot()
|
||||
if self.handle_night_commission():
|
||||
super().screenshot()
|
||||
|
||||
return self.image
|
||||
|
Loading…
Reference in New Issue
Block a user