diff --git a/assets/cn/base/popup/GET_LIGHT_CONE.png b/assets/cn/base/popup/GET_LIGHT_CONE.png new file mode 100644 index 000000000..0a88e28ad Binary files /dev/null and b/assets/cn/base/popup/GET_LIGHT_CONE.png differ diff --git a/assets/en/base/popup/GET_LIGHT_CONE.png b/assets/en/base/popup/GET_LIGHT_CONE.png new file mode 100644 index 000000000..b524f8acf Binary files /dev/null and b/assets/en/base/popup/GET_LIGHT_CONE.png differ diff --git a/tasks/base/assets/assets_base_popup.py b/tasks/base/assets/assets_base_popup.py index e640e5659..89ac6b632 100644 --- a/tasks/base/assets/assets_base_popup.py +++ b/tasks/base/assets/assets_base_popup.py @@ -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( diff --git a/tasks/base/popup.py b/tasks/base/popup.py index 074140bc4..000194150 100644 --- a/tasks/base/popup.py +++ b/tasks/base/popup.py @@ -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 diff --git a/tasks/base/ui.py b/tasks/base/ui.py index da63c2312..c93af5f33 100644 --- a/tasks/base/ui.py +++ b/tasks/base/ui.py @@ -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) diff --git a/tasks/combat/combat.py b/tasks/combat/combat.py index 905656dd2..d26d29bb4 100644 --- a/tasks/combat/combat.py +++ b/tasks/combat/combat.py @@ -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