Fix: Handle light cone drop from Echo of War (#171)

This commit is contained in:
LmeSzinc 2023-11-02 11:39:15 +08:00
parent 1e4db4eef0
commit 881389efce
6 changed files with 38 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -13,6 +13,23 @@ BATTLE_PASS_NOTIFICATION = ButtonWrapper(
button=(895, 595, 1180, 630),
),
)
GET_LIGHT_CONE = ButtonWrapper(
name='GET_LIGHT_CONE',
cn=Button(
file='./assets/cn/base/popup/GET_LIGHT_CONE.png',
area=(205, 321, 242, 339),
search=(185, 301, 262, 359),
color=(130, 130, 131),
button=(205, 321, 242, 339),
),
en=Button(
file='./assets/en/base/popup/GET_LIGHT_CONE.png',
area=(260, 322, 306, 338),
search=(240, 302, 326, 358),
color=(147, 147, 148),
button=(260, 322, 306, 338),
),
)
GET_REWARD = ButtonWrapper(
name='GET_REWARD',
share=Button(

View File

@ -96,3 +96,20 @@ class PopupHandler(ModuleBase):
return True
return False
def handle_get_light_cone(self, interval=2) -> bool:
"""
Popup when getting a light cone from Echo of War.
Args:
interval:
Returns:
If handled.
"""
if self.appear(GET_LIGHT_CONE, interval=interval):
logger.info(f'{GET_LIGHT_CONE} -> {GET_REWARD}')
self.device.click(GET_REWARD)
return True
return False

View File

@ -321,6 +321,8 @@ class UI(MainPage):
return True
if self.handle_monthly_card_reward():
return True
if self.handle_get_light_cone():
return True
if self.appear(COMBAT_PREPARE, interval=5):
logger.info(f'UI additional: {COMBAT_PREPARE} -> {CLOSE}')
self.device.click(CLOSE)

View File

@ -306,6 +306,8 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo
logger.info(f'{COMBAT_AGAIN} -> {COMBAT_EXIT}')
self.device.click(COMBAT_EXIT)
continue
if self.handle_get_light_cone():
continue
def is_trailblaze_power_exhausted(self) -> bool:
flag = self.config.stored.TrailblazePower.value < self.combat_wave_cost