mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-15 22:19:18 +00:00
Fix: Handle missing EFFECT_NOTIFICATION when entering forgotten hall
This commit is contained in:
parent
3e5a9d4625
commit
3f0bdb6aa3
Binary file not shown.
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 8.4 KiB |
@ -27,10 +27,10 @@ ENTER_FORGOTTEN_HALL_DUNGEON = ButtonWrapper(
|
||||
name='ENTER_FORGOTTEN_HALL_DUNGEON',
|
||||
share=Button(
|
||||
file='./assets/share/forgotten_hall/ENTER_FORGOTTEN_HALL_DUNGEON.png',
|
||||
area=(1233, 653, 1241, 680),
|
||||
search=(1213, 633, 1261, 700),
|
||||
color=(219, 221, 221),
|
||||
button=(1233, 653, 1241, 680),
|
||||
area=(989, 649, 1231, 684),
|
||||
search=(969, 629, 1251, 704),
|
||||
color=(214, 214, 217),
|
||||
button=(989, 649, 1231, 684),
|
||||
),
|
||||
)
|
||||
ENTRANCE_CHECKED = ButtonWrapper(
|
||||
|
@ -151,19 +151,24 @@ class ForgottenHallUI(DungeonUI):
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
if np.mean(get_color(self.device.image, ENTER_FORGOTTEN_HALL_DUNGEON.area)) > 128:
|
||||
if self._forgotten_hall_enter_appear():
|
||||
logger.info("First character is chosen")
|
||||
break
|
||||
if interval.reached():
|
||||
self.device.click(FIRST_CHARACTER)
|
||||
interval.reset()
|
||||
|
||||
def _forgotten_hall_enter_appear(self):
|
||||
# White button, with a color of (214, 214, 214)
|
||||
color = get_color(self.device.image, ENTER_FORGOTTEN_HALL_DUNGEON.area)
|
||||
return np.mean(color) > 180
|
||||
|
||||
def _enter_forgotten_hall_dungeon(self, skip_first_screenshot=True):
|
||||
"""
|
||||
called after team is set
|
||||
"""
|
||||
interval = Timer(1)
|
||||
joystick = MapControlJoystick(self.config, self.device)
|
||||
interval = Timer(3)
|
||||
timeout = Timer(3)
|
||||
while 1: # enter ui -> popup
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
@ -172,11 +177,19 @@ class ForgottenHallUI(DungeonUI):
|
||||
|
||||
if self.appear(EFFECT_NOTIFICATION):
|
||||
break
|
||||
if self.match_template_color(DUNGEON_ENTER_CHECKED):
|
||||
if timeout.reached():
|
||||
logger.info('Wait dungeon EFFECT_NOTIFICATION timeout')
|
||||
break
|
||||
else:
|
||||
timeout.reset()
|
||||
|
||||
if interval.reached() and np.mean(get_color(self.device.image, ENTER_FORGOTTEN_HALL_DUNGEON.area)) > 128:
|
||||
if interval.reached() and self._forgotten_hall_enter_appear():
|
||||
self.device.image_save()
|
||||
self.device.click(ENTER_FORGOTTEN_HALL_DUNGEON)
|
||||
interval.reset()
|
||||
|
||||
joystick = MapControlJoystick(self.config, self.device)
|
||||
skip_first_screenshot = True
|
||||
while 1: # pop up -> dungeon inside
|
||||
if skip_first_screenshot:
|
||||
|
Loading…
Reference in New Issue
Block a user