コード例 #1
0
ファイル: shadowcheck.py プロジェクト: richardfoltin/PGNumbra
def save_account_info(acc):
    global acc_info_tmpl

    def bool(x):
        return '' if x is None else ('Yes' if x else 'No')

    km_walked_f = acc.get_stats('km_walked')
    if km_walked_f:
        km_walked_str = '{:.1f} km'.format(km_walked_f)
    else:
        km_walked_str = ''
    line = acc_info_tmpl.format(
        acc.username,
        bool(acc.is_warned()),
        bool(acc.is_banned()),
        bool(acc.get_state('banned')),
        bool(acc.has_captcha()),
        bool(is_blind(acc)),
        acc.get_stats('level', ''),
        acc.get_stats('experience', ''),
        acc.get_stats('pokemons_encountered', ''),
        acc.get_stats('pokeballs_thrown', ''),
        acc.get_stats('pokemons_captured', ''),
        acc.get_stats('poke_stop_visits', ''),
        km_walked_str
    )
    write_line_to_file(ACC_INFO_FILE, line)

    if mrmime_pgpool_enabled():
        acc.update_pgpool()
コード例 #2
0
    def release(self, reason="No longer in use"):
        if mrmime_pgpool_enabled():
            self.update_pgpool(release=True, reason=reason)

        self._api._session.close()

        auth_provider = self._api.get_auth_provider()
        if isinstance(auth_provider, AuthPtc):
            auth_provider._session.close()

        del self._api
コード例 #3
0
    def __init__(self,
                 auth_service,
                 username,
                 password,
                 hash_key=None,
                 hash_key_provider=None,
                 proxy_url=None,
                 proxy_provider=None):

        self.auth_service = auth_service
        self.username = username
        self.password = password

        # Get myself a copy of the config
        self.cfg = _mr_mime_cfg.copy()

        # Initialize hash keys
        self._hash_key = None
        if hash_key_provider and not hash_key_provider.is_empty():
            self._hash_key_provider = hash_key_provider
        elif hash_key:
            self._hash_key_provider = CyclicResourceProvider(hash_key)
            self._hash_key = hash_key
        else:
            self._hash_key_provider = None

        # Initialize proxies
        self._proxy_url = None
        if proxy_provider and not proxy_provider.is_empty():
            self._proxy_provider = proxy_provider
        elif proxy_url:
            self._proxy_provider = CyclicResourceProvider(proxy_url)
            self._proxy_url = proxy_url
        else:
            self._proxy_provider = None

        # Captcha
        self.captcha_url = None

        # Inventory information
        self.inbox = {}
        self.inventory = None
        self.inventory_balls = 0
        self.inventory_lures = 0
        self.inventory_total = 0
        self.incubators = []
        self.pokemon = {}
        self.eggs = []

        # Current location
        self.latitude = None
        self.longitude = None
        self.altitude = None

        # Count number of rareless scans (to detect shadowbans)
        self.rareless_scans = None
        self.shadowbanned = None

        # Last log message (for GUI/console)
        self.last_msg = ""

        # --- private fields

        self._reset_api()

        # Will be set to true if a request returns a BAD_REQUEST response which equals a ban
        self._bad_request_ban = False

        # Tutorial state and warn/ban flags
        self._player_state = {}

        # Trainer statistics
        self._player_stats = None

        # PGPool
        self._pgpool_auto_update_enabled = mrmime_pgpool_enabled(
        ) and self.cfg['pgpool_auto_update']
        self._last_pgpool_update = time.time()

        self.callback_egg_hatched = None