Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust MITMBase to only open and close Questlog #1051

Merged
merged 2 commits into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions mapadroid/worker/MITMBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,59 +277,10 @@ def _clear_quests(self, delayadd, openmenu=True):
self.logger.debug("_clear_quests Open menu: {}, {}", int(x), int(y))
time.sleep(6 + int(delayadd))

if self._enhanced_mode:
x, y = self._resocalc.get_close_main_button_coords(self)
self._communicator.click(int(x), int(y))
return

x, y = self._resocalc.get_quest_listview(self)
self._communicator.click(int(x), int(y))
self.logger.debug("_clear_quests Open field: {}, {}", int(x), int(y))
time.sleep(4 + int(delayadd))

trashcancheck = self._get_trash_positions(full_screen=True)
self.logger.debug("_clear_quests Found trash: {}", trashcancheck)
if trashcancheck is None:
self.logger.error('Could not find any trashcan - abort')
return
if len(trashcancheck) == 0:
self._clear_quests_failcount += 1
if self._clear_quests_failcount < 3:
self.logger.warning("Could not find any trashcan on a valid screenshot {} time(s) in a row!",
self._clear_quests_failcount)
else:
self._clear_quests_failcount = 0
self.logger.error("Unable to clear quests 3 times in a row. Restart pogo ...")
if not self._restart_pogo(mitm_mapper=self._mitm_mapper):
# TODO: put in loop, count up for a reboot ;)
raise InternalStopWorkerException
return
else:
self.logger.info("Found {} trashcan(s) on screen", len(trashcancheck))
# get confirm box coords
x, y = self._resocalc.get_confirm_delete_quest_coords(self)

for trash in range(len(trashcancheck)):
self._clear_quests_failcount = 0
self.set_devicesettings_value('last_questclear_time', time.time())
self.logger.info("Delete old quest {}", int(trash) + 1)
for i in range(3):
self.logger.debug("repeated trash click #{}", i + 1)
self._communicator.click(int(trashcancheck[0].x), int(trashcancheck[0].y))
time.sleep(0.3 + int(delayadd))
self.logger.debug("final trash click ...")
self._communicator.click(int(trashcancheck[0].x), int(trashcancheck[0].y))
time.sleep(2.5 + int(delayadd))
self._communicator.click(int(x), int(y))
time.sleep(1 + int(delayadd))

x, y = self._resocalc.get_close_main_button_coords(self)
self._communicator.click(int(x), int(y))

time.sleep(1.5)

self.logger.debug('{_clear_quests} finished')
return

def _open_gym(self, delayadd):
self.logger.debug('{_open_gym} called')
Expand Down
6 changes: 2 additions & 4 deletions mapadroid/worker/WorkerQuests.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,7 @@ def _handle_stop(self, timestamp: float):
if self._db_wrapper.check_stop_quest(self.current_location.lat,
self.current_location.lng):
self.logger.info('Quest is done without us noticing. Getting new Quest...')
if not self._enhanced_mode:
self.clear_thread_task = ClearThreadTasks.QUEST
self.clear_thread_task = ClearThreadTasks.QUEST
break
elif data_received == FortSearchResultTypes.QUEST:
self.logger.info('Received new Quest')
Expand Down Expand Up @@ -793,8 +792,7 @@ def _handle_stop(self, timestamp: float):
if not self._restart_pogo(mitm_mapper=self._mitm_mapper):
# TODO: put in loop, count up for a reboot ;)
raise InternalStopWorkerException
if not self._enhanced_mode:
self.clear_thread_task = ClearThreadTasks.QUEST
self.clear_thread_task = ClearThreadTasks.QUEST
self._clear_quest_counter = 0
break
else:
Expand Down