From adecbf52213d1addc84d59adbe7877b2f6a0e28c Mon Sep 17 00:00:00 2001 From: JabLuszko Date: Sat, 2 Sep 2023 20:40:51 +0200 Subject: [PATCH] New screen Limitations aka most likely better MAINTENANCE (#1362) * Update utils.py * Update utils.py * Update screenPath.py * Update screen_type.py * Update AbstractWorkerStrategy.py * Update screenPath.py * Update screenPath.py --- mapadroid/ocr/screenPath.py | 13 +++++++++++-- mapadroid/ocr/screen_type.py | 1 + mapadroid/ocr/utils.py | 3 ++- mapadroid/worker/strategy/AbstractWorkerStrategy.py | 3 +++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/mapadroid/ocr/screenPath.py b/mapadroid/ocr/screenPath.py index 0d35cc115..89ae195a0 100644 --- a/mapadroid/ocr/screenPath.py +++ b/mapadroid/ocr/screenPath.py @@ -326,6 +326,11 @@ async def __handle_screentype(self, screentype: ScreenType, logger.warning('Account saw maintenance warning!') await self._account_handler.mark_burnt(self._worker_state.device_id, BurnType.MAINTENANCE) + elif screentype == ScreenType.LIMITATIONS: + self._nextscreen = ScreenType.UNDEFINED + logger.warning('Account saw limitations/maintenance warning!') + await self._account_handler.mark_burnt(self._worker_state.device_id, + BurnType.MAINTENANCE) elif screentype == ScreenType.POGO: screentype = await self.__check_pogo_screen_ban_or_loading(screentype, y_offset=y_offset) elif screentype == ScreenType.QUEST: @@ -418,8 +423,12 @@ async def __handle_google_login(self, screentype) -> ScreenType: async def __handle_retry_screen(self, diff, global_dict) -> None: self._nextscreen = ScreenType.UNDEFINED - click_text = 'DIFFERENT,AUTRE,AUTORISER,ANDERES,KONTO,ACCOUNT' - await self.__click_center_button_text(click_text, diff, global_dict) + # forcing clear_game_data here due to Niantic changes and game now remembering/pre-filling username on login + await self.clear_game_data() + # after clear_game_data there should be no reason to click this button as game gets killed + # but let's leave it here if Niantic decides this is a bug rather than QOL change + #click_text = 'DIFFERENT,AUTRE,AUTORISER,ANDERES,KONTO,ACCOUNT' + #await self.__click_center_button_text(click_text, diff, global_dict) async def __click_center_button_text(self, click_text, diff, global_dict): n_boxes = len(global_dict['text']) diff --git a/mapadroid/ocr/screen_type.py b/mapadroid/ocr/screen_type.py index 3ac2bb9e9..a45875c10 100644 --- a/mapadroid/ocr/screen_type.py +++ b/mapadroid/ocr/screen_type.py @@ -35,6 +35,7 @@ class ScreenType(Enum): WILLOWNAME = 35 # Professor Blabla asking for name. ADVENTURESYNC = 36 # Adventure Sync overlay after tutorial. One blue button: Turn it On! WILLOWGO = 37 # Professor Blabla at end of tutorial. + LIMITATIONS = 38 # Most likely new MAINTENANCE/24h cooldown POGO = 99 # uhm, whatever... At least pogo is topmost, no idea where we are yet tho (in the process of switching) ERROR = 100 # some issue occurred while handling screentypes or not able to determine screen BLACK = 110 # screen is black, likely loading up game diff --git a/mapadroid/ocr/utils.py b/mapadroid/ocr/utils.py index f3c0326a8..a4f145423 100644 --- a/mapadroid/ocr/utils.py +++ b/mapadroid/ocr/utils.py @@ -42,7 +42,8 @@ 34: ['nearby!', 'Nahe!', 'pres'], 35: ['Congratulations!', 'Gluckwunsch!', 'felicitations!', 'first', 'erstes', 'abord'], 36: ['Sync'], - 37: ['PokéStops.'] + 37: ['PokéStops.'], + 38: ['limitations'] } diff --git a/mapadroid/worker/strategy/AbstractWorkerStrategy.py b/mapadroid/worker/strategy/AbstractWorkerStrategy.py index bf615728a..19a3d9d8b 100644 --- a/mapadroid/worker/strategy/AbstractWorkerStrategy.py +++ b/mapadroid/worker/strategy/AbstractWorkerStrategy.py @@ -371,6 +371,9 @@ async def _handle_screen(self): elif screen_type == ScreenType.MAINTENANCE: logger.warning("Maintenance screen - switch account ...") await self._switch_user() + elif screen_type == ScreenType.LIMITATIONS: + logger.warning("Limitations/Maintenance screen - switch account ...") + await self._switch_user() elif screen_type in [ScreenType.ERROR, ScreenType.FAILURE]: logger.warning('Something wrong with screendetection or pogo failure screen') self._worker_state.login_error_count += 1