diff --git a/PokemonGo.RocketBot.Logic/Settings.cs b/PokemonGo.RocketBot.Logic/Settings.cs
index 16ff321..a0318f4 100644
--- a/PokemonGo.RocketBot.Logic/Settings.cs
+++ b/PokemonGo.RocketBot.Logic/Settings.cs
@@ -1,26 +1,24 @@
-
#region using directives
-using Newtonsoft.Json;
-using Newtonsoft.Json.Converters;
-using PokemonGo.RocketBot.Logic.Common;
-using PokemonGo.RocketBot.Logic.Logging;
-using PokemonGo.RocketBot.Logic.State;
-using PokemonGo.RocketBot.Logic.Utils;
-using POGOProtos.Enums;
-using POGOProtos.Inventory.Item;
-using PokemonGo.RocketAPI;
-using PokemonGo.RocketAPI.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Net;
-using System.Net.Http;
using System.Reflection;
using System.Security.Cryptography;
using System.Threading;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+using PokemonGo.RocketAPI;
+using PokemonGo.RocketAPI.Enums;
+using PokemonGo.RocketBot.Logic.Common;
+using PokemonGo.RocketBot.Logic.Logging;
+using PokemonGo.RocketBot.Logic.State;
+using PokemonGo.RocketBot.Logic.Utils;
+using POGOProtos.Enums;
+using POGOProtos.Inventory.Item;
#endregion
@@ -28,50 +26,52 @@ namespace PokemonGo.RocketBot.Logic
{
public class AuthSettings
{
- [JsonIgnore]
- private string _filePath;
+ [JsonIgnore] private string _filePath;
+
+ [DefaultValue("msm8996")] public string AndroidBoardName;
+
+ [DefaultValue("1.0.0.0000")] public string AndroidBootloader;
public AuthType AuthType;
- public string GoogleUsername;
+
+ [DefaultValue("HTC")] public string DeviceBrand;
+
+ [DefaultValue("8525f5d8201f78b5")] public string DeviceId;
+
+ [DefaultValue("HTC 10")] public string DeviceModel;
+
+ [DefaultValue("qcom")] public string DeviceModelBoot;
+
+ [DefaultValue("pmewl_00531")] public string DeviceModelIdentifier;
+
+ // device data
+ [DefaultValue("random")] public string DevicePackageName;
+
+ [DefaultValue("pmewl_00531")] public string FirmwareBrand;
+
+ [DefaultValue("htc/pmewl_00531/htc_pmewl:6.0.1/MMB29M/770927.1:user/release-keys")] public string
+ FirmwareFingerprint;
+
+ [DefaultValue("release-keys")] public string FirmwareTags;
+
+ [DefaultValue("user")] public string FirmwareType;
+
+ public string GoogleApiKey;
public string GooglePassword;
- public string PtcUsername;
+ public string GoogleUsername;
+
+ [DefaultValue("HTC")] public string HardwareManufacturer;
+
+ [DefaultValue("HTC 10")] public string HardwareModel;
+
public string PtcPassword;
+ public string PtcUsername;
public bool UseProxy;
+ public bool UseProxyAuthentication;
public string UseProxyHost;
+ public string UseProxyPassword;
public string UseProxyPort;
- public bool UseProxyAuthentication;
public string UseProxyUsername;
- public string UseProxyPassword;
- public string GoogleApiKey;
- // device data
- [DefaultValue("random")]
- public string DevicePackageName;
- [DefaultValue("8525f5d8201f78b5")]
- public string DeviceId;
- [DefaultValue("msm8996")]
- public string AndroidBoardName;
- [DefaultValue("1.0.0.0000")]
- public string AndroidBootloader;
- [DefaultValue("HTC")]
- public string DeviceBrand;
- [DefaultValue("HTC 10")]
- public string DeviceModel;
- [DefaultValue("pmewl_00531")]
- public string DeviceModelIdentifier;
- [DefaultValue("qcom")]
- public string DeviceModelBoot;
- [DefaultValue("HTC")]
- public string HardwareManufacturer;
- [DefaultValue("HTC 10")]
- public string HardwareModel;
- [DefaultValue("pmewl_00531")]
- public string FirmwareBrand;
- [DefaultValue("release-keys")]
- public string FirmwareTags;
- [DefaultValue("user")]
- public string FirmwareType;
- [DefaultValue("htc/pmewl_00531/htc_pmewl:6.0.1/MMB29M/770927.1:user/release-keys")]
- public string FirmwareFingerprint;
public AuthSettings()
{
@@ -80,9 +80,9 @@ namespace PokemonGo.RocketBot.Logic
public void InitializePropertyDefaultValues(object obj)
{
- FieldInfo[] fields = obj.GetType().GetFields();
+ var fields = obj.GetType().GetFields();
- foreach (FieldInfo field in fields)
+ foreach (var field in fields)
{
var d = field.GetCustomAttribute<DefaultValueAttribute>();
@@ -103,27 +103,29 @@ namespace PokemonGo.RocketBot.Logic
var input = File.ReadAllText(_filePath);
var settings = new JsonSerializerSettings();
- settings.Converters.Add(new StringEnumConverter { CamelCaseText = true });
+ settings.Converters.Add(new StringEnumConverter {CamelCaseText = true});
JsonConvert.PopulateObject(input, this, settings);
}
// Do some post-load logic to determine what device info to be using - if 'custom' is set we just take what's in the file without question
- if (!this.DevicePackageName.Equals("random", StringComparison.InvariantCultureIgnoreCase) && !this.DevicePackageName.Equals("custom", StringComparison.InvariantCultureIgnoreCase))
+ if (!DevicePackageName.Equals("random", StringComparison.InvariantCultureIgnoreCase) &&
+ !DevicePackageName.Equals("custom", StringComparison.InvariantCultureIgnoreCase))
{
// User requested a specific device package, check to see if it exists and if so, set it up - otherwise fall-back to random package
- string keepDevId = this.DeviceId;
- SetDevInfoByKey(this.DevicePackageName);
- this.DeviceId = keepDevId;
+ var keepDevId = DeviceId;
+ SetDevInfoByKey(DevicePackageName);
+ DeviceId = keepDevId;
}
- if (this.DevicePackageName.Equals("random", StringComparison.InvariantCultureIgnoreCase))
+ if (DevicePackageName.Equals("random", StringComparison.InvariantCultureIgnoreCase))
{
// Random is set, so pick a random device package and set it up - it will get saved to disk below and re-used in subsequent sessions
- Random rnd = new Random();
- int rndIdx = rnd.Next(0, DeviceInfoHelper.DeviceInfoSets.Keys.Count - 1);
- this.DevicePackageName = DeviceInfoHelper.DeviceInfoSets.Keys.ToArray()[rndIdx];
- SetDevInfoByKey(this.DevicePackageName);
+ var rnd = new Random();
+ var rndIdx = rnd.Next(0, DeviceInfoHelper.DeviceInfoSets.Keys.Count - 1);
+ DevicePackageName = DeviceInfoHelper.DeviceInfoSets.Keys.ToArray()[rndIdx];
+ SetDevInfoByKey(DevicePackageName);
}
- if (string.IsNullOrEmpty(this.DeviceId) || this.DeviceId == "8525f5d8201f78b5")
- this.DeviceId = this.RandomString(16, "0123456789abcdef"); // changed to random hex as full alphabet letters could have been flagged
+ if (string.IsNullOrEmpty(DeviceId) || DeviceId == "8525f5d8201f78b5")
+ DeviceId = RandomString(16, "0123456789abcdef");
+ // changed to random hex as full alphabet letters could have been flagged
// Jurann: Note that some device IDs I saw when adding devices had smaller numbers, only 12 or 14 chars instead of 16 - probably not important but noted here anyway
@@ -159,7 +161,7 @@ namespace PokemonGo.RocketBot.Logic
{
DefaultValueHandling = DefaultValueHandling.Include,
Formatting = Formatting.Indented,
- Converters = new JsonConverter[] { new StringEnumConverter { CamelCaseText = true } }
+ Converters = new JsonConverter[] {new StringEnumConverter {CamelCaseText = true}}
};
var output = JsonConvert.SerializeObject(this, jsonSerializeSettings);
@@ -185,15 +187,17 @@ namespace PokemonGo.RocketBot.Logic
{
using (var tempWebClient = new NecroWebClient())
{
- string unproxiedIP = WebClientExtensions.DownloadString(tempWebClient, new Uri("https://api.ipify.org/?format=text"));
+ var unproxiedIP = WebClientExtensions.DownloadString(tempWebClient,
+ new Uri("https://api.ipify.org/?format=text"));
if (UseProxy)
{
- tempWebClient.Proxy = this.InitProxy();
- string proxiedIPres = WebClientExtensions.DownloadString(tempWebClient, new Uri("https://api.ipify.org/?format=text"));
- string proxiedIP = proxiedIPres == null ? "INVALID PROXY" : proxiedIPres;
+ tempWebClient.Proxy = InitProxy();
+ var proxiedIPres = WebClientExtensions.DownloadString(tempWebClient,
+ new Uri("https://api.ipify.org/?format=text"));
+ var proxiedIP = proxiedIPres == null ? "INVALID PROXY" : proxiedIPres;
Logger.Write(
- $"Your IP is: {unproxiedIP} / Proxy IP is: {proxiedIP}",
- LogLevel.Info, (unproxiedIP == proxiedIP) ? ConsoleColor.Red : ConsoleColor.Green);
+ $"Your IP is: {unproxiedIP} / Proxy IP is: {proxiedIP}",
+ LogLevel.Info, unproxiedIP == proxiedIP ? ConsoleColor.Red : ConsoleColor.Green);
if (unproxiedIP == proxiedIP || proxiedIPres == null)
{
@@ -206,24 +210,24 @@ namespace PokemonGo.RocketBot.Logic
else
{
Logger.Write(
- $"Your IP is: {unproxiedIP}",
- LogLevel.Info, ConsoleColor.Red);
+ $"Your IP is: {unproxiedIP}",
+ LogLevel.Info, ConsoleColor.Red);
}
}
}
private string RandomString(int length, string alphabet = "abcdefghijklmnopqrstuvwxyz0123456789")
{
- var outOfRange = Byte.MaxValue + 1 - (Byte.MaxValue + 1) % alphabet.Length;
+ var outOfRange = byte.MaxValue + 1 - (byte.MaxValue + 1)%alphabet.Length;
return string.Concat(
Enumerable
- .Repeat(0, Int32.MaxValue)
- .Select(e => this.RandomByte())
+ .Repeat(0, int.MaxValue)
+ .Select(e => RandomByte())
.Where(randomByte => randomByte < outOfRange)
.Take(length)
- .Select(randomByte => alphabet[randomByte % alphabet.Length])
- );
+ .Select(randomByte => alphabet[randomByte%alphabet.Length])
+ );
}
private byte RandomByte()
@@ -238,25 +242,26 @@ namespace PokemonGo.RocketBot.Logic
private void SetDevInfoByKey(string devKey)
{
- if (DeviceInfoHelper.DeviceInfoSets.ContainsKey(this.DevicePackageName))
+ if (DeviceInfoHelper.DeviceInfoSets.ContainsKey(DevicePackageName))
{
- this.AndroidBoardName = DeviceInfoHelper.DeviceInfoSets[this.DevicePackageName]["AndroidBoardName"];
- this.AndroidBootloader = DeviceInfoHelper.DeviceInfoSets[this.DevicePackageName]["AndroidBootloader"];
- this.DeviceBrand = DeviceInfoHelper.DeviceInfoSets[this.DevicePackageName]["DeviceBrand"];
- this.DeviceId = DeviceInfoHelper.DeviceInfoSets[this.DevicePackageName]["DeviceId"];
- this.DeviceModel = DeviceInfoHelper.DeviceInfoSets[this.DevicePackageName]["DeviceModel"];
- this.DeviceModelBoot = DeviceInfoHelper.DeviceInfoSets[this.DevicePackageName]["DeviceModelBoot"];
- this.DeviceModelIdentifier = DeviceInfoHelper.DeviceInfoSets[this.DevicePackageName]["DeviceModelIdentifier"];
- this.FirmwareBrand = DeviceInfoHelper.DeviceInfoSets[this.DevicePackageName]["FirmwareBrand"];
- this.FirmwareFingerprint = DeviceInfoHelper.DeviceInfoSets[this.DevicePackageName]["FirmwareFingerprint"];
- this.FirmwareTags = DeviceInfoHelper.DeviceInfoSets[this.DevicePackageName]["FirmwareTags"];
- this.FirmwareType = DeviceInfoHelper.DeviceInfoSets[this.DevicePackageName]["FirmwareType"];
- this.HardwareManufacturer = DeviceInfoHelper.DeviceInfoSets[this.DevicePackageName]["HardwareManufacturer"];
- this.HardwareModel = DeviceInfoHelper.DeviceInfoSets[this.DevicePackageName]["HardwareModel"];
+ AndroidBoardName = DeviceInfoHelper.DeviceInfoSets[DevicePackageName]["AndroidBoardName"];
+ AndroidBootloader = DeviceInfoHelper.DeviceInfoSets[DevicePackageName]["AndroidBootloader"];
+ DeviceBrand = DeviceInfoHelper.DeviceInfoSets[DevicePackageName]["DeviceBrand"];
+ DeviceId = DeviceInfoHelper.DeviceInfoSets[DevicePackageName]["DeviceId"];
+ DeviceModel = DeviceInfoHelper.DeviceInfoSets[DevicePackageName]["DeviceModel"];
+ DeviceModelBoot = DeviceInfoHelper.DeviceInfoSets[DevicePackageName]["DeviceModelBoot"];
+ DeviceModelIdentifier = DeviceInfoHelper.DeviceInfoSets[DevicePackageName]["DeviceModelIdentifier"];
+ FirmwareBrand = DeviceInfoHelper.DeviceInfoSets[DevicePackageName]["FirmwareBrand"];
+ FirmwareFingerprint = DeviceInfoHelper.DeviceInfoSets[DevicePackageName]["FirmwareFingerprint"];
+ FirmwareTags = DeviceInfoHelper.DeviceInfoSets[DevicePackageName]["FirmwareTags"];
+ FirmwareType = DeviceInfoHelper.DeviceInfoSets[DevicePackageName]["FirmwareType"];
+ HardwareManufacturer = DeviceInfoHelper.DeviceInfoSets[DevicePackageName]["HardwareManufacturer"];
+ HardwareModel = DeviceInfoHelper.DeviceInfoSets[DevicePackageName]["HardwareModel"];
}
else
{
- throw new ArgumentException("Invalid device info package! Check your auth.config file and make sure a valid DevicePackageName is set. For simple use set it to 'random'. If you have a custom device, then set it to 'custom'.");
+ throw new ArgumentException(
+ "Invalid device info package! Check your auth.config file and make sure a valid DevicePackageName is set. For simple use set it to 'random'. If you have a custom device, then set it to 'custom'.");
}
}
@@ -264,7 +269,7 @@ namespace PokemonGo.RocketBot.Logic
{
if (!UseProxy) return null;
- WebProxy prox = new WebProxy(new System.Uri($"http://{UseProxyHost}:{UseProxyPort}"), false, null);
+ var prox = new WebProxy(new Uri($"http://{UseProxyHost}:{UseProxyPort}"), false, null);
if (UseProxyAuthentication)
prox.Credentials = new NetworkCredential(UseProxyUsername, UseProxyPassword);
@@ -275,268 +280,93 @@ namespace PokemonGo.RocketBot.Logic
public class GlobalSettings
{
- [JsonIgnore]
- public AuthSettings Auth = new AuthSettings();
- [JsonIgnore]
- public string GeneralConfigPath;
- [JsonIgnore]
- public string ProfileConfigPath;
- [JsonIgnore]
- public string ProfilePath;
-
- [JsonIgnore]
- public bool isGui;
-
- [DefaultValue(false)]
- public bool EnableAdvancedSettings;
-
- [DefaultValue("en")]
- public string TranslationLanguageCode;
- //autoupdate
- [DefaultValue(true)]
- public bool AutoUpdate;
- [DefaultValue(true)]
- public bool TransferConfigAndAuthOnUpdate;
- //websockets
- [DefaultValue(false)]
- public bool UseWebsocket;
- [DefaultValue(14251)]
- public int WebSocketPort;
- //pressakeyshit
- [DefaultValue(false)]
- public bool StartupWelcomeDelay;
- //Telegram
- [DefaultValue(false)]
- public bool UseTelegramApi;
- [DefaultValue(null)]
- public string TelegramApiKey;
-
//console options
- [DefaultValue(0)]
- public int AmountOfPokemonToDisplayOnStart;
- [DefaultValue(true)]
- public bool DetailedCountsBeforeRecycling;
+ [DefaultValue(0)] public int AmountOfPokemonToDisplayOnStart;
+
+ [DefaultValue(5)] public int AmountOfTimesToUpgradeLoop;
+
+ [JsonIgnore] public AuthSettings Auth = new AuthSettings();
+
+ [DefaultValue(false)] public bool AutoFavoritePokemon;
- [DefaultValue(3)]
- public int MaxBerriesToUsePerPokemon;
- //pokemon
- [DefaultValue(true)]
- public bool CatchPokemon;
//powerup
- [DefaultValue(false)]
- public bool AutomaticallyLevelUpPokemon;
- [DefaultValue(true)]
- public bool OnlyUpgradeFavorites;
-
- [DefaultValue((true))]
- public bool UseLevelUpList;
- [DefaultValue(5)]
- public int AmountOfTimesToUpgradeLoop;
- [DefaultValue(5000)]
- public int GetMinStarDustForLevelUp;
- [DefaultValue("iv")]
- public string LevelUpByCPorIv;
- [DefaultValue(1000)]
- public float UpgradePokemonCpMinimum;
- [DefaultValue(95)]
- public float UpgradePokemonIvMinimum;
- [DefaultValue("and")]
- public string UpgradePokemonMinimumStatsOperator;
- //position
- [DefaultValue(false)]
- public bool DisableHumanWalking;
- [DefaultValue(40.785091)]
- public double DefaultLatitude;
- [DefaultValue(-73.968285)]
- public double DefaultLongitude;
- [DefaultValue(19.0)]
- public double WalkingSpeedInKilometerPerHour;
- [DefaultValue(true)]
- public bool UseWalkingSpeedVariant;
- [DefaultValue(1.2)]
- public double WalkingSpeedVariant;
- [DefaultValue(true)]
- public bool ShowVariantWalking;
- [DefaultValue(10)]
- public int MaxSpawnLocationOffset;
- //softban related
- [DefaultValue(false)]
- public bool FastSoftBanBypass;
+ [DefaultValue(false)] public bool AutomaticallyLevelUpPokemon;
+
+ //autoupdate
+ [DefaultValue(true)] public bool AutoUpdate;
+
+ //pokemon
+ [DefaultValue(true)] public bool CatchPokemon;
+
+ [DefaultValue(90)] public int CurveThrowChance;
+
+ [DefaultValue(40.785091)] public double DefaultLatitude;
+
+ [DefaultValue(-73.968285)] public double DefaultLongitude;
+
//delays
- [DefaultValue(500)]
- public int DelayBetweenPlayerActions;
- [DefaultValue(100)]
- public int DelayBetweenPokemonCatch;
+ [DefaultValue(500)] public int DelayBetweenPlayerActions;
+
+ [DefaultValue(100)] public int DelayBetweenPokemonCatch;
+
+ [DefaultValue(false)] public bool DelayBetweenRecycleActions;
+
+ [DefaultValue(true)] public bool DetailedCountsBeforeRecycling;
+
+ //position
+ [DefaultValue(false)] public bool DisableHumanWalking;
+
//dump stats
- [DefaultValue(false)]
- public bool DumpPokemonStats;
- //evolve
- [DefaultValue(95)]
- public float EvolveAboveIvValue;
- [DefaultValue(false)]
- public bool EvolveAllPokemonAboveIv;
- [DefaultValue(true)]
- public bool EvolveAllPokemonWithEnoughCandy;
- [DefaultValue(90.0)]
- public double EvolveKeptPokemonsAtStorageUsagePercentage;
- [DefaultValue(false)]
- public bool KeepPokemonsThatCanEvolve;
- //keeping
- [DefaultValue(1250)]
- public int KeepMinCp;
- [DefaultValue(90)]
- public float KeepMinIvPercentage;
- [DefaultValue(6)]
- public int KeepMinLvl;
- [DefaultValue("or")]
- public string KeepMinOperator;
- [DefaultValue(false)]
- public bool UseKeepMinLvl;
- [DefaultValue(false)]
- public bool PrioritizeIvOverCp;
- [DefaultValue(0)]
- public int KeepMinDuplicatePokemon;
- //gpx
- [DefaultValue(false)]
- public bool UseGpxPathing;
- [DefaultValue("GPXPath.GPX")]
- public string GpxFile;
- //recycle
- [DefaultValue(true)]
- public bool VerboseRecycling;
- [DefaultValue(90.0)]
- public double RecycleInventoryAtUsagePercentage;
- [DefaultValue(false)]
- public bool RandomizeRecycle;
- [DefaultValue(5)]
- public int RandomRecycleValue;
- [DefaultValue(false)]
- public bool DelayBetweenRecycleActions;
- //lucky, incense and berries
- [DefaultValue(true)]
- public bool UseEggIncubators;
- [DefaultValue(false)]
- public bool UseLuckyEggConstantly;
- [DefaultValue(30)]
- public int UseLuckyEggsMinPokemonAmount;
- [DefaultValue(false)]
- public bool UseLuckyEggsWhileEvolving;
- [DefaultValue(false)]
- public bool UseIncenseConstantly;
- [DefaultValue(1000)]
- public int UseBerriesMinCp;
- [DefaultValue(90)]
- public float UseBerriesMinIv;
- [DefaultValue(0.20)]
- public double UseBerriesBelowCatchProbability;
- [DefaultValue("or")]
- public string UseBerriesOperator;
- //snipe
- [DefaultValue(false)]
- public bool UseSnipeLocationServer;
- [DefaultValue("localhost")]
- public string SnipeLocationServer;
- [DefaultValue(16969)]
- public int SnipeLocationServerPort;
- [DefaultValue(true)]
- public bool GetSniperInfoFromPokezz;
- [DefaultValue(true)]
- public bool GetOnlyVerifiedSniperInfoFromPokezz;
- [DefaultValue(true)]
- public bool GetSniperInfoFromPokeSnipers;
- [DefaultValue(true)]
- public bool GetSniperInfoFromPokeWatchers;
- [DefaultValue(true)]
- public bool SnipeWithSkiplagged;
- [DefaultValue(20)]
- public int MinPokeballsToSnipe;
- [DefaultValue(0)]
- public int MinPokeballsWhileSnipe;
- [DefaultValue(60000)]
- public int MinDelayBetweenSnipes;
- [DefaultValue(0.005)]
- public double SnipingScanOffset;
- [DefaultValue(false)]
- public bool SnipeAtPokestops;
- [DefaultValue(false)]
- public bool SnipeIgnoreUnknownIv;
- [DefaultValue(false)]
- public bool UseTransferIvForSnipe;
- [DefaultValue(false)]
- public bool SnipePokemonNotInPokedex;
- //rename
- [DefaultValue(false)]
- public bool RenamePokemon;
- [DefaultValue(true)]
- public bool RenameOnlyAboveIv;
- [DefaultValue("{1}_{0}")]
- public string RenameTemplate;
- //amounts
- [DefaultValue(6)]
- public int MaxPokeballsPerPokemon;
- [DefaultValue(1000)]
- public int MaxTravelDistanceInMeters;
- [DefaultValue(120)]
- public int TotalAmountOfPokeballsToKeep;
- [DefaultValue(80)]
- public int TotalAmountOfPotionsToKeep;
- [DefaultValue(60)]
- public int TotalAmountOfRevivesToKeep;
- [DefaultValue(50)]
- public int TotalAmountOfBerriesToKeep;
- //balls
- [DefaultValue(1000)]
- public int UseGreatBallAboveCp;
- [DefaultValue(1250)]
- public int UseUltraBallAboveCp;
- [DefaultValue(1500)]
- public int UseMasterBallAboveCp;
- [DefaultValue(85.0)]
- public double UseGreatBallAboveIv;
- [DefaultValue(95.0)]
- public double UseUltraBallAboveIv;
- [DefaultValue(0.2)]
- public double UseGreatBallBelowCatchProbability;
- [DefaultValue(0.1)]
- public double UseUltraBallBelowCatchProbability;
- [DefaultValue(0.05)]
- public double UseMasterBallBelowCatchProbability;
+ [DefaultValue(false)] public bool DumpPokemonStats;
+
+ [DefaultValue(false)] public bool EnableAdvancedSettings;
+
//customizable catch
- [DefaultValue(false)]
- public bool EnableHumanizedThrows;
- [DefaultValue(40)]
- public int NiceThrowChance;
- [DefaultValue(30)]
- public int GreatThrowChance;
- [DefaultValue(10)]
- public int ExcellentThrowChance;
- [DefaultValue(90)]
- public int CurveThrowChance;
- [DefaultValue(90.00)]
- public double ForceGreatThrowOverIv;
- [DefaultValue(95.00)]
- public double ForceExcellentThrowOverIv;
- [DefaultValue(1000)]
- public int ForceGreatThrowOverCp;
- [DefaultValue(1500)]
- public int ForceExcellentThrowOverCp;
- //transfer
- [DefaultValue(false)]
- public bool TransferWeakPokemon;
- [DefaultValue(true)]
- public bool TransferDuplicatePokemon;
- [DefaultValue(true)]
- public bool TransferDuplicatePokemonOnCapture;
+ [DefaultValue(false)] public bool EnableHumanizedThrows;
+
+ //evolve
+ [DefaultValue(95)] public float EvolveAboveIvValue;
+
+ [DefaultValue(false)] public bool EvolveAllPokemonAboveIv;
+
+ [DefaultValue(true)] public bool EvolveAllPokemonWithEnoughCandy;
+
+ [DefaultValue(90.0)] public double EvolveKeptPokemonsAtStorageUsagePercentage;
+
+ [DefaultValue(10)] public int ExcellentThrowChance;
+
+ //softban related
+ [DefaultValue(false)] public bool FastSoftBanBypass;
+
//favorite
- [DefaultValue(95)]
- public float FavoriteMinIvPercentage;
- [DefaultValue(false)]
- public bool AutoFavoritePokemon;
- //notcatch
- [DefaultValue(false)]
- public bool UsePokemonToNotCatchFilter;
- [DefaultValue(false)]
- public bool UsePokemonSniperFilterOnly;
+ [DefaultValue(95)] public float FavoriteMinIvPercentage;
+
+ [DefaultValue(1500)] public int ForceExcellentThrowOverCp;
+
+ [DefaultValue(95.00)] public double ForceExcellentThrowOverIv;
+
+ [DefaultValue(1000)] public int ForceGreatThrowOverCp;
+
+ [DefaultValue(90.00)] public double ForceGreatThrowOverIv;
+
+ [JsonIgnore] public string GeneralConfigPath;
+
+ [DefaultValue(5000)] public int GetMinStarDustForLevelUp;
+
+ [DefaultValue(true)] public bool GetOnlyVerifiedSniperInfoFromPokezz;
+
+ [DefaultValue(true)] public bool GetSniperInfoFromPokeSnipers;
+
+ [DefaultValue(true)] public bool GetSniperInfoFromPokeWatchers;
+
+ [DefaultValue(true)] public bool GetSniperInfoFromPokezz;
+
+ [DefaultValue("GPXPath.GPX")] public string GpxFile;
+
+ [DefaultValue(30)] public int GreatThrowChance;
+
+ [JsonIgnore] public bool isGui;
+
public List<KeyValuePair<ItemId, int>> ItemRecycleFilter = new List<KeyValuePair<ItemId, int>>
{
new KeyValuePair<ItemId, int>(ItemId.ItemUnknown, 0),
@@ -556,6 +386,40 @@ namespace PokemonGo.RocketBot.Logic
new KeyValuePair<ItemId, int>(ItemId.ItemItemStorageUpgrade, 100)
};
+ //keeping
+ [DefaultValue(1250)] public int KeepMinCp;
+
+ [DefaultValue(0)] public int KeepMinDuplicatePokemon;
+
+ [DefaultValue(90)] public float KeepMinIvPercentage;
+
+ [DefaultValue(6)] public int KeepMinLvl;
+
+ [DefaultValue("or")] public string KeepMinOperator;
+
+ [DefaultValue(false)] public bool KeepPokemonsThatCanEvolve;
+
+ [DefaultValue("iv")] public string LevelUpByCPorIv;
+
+ [DefaultValue(3)] public int MaxBerriesToUsePerPokemon;
+
+ //amounts
+ [DefaultValue(6)] public int MaxPokeballsPerPokemon;
+
+ [DefaultValue(10)] public int MaxSpawnLocationOffset;
+
+ [DefaultValue(1000)] public int MaxTravelDistanceInMeters;
+
+ [DefaultValue(60000)] public int MinDelayBetweenSnipes;
+
+ [DefaultValue(20)] public int MinPokeballsToSnipe;
+
+ [DefaultValue(0)] public int MinPokeballsWhileSnipe;
+
+ [DefaultValue(40)] public int NiceThrowChance;
+
+ [DefaultValue(true)] public bool OnlyUpgradeFavorites;
+
public List<PokemonId> PokemonsNotToTransfer = new List<PokemonId>
{
@@ -636,7 +500,8 @@ namespace PokemonGo.RocketBot.Logic
//PokemonId.Goldeen,
//PokemonId.Staryu
};
- public List<PokemonId> PokemonsToLevelUp = new List<PokemonId>
+
+ public List<PokemonId> PokemonsToIgnore = new List<PokemonId>
{
//criteria: most common
PokemonId.Caterpie,
@@ -647,7 +512,8 @@ namespace PokemonGo.RocketBot.Logic
PokemonId.Zubat,
PokemonId.Doduo
};
- public List<PokemonId> PokemonsToIgnore = new List<PokemonId>
+
+ public List<PokemonId> PokemonsToLevelUp = new List<PokemonId>
{
//criteria: most common
PokemonId.Caterpie,
@@ -764,16 +630,153 @@ namespace PokemonGo.RocketBot.Logic
PokemonId.Mewtwo
};
+ [DefaultValue(false)] public bool PrioritizeIvOverCp;
+
+ [JsonIgnore] public string ProfileConfigPath;
+
+ [JsonIgnore] public string ProfilePath;
+
+ [DefaultValue(false)] public bool RandomizeRecycle;
+
+ [DefaultValue(5)] public int RandomRecycleValue;
+
+ [DefaultValue(90.0)] public double RecycleInventoryAtUsagePercentage;
+
+ [DefaultValue(true)] public bool RenameOnlyAboveIv;
+
+ //rename
+ [DefaultValue(false)] public bool RenamePokemon;
+
+ [DefaultValue("{1}_{0}")] public string RenameTemplate;
+
+ [DefaultValue(true)] public bool ShowVariantWalking;
+
+ [DefaultValue(false)] public bool SnipeAtPokestops;
+
+ [DefaultValue(false)] public bool SnipeIgnoreUnknownIv;
+
+ [DefaultValue("localhost")] public string SnipeLocationServer;
+
+ [DefaultValue(16969)] public int SnipeLocationServerPort;
+
+ [DefaultValue(false)] public bool SnipePokemonNotInPokedex;
+
+ [DefaultValue(true)] public bool SnipeWithSkiplagged;
+
+ [DefaultValue(0.005)] public double SnipingScanOffset;
+
+ //pressakeyshit
+ [DefaultValue(false)] public bool StartupWelcomeDelay;
+
+ [DefaultValue(null)] public string TelegramApiKey;
+
+ [DefaultValue(50)] public int TotalAmountOfBerriesToKeep;
+
+ [DefaultValue(120)] public int TotalAmountOfPokeballsToKeep;
+
+ [DefaultValue(80)] public int TotalAmountOfPotionsToKeep;
+
+ [DefaultValue(60)] public int TotalAmountOfRevivesToKeep;
+
+ [DefaultValue(true)] public bool TransferConfigAndAuthOnUpdate;
+
+ [DefaultValue(true)] public bool TransferDuplicatePokemon;
+
+ [DefaultValue(true)] public bool TransferDuplicatePokemonOnCapture;
+
+ //transfer
+ [DefaultValue(false)] public bool TransferWeakPokemon;
+
+ [DefaultValue("en")] public string TranslationLanguageCode;
+
+ [DefaultValue(1000)] public float UpgradePokemonCpMinimum;
+
+ [DefaultValue(95)] public float UpgradePokemonIvMinimum;
+
+ [DefaultValue("and")] public string UpgradePokemonMinimumStatsOperator;
+
+ [DefaultValue(0.20)] public double UseBerriesBelowCatchProbability;
+
+ [DefaultValue(1000)] public int UseBerriesMinCp;
+
+ [DefaultValue(90)] public float UseBerriesMinIv;
+
+ [DefaultValue("or")] public string UseBerriesOperator;
+
+ //lucky, incense and berries
+ [DefaultValue(true)] public bool UseEggIncubators;
+
+ //gpx
+ [DefaultValue(false)] public bool UseGpxPathing;
+
+ //balls
+ [DefaultValue(1000)] public int UseGreatBallAboveCp;
+
+ [DefaultValue(85.0)] public double UseGreatBallAboveIv;
+
+ [DefaultValue(0.2)] public double UseGreatBallBelowCatchProbability;
+
+ [DefaultValue(false)] public bool UseIncenseConstantly;
+
+ [DefaultValue(false)] public bool UseKeepMinLvl;
+
+ [DefaultValue(true)] public bool UseLevelUpList;
+
+ [DefaultValue(false)] public bool UseLuckyEggConstantly;
+
+ [DefaultValue(30)] public int UseLuckyEggsMinPokemonAmount;
+
+ [DefaultValue(false)] public bool UseLuckyEggsWhileEvolving;
+
+ [DefaultValue(1500)] public int UseMasterBallAboveCp;
+
+ [DefaultValue(0.05)] public double UseMasterBallBelowCatchProbability;
+
+ [DefaultValue(false)] public bool UsePokemonSniperFilterOnly;
+
+ //notcatch
+ [DefaultValue(false)] public bool UsePokemonToNotCatchFilter;
+
+ //snipe
+ [DefaultValue(false)] public bool UseSnipeLocationServer;
+
+ //Telegram
+ [DefaultValue(false)] public bool UseTelegramApi;
+
+ [DefaultValue(false)] public bool UseTransferIvForSnipe;
+
+ [DefaultValue(1250)] public int UseUltraBallAboveCp;
+
+ [DefaultValue(95.0)] public double UseUltraBallAboveIv;
+
+ [DefaultValue(0.1)] public double UseUltraBallBelowCatchProbability;
+
+ [DefaultValue(true)] public bool UseWalkingSpeedVariant;
+
+ //websockets
+ [DefaultValue(false)] public bool UseWebsocket;
+
+ //recycle
+ [DefaultValue(true)] public bool VerboseRecycling;
+
+ [DefaultValue(19.0)] public double WalkingSpeedInKilometerPerHour;
+
+ [DefaultValue(1.2)] public double WalkingSpeedVariant;
+
+ [DefaultValue(14251)] public int WebSocketPort;
+
public GlobalSettings()
{
InitializePropertyDefaultValues(this);
}
+ public static GlobalSettings Default => new GlobalSettings();
+
public void InitializePropertyDefaultValues(object obj)
{
- FieldInfo[] fields = obj.GetType().GetFields();
+ var fields = obj.GetType().GetFields();
- foreach (FieldInfo field in fields)
+ foreach (var field in fields)
{
var d = field.GetCustomAttribute<DefaultValueAttribute>();
@@ -782,12 +785,12 @@ namespace PokemonGo.RocketBot.Logic
}
}
- public static GlobalSettings Default => new GlobalSettings();
-
public static GlobalSettings Load(string path, bool boolSkipSave = false)
{
GlobalSettings settings = null;
- bool isGui = (AppDomain.CurrentDomain.GetAssemblies().SingleOrDefault(a => a.FullName.Contains("PoGo.NecroBot.GUI")) != null);
+ var isGui =
+ AppDomain.CurrentDomain.GetAssemblies().SingleOrDefault(a => a.FullName.Contains("PoGo.NecroBot.GUI")) !=
+ null;
var profilePath = Path.Combine(Directory.GetCurrentDirectory(), path);
var profileConfigPath = Path.Combine(profilePath, "config");
var configFile = Path.Combine(profileConfigPath, "config.json");
@@ -798,8 +801,8 @@ namespace PokemonGo.RocketBot.Logic
try
{
//if the file exists, load the settings
- string input = "";
- int count = 0;
+ var input = "";
+ var count = 0;
while (true)
{
try
@@ -817,10 +820,11 @@ namespace PokemonGo.RocketBot.Logic
count++;
Thread.Sleep(1000);
}
- };
+ }
+ ;
var jsonSettings = new JsonSerializerSettings();
- jsonSettings.Converters.Add(new StringEnumConverter { CamelCaseText = true });
+ jsonSettings.Converters.Add(new StringEnumConverter {CamelCaseText = true});
jsonSettings.ObjectCreationHandling = ObjectCreationHandling.Replace;
jsonSettings.DefaultValueHandling = DefaultValueHandling.Populate;
@@ -878,7 +882,7 @@ namespace PokemonGo.RocketBot.Logic
while (true)
{
- string strInput = Console.ReadLine().ToLower();
+ var strInput = Console.ReadLine().ToLower();
switch (strInput)
{
@@ -894,9 +898,9 @@ namespace PokemonGo.RocketBot.Logic
}
}
- public static Session SetupSettings(Session session, GlobalSettings settings, String configPath)
+ public static Session SetupSettings(Session session, GlobalSettings settings, string configPath)
{
- Session newSession = SetupTranslationCode(session, session.Translation, settings);
+ var newSession = SetupTranslationCode(session, session.Translation, settings);
SetupAccountType(newSession.Translation, settings);
SetupUserAccount(newSession.Translation, settings);
@@ -913,7 +917,7 @@ namespace PokemonGo.RocketBot.Logic
Logger.Write(translator.GetTranslation(TranslationString.FirstStartLanguagePrompt, "Y", "N"), LogLevel.None);
string strInput;
- bool boolBreak = false;
+ var boolBreak = false;
while (!boolBreak)
{
strInput = Console.ReadLine().ToLower();
@@ -964,7 +968,9 @@ namespace PokemonGo.RocketBot.Logic
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupTypeConfirm, "PTC"));
return;
default:
- Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupTypePromptError, "google", "ptc"), LogLevel.Error);
+ Logger.Write(
+ translator.GetTranslation(TranslationString.FirstStartSetupTypePromptError, "google", "ptc"),
+ LogLevel.Error);
break;
}
}
@@ -974,7 +980,7 @@ namespace PokemonGo.RocketBot.Logic
{
Console.WriteLine("");
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupUsernamePrompt), LogLevel.None);
- string strInput = Console.ReadLine();
+ var strInput = Console.ReadLine();
if (settings.Auth.AuthType == AuthType.Google)
settings.Auth.GoogleUsername = strInput;
@@ -997,12 +1003,13 @@ namespace PokemonGo.RocketBot.Logic
private static void SetupConfig(ITranslation translator, GlobalSettings settings)
{
- Logger.Write(translator.GetTranslation(TranslationString.FirstStartDefaultLocationPrompt, "Y", "N"), LogLevel.None);
+ Logger.Write(translator.GetTranslation(TranslationString.FirstStartDefaultLocationPrompt, "Y", "N"),
+ LogLevel.None);
- bool boolBreak = false;
+ var boolBreak = false;
while (!boolBreak)
{
- string strInput = Console.ReadLine().ToLower();
+ var strInput = Console.ReadLine().ToLower();
switch (strInput)
{
@@ -1025,15 +1032,15 @@ namespace PokemonGo.RocketBot.Logic
{
try
{
- double dblInput = double.Parse(Console.ReadLine());
+ var dblInput = double.Parse(Console.ReadLine());
settings.DefaultLatitude = dblInput;
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupDefaultLatConfirm, dblInput));
break;
}
catch (FormatException)
{
- Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupDefaultLocationError, settings.DefaultLatitude, LogLevel.Error));
- continue;
+ Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupDefaultLocationError,
+ settings.DefaultLatitude, LogLevel.Error));
}
}
@@ -1042,20 +1049,20 @@ namespace PokemonGo.RocketBot.Logic
{
try
{
- double dblInput = double.Parse(Console.ReadLine());
+ var dblInput = double.Parse(Console.ReadLine());
settings.DefaultLongitude = dblInput;
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupDefaultLongConfirm, dblInput));
break;
}
catch (FormatException)
{
- Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupDefaultLocationError, settings.DefaultLongitude, LogLevel.Error));
- continue;
+ Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupDefaultLocationError,
+ settings.DefaultLongitude, LogLevel.Error));
}
}
}
- private static void SaveFiles(GlobalSettings settings, String configFile)
+ private static void SaveFiles(GlobalSettings settings, string configFile)
{
settings.Save(configFile);
settings.Auth.Load(Path.Combine(settings.ProfileConfigPath, "auth.json"));
@@ -1067,7 +1074,7 @@ namespace PokemonGo.RocketBot.Logic
{
DefaultValueHandling = DefaultValueHandling.Include,
Formatting = Formatting.Indented,
- Converters = new JsonConverter[] { new StringEnumConverter { CamelCaseText = true } }
+ Converters = new JsonConverter[] {new StringEnumConverter {CamelCaseText = true}}
};
var output = JsonConvert.SerializeObject(this, jsonSerializeSettings);
@@ -1097,6 +1104,42 @@ namespace PokemonGo.RocketBot.Logic
public string GoogleUsername => _settings.Auth.GoogleUsername;
public string GooglePassword => _settings.Auth.GooglePassword;
+ double ISettings.DefaultLatitude
+ {
+ get
+ {
+ return _settings.DefaultLatitude + _rand.NextDouble()*((double) _settings.MaxSpawnLocationOffset/111111);
+ }
+
+ set { _settings.DefaultLatitude = value; }
+ }
+
+ double ISettings.DefaultLongitude
+ {
+ get
+ {
+ return _settings.DefaultLongitude +
+ _rand.NextDouble()*
+ ((double) _settings.MaxSpawnLocationOffset/111111/Math.Cos(_settings.DefaultLatitude));
+ }
+
+ set { _settings.DefaultLongitude = value; }
+ }
+
+ double ISettings.DefaultAltitude
+ {
+ get
+ {
+ return
+ LocationUtils.getElevation(_settings.DefaultLatitude, _settings.DefaultLongitude) +
+ _rand.NextDouble()*
+ (5/Math.Cos(LocationUtils.getElevation(_settings.DefaultLatitude, _settings.DefaultLongitude)));
+ }
+
+
+ set { }
+ }
+
#region Auth Config Values
public bool UseProxy
@@ -1140,6 +1183,7 @@ namespace PokemonGo.RocketBot.Logic
get { return null; }
set { GoogleRefreshToken = null; }
}
+
AuthType ISettings.AuthType
{
get { return _settings.Auth.AuthType; }
@@ -1179,71 +1223,84 @@ namespace PokemonGo.RocketBot.Logic
#region Device Config Values
- string DevicePackageName
+ private string DevicePackageName
{
get { return _settings.Auth.DevicePackageName; }
set { _settings.Auth.DevicePackageName = value; }
}
+
string ISettings.DeviceId
{
get { return _settings.Auth.DeviceId; }
set { _settings.Auth.DeviceId = value; }
}
+
string ISettings.AndroidBoardName
{
get { return _settings.Auth.AndroidBoardName; }
set { _settings.Auth.AndroidBoardName = value; }
}
+
string ISettings.AndroidBootloader
{
get { return _settings.Auth.AndroidBootloader; }
set { _settings.Auth.AndroidBootloader = value; }
}
+
string ISettings.DeviceBrand
{
get { return _settings.Auth.DeviceBrand; }
set { _settings.Auth.DeviceBrand = value; }
}
+
string ISettings.DeviceModel
{
get { return _settings.Auth.DeviceModel; }
set { _settings.Auth.DeviceModel = value; }
}
+
string ISettings.DeviceModelIdentifier
{
get { return _settings.Auth.DeviceModelIdentifier; }
set { _settings.Auth.DeviceModelIdentifier = value; }
}
+
string ISettings.DeviceModelBoot
{
get { return _settings.Auth.DeviceModelBoot; }
set { _settings.Auth.DeviceModelBoot = value; }
}
+
string ISettings.HardwareManufacturer
{
get { return _settings.Auth.HardwareManufacturer; }
set { _settings.Auth.HardwareManufacturer = value; }
}
+
string ISettings.HardwareModel
{
get { return _settings.Auth.HardwareModel; }
set { _settings.Auth.HardwareModel = value; }
}
+
string ISettings.FirmwareBrand
{
get { return _settings.Auth.FirmwareBrand; }
set { _settings.Auth.FirmwareBrand = value; }
}
+
string ISettings.FirmwareTags
{
get { return _settings.Auth.FirmwareTags; }
set { _settings.Auth.FirmwareTags = value; }
}
+
string ISettings.FirmwareType
{
get { return _settings.Auth.FirmwareType; }
set { _settings.Auth.FirmwareType = value; }
}
+
string ISettings.FirmwareFingerprint
{
get { return _settings.Auth.FirmwareFingerprint; }
@@ -1251,42 +1308,6 @@ namespace PokemonGo.RocketBot.Logic
}
#endregion Device Config Values
-
- double ISettings.DefaultLatitude
- {
- get
- {
- return _settings.DefaultLatitude + _rand.NextDouble() * ((double)_settings.MaxSpawnLocationOffset / 111111);
- }
-
- set { _settings.DefaultLatitude = value; }
- }
-
- double ISettings.DefaultLongitude
- {
- get
- {
- return _settings.DefaultLongitude +
- _rand.NextDouble() *
- ((double)_settings.MaxSpawnLocationOffset / 111111 / Math.Cos(_settings.DefaultLatitude));
- }
-
- set { _settings.DefaultLongitude = value; }
- }
-
- double ISettings.DefaultAltitude
- {
- get
- {
- return
- LocationUtils.getElevation(_settings.DefaultLatitude, _settings.DefaultLongitude) +
- _rand.NextDouble() *
- ((double)5 / Math.Cos(LocationUtils.getElevation(_settings.DefaultLatitude, _settings.DefaultLongitude)));
- }
-
-
- set { }
- }
}
public class LogicSettings : ILogicSettings
@@ -1381,7 +1402,10 @@ namespace PokemonGo.RocketBot.Logic
public bool DetailedCountsBeforeRecycling => _settings.DetailedCountsBeforeRecycling;
public bool VerboseRecycling => _settings.VerboseRecycling;
public double RecycleInventoryAtUsagePercentage => _settings.RecycleInventoryAtUsagePercentage;
- public double EvolveKeptPokemonsAtStorageUsagePercentage => _settings.EvolveKeptPokemonsAtStorageUsagePercentage;
+
+ public double EvolveKeptPokemonsAtStorageUsagePercentage => _settings.EvolveKeptPokemonsAtStorageUsagePercentage
+ ;
+
public ICollection<KeyValuePair<ItemId, int>> ItemRecycleFilter => _settings.ItemRecycleFilter;
public ICollection<PokemonId> PokemonsToEvolve => _settings.PokemonsToEvolve;
public ICollection<PokemonId> PokemonsToLevelUp => _settings.PokemonsToLevelUp;
diff --git a/PokemonGo.RocketBot.Logic/Tasks/FarmPokestopsTask.cs b/PokemonGo.RocketBot.Logic/Tasks/FarmPokestopsTask.cs
index 19ad55a..cd8db01 100644
--- a/PokemonGo.RocketBot.Logic/Tasks/FarmPokestopsTask.cs
+++ b/PokemonGo.RocketBot.Logic/Tasks/FarmPokestopsTask.cs
@@ -123,7 +123,7 @@ namespace PokemonGo.RocketBot.Logic.Tasks
if ((int) fortSearch.CooldownCompleteTimestampMs != 0)
{
break;
- // Check if successfully looted, if so program can continue as this was "false alarm".
+ // Check if successfully looted, if so program can continue as this was "false alarm".
}
fortTry += 1;
diff --git a/PokemonGo.RocketBot.Window/Forms/SettingForm.cs b/PokemonGo.RocketBot.Window/Forms/SettingForm.cs
index 6945541..ffc611d 100644
--- a/PokemonGo.RocketBot.Window/Forms/SettingForm.cs
+++ b/PokemonGo.RocketBot.Window/Forms/SettingForm.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Diagnostics.Eventing.Reader;
using System.Drawing;
using System.Globalization;
using System.IO;
@@ -17,16 +16,16 @@ namespace PokemonGo.RocketBot.Window.Forms
{
internal partial class SettingsForm : Form
{
- private readonly GlobalSettings _setting;
- private readonly DeviceHelper _deviceHelper;
- private readonly List<DeviceInfo> _deviceInfos;
- private TabPage _tabAdvSettingTab;
+ private const int DefaultZoomLevel = 15;
private static readonly string ConfigFolderPath = Path.Combine(Directory.GetCurrentDirectory(), "Config");
private static readonly string AuthFilePath = Path.Combine(ConfigFolderPath, "auth.json");
private static readonly string ConfigFilePath = Path.Combine(ConfigFolderPath, "config.json");
private static readonly string LanguagePath = Path.Combine(ConfigFolderPath, "Translations");
- private const int DefaultZoomLevel = 15;
+ private readonly DeviceHelper _deviceHelper;
+ private readonly List<DeviceInfo> _deviceInfos;
+ private readonly GlobalSettings _setting;
+ private TabPage _tabAdvSettingTab;
public SettingsForm(ref GlobalSettings settings)
{
@@ -36,7 +35,9 @@ namespace PokemonGo.RocketBot.Window.Forms
_deviceHelper = new DeviceHelper();
_deviceInfos = _deviceHelper.DeviceBucket;
- foreach (var pokemon in Enum.GetValues(typeof(PokemonId)).Cast<PokemonId>().Where(id => id != PokemonId.Missingno))
+ foreach (
+ var pokemon in
+ Enum.GetValues(typeof(PokemonId)).Cast<PokemonId>().Where(id => id != PokemonId.Missingno))
{
clbIgnore.Items.Add(pokemon);
clbTransfer.Items.Add(pokemon);
@@ -50,6 +51,7 @@ namespace PokemonGo.RocketBot.Window.Forms
GetLanguageList();
#region Advanced Setting Init
+
//proxy
proxyGb.Visible = _setting.EnableAdvancedSettings;
//advanced tab
@@ -67,17 +69,24 @@ namespace PokemonGo.RocketBot.Window.Forms
#endregion
#region Login Type and info
+
authTypeCb.Text = _setting.Auth.AuthType.ToString();
- UserLoginBox.Text = _setting.Auth.AuthType == AuthType.Google ? _setting.Auth.GoogleUsername : _setting.Auth.PtcUsername;
- UserPasswordBox.Text = _setting.Auth.AuthType == AuthType.Google ? _setting.Auth.GooglePassword : _setting.Auth.PtcPassword;
+ UserLoginBox.Text = _setting.Auth.AuthType == AuthType.Google
+ ? _setting.Auth.GoogleUsername
+ : _setting.Auth.PtcUsername;
+ UserPasswordBox.Text = _setting.Auth.AuthType == AuthType.Google
+ ? _setting.Auth.GooglePassword
+ : _setting.Auth.PtcPassword;
//proxy
useProxyCb.Checked = _setting.Auth.UseProxy;
useProxyAuthCb.Checked = _setting.Auth.UseProxy && _setting.Auth.UseProxyAuthentication;
ToggleProxyCtrls();
+
#endregion
#region Map Info
+
//use google provider
gMapCtrl.MapProvider = GoogleMapProvider.Instance;
//get tiles from server only
@@ -98,9 +107,11 @@ namespace PokemonGo.RocketBot.Window.Forms
gMapCtrl.DisableFocusOnMouseEnter = true;
tbWalkingSpeed.Text = _setting.WalkingSpeedInKilometerPerHour.ToString(CultureInfo.InvariantCulture);
+
#endregion
#region Device Info
+
//by default, select one from Necro's device dictionary
DeviceIdTb.Text = _setting.Auth.DeviceId;
AndroidBoardNameTb.Text = _setting.Auth.AndroidBoardName;
@@ -116,6 +127,7 @@ namespace PokemonGo.RocketBot.Window.Forms
FirmwareTypeTb.Text = _setting.Auth.FirmwareType;
FirmwareFingerprintTb.Text = _setting.Auth.FirmwareFingerprint;
deviceTypeCb.SelectedIndex = _setting.Auth.DeviceBrand.ToLower() == "apple" ? 0 : 1;
+
#endregion
#region Pokemon Info
@@ -131,7 +143,8 @@ namespace PokemonGo.RocketBot.Window.Forms
tbUseBerriesMinCp.Text = _setting.UseBerriesMinCp.ToString();
tbUseBerriesMinIv.Text = _setting.UseBerriesMinIv.ToString(CultureInfo.InvariantCulture);
- tbUseBerriesBelowCatchProbability.Text = _setting.UseBerriesBelowCatchProbability.ToString(CultureInfo.InvariantCulture);
+ tbUseBerriesBelowCatchProbability.Text =
+ _setting.UseBerriesBelowCatchProbability.ToString(CultureInfo.InvariantCulture);
cbUseBerriesOperator.SelectedIndex = _setting.UseBerriesOperator == "and" ? 0 : 1;
tbUseGreatBallAboveCp.Text = _setting.UseGreatBallAboveCp.ToString();
@@ -139,14 +152,18 @@ namespace PokemonGo.RocketBot.Window.Forms
tbUseMasterBallAboveCp.Text = _setting.UseMasterBallAboveCp.ToString();
tbUseGreatBallAboveIv.Text = _setting.UseGreatBallAboveIv.ToString(CultureInfo.InvariantCulture);
tbUseUltraBallAboveIv.Text = _setting.UseUltraBallAboveIv.ToString(CultureInfo.InvariantCulture);
- tbUseGreatBallBelowCatchProbability.Text = _setting.UseGreatBallBelowCatchProbability.ToString(CultureInfo.InvariantCulture);
- tbUseUltraBallBelowCatchProbability.Text = _setting.UseUltraBallBelowCatchProbability.ToString(CultureInfo.InvariantCulture);
- tbUseMasterBallBelowCatchProbability.Text = _setting.UseMasterBallBelowCatchProbability.ToString(CultureInfo.InvariantCulture);
+ tbUseGreatBallBelowCatchProbability.Text =
+ _setting.UseGreatBallBelowCatchProbability.ToString(CultureInfo.InvariantCulture);
+ tbUseUltraBallBelowCatchProbability.Text =
+ _setting.UseUltraBallBelowCatchProbability.ToString(CultureInfo.InvariantCulture);
+ tbUseMasterBallBelowCatchProbability.Text =
+ _setting.UseMasterBallBelowCatchProbability.ToString(CultureInfo.InvariantCulture);
foreach (var poke in _setting.PokemonsToIgnore)
{
clbIgnore.SetItemChecked(clbIgnore.FindStringExact(poke.ToString()), true);
}
+
#endregion
#region Transfer
@@ -166,9 +183,11 @@ namespace PokemonGo.RocketBot.Window.Forms
{
clbTransfer.SetItemChecked(clbTransfer.FindStringExact(poke.ToString()), true);
}
+
#endregion
#region Powerup
+
//focuse to use filter list
_setting.UseLevelUpList = true;
@@ -197,6 +216,7 @@ namespace PokemonGo.RocketBot.Window.Forms
label30.Visible = true;
tbPowerUpMinCP.Visible = true;
}
+
#endregion
#region Evo
@@ -205,18 +225,21 @@ namespace PokemonGo.RocketBot.Window.Forms
tbEvoAboveIV.Text = _setting.EvolveAboveIvValue.ToString(CultureInfo.InvariantCulture);
cbEvolveAllPokemonWithEnoughCandy.Checked = _setting.EvolveAllPokemonWithEnoughCandy;
cbKeepPokemonsThatCanEvolve.Checked = _setting.KeepPokemonsThatCanEvolve;
- tbEvolveKeptPokemonsAtStorageUsagePercentage.Text = _setting.EvolveKeptPokemonsAtStorageUsagePercentage.ToString(CultureInfo.InvariantCulture);
+ tbEvolveKeptPokemonsAtStorageUsagePercentage.Text =
+ _setting.EvolveKeptPokemonsAtStorageUsagePercentage.ToString(CultureInfo.InvariantCulture);
cbUseLuckyEggsWhileEvolving.Checked = _setting.UseLuckyEggsWhileEvolving;
tbUseLuckyEggsMinPokemonAmount.Text = _setting.UseLuckyEggsMinPokemonAmount.ToString();
foreach (var poke in _setting.PokemonsToEvolve)
{
clbEvolve.SetItemChecked(clbEvolve.FindStringExact(poke.ToString()), true);
}
+
#endregion
#endregion
#region Item Info
+
cbUseLuckyEggConstantly.Checked = _setting.UseLuckyEggConstantly;
cbUseIncenseConstantly.Checked = _setting.UseIncenseConstantly;
tbTotalAmountOfPokeballsToKeep.Text = _setting.TotalAmountOfPokeballsToKeep.ToString();
@@ -224,14 +247,16 @@ namespace PokemonGo.RocketBot.Window.Forms
tbTotalAmountOfRevivesToKeep.Text = _setting.TotalAmountOfRevivesToKeep.ToString();
tbTotalAmountOfBerriesToKeep.Text = _setting.TotalAmountOfBerriesToKeep.ToString();
cbVerboseRecycling.Checked = _setting.VerboseRecycling;
- tbRecycleInventoryAtUsagePercentage.Text = _setting.RecycleInventoryAtUsagePercentage.ToString(CultureInfo.InvariantCulture);
+ tbRecycleInventoryAtUsagePercentage.Text =
+ _setting.RecycleInventoryAtUsagePercentage.ToString(CultureInfo.InvariantCulture);
#endregion
#region Advance Settings
cbDisableHumanWalking.Checked = _setting.DisableHumanWalking;
- tbWalkingSpeedOffSetInKilometerPerHour.Text = _setting.WalkingSpeedVariant.ToString(CultureInfo.InvariantCulture);
+ tbWalkingSpeedOffSetInKilometerPerHour.Text =
+ _setting.WalkingSpeedVariant.ToString(CultureInfo.InvariantCulture);
tbMaxSpawnLocationOffset.Text = _setting.MaxSpawnLocationOffset.ToString();
tbMaxTravelDistanceInMeters.Text = _setting.MaxTravelDistanceInMeters.ToString();
@@ -256,9 +281,10 @@ namespace PokemonGo.RocketBot.Window.Forms
}
#region private methods
+
private static int ConvertStringToInt(string input)
{
- int output = 0;
+ var output = 0;
int.TryParse(input, out output);
return output;
}
@@ -283,31 +309,32 @@ namespace PokemonGo.RocketBot.Window.Forms
}
/// <summary>
- /// Get languale list from Translations folder and populate it to combo box
+ /// Get languale list from Translations folder and populate it to combo box
/// </summary>
private void GetLanguageList()
{
- var languages = new List<string> { "en" };
+ var languages = new List<string> {"en"};
var langFiles = Directory.GetFiles(LanguagePath, "*.json", SearchOption.TopDirectoryOnly);
- languages.AddRange(langFiles.Select(langFileName => Path.GetFileNameWithoutExtension(langFileName)?.Replace("translation.", ""))
- .Where(langCode => langCode != "en"));
+ languages.AddRange(langFiles.Select(
+ langFileName => Path.GetFileNameWithoutExtension(langFileName)?.Replace("translation.", ""))
+ .Where(langCode => langCode != "en"));
cbLanguage.DataSource = languages;
}
/// <summary>
- /// Update location lat and lon to textboxes
+ /// Update location lat and lon to textboxes
/// </summary>
private void UpdateLocationInfo()
{
//not rounding it, need to have correct position to prevent map drifting
tbLatitude.Text = gMapCtrl.Position.Lat.ToString(CultureInfo.InvariantCulture);
- tbLongitude.Text = gMapCtrl.Position.Lng.ToString(CultureInfo.InvariantCulture);
+ tbLongitude.Text = gMapCtrl.Position.Lng.ToString(CultureInfo.InvariantCulture);
//update trackbar
- trackBar.Value = (int)Math.Round(gMapCtrl.Zoom);
+ trackBar.Value = (int) Math.Round(gMapCtrl.Zoom);
}
/// <summary>
- /// Update map location base on giving lng and lat
+ /// Update map location base on giving lng and lat
/// </summary>
/// <param name="lng"></param>
/// <param name="lat"></param>
@@ -377,17 +404,20 @@ namespace PokemonGo.RocketBot.Window.Forms
private static void ListSelectAllHandler(CheckedListBox targetList, bool setToValue)
{
- for (int index = 0; index < targetList.Items.Count; index++)
+ for (var index = 0; index < targetList.Items.Count; index++)
{
targetList.SetItemChecked(index, setToValue);
}
}
+
#endregion
#region Events
+
private void saveBtn_Click(object sender, EventArgs e)
{
#region Auth Settings
+
_setting.Auth.AuthType = authTypeCb.Text == @"Google" ? AuthType.Google : AuthType.Ptc;
if (_setting.Auth.AuthType == AuthType.Google)
{
@@ -426,6 +456,7 @@ namespace PokemonGo.RocketBot.Window.Forms
_setting.Auth.FirmwareFingerprint = FirmwareFingerprintTb.Text;
_setting.Auth.Save(AuthFilePath);
+
#endregion
#region Bot Settings
@@ -433,9 +464,11 @@ namespace PokemonGo.RocketBot.Window.Forms
_setting.TranslationLanguageCode = cbLanguage.Text;
#region Location
+
_setting.DefaultLatitude = ConvertStringToDouble(tbLatitude.Text);
_setting.DefaultLongitude = ConvertStringToDouble(tbLongitude.Text);
_setting.WalkingSpeedInKilometerPerHour = ConvertStringToInt(tbWalkingSpeed.Text);
+
#endregion
#region Pokemon
@@ -462,10 +495,13 @@ namespace PokemonGo.RocketBot.Window.Forms
_setting.UseUltraBallAboveIv = ConvertStringToDouble(tbUseUltraBallAboveIv.Text);
_setting.UseGreatBallBelowCatchProbability = ConvertStringToDouble(tbUseGreatBallBelowCatchProbability.Text);
_setting.UseUltraBallBelowCatchProbability = ConvertStringToDouble(tbUseUltraBallBelowCatchProbability.Text);
- _setting.UseMasterBallBelowCatchProbability = ConvertStringToDouble(tbUseMasterBallBelowCatchProbability.Text);
+ _setting.UseMasterBallBelowCatchProbability =
+ ConvertStringToDouble(tbUseMasterBallBelowCatchProbability.Text);
+
#endregion
#region Transfer
+
_setting.PrioritizeIvOverCp = cbPrioritizeIvOverCp.Checked;
_setting.KeepMinCp = ConvertStringToInt(tbKeepMinCp.Text);
_setting.KeepMinIvPercentage = ConvertStringToFloat(tbKeepMinIV.Text);
@@ -478,9 +514,11 @@ namespace PokemonGo.RocketBot.Window.Forms
_setting.KeepMinDuplicatePokemon = ConvertStringToInt(tbKeepMinDuplicatePokemon.Text);
_setting.UseKeepMinLvl = cbUseKeepMinLvl.Checked;
_setting.PokemonsNotToTransfer = ConvertClbToList(clbTransfer);
+
#endregion
#region PowerUp
+
_setting.UseLevelUpList = true;
_setting.AutomaticallyLevelUpPokemon = cbAutoPowerUp.Checked;
@@ -491,17 +529,21 @@ namespace PokemonGo.RocketBot.Window.Forms
_setting.UpgradePokemonIvMinimum = ConvertStringToFloat(tbPowerUpMinIV.Text);
_setting.UpgradePokemonCpMinimum = ConvertStringToFloat(tbPowerUpMinCP.Text);
_setting.PokemonsToLevelUp = ConvertClbToList(clbPowerUp);
+
#endregion
#region Evo
+
_setting.EvolveAllPokemonAboveIv = cbEvoAllAboveIV.Checked;
_setting.EvolveAboveIvValue = ConvertStringToFloat(tbEvoAboveIV.Text);
_setting.EvolveAllPokemonWithEnoughCandy = cbEvolveAllPokemonWithEnoughCandy.Checked;
_setting.KeepPokemonsThatCanEvolve = cbKeepPokemonsThatCanEvolve.Checked;
_setting.UseLuckyEggsWhileEvolving = cbUseLuckyEggsWhileEvolving.Checked;
- _setting.EvolveKeptPokemonsAtStorageUsagePercentage = ConvertStringToDouble(tbEvolveKeptPokemonsAtStorageUsagePercentage.Text);
+ _setting.EvolveKeptPokemonsAtStorageUsagePercentage =
+ ConvertStringToDouble(tbEvolveKeptPokemonsAtStorageUsagePercentage.Text);
_setting.UseLuckyEggsMinPokemonAmount = ConvertStringToInt(tbUseLuckyEggsMinPokemonAmount.Text);
_setting.PokemonsToEvolve = ConvertClbToList(clbEvolve);
+
#endregion
#endregion
@@ -516,6 +558,7 @@ namespace PokemonGo.RocketBot.Window.Forms
_setting.TotalAmountOfBerriesToKeep = ConvertStringToInt(tbTotalAmountOfBerriesToKeep.Text);
_setting.VerboseRecycling = cbVerboseRecycling.Checked;
_setting.RecycleInventoryAtUsagePercentage = ConvertStringToDouble(tbRecycleInventoryAtUsagePercentage.Text);
+
#endregion
#region Advanced Settings
@@ -541,9 +584,11 @@ namespace PokemonGo.RocketBot.Window.Forms
_setting.ForceExcellentThrowOverIv = ConvertStringToDouble(tbForceExcellentThrowOverIv.Text);
_setting.ForceGreatThrowOverCp = ConvertStringToInt(tbForceGreatThrowOverCp.Text);
_setting.ForceExcellentThrowOverCp = ConvertStringToInt(tbForceExcellentThrowOverCp.Text);
+
#endregion
_setting.Save(ConfigFilePath);
+
#endregion
Close();
@@ -611,7 +656,7 @@ namespace PokemonGo.RocketBot.Window.Forms
private void AdressBox_KeyPress(object sender, KeyPressEventArgs e)
{
- if (e.KeyChar != (char)Keys.Enter)
+ if (e.KeyChar != (char) Keys.Enter)
{
return;
}
@@ -704,6 +749,7 @@ namespace PokemonGo.RocketBot.Window.Forms
tabControl.TabPages.Remove(_tabAdvSettingTab);
}
}
+
#endregion
}
-}
+}
\ No newline at end of file
You may download the files in Public Git.