示例#1
0
 def __init__(self, args, dev_id, origin, communicator: AbstractCommunicator, walker, mapping_manager,
              mitm_mapper: MitmMapper, db_wrapper: DbWrapper, area_id: int, routemanager_name: str, event):
     AbstractWorker.__init__(self, origin=origin, communicator=communicator)
     self._args = args
     self._event = event
     self._stop_worker_event = Event()
     self._dev_id = dev_id
     self._origin = origin
     self._routemanager_name = routemanager_name
     self._area_id = area_id
     self._walker = walker
     self.workerstart = None
     self._mapping_manager: MappingManager = mapping_manager
     self._mitm_mapper = mitm_mapper
     self._db_wrapper = db_wrapper
示例#2
0
文件: WorkerBase.py 项目: kimzky/MAD
    def __init__(self,
                 args,
                 dev_id,
                 origin,
                 last_known_state,
                 communicator: AbstractCommunicator,
                 mapping_manager: MappingManager,
                 area_id: int,
                 routemanager_name: str,
                 db_wrapper: DbWrapper,
                 pogo_window_manager: PogoWindows,
                 walker=None,
                 event=None):
        AbstractWorker.__init__(self, origin=origin, communicator=communicator)
        self._mapping_manager: MappingManager = mapping_manager
        self._routemanager_name: str = routemanager_name
        self._area_id = area_id
        self._dev_id: int = dev_id
        self._event = event
        self._origin: str = origin
        self._applicationArgs = args
        self._last_known_state = last_known_state
        self._work_mutex = Lock()
        self.loop = None
        self.loop_started = Event()
        self.loop_tid = None
        self._async_io_looper_thread = None
        self._location_count = 0
        self._init: bool = self._mapping_manager.routemanager_get_init(
            self._routemanager_name)
        self._walker = walker

        self._lastScreenshotTaken = 0
        self._stop_worker_event = Event()
        self._db_wrapper = db_wrapper
        self._resocalc = Resocalculator
        self._screen_x = 0
        self._screen_y = 0
        self._geofix_sleeptime = 0
        self._pogoWindowManager = pogo_window_manager
        self._waittime_without_delays = 0
        self._transporttype = 0
        self._not_injected_count: int = 0
        self._same_screen_count: int = 0
        self._last_screen_type: ScreenType = ScreenType.UNDEFINED
        self._loginerrorcounter: int = 0
        self._mode = self._mapping_manager.routemanager_get_mode(
            self._routemanager_name)
        self._levelmode = self._mapping_manager.routemanager_get_level(
            self._routemanager_name)
        self._geofencehelper = self._mapping_manager.routemanager_get_geofence_helper(
            self._routemanager_name)

        self.current_location = Location(0.0, 0.0)
        self.last_location = self.get_devicesettings_value(
            "last_location", None)

        if self.last_location is None:
            self.last_location = Location(0.0, 0.0)

        if self.get_devicesettings_value('last_mode', None) is not None and \
                self.get_devicesettings_value('last_mode') in ("raids_mitm", "mon_mitm", "iv_mitm"):
            # Reset last_location - no useless waiting delays (otherwise stop mode)
            self.last_location = Location(0.0, 0.0)

        self.set_devicesettings_value(
            "last_mode",
            self._mapping_manager.routemanager_get_mode(
                self._routemanager_name))
        self.workerstart = None
        self._WordToScreenMatching = WordToScreenMatching(
            self._communicator, self._pogoWindowManager, self._origin,
            self._resocalc, mapping_manager, self._applicationArgs)