Example #1
0
        public void SetSettings(ISettings settings)
        {
            Settings = settings;

            Login     = new Rpc.Login(this);
            Player    = new Rpc.Player(this);
            Download  = new Rpc.Download(this);
            Inventory = new Rpc.Inventory(this);
            Map       = new Rpc.Map(this);
            Fort      = new Rpc.Fort(this);
            Encounter = new Rpc.Encounter(this);
            Misc      = new Rpc.Misc(this);

            Player.SetCoordinates(Settings.DefaultLatitude, Settings.DefaultLongitude, Settings.DefaultAltitude);

            ProxyEx proxy = new ProxyEx
            {
                Address  = Settings.ProxyIP,
                Port     = Settings.ProxyPort,
                Username = Settings.ProxyUsername,
                Password = Settings.ProxyPassword
            };

            HttpClientHandler handler = new HttpClientHandler
            {
                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
                AllowAutoRedirect      = false,
                Proxy    = proxy.AsWebProxy(),
                UseProxy = true,
            };

            PokemonHttpClient = new PokemonHttpClient(handler);
        }
Example #2
0
        public Client(ISettings settings, IApiFailureStrategy apiFailureStrategy)
        {
            Settings          = settings;
            ApiFailure        = apiFailureStrategy;
            Proxy             = InitProxy();
            PokemonHttpClient = new PokemonHttpClient();
            Login             = new Rpc.Login(this);
            Player            = new Player(this);
            Download          = new Download(this);
            Inventory         = new Inventory(this);
            Map       = new Map(this);
            Fort      = new Fort(this);
            Encounter = new Encounter(this);
            Misc      = new Misc(this);

            Player.SetCoordinates(Settings.DefaultLatitude, Settings.DefaultLongitude, Settings.DefaultAltitude);

            InventoryLastUpdateTimestamp = 0;

            Platform = settings.DevicePlatform.Equals("ios", StringComparison.Ordinal) ? Platform.Ios : Platform.Android;

            AppVersion   = 3500;
            SettingsHash = "";

            CurrentApiEmulationVersion = new Version("0.35.0");
        }
Example #3
0
        public Client(Shared.ClientSettings settings)
        {
            ReadyToUse        = false;
            AuthType          = settings.userType;
            Username          = settings.userName;
            Password          = settings.password;
            proxy             = InitProxy(settings.proxyUrl, settings.proxyPort, settings.proxyUser, settings.proxyPass);
            PokemonHttpClient = new PokemonHttpClient();
            Login             = new Rpc.Login(this);
            Player            = new Rpc.Player(this);
            Download          = new Rpc.Download(this);
            Inventory         = new Rpc.Inventory(this);
            Map       = new Rpc.Map(this);
            Fort      = new Rpc.Fort(this);
            Encounter = new Rpc.Encounter(this);
            Misc      = new Rpc.Misc(this);
            Hasher    = new PokeHashHasher(settings.hashKey);
            Store     = new PokemonGo.RocketAPI.Rpc.Store(this);
            Platform  = POGOProtos.Enums.Platform.Ios;

            //Player.SetCoordinates(settings.latitude, settings.longitude, settings.altitude);

            InventoryLastUpdateTimestamp = 0;

            AppVersion   = Resources.Api.ClientVersionInt;
            SettingsHash = "";

            CurrentApiEmulationVersion = settings.currentApi;
        }
Example #4
0
        public Client(ISettings settings)
        {
            Settings          = settings;
            proxy             = InitProxy();
            PokemonHttpClient = new PokemonHttpClient();
            Login             = new Rpc.Login(this);
            Player            = new Rpc.Player(this);
            Download          = new Rpc.Download(this);
            Inventory         = new Rpc.Inventory(this);
            Map       = new Rpc.Map(this);
            Fort      = new Rpc.Fort(this);
            Encounter = new Rpc.Encounter(this);
            Misc      = new Rpc.Misc(this);

            Player.SetCoordinates(settings.DefaultLatitude, settings.DefaultLongitude, settings.DefaultAltitude);

            InventoryLastUpdateTimestamp = 0;

            /*AppVersion = 4303;
             * SettingsHash = "";
             *
             * CurrentApiEmulationVersion = new Version("0.43.3");*/

            AppVersion   = 4500;
            SettingsHash = "";

            CurrentApiEmulationVersion = new Version("0.45.0");
        }
Example #5
0
        public Client(ISettings settings, IApiFailureStrategy apiFailureStrategy)
        {
            //handle initial session hash
            Random = new Random(DateTime.Now.Millisecond);
            GenerateNewSessionHash();

            //setup
            Settings   = settings;
            ApiFailure = apiFailureStrategy;
            if (settings.UseProxy)
            {
                InitProxy(settings);
            }
            PokemonHttpClient = new PokemonHttpClient(settings);
            Login             = new Rpc.Login(this);
            Player            = new Rpc.Player(this);
            Download          = new Rpc.Download(this);
            Inventory         = new Rpc.Inventory(this);
            Map       = new Rpc.Map(this);
            Fort      = new Rpc.Fort(this);
            Encounter = new Rpc.Encounter(this);
            Misc      = new Rpc.Misc(this);

            //player coords
            Player.SetCoordinates(Settings.DefaultLatitude, Settings.DefaultLongitude, Settings.DefaultAltitude);
        }
Example #6
0
        public Client(ISettings settings)
        {
            Settings          = settings;
            Proxy             = InitProxy();
            PokemonHttpClient = new PokemonHttpClient();
            Login             = new Rpc.Login(this);
            Player            = new Player(this);
            Download          = new Download(this);
            Inventory         = new Inventory(this);
            Map            = new Map(this);
            Fort           = new Fort(this);
            Encounter      = new Encounter(this);
            Misc           = new Misc(this);
            KillswitchTask = new KillSwitchTask(this);

            Player.SetCoordinates(Settings.DefaultLatitude, Settings.DefaultLongitude, Settings.DefaultAltitude);

            InventoryLastUpdateTimestamp = 0;

            Platform = settings.DevicePlatform.Equals("ios", StringComparison.Ordinal) ? Platform.Ios : Platform.Android;

            // We can no longer emulate Android so for now just overwrite settings with randomly generated iOS device info.
            if (Platform == Platform.Android)
            {
                DeviceInfo iosInfo = DeviceInfoHelper.GetRandomIosDevice();
                settings.DeviceId             = iosInfo.DeviceId;
                settings.DeviceBrand          = iosInfo.DeviceBrand;
                settings.DeviceModel          = iosInfo.DeviceModel;
                settings.DeviceModelBoot      = iosInfo.DeviceModelBoot;
                settings.HardwareManufacturer = iosInfo.HardwareManufacturer;
                settings.HardwareModel        = iosInfo.HardwareModel;
                settings.FirmwareBrand        = iosInfo.FirmwareBrand;
                settings.FirmwareType         = iosInfo.FirmwareType;

                // Clear out the android fields.
                settings.AndroidBoardName      = "";
                settings.AndroidBootloader     = "";
                settings.DeviceModelIdentifier = "";
                settings.FirmwareTags          = "";
                settings.FirmwareFingerprint   = "";

                // Now set the client platform to ios
                Platform = Platform.Ios;
            }

            AppVersion   = 4500;
            SettingsHash = "";

            CurrentApiEmulationVersion = new Version("0.45.0");
        }
Example #7
0
        public Client(ISettings settings)
        {
            Settings = settings;

            Login     = new Rpc.Login(this);
            Player    = new Rpc.Player(this);
            Download  = new Rpc.Download(this);
            Inventory = new Rpc.Inventory(this);
            Map       = new Rpc.Map(this);
            Fort      = new Rpc.Fort(this);
            Encounter = new Rpc.Encounter(this);
            Misc      = new Rpc.Misc(this);

            Player.SetCoordinates(Settings.DefaultLatitude, Settings.DefaultLongitude, Settings.DefaultAltitude);
        }
Example #8
0
        public Client(ISettings settings)
        {
            Settings = settings;

            Login = new Rpc.Login(this);
            Player = new Rpc.Player(this);
            Download = new Rpc.Download(this);
            Inventory = new Rpc.Inventory(this);
            Map = new Rpc.Map(this);
            Fort = new Rpc.Fort(this);
            Encounter = new Rpc.Encounter(this);
            Misc = new Rpc.Misc(this);

            Player.SetCoordinates(Settings.DefaultLatitude, Settings.DefaultLongitude, Settings.DefaultAltitude);
        }
        public Client(ISettings settings)
        {
            DeviceId = RequestBuilder.GetDeviceId();
            RequestBuilder.SetDevice(settings);

            Settings = settings;

            Login     = new Rpc.Login(this);
            Player    = new Rpc.Player(this);
            Download  = new Rpc.Download(this);
            Inventory = new Rpc.Inventory(this);
            Map       = new Rpc.Map(this);
            Fort      = new Rpc.Fort(this);
            Encounter = new Rpc.Encounter(this);
            Misc      = new Rpc.Misc(this);
        }
Example #10
0
        public Client(ISettings settings, IApiFailureStrategy apiFailureStrategy)
        {
            Settings   = settings;
            ApiFailure = apiFailureStrategy;

            Login     = new Rpc.Login(this);
            Player    = new Rpc.Player(this);
            Download  = new Rpc.Download(this);
            Inventory = new Rpc.Inventory(this);
            Map       = new Rpc.Map(this);
            Fort      = new Rpc.Fort(this);
            Encounter = new Rpc.Encounter(this);
            Misc      = new Rpc.Misc(this);

            Player.SetCoordinates(Settings.DefaultLatitude, Settings.DefaultLongitude, 0.0);
        }
Example #11
0
        public Client(ISettings settings, IApiFailureStrategy apiFailureStrategy)
        {
            Settings          = settings;
            ApiFailure        = apiFailureStrategy;
            Proxy             = InitProxy();
            PokemonHttpClient = new PokemonHttpClient();
            Login             = new Rpc.Login(this);
            Player            = new Player(this);
            Download          = new Download(this);
            Inventory         = new Inventory(this);
            Map       = new Map(this);
            Fort      = new Fort(this);
            Encounter = new Encounter(this);
            Misc      = new Misc(this);

            Player.SetCoordinates(Settings.DefaultLatitude, Settings.DefaultLongitude, Settings.DefaultAltitude);
        }
Example #12
0
        public Client(ISettings settings, IApiFailureStrategy apiFailureStrategy, IDeviceInfo deviceInfo)
        {
            Settings   = settings;
            ApiFailure = apiFailureStrategy;

            Login      = new Rpc.Login(this);
            Player     = new Player(this);
            Download   = new Download(this);
            Inventory  = new Inventory(this);
            Map        = new Map(this);
            Fort       = new Fort(this);
            Encounter  = new Encounter(this);
            Misc       = new Misc(this);
            DeviceInfo = deviceInfo;

            Player.SetCoordinates(Settings.DefaultLatitude, Settings.DefaultLongitude, Settings.DefaultAltitude);
        }
Example #13
0
        public Client(Shared.ClientSettings settings)
        {
            ReadyToUse        = false;
            AuthType          = settings.userType;
            Username          = settings.userName;
            Password          = settings.password;
            proxy             = InitProxy(settings.proxyUrl, settings.proxyPort, settings.proxyUser, settings.proxyPass);
            PokemonHttpClient = new PokemonHttpClient();
            Login             = new Rpc.Login(this);
            Player            = new Rpc.Player(this);
            Download          = new Rpc.Download(this);
            Inventory         = new Rpc.Inventory(this);
            Map       = new Rpc.Map(this);
            Fort      = new Rpc.Fort(this);
            Encounter = new Rpc.Encounter(this);
            Misc      = new Rpc.Misc(this);
            Crypter   = new Cipher();
            Hasher    = new PokeHashHasher(settings.hashKey);
            Store     = new PokemonGo.RocketAPI.Rpc.Store(this);

            if (DeviceSetup.SelectedDevice.OSType == "iOS")
            {
                Platform = POGOProtos.Enums.Platform.Ios;
            }
            else
            {
                Platform = POGOProtos.Enums.Platform.Android;
            }

            Logger.Info("Platform:" + Platform);


            InventoryLastUpdateTimestamp = 0;

            AppVersion   = Resources.Api.AndroidClientVersionInt;
            SettingsHash = "";

            CurrentApiEmulationVersion = settings.currentApi;
        }
Example #14
0
        public Client(ISettings settings)
        {
            if (settings.UsePogoDevHashServer)
            {
                if (string.IsNullOrEmpty(settings.AuthAPIKey))
                {
                    throw new AuthConfigException("You selected Pogodev API but not provide proper API Key");
                }
                Hasher  = new PokefamerHasher(settings.AuthAPIKey);
                Cryptor = new Crypt();

                // These constants need to change if we update the hashing server API version that is used.
                AppVersion = 5120;
                CurrentApiEmulationVersion = new Version("0.51.2");
            }
            else
            if (settings.UseLegacyAPI)
            {
                Hasher     = new LegacyHashser();
                Cryptor    = new LegacyCrypt();
                AppVersion = 4500;
                CurrentApiEmulationVersion = new Version("0.45.0");
            }
            else
            {
                throw new AuthConfigException("No API method being select in your auth.json");
            }

            //Hasher = new LegacyHashser();


            Settings          = settings;
            Proxy             = InitProxy();
            PokemonHttpClient = new PokemonHttpClient();
            Login             = new Rpc.Login(this);
            Player            = new Player(this);
            Download          = new Download(this);
            Inventory         = new Inventory(this);
            Map            = new Map(this);
            Fort           = new Fort(this);
            Encounter      = new Encounter(this);
            Misc           = new Misc(this);
            KillswitchTask = new KillSwitchTask(this);

            Player.SetCoordinates(Settings.DefaultLatitude, Settings.DefaultLongitude, Settings.DefaultAltitude);

            InventoryLastUpdateTimestamp = 0;

            Platform = settings.DevicePlatform.Equals("ios", StringComparison.Ordinal) ? Platform.Ios : Platform.Android;

            // We can no longer emulate Android so for now just overwrite settings with randomly generated iOS device info.
            if (Platform == Platform.Android)
            {
                DeviceInfo iosInfo = DeviceInfoHelper.GetRandomIosDevice();
                settings.DeviceId             = iosInfo.DeviceId;
                settings.DeviceBrand          = iosInfo.DeviceBrand;
                settings.DeviceModel          = iosInfo.DeviceModel;
                settings.DeviceModelBoot      = iosInfo.DeviceModelBoot;
                settings.HardwareManufacturer = iosInfo.HardwareManufacturer;
                settings.HardwareModel        = iosInfo.HardwareModel;
                settings.FirmwareBrand        = iosInfo.FirmwareBrand;
                settings.FirmwareType         = iosInfo.FirmwareType;

                // Clear out the android fields.
                settings.AndroidBoardName      = "";
                settings.AndroidBootloader     = "";
                settings.DeviceModelIdentifier = "";
                settings.FirmwareTags          = "";
                settings.FirmwareFingerprint   = "";

                // Now set the client platform to ios
                Platform = Platform.Ios;
            }
            SettingsHash = "";
        }