Example #1
0
        public PtcLogin(string username, string password, ISettings settings)
        {
            this.username = username;
            this.password = password;
            this.settings = settings;

            defaultProxy = new ProxyEx
            {
                Address  = settings.ProxyIP,
                Port     = settings.ProxyPort,
                Username = settings.ProxyUsername,
                Password = settings.ProxyPassword
            };
        }
Example #2
0
        public bool AddProxy(string data)
        {
            ProxyEx proxy = null;

            if (!ProxyEx.TryParse(data, out proxy))
            {
                return(false);
            }


            GoProxy goProxy = new GoProxy
            {
                Address  = proxy.Address,
                Password = proxy.Password,
                Port     = proxy.Port,
                Username = proxy.Username
            };

            return(AddProxy(goProxy));
        }
Example #3
0
        private bool SaveSettings()
        {
            Settings userSettings = _manager.UserSettings;

            ProxyEx proxyEx = null;

            int maxLevel;

            if (!Int32.TryParse(textBoxMaxLevel.Text, out maxLevel) || maxLevel < 0)
            {
                MessageBox.Show("Invalid Max level", "Warning");
                return(false);
            }

            int minPokemonBeforeEvolve;

            if (!Int32.TryParse(textBoxPokemonBeforeEvolve.Text, out minPokemonBeforeEvolve) || minPokemonBeforeEvolve < 0)
            {
                MessageBox.Show("Invalid pokemon before evolve", "Warning");
                return(false);
            }
            int walkingSpeed;

            if (!Int32.TryParse(textBoxWalkSpeed.Text, out walkingSpeed) || walkingSpeed <= 0)
            {
                MessageBox.Show("Invalid walking speed", "Warning");
                return(false);
            }
            int maxTravelDistance;

            if (!Int32.TryParse(textBoxMaxTravelDistance.Text, out maxTravelDistance) || maxTravelDistance <= 0)
            {
                MessageBox.Show("Invalid max travel distance", "Warning");
                return(false);
            }
            double defaultLat;

            if (!Double.TryParse(textBoxLat.Text.Replace(",", "."), NumberStyles.Any, CultureInfo.InvariantCulture, out defaultLat))
            {
                MessageBox.Show("Invalid latitude", "Warning");
                return(false);
            }
            double defaultLong;

            if (!Double.TryParse(textBoxLong.Text.Replace(",", "."), NumberStyles.Any, CultureInfo.InvariantCulture, out defaultLong))
            {
                MessageBox.Show("Invalid longitude", "Warning");
                return(false);
            }

            if (!String.IsNullOrEmpty(textBoxProxy.Text) && !ProxyEx.TryParse(textBoxProxy.Text, out proxyEx))
            {
                MessageBox.Show("Invalid proxy format", "Warning");
                return(false);
            }

            if (comboBoxMinAccountState.SelectedItem == null)
            {
                MessageBox.Show("Please select a valid min account state", "Warning");
                return(false);
            }

            if (walkingSpeed < (double)numericUpDownWalkingOffset.Value)
            {
                MessageBox.Show("Walking offset must be more than walking speed", "Warning");
                return(false);
            }

            if (String.IsNullOrEmpty(textBoxPtcUsername.Text))
            {
                MessageBox.Show("Invalid Username", "Warning");
                return(false);
            }
            if (String.IsNullOrEmpty(textBoxPtcPassword.Text))
            {
                MessageBox.Show("Invalid Password", "Warning");
                return(false);
            }

            userSettings.AuthType = textBoxPtcUsername.Text.Contains("@") ? AuthType.Google : AuthType.Ptc;

            userSettings.MimicWalking     = checkBoxMimicWalking.Checked;
            userSettings.ShufflePokestops = checkBoxShufflePokestops.Checked;

            userSettings.Username                = textBoxPtcUsername.Text.Trim();
            userSettings.Password                = textBoxPtcPassword.Text.Trim();
            userSettings.Latitude                = defaultLat;
            userSettings.Longitude               = defaultLong;
            userSettings.WalkingSpeed            = walkingSpeed;
            userSettings.MaxTravelDistance       = maxTravelDistance;
            userSettings.EncounterWhileWalking   = checkBoxEncounterWhileWalking.Checked;
            userSettings.AccountName             = textBoxName.Text;
            userSettings.TransferPokemon         = checkBoxTransfers.Checked;
            userSettings.TransferSlashPokemons   = checkBoxTransferSlashPokemons.Checked;
            userSettings.EvolvePokemon           = checkBoxEvolve.Checked;
            userSettings.RecycleItems            = checkBoxRecycle.Checked;
            userSettings.MinPokemonBeforeEvolve  = minPokemonBeforeEvolve;
            userSettings.UseLuckyEgg             = checkBoxUseLuckyEgg.Checked;
            userSettings.IncubateEggs            = checkBoxIncubateEggs.Checked;
            userSettings.OnlyUnlimitedIncubator  = checkBoxOnlyUnlimitedIncubator.Checked;
            userSettings.MaxLevel                = maxLevel;
            userSettings.CatchPokemon            = checkBoxCatchPokemon.Checked;
            userSettings.StopAtMinAccountState   = (AccountState)comboBoxMinAccountState.SelectedItem;
            userSettings.SearchFortBelowPercent  = (double)numericUpDownSearchFortBelow.Value;
            userSettings.CatchPokemonDayLimit    = (int)numericUpDownPokemonsDayLimit.Value;
            userSettings.SpinPokestopsDayLimit   = (int)numericUpDownStopsDayLimit.Value;
            userSettings.ForceEvolveAbovePercent = (double)numericUpDownForceEvolveAbove.Value;
            userSettings.ClaimLevelUpRewards     = checkBoxClaimLevelUp.Checked;
            userSettings.StopOnAPIUpdate         = checkBoxStopOnAPIUpdate.Checked;
            userSettings.SpinGyms                = checkBoxSpinGyms.Checked;
            userSettings.DeployPokemon           = checkBoxDeployToGym.Checked;
            AutoUpdate = cbAutoUpdate.Checked;
            userSettings.UseBerries         = checkBoxUseBerries.Checked;
            userSettings.DisableCatchDelay  = (int)numericUpDownDisableCatchDelay.Value;
            userSettings.UseIncense         = cbUseIncense.Checked;
            userSettings.RunForHours        = (double)numericUpDownRunForHours.Value;
            userSettings.MaxLogs            = (int)numericUpDownMaxLogs.Value;
            userSettings.StopOnIPBan        = checkBoxStopOnIPBan.Checked;
            userSettings.MaxFailBeforeReset = (int)numericUpDownMaxFailBeforeReset.Value;
            userSettings.AutoRotateProxies  = checkBoxAutoRotateProxies.Checked;
            userSettings.AutoRemoveOnStop   = checkBoxRemoveOnStop.Checked;

            //Humanization
            userSettings.EnableHumanization   = checkBoxHumanizeThrows.Checked;
            userSettings.InsideReticuleChance = (int)numericUpDownInsideReticuleChance.Value;

            userSettings.GeneralDelay       = (int)numericUpDownGeneralDelay.Value;
            userSettings.GeneralDelayRandom = (int)numericUpDownGeneralDelayRandom.Value;

            userSettings.DelayBetweenLocationUpdates = (int)numericUpDownLocationUpdateDelay.Value;
            userSettings.LocationupdateDelayRandom   = (int)numericUpDownLocationUpdateRandom.Value;

            userSettings.DelayBetweenPlayerActions = (int)numericUpDownPlayerActionDelay.Value;
            userSettings.PlayerActionDelayRandom   = (int)numericUpDownPlayerActionRandomiz.Value;

            userSettings.WalkingSpeedOffset = (double)numericUpDownWalkingOffset.Value;
            //End humanization

            //Device settings
            userSettings.DeviceId             = textBoxDeviceId.Text;
            userSettings.DeviceModel          = textBoxDeviceModel.Text;
            userSettings.DeviceBrand          = textBoxDeviceBrand.Text;
            userSettings.DeviceModelBoot      = textBoxDeviceModelBoot.Text;
            userSettings.HardwareManufacturer = textBoxHardwareManufacturer.Text;
            userSettings.HardwareModel        = textBoxHardwareModel.Text;
            userSettings.FirmwareBrand        = textBoxFirmwareBrand.Text;
            userSettings.FirmwareType         = textBoxFirmwareType.Text;
            //End device settings

            //Api config
            userSettings.HashHost      = new Uri(cbHashHost.Text);
            userSettings.HashEndpoint  = cbHashEndpoint.Text;
            userSettings.AuthAPIKey    = tbAuthHashKey.Text;
            userSettings.UseOnlyOneKey = cbUseOnlyThisHashKey.Checked;
            //End api config

            //Location time zones
            var x = new TimeZoneIds().GetTimeZoneIds();

            userSettings.TimeZone = cbTimeZones.Text;
            userSettings.Country  = x[cbTimeZones.Text].Item1;
            userSettings.Language = x[cbTimeZones.Text].Item2;
            userSettings.POSIX    = x[cbTimeZones.Text].Item3;
            //End location time zones

            userSettings.GetArBonus       = checkBoxGetARBonus.Checked;
            userSettings.CompleteTutorial = checkBoxCompleteTutorial.Checked;
            userSettings.TransferAtOnce   = checkBoxTransferAtOnce.Checked;

            if (proxyEx != null)
            {
                userSettings.ProxyIP       = proxyEx.Address;
                userSettings.ProxyPort     = proxyEx.Port;
                userSettings.ProxyUsername = proxyEx.Username;
                userSettings.ProxyPassword = proxyEx.Password;
            }
            else
            {
                userSettings.ProxyUsername = null;
                userSettings.ProxyPassword = null;
                userSettings.ProxyIP       = null;
                userSettings.ProxyPort     = 0;
            }

            userSettings.ARBonusProximity = numericUpDownProximity.Value;
            userSettings.ARBonusAwareness = numericUpDownAwareness.Value;

            // Developer options
            userSettings.ShowDebugLogs     = checkBoxShowDebugLogs.Checked;
            userSettings.DownloadResources = checkBoxDownloadResources.Checked;

            //Captcha Config
            userSettings.AllowManualCaptchaResolve = AllowManualCaptchaResolve.Checked;
            int manualCaptchaTimeout;

            if (!Int32.TryParse(ManualCaptchaTimeout.Text, out manualCaptchaTimeout) || maxLevel < 0)
            {
                MessageBox.Show("InvalidTimeOut", "Warning");
                return(false);
            }
            userSettings.ManualCaptchaTimeout = manualCaptchaTimeout;
            userSettings.PlaySoundOnCaptcha   = PlaySoundOnCaptcha.Checked;
            userSettings.DisplayOnTop         = DisplayOnTop.Checked;
            userSettings.Enable2Captcha       = Enable2Captcha.Checked;
            userSettings.EnableAntiCaptcha    = EnableAntiCaptcha.Checked;
            userSettings.AntiCaptchaAPIKey    = AntiCaptchaAPIKey.Text;
            userSettings.ProxyHostCaptcha     = ProxyHostCaptcha.Text;
            int proxyPortCaptcha;

            if (!Int32.TryParse(ProxyPortCaptcha.Text, out proxyPortCaptcha) || maxLevel < 0)
            {
                MessageBox.Show("InvalidProxyCaptchaPort", "Warning");
                return(false);
            }
            userSettings.ProxyPortCaptcha          = proxyPortCaptcha;
            userSettings.EnableCaptchaSolutions    = EnableCaptchaSolutions.Checked;
            userSettings.CaptchaSolutionAPIKey     = CaptchaSolutionAPIKey.Text;
            userSettings.CaptchaSolutionsSecretKey = CaptchaSolutionsSecretKey.Text;
            int autoCaptchaTimeout;

            if (!Int32.TryParse(AutoCaptchaTimeout.Text, out autoCaptchaTimeout) || maxLevel < 0)
            {
                MessageBox.Show("InvalidAutoCaptchaTimeout", "Warning");
                return(false);
            }
            userSettings.AutoCaptchaTimeout = autoCaptchaTimeout;
            int autoCaptchaRetries;

            if (!Int32.TryParse(AutoCaptchaRetries.Text, out autoCaptchaRetries) || maxLevel < 0)
            {
                MessageBox.Show("InvalidAutoCaptchaRetries", "Warning");
                return(false);
            }
            userSettings.AutoCaptchaRetries          = autoCaptchaRetries;
            userSettings.TwoCaptchaAPIKey            = TwoCaptchaAPIKey.Text;
            userSettings.DefaultTeam                 = (string)cbTeam.SelectedItem ?? "Neutral";
            userSettings.GoOnlyToGyms                = checkBoxGoToGymsOnly.Checked;
            userSettings.UpgradePokemon              = checkBoxUpgradePokemons.Checked;
            userSettings.AutoFavoritShiny            = checkBoxAutoFavShiny.Checked;
            userSettings.SnipeAllPokemonsNoInPokedex = checkBoxSniperNoInPokedex.Checked;

            return(true);
        }
Example #4
0
        private bool SaveSettings()
        {
            Settings userSettings = _manager.UserSettings;

            double  defaultLat             = 0;
            double  defaultLong            = 0;
            int     walkingSpeed           = 0;
            int     maxTravelDistance      = 0;
            int     minPokemonBeforeEvolve = 0;
            int     maxLevel = 0;
            ProxyEx proxyEx  = null;

            if (!Int32.TryParse(textBoxMaxLevel.Text, out maxLevel) || maxLevel < 0)
            {
                MessageBox.Show("Invalid Max level", "Warning");
                return(false);
            }

            if (!Int32.TryParse(textBoxPokemonBeforeEvolve.Text, out minPokemonBeforeEvolve) || minPokemonBeforeEvolve < 0)
            {
                MessageBox.Show("Invalid pokemon before evolve", "Warning");
                return(false);
            }

            if (!Int32.TryParse(textBoxWalkSpeed.Text, out walkingSpeed) || walkingSpeed <= 0)
            {
                MessageBox.Show("Invalid walking speed", "Warning");
                return(false);
            }

            if (!Int32.TryParse(textBoxMaxTravelDistance.Text, out maxTravelDistance) || maxTravelDistance <= 0)
            {
                MessageBox.Show("Invalid max travel distance", "Warning");
                return(false);
            }

            if (!Double.TryParse(textBoxLat.Text.Replace(",", "."), NumberStyles.Any, CultureInfo.InvariantCulture, out defaultLat))
            {
                MessageBox.Show("Invalid latitude", "Warning");
                return(false);
            }

            if (!Double.TryParse(textBoxLong.Text.Replace(",", "."), NumberStyles.Any, CultureInfo.InvariantCulture, out defaultLong))
            {
                MessageBox.Show("Invalid longitude", "Warning");
                return(false);
            }

            if (!String.IsNullOrEmpty(textBoxProxy.Text) && !ProxyEx.TryParse(textBoxProxy.Text, out proxyEx))
            {
                MessageBox.Show("Invalid proxy format", "Warning");
                return(false);
            }

            if (comboBoxMinAccountState.SelectedItem == null)
            {
                MessageBox.Show("Please select a valid min account state", "Warning");
                return(false);
            }

            if (walkingSpeed < (double)numericUpDownWalkingOffset.Value)
            {
                MessageBox.Show("Walking offset must be more than walking speed", "Warning");
                return(false);
            }

            if (radioButtonPtc.Checked)
            {
                userSettings.AuthType = AuthType.Ptc;
            }
            else
            {
                userSettings.AuthType = AuthType.Google;
            }


            userSettings.MimicWalking           = checkBoxMimicWalking.Checked;
            userSettings.PtcUsername            = textBoxPtcUsername.Text.Trim();
            userSettings.PtcPassword            = textBoxPtcPassword.Text.Trim();
            userSettings.DefaultLatitude        = defaultLat;
            userSettings.DefaultLongitude       = defaultLong;
            userSettings.WalkingSpeed           = walkingSpeed;
            userSettings.MaxTravelDistance      = maxTravelDistance;
            userSettings.EncounterWhileWalking  = checkBoxEncounterWhileWalking.Checked;
            userSettings.AccountName            = textBoxName.Text;
            userSettings.TransferPokemon        = checkBoxTransfers.Checked;
            userSettings.EvolvePokemon          = checkBoxEvolve.Checked;
            userSettings.RecycleItems           = checkBoxRecycle.Checked;
            userSettings.MinPokemonBeforeEvolve = minPokemonBeforeEvolve;
            userSettings.UseLuckyEgg            = checkBoxUseLuckyEgg.Checked;
            userSettings.IncubateEggsBasicOnly  = checkBoxIncubateEggs.Checked;
            userSettings.MaxLevel               = maxLevel;
            userSettings.CatchPokemon           = checkBoxCatchPokemon.Checked;
            userSettings.SnipePokemon           = checkBoxSnipePokemon.Checked;
            userSettings.SnipeAfterPokestops    = (int)numericUpDownSnipeAfterStops.Value;
            userSettings.MinBallsToSnipe        = (int)numericUpDownMinBallsToSnipe.Value;
            userSettings.MaxPokemonPerSnipe     = (int)numericUpDownMaxPokemonPerSnipe.Value;
            userSettings.SnipeAfterLevel        = (int)numericUpDownSnipeAfterLevel.Value;
            userSettings.StopAtMinAccountState  = (AccountState)comboBoxMinAccountState.SelectedItem;
            userSettings.SearchFortBelowPercent = (double)numericUpDownSearchFortBelow.Value;
            userSettings.ClaimLevelUpRewards    = checkBoxClaimLevelUp.Checked;
            userSettings.StopOnAPIUpdate        = checkBoxStopOnAPIUpdate.Checked;

            userSettings.RunForHours        = (double)numericUpDownRunForHours.Value;
            userSettings.MaxLogs            = (int)numericUpDownMaxLogs.Value;
            userSettings.StopOnIPBan        = checkBoxStopOnIPBan.Checked;
            userSettings.MaxFailBeforeReset = (int)numericUpDownMaxFailBeforeReset.Value;
            userSettings.AutoRotateProxies  = checkBoxAutoRotateProxies.Checked;
            userSettings.AutoRemoveOnStop   = checkBoxRemoveOnStop.Checked;

            //Humanization
            userSettings.EnableHumanization   = checkBoxHumanizeThrows.Checked;
            userSettings.InsideReticuleChance = (int)numericUpDownInsideReticuleChance.Value;

            userSettings.GeneralDelay       = (int)numericUpDownGeneralDelay.Value;
            userSettings.GeneralDelayRandom = (int)numericUpDownGeneralDelayRandom.Value;

            userSettings.DelayBetweenSnipes       = (int)numericUpDownDelayBetweenSnipes.Value;
            userSettings.BetweenSnipesDelayRandom = (int)numericUpDownDelayBetweenSnipeRandom.Value;

            userSettings.DelayBetweenLocationUpdates = (int)numericUpDownLocationUpdateDelay.Value;
            userSettings.LocationupdateDelayRandom   = (int)numericUpDownLocationUpdateRandom.Value;

            userSettings.DelayBetweenPlayerActions = (int)numericUpDownPlayerActionDelay.Value;
            userSettings.PlayerActionDelayRandom   = (int)numericUpDownPlayerActionRandomiz.Value;

            userSettings.WalkingSpeedOffset = (double)numericUpDownWalkingOffset.Value;
            //End humanization

            //Device settings
            userSettings.DeviceId              = textBoxDeviceId.Text;
            userSettings.DeviceModel           = textBoxDeviceModel.Text;
            userSettings.DeviceBrand           = textBoxDeviceBrand.Text;
            userSettings.DeviceModelBoot       = textBoxDeviceModelBoot.Text;
            userSettings.DeviceModelIdentifier = textBoxDeviceModelIdentifier.Text;
            userSettings.FirmwareBrand         = textBoxFirmwareBrand.Text;
            userSettings.FirmwareFingerprint   = textBoxFirmwareFingerprint.Text;
            userSettings.FirmwareTags          = textBoxFirmwareTags.Text;
            userSettings.FirmwareType          = textBoxFirmwareType.Text;
            userSettings.AndroidBoardName      = textBoxAnroidBoardName.Text;
            userSettings.AndroidBootloader     = textBoxAndroidBootLoader.Text;
            userSettings.HardwareManufacturer  = textBoxHardwareManufacturer.Text;
            userSettings.HardwareModel         = textBoxHardwareModel.Text;
            //End device settings

            if (proxyEx != null)
            {
                userSettings.ProxyIP       = proxyEx.Address;
                userSettings.ProxyPort     = proxyEx.Port;
                userSettings.ProxyUsername = proxyEx.Username;
                userSettings.ProxyPassword = proxyEx.Password;
            }
            else
            {
                userSettings.ProxyUsername = null;
                userSettings.ProxyPassword = null;
                userSettings.ProxyIP       = null;
                userSettings.ProxyPort     = 0;
            }

            return(true);
        }
        private bool SaveSettings()
        {
            Settings userSettings = _manager.UserSettings;

            ProxyEx proxyEx = null;

            int maxLevel;

            if (!Int32.TryParse(textBoxMaxLevel.Text, out maxLevel) || maxLevel < 0)
            {
                MessageBox.Show("Invalid Max level", "Warning");
                return(false);
            }

            int minPokemonBeforeEvolve;

            if (!Int32.TryParse(textBoxPokemonBeforeEvolve.Text, out minPokemonBeforeEvolve) || minPokemonBeforeEvolve < 0)
            {
                MessageBox.Show("Invalid pokemon before evolve", "Warning");
                return(false);
            }
            int walkingSpeed;

            if (!Int32.TryParse(textBoxWalkSpeed.Text, out walkingSpeed) || walkingSpeed <= 0)
            {
                MessageBox.Show("Invalid walking speed", "Warning");
                return(false);
            }
            int maxTravelDistance;

            if (!Int32.TryParse(textBoxMaxTravelDistance.Text, out maxTravelDistance) || maxTravelDistance <= 0)
            {
                MessageBox.Show("Invalid max travel distance", "Warning");
                return(false);
            }
            double defaultLat;

            if (!Double.TryParse(textBoxLat.Text.Replace(",", "."), NumberStyles.Any, CultureInfo.InvariantCulture, out defaultLat))
            {
                MessageBox.Show("Invalid latitude", "Warning");
                return(false);
            }
            double defaultLong;

            if (!Double.TryParse(textBoxLong.Text.Replace(",", "."), NumberStyles.Any, CultureInfo.InvariantCulture, out defaultLong))
            {
                MessageBox.Show("Invalid longitude", "Warning");
                return(false);
            }

            if (!String.IsNullOrEmpty(textBoxProxy.Text) && !ProxyEx.TryParse(textBoxProxy.Text, out proxyEx))
            {
                MessageBox.Show("Invalid proxy format", "Warning");
                return(false);
            }

            if (comboBoxMinAccountState.SelectedItem == null)
            {
                MessageBox.Show("Please select a valid min account state", "Warning");
                return(false);
            }

            if (walkingSpeed < (double)numericUpDownWalkingOffset.Value)
            {
                MessageBox.Show("Walking offset must be more than walking speed", "Warning");
                return(false);
            }

            userSettings.AuthType = textBoxPtcUsername.Text.Contains("@") ?  AuthType.Google : AuthType.Ptc;

            userSettings.MimicWalking            = checkBoxMimicWalking.Checked;
            userSettings.Username                = textBoxPtcUsername.Text.Trim();
            userSettings.Password                = textBoxPtcPassword.Text.Trim();
            userSettings.DefaultLatitude         = defaultLat;
            userSettings.DefaultLongitude        = defaultLong;
            userSettings.WalkingSpeed            = walkingSpeed;
            userSettings.MaxTravelDistance       = maxTravelDistance;
            userSettings.EncounterWhileWalking   = checkBoxEncounterWhileWalking.Checked;
            userSettings.AccountName             = textBoxName.Text;
            userSettings.TransferPokemon         = checkBoxTransfers.Checked;
            userSettings.EvolvePokemon           = checkBoxEvolve.Checked;
            userSettings.RecycleItems            = checkBoxRecycle.Checked;
            userSettings.MinPokemonBeforeEvolve  = minPokemonBeforeEvolve;
            userSettings.UseLuckyEgg             = checkBoxUseLuckyEgg.Checked;
            userSettings.IncubateEggs            = checkBoxIncubateEggs.Checked;
            userSettings.MaxLevel                = maxLevel;
            userSettings.CatchPokemon            = checkBoxCatchPokemon.Checked;
            userSettings.StopAtMinAccountState   = (AccountState)comboBoxMinAccountState.SelectedItem;
            userSettings.SearchFortBelowPercent  = (double)numericUpDownSearchFortBelow.Value;
            userSettings.ForceEvolveAbovePercent = (double)numericUpDownForceEvolveAbove.Value;
            userSettings.ClaimLevelUpRewards     = checkBoxClaimLevelUp.Checked;
            userSettings.StopOnAPIUpdate         = checkBoxStopOnAPIUpdate.Checked;
            userSettings.SpinGyms                = checkBoxSpinGyms.Checked;
            AutoUpdate = cbAutoUpdate.Checked;
            userSettings.UseBerries = checkBoxUseBerries.Checked;

            userSettings.RunForHours        = (double)numericUpDownRunForHours.Value;
            userSettings.MaxLogs            = (int)numericUpDownMaxLogs.Value;
            userSettings.StopOnIPBan        = checkBoxStopOnIPBan.Checked;
            userSettings.MaxFailBeforeReset = (int)numericUpDownMaxFailBeforeReset.Value;
            userSettings.AutoRotateProxies  = checkBoxAutoRotateProxies.Checked;
            userSettings.AutoRemoveOnStop   = checkBoxRemoveOnStop.Checked;

            //Humanization
            userSettings.EnableHumanization   = checkBoxHumanizeThrows.Checked;
            userSettings.InsideReticuleChance = (int)numericUpDownInsideReticuleChance.Value;

            userSettings.GeneralDelay       = (int)numericUpDownGeneralDelay.Value;
            userSettings.GeneralDelayRandom = (int)numericUpDownGeneralDelayRandom.Value;

            userSettings.DelayBetweenLocationUpdates = (int)numericUpDownLocationUpdateDelay.Value;
            userSettings.LocationupdateDelayRandom   = (int)numericUpDownLocationUpdateRandom.Value;

            userSettings.DelayBetweenPlayerActions = (int)numericUpDownPlayerActionDelay.Value;
            userSettings.PlayerActionDelayRandom   = (int)numericUpDownPlayerActionRandomiz.Value;

            userSettings.WalkingSpeedOffset = (double)numericUpDownWalkingOffset.Value;
            //End humanization

            //Device settings
            userSettings.DeviceId             = textBoxDeviceId.Text;
            userSettings.DeviceModel          = textBoxDeviceModel.Text;
            userSettings.DeviceBrand          = textBoxDeviceBrand.Text;
            userSettings.DeviceModelBoot      = textBoxDeviceModelBoot.Text;
            userSettings.FirmwareBrand        = textBoxFirmwareBrand.Text;
            userSettings.FirmwareType         = textBoxFirmwareType.Text;
            userSettings.HardwareManufacturer = textBoxHardwareManufacturer.Text;
            userSettings.HardwareModel        = textBoxHardwareModel.Text;
            //End device settings

            //Api config
            userSettings.HashHost      = new Uri(cbHashHost.Text);
            userSettings.HashEndpoint  = cbHashEndpoint.Text;
            userSettings.AuthAPIKey    = tbAuthHashKey.Text;
            userSettings.UseOnlyOneKey = cbUseOnlyThisHashKey.Checked;
            //End api config

            //Location time zones
            var x = new TimeZoneIds().GetTimeZoneIds();

            userSettings.TimeZone = cbTimeZones.Text;
            userSettings.Country  = x[cbTimeZones.Text].Item1;
            userSettings.Language = x[cbTimeZones.Text].Item2;
            userSettings.POSIX    = x[cbTimeZones.Text].Item3;
            //End location time zones

            if (proxyEx != null)
            {
                userSettings.ProxyIP       = proxyEx.Address;
                userSettings.ProxyPort     = proxyEx.Port;
                userSettings.ProxyUsername = proxyEx.Username;
                userSettings.ProxyPassword = proxyEx.Password;
            }
            else
            {
                userSettings.ProxyUsername = null;
                userSettings.ProxyPassword = null;
                userSettings.ProxyIP       = null;
                userSettings.ProxyPort     = 0;
            }

            return(true);
        }
Example #6
0
        private bool SaveSettings()
        {
            Settings userSettings = _manager.UserSettings;

            double  defaultLat             = 0;
            double  defaultLong            = 0;
            int     walkingSpeed           = 0;
            int     maxTravelDistance      = 0;
            int     minPokemonBeforeEvolve = 0;
            int     maxLevel = 0;
            ProxyEx proxyEx  = null;

            if (!Int32.TryParse(textBoxMaxLevel.Text, out maxLevel) || maxLevel < 0)
            {
                MessageBox.Show("Invalid Max level");
                return(false);
            }

            if (!Int32.TryParse(textBoxPokemonBeforeEvolve.Text, out minPokemonBeforeEvolve) || minPokemonBeforeEvolve < 0)
            {
                MessageBox.Show("Invalid pokemon before evolve");
                return(false);
            }

            if (!Int32.TryParse(textBoxWalkSpeed.Text, out walkingSpeed) || walkingSpeed <= 0)
            {
                MessageBox.Show("Invalid walking speed");
                return(false);
            }

            if (!Int32.TryParse(textBoxMaxTravelDistance.Text, out maxTravelDistance) || maxTravelDistance <= 0)
            {
                MessageBox.Show("Invalid max travel distance");
                return(false);
            }

            if (!Double.TryParse(textBoxLat.Text, out defaultLat))
            {
                MessageBox.Show("Invalid latitude");
                return(false);
            }

            if (!Double.TryParse(textBoxLong.Text, out defaultLong))
            {
                MessageBox.Show("Invalid longitude");
                return(false);
            }

            if (!String.IsNullOrEmpty(textBoxProxy.Text) && !ProxyEx.TryParse(textBoxProxy.Text, out proxyEx))
            {
                MessageBox.Show("Invalid proxy format");
                return(false);
            }

            if (radioButtonPtc.Checked)
            {
                userSettings.AuthType = AuthType.Ptc;
            }
            else
            {
                userSettings.AuthType = AuthType.Google;
            }

            userSettings.MimicWalking           = checkBoxMimicWalking.Checked;
            userSettings.PtcUsername            = textBoxPtcUsername.Text;
            userSettings.PtcPassword            = textBoxPtcPassword.Text;
            userSettings.DefaultLatitude        = defaultLat;
            userSettings.DefaultLongitude       = defaultLong;
            userSettings.WalkingSpeed           = walkingSpeed;
            userSettings.MaxTravelDistance      = maxTravelDistance;
            userSettings.EncounterWhileWalking  = checkBoxEncounterWhileWalking.Checked;
            userSettings.AccountName            = textBoxName.Text;
            userSettings.TransferPokemon        = checkBoxTransfers.Checked;
            userSettings.EvolvePokemon          = checkBoxEvolve.Checked;
            userSettings.RecycleItems           = checkBoxRecycle.Checked;
            userSettings.MinPokemonBeforeEvolve = minPokemonBeforeEvolve;
            userSettings.UseLuckyEgg            = checkBoxUseLuckyEgg.Checked;
            userSettings.IncubateEggs           = checkBoxIncubateEggs.Checked;
            userSettings.MaxLevel            = maxLevel;
            userSettings.CatchPokemon        = checkBoxCatchPokemon.Checked;
            userSettings.SnipePokemon        = checkBoxSnipePokemon.Checked;
            userSettings.SnipeAfterPokestops = (int)numericUpDownSnipeAfterStops.Value;

            if (proxyEx != null)
            {
                userSettings.ProxyIP       = proxyEx.Address;
                userSettings.ProxyPort     = proxyEx.Port;
                userSettings.ProxyUsername = proxyEx.Username;
                userSettings.ProxyPassword = proxyEx.Password;
            }
            else
            {
                userSettings.ProxyUsername = null;
                userSettings.ProxyPassword = null;
                userSettings.ProxyIP       = null;
                userSettings.ProxyPort     = 0;
            }

            return(true);
        }