Merge pull request #957 from ChemiHatake/Beta-Build

Brian [2016-08-13 12:16:57]
Merge pull request #957 from ChemiHatake/Beta-Build

[Feature] Auto-Incubating & Typo fixes & Code cleanup
Filename
src/RocketBotGUI/App.config
src/RocketBotGUI/MainForm.cs
src/RocketBotGUI/Settings.cs
src/RocketBotGUI/SettingsForm.Designer.cs
src/RocketBotGUI/SettingsForm.cs
diff --git a/src/RocketBotGUI/App.config b/src/RocketBotGUI/App.config
index 448876f..9a4bfcc 100644
--- a/src/RocketBotGUI/App.config
+++ b/src/RocketBotGUI/App.config
@@ -44,7 +44,7 @@
     <!--Recycle Interval in seconds-->
     <add key="Language" value="english" />
     <!--Languages english/german-->
-    <add key="RazzBerryMode" value="probability" />
+    <add key="RazzBerryMode" value="Probability" />
     <!--When to use RazzBerry cp/probability-->
     <add key="RazzBerrySetting" value="0.4" />
     <!--Cp Mode: Use RazzBerry when Pokemon is over this value; pobability Mode: Use Razzberry when % between 0 and 1 of catching is under this value-->
@@ -61,6 +61,7 @@
     <add key="CatchPokemon" value="true" />
     <!--Only visit pokestop and collect items-->
     <add key="EvolveAllGivenPokemons" value="false" />
+    <add key="UseIncubatorsMode" value="Disabled" />
     <add key="ClientSettingsProvider.ServiceUri" value="" />
     <add key="MaxItemPokeBall" value="100" />
     <add key="MaxItemGreatBall" value="100" />
diff --git a/src/RocketBotGUI/MainForm.cs b/src/RocketBotGUI/MainForm.cs
index 3d8a1e1..de6b271 100644
--- a/src/RocketBotGUI/MainForm.cs
+++ b/src/RocketBotGUI/MainForm.cs
@@ -1,4 +1,21 @@
-using System;
+using BrightIdeasSoftware;
+using GMap.NET;
+using GMap.NET.MapProviders;
+using GMap.NET.WindowsForms;
+using GMap.NET.WindowsForms.Markers;
+using POGOProtos.Data;
+using POGOProtos.Data.Player;
+using POGOProtos.Enums;
+using POGOProtos.Inventory;
+using POGOProtos.Inventory.Item;
+using POGOProtos.Map.Fort;
+using POGOProtos.Map.Pokemon;
+using POGOProtos.Networking.Responses;
+using PokemonGo.RocketAPI.Enums;
+using PokemonGo.RocketAPI.Exceptions;
+using PokemonGo.RocketAPI.Extensions;
+using PokemonGo.RocketAPI.Helpers;
+using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Drawing;
@@ -11,22 +28,6 @@ using System.Threading;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 using System.Xml;
-using BrightIdeasSoftware;
-using GMap.NET;
-using GMap.NET.MapProviders;
-using GMap.NET.WindowsForms;
-using GMap.NET.WindowsForms.Markers;
-using PokemonGo.RocketAPI.Enums;
-using PokemonGo.RocketAPI.Exceptions;
-using PokemonGo.RocketAPI.Extensions;
-using PokemonGo.RocketAPI.Helpers;
-using POGOProtos.Data;
-using POGOProtos.Enums;
-using POGOProtos.Inventory;
-using POGOProtos.Inventory.Item;
-using POGOProtos.Map.Fort;
-using POGOProtos.Map.Pokemon;
-using POGOProtos.Networking.Responses;
 using static System.Reflection.Assembly;

 namespace PokemonGo.RocketAPI.Window
@@ -281,6 +282,7 @@ namespace PokemonGo.RocketAPI.Window
                     case AuthType.Ptc:
                         ColoredConsoleWrite(Color.Green, "Login Type: Pokemon Trainers Club");
                         break;
+
                     case AuthType.Google:
                         ColoredConsoleWrite(Color.Green, "Login Type: Google");
                         break;
@@ -393,7 +395,6 @@ namespace PokemonGo.RocketAPI.Window
                     ColoredConsoleWrite(Color.DarkGray, "Unable to get Country/Place");
                 }

-
                 ColoredConsoleWrite(Color.Yellow, "----------------------------");

                 // I believe a switch is more efficient and easier to read.
@@ -402,36 +403,57 @@ namespace PokemonGo.RocketAPI.Window
                     case "Leave Strongest":
                         await TransferAllButStrongestUnwantedPokemon(_client);
                         break;
+
                     case "All":
                         await TransferAllGivenPokemons(_client, pokemons, ClientSettings.TransferIvThreshold);
                         break;
+
                     case "Duplicate":
                         await TransferDuplicatePokemon(_client);
                         break;
+
                     case "IV Duplicate":
                         await TransferDuplicateIVPokemon(_client);
                         break;
+
                     case "CP/IV Duplicate":
                         await TransferDuplicateCPIVPokemon(_client);
                         break;
+
                     case "CP":
                         await TransferAllWeakPokemon(_client, ClientSettings.TransferCpThreshold);
                         break;
+
                     case "IV":
                         await TransferAllGivenPokemons(_client, pokemons, ClientSettings.TransferIvThreshold);
                         break;
+
                     default:
                         ColoredConsoleWrite(Color.DarkGray, "Transfering pokemon disabled");
                         break;
                 }

-
                 if (ClientSettings.EvolveAllGivenPokemons)
                     await EvolveAllGivenPokemons(_client, pokemons);
                 if (ClientSettings.Recycler)
                     await RecycleItems(_client);
                 //client.RecycleItems(client);
                 //await Task.Delay(5000);
+
+                String incubatorMode = ClientSettings.UseIncubatorsMode.ToLower();
+                switch (incubatorMode)
+                {
+                    case "only unlimited":
+                        await UseIncubators(_client, incubatorMode);
+                        break;
+                    case "all incubators":
+                        await UseIncubators(_client, incubatorMode);
+                        break;
+                    default:
+                        ColoredConsoleWrite(Color.DarkGray, "Using incubators disabled");
+                        break;
+                }
+
                 await PrintLevel(_client);

                 await ExecuteFarmingPokestopsAndPokemons(_client);
@@ -499,7 +521,7 @@ namespace PokemonGo.RocketAPI.Window
                 ColoredConsoleWrite(Color.Red, "Access Token Expired - Restarting");
                 //if (!_stopping) Execute();
             }
-            catch (GoogleException ex)
+            catch (GoogleException)
             {
                 ColoredConsoleWrite(Color.Red, "Please check your google login information again");
             }
@@ -512,7 +534,6 @@ namespace PokemonGo.RocketAPI.Window
                 ColoredConsoleWrite(Color.Red, "Invalid response - Restarting");
                 //if (!_stopping) Execute();
             }
-
             catch (Exception ex)
             {
                 ColoredConsoleWrite(Color.Red, ex.ToString());
@@ -546,6 +567,7 @@ namespace PokemonGo.RocketAPI.Window
                                     return reader.ReadString();
                                 }
                                 break;
+
                             default:
                                 return "N/A";
                                 break;
@@ -617,10 +639,10 @@ namespace PokemonGo.RocketAPI.Window
                 ColoredConsoleWrite(Color.Green, $"Encounter a {pokemonName} with {pokemonCp} CP and {pokemonIv}% IV");
                 do
                 {
-                    if (ClientSettings.RazzBerryMode == "cp")
+                    if (ClientSettings.RazzBerryMode.ToLower().Equals("cp"))
                         if (pokemonCp > ClientSettings.RazzBerrySetting)
                             await UseRazzBerry(client, pokemon.EncounterId, pokemon.SpawnPointId);
-                    if (ClientSettings.RazzBerryMode == "probability")
+                    if (ClientSettings.RazzBerryMode.ToLower().Equals("probability"))
                         if (encounterPokemonResponse.CaptureProbability.CaptureProbability_.First() <
                             ClientSettings.RazzBerrySetting)
                             await UseRazzBerry(client, pokemon.EncounterId, pokemon.SpawnPointId);
@@ -648,31 +670,37 @@ namespace PokemonGo.RocketAPI.Window
                 else
                     ColoredConsoleWrite(Color.Red, $"{pokemonName} with {pokemonCp} CP and {pokemonIv}% IV got away..");

-
                 // I believe a switch is more efficient and easier to read.
                 switch (ClientSettings.TransferType)
                 {
                     case "Leave Strongest":
                         await TransferAllButStrongestUnwantedPokemon(client);
                         break;
+
                     case "All":
                         await TransferAllGivenPokemons(client, pokemons2, ClientSettings.TransferIvThreshold);
                         break;
+
                     case "Duplicate":
                         await TransferDuplicatePokemon(client);
                         break;
+
                     case "IV Duplicate":
                         await TransferDuplicateIVPokemon(client);
                         break;
+
                     case "CP/IV Duplicate":
                         await TransferDuplicateCPIVPokemon(client);
                         break;
+
                     case "CP":
                         await TransferAllWeakPokemon(client, ClientSettings.TransferCpThreshold);
                         break;
+
                     case "IV":
                         await TransferAllGivenPokemons(client, pokemons2, ClientSettings.TransferIvThreshold);
                         break;
+
                     default:
                         ColoredConsoleWrite(Color.DarkGray, "Transfering pokemon disabled");
                         break;
@@ -721,7 +749,6 @@ namespace PokemonGo.RocketAPI.Window
                 _pokestopsOverlay.Routes.Clear();
                 _pokestopsOverlay.Routes.Add(new GMapRoute(routePoint, "Walking Path"));

-
                 _pokemonsOverlay.Markers.Clear();
                 if (_wildPokemons != null)
                 {
@@ -789,10 +816,11 @@ namespace PokemonGo.RocketAPI.Window
                     PokeStopOutput.Write($", Gems: {fortSearch.GemsAwarded}");
                 if (fortSearch.PokemonDataEgg != null)
                     PokeStopOutput.Write($", Eggs: {fortSearch.PokemonDataEgg}");
-                if (GetFriendlyItemsString(fortSearch.ItemsAwarded) != string.Empty) {
+                if (GetFriendlyItemsString(fortSearch.ItemsAwarded) != string.Empty)
+                {
                     PokeStopOutput.Write($", Items: {GetFriendlyItemsString(fortSearch.ItemsAwarded)} ");
                 }
-
+
                 ColoredConsoleWrite(Color.Cyan, PokeStopOutput.ToString());

                 await RecycleItems(client);
@@ -808,7 +836,6 @@ namespace PokemonGo.RocketAPI.Window
             _farmingStops = false;
             /*if (!_forceUnbanning && !_stopping)
             {
-
                 //await ExecuteFarmingPokestopsAndPokemons(client);
             }*/
         }
@@ -895,7 +922,6 @@ namespace PokemonGo.RocketAPI.Window
                 .Aggregate((a, b) => $"{a}, {b}");
         }

-
         private async Task TransferAllButStrongestUnwantedPokemon(Client client)
         {
             var unwantedPokemonTypes = new List<PokemonId>();
@@ -1154,7 +1180,6 @@ namespace PokemonGo.RocketAPI.Window
             ColoredConsoleWrite(Color.Gray, $"Finished grinding all the meat");
         }

-
         public async Task PrintLevel(Client client)
         {
             var inventory = await client.Inventory.GetInventory();
@@ -1244,82 +1269,121 @@ namespace PokemonGo.RocketAPI.Window
             {
                 case 1:
                     return 0;
+
                 case 2:
                     return 1000;
+
                 case 3:
                     return 2000;
+
                 case 4:
                     return 3000;
+
                 case 5:
                     return 4000;
+
                 case 6:
                     return 5000;
+
                 case 7:
                     return 6000;
+
                 case 8:
                     return 7000;
+
                 case 9:
                     return 8000;
+
                 case 10:
                     return 9000;
+
                 case 11:
                     return 10000;
+
                 case 12:
                     return 10000;
+
                 case 13:
                     return 10000;
+
                 case 14:
                     return 10000;
+
                 case 15:
                     return 15000;
+
                 case 16:
                     return 20000;
+
                 case 17:
                     return 20000;
+
                 case 18:
                     return 20000;
+
                 case 19:
                     return 25000;
+
                 case 20:
                     return 25000;
+
                 case 21:
                     return 50000;
+
                 case 22:
                     return 75000;
+
                 case 23:
                     return 100000;
+
                 case 24:
                     return 125000;
+
                 case 25:
                     return 150000;
+
                 case 26:
                     return 190000;
+
                 case 27:
                     return 200000;
+
                 case 28:
                     return 250000;
+
                 case 29:
                     return 300000;
+
                 case 30:
                     return 350000;
+
                 case 31:
                     return 500000;
+
                 case 32:
                     return 500000;
+
                 case 33:
                     return 750000;
+
                 case 34:
                     return 1000000;
+
                 case 35:
                     return 1250000;
+
                 case 36:
                     return 1500000;
+
                 case 37:
                     return 2000000;
+
                 case 38:
                     return 2500000;
+
                 case 39:
                     return 1000000;
+
                 case 40:
                     return 1000000;
             }
@@ -1401,6 +1465,7 @@ namespace PokemonGo.RocketAPI.Window
                 case ConsoleColor.Green:
                     c = Color.Green;
                     break;
+
                 case ConsoleColor.DarkCyan:
                     c = Color.DarkCyan;
                     break;
@@ -1658,7 +1723,7 @@ namespace PokemonGo.RocketAPI.Window

                 lblInventory.Text = itemscount + " / " + profile.PlayerData.MaxItemStorage;
             }
-            catch (GoogleException ex)
+            catch (GoogleException)
             {
                 ColoredConsoleWrite(Color.Red, "Please check your google login information again");
             }
@@ -1846,6 +1911,59 @@ namespace PokemonGo.RocketAPI.Window
             ReloadPokemonList();
         }

+        private async Task UseIncubators(Client client, String mode)
+        {
+            var profile = (await GetProfile(client)).FirstOrDefault();
+
+            if (profile == null)
+                return;
+
+            var kmWalked = profile.KmWalked;
+
+            var unusedEggs = (await getUnusedEggs(client))
+                .Where(x => string.IsNullOrEmpty(x.EggIncubatorId))
+                .OrderBy(x => x.EggKmWalkedTarget - x.EggKmWalkedStart)
+                .ToList();
+            var incubators = (await getUnusedIncubators(client))
+                .Where(x => x.UsesRemaining > 0 || x.ItemId == ItemId.ItemIncubatorBasicUnlimited)
+                .OrderByDescending(x => x.ItemId == ItemId.ItemIncubatorBasicUnlimited)
+                .OrderByDescending(x => x.PokemonId != 0)
+                .ToList();
+
+            var num = 1;
+
+            foreach (var inc in incubators)
+            {
+                var usesLeft = (inc.ItemId == ItemId.ItemIncubatorBasicUnlimited) ?
+                "∞" : inc.UsesRemaining.ToString();
+                if (inc.PokemonId == 0)
+                {
+                    if (mode.Equals("only unlimited")
+                        && inc.ItemId != ItemId.ItemIncubatorBasicUnlimited)
+                        continue;
+
+                    var egg = (inc.ItemId == ItemId.ItemIncubatorBasicUnlimited && incubators.Count > 1)
+                    ? unusedEggs.FirstOrDefault()
+                    : unusedEggs.LastOrDefault();
+
+                    if (egg == null)
+                        continue;
+
+                    var useIncubator = await client.Inventory.UseItemEggIncubator(inc.Id, egg.Id);
+                    unusedEggs.Remove(egg);
+                    var eggKm = egg.EggKmWalkedTarget;
+                    ColoredConsoleWrite(Color.YellowGreen, $"Incubator #{num} was successfully used on a {eggKm}km egg, Incubator uses left: {usesLeft}");
+                }
+                else
+                {
+                    var remainingDistance = String.Format("{0:0.00}", (inc.TargetKmWalked - kmWalked));
+                    var eggKm = inc.TargetKmWalked - inc.StartKmWalked;
+                    ColoredConsoleWrite(Color.YellowGreen, $"[Status] Incubator #{num}, Uses left: {usesLeft}, Distance left: {remainingDistance}/{eggKm} km");
+                }
+                num++;
+            }
+        }
+
         private void CleanUpTransferPokemon(PokemonObject pokemon, string type)
         {
             var ET = pokemon.EvolveTimes;
@@ -1933,6 +2051,33 @@ namespace PokemonGo.RocketAPI.Window
                 .Where(p => p != null);
         }

+        private async Task<IEnumerable<EggIncubator>> getUnusedIncubators(Client client)
+        {
+            var inventory = await client.Inventory.GetInventory();
+            return inventory.InventoryDelta.InventoryItems.
+            Where(x => x.InventoryItemData?.EggIncubators != null).
+            SelectMany(x => x.InventoryItemData.EggIncubators.EggIncubator).
+            Where(x => x != null);
+        }
+
+        private async Task<IEnumerable<PokemonData>> getUnusedEggs(Client client)
+        {
+            var inventory = await client.Inventory.GetInventory();
+            return inventory.InventoryDelta.InventoryItems.
+            Select(i => i.InventoryItemData?.PokemonData).
+            Where(p => p != null && p.IsEgg).ToList().
+            Where(x => string.IsNullOrEmpty(x.EggIncubatorId)).
+            OrderBy(x => x.EggKmWalkedTarget - x.EggKmWalkedStart);
+        }
+
+        private async Task<IEnumerable<PlayerStats>> GetProfile(Client client)
+        {
+            var inventory = await client.Inventory.GetInventory();
+            return inventory.InventoryDelta.InventoryItems
+                .Select(i => i.InventoryItemData?.PlayerStats)
+                .Where(p => p != null);
+        }
+
         public async Task<IEnumerable<ItemData>> GetItemsToRecycle(ISettings _settings, Client client)
         {
             var itemCounts = (_settings as Settings).ItemCounts;
@@ -1940,9 +2085,12 @@ namespace PokemonGo.RocketAPI.Window
             var myItems = await GetItems(client);
             var itemsToRecycle = new List<ItemData>();

-            foreach (var itemData in myItems) {
-                foreach (var itemCount in itemCounts) {
-                    if (itemData.ItemId == itemCount.ItemId && itemData.Count > itemCount.Count) {
+            foreach (var itemData in myItems)
+            {
+                foreach (var itemCount in itemCounts)
+                {
+                    if (itemData.ItemId == itemCount.ItemId && itemData.Count > itemCount.Count)
+                    {
                         var itemToRecycle = new ItemData();
                         itemToRecycle.ItemId = itemData.ItemId;
                         itemToRecycle.Count = itemData.Count - itemCount.Count;
@@ -2093,6 +2241,6 @@ namespace PokemonGo.RocketAPI.Window
             await ReloadPokemonList();
         }

-        #endregion
+        #endregion POKEMON LIST
     }
 }
\ No newline at end of file
diff --git a/src/RocketBotGUI/Settings.cs b/src/RocketBotGUI/Settings.cs
index 8cb10cb..1826284 100644
--- a/src/RocketBotGUI/Settings.cs
+++ b/src/RocketBotGUI/Settings.cs
@@ -1,14 +1,14 @@
 #region

+using POGOProtos.Enums;
+using POGOProtos.Inventory.Item;
+using PokemonGo.RocketAPI.Enums;
 using System;
 using System.Collections.Generic;
 using System.Configuration;
 using System.Globalization;
 using System.Runtime.CompilerServices;
 using System.Threading;
-using PokemonGo.RocketAPI.Enums;
-using POGOProtos.Enums;
-using POGOProtos.Inventory.Item;

 #endregion

@@ -62,7 +62,6 @@ namespace PokemonGo.RocketAPI.Window
         public string PtcUsername => GetSetting() != string.Empty ? GetSetting() : "username";
         public string PtcPassword => GetSetting() != string.Empty ? GetSetting() : "password";

-
         public string LevelOutput => GetSetting() != string.Empty ? GetSetting() : "time";

         public int LevelTimeInterval => GetSetting() != string.Empty ? Convert.ToInt16(GetSetting()) : 600;
@@ -118,25 +117,32 @@ namespace PokemonGo.RocketAPI.Window

         public string Language => GetSetting() != string.Empty ? GetSetting() : "english";

-        public string RazzBerryMode => GetSetting() != string.Empty ? GetSetting() : "cp";
+        public string RazzBerryMode => GetSetting() != string.Empty ? GetSetting() : "CP";
+
+        public string UseIncubatorsMode => GetSetting() != string.Empty ? GetSetting() : "Disabled";

         public double RazzBerrySetting
             => GetSetting() != string.Empty ? double.Parse(GetSetting(), CultureInfo.InvariantCulture) : 500;

-        public List<ItemData> ItemCounts
+        public List<ItemData> ItemCounts
         {
-            get
+            get
             {
                 var itemCounts = new List<ItemData>();
                 var items = GetSetting() != String.Empty ? GetSetting() :
                     "ItemPokeball,100;ItemGreatBall,100;ItemUltraBall,50;ItemRazzBerry,25;ItemPotion,0;ItemSuperPotion,0;ItemHyperPotion,10;ItemMaxPotion,20;ItemRevive,10;ItemMaxRevive,10";
-                if (items.Contains(";")) {
-                    foreach (var item in items.Split(';')) {
-                        if (item.Contains(",")) {
+                if (items.Contains(";"))
+                {
+                    foreach (var item in items.Split(';'))
+                    {
+                        if (item.Contains(","))
+                        {
                             var itemId = item.Split(',')[0];
                             var count = Int32.Parse(item.Split(',')[1]);
-                            foreach (ItemId id in Enum.GetValues(typeof(ItemId))) {
-                                if (id.ToString().Equals(itemId)) {
+                            foreach (ItemId id in Enum.GetValues(typeof(ItemId)))
+                            {
+                                if (id.ToString().Equals(itemId))
+                                {
                                     ItemData itemData = new ItemData();
                                     itemData.ItemId = id;
                                     itemData.Count = count;
@@ -150,13 +156,15 @@ namespace PokemonGo.RocketAPI.Window
                 return itemCounts;
             }

-            set
+            set
             {
                 var items = "";
-                foreach (var itemData in value) {
+                foreach (var itemData in value)
+                {
                     items += itemData.ItemId.ToString() + "," + itemData.Count + ";";
                 }
-                if (items != string.Empty) {
+                if (items != string.Empty)
+                {
                     items = items.Remove(items.Length - 1, 1);
                 }
                 SetSetting(items);
@@ -277,12 +285,11 @@ namespace PokemonGo.RocketAPI.Window
             }
         }

-
         public AuthType AuthType
         {
             get
             {
-                return (GetSetting() != string.Empty ? GetSetting() : "Ptc") == "Ptc" ? AuthType.Ptc : AuthType.Google;
+                return (GetSetting() != string.Empty ? GetSetting() : "PTC") == "PTC" ? AuthType.Ptc : AuthType.Google;
             }
             set { SetSetting(value.ToString()); }
         }
@@ -296,7 +303,6 @@ namespace PokemonGo.RocketAPI.Window
             set { SetSetting(value); }
         }

-
         public double DefaultLongitude
         {
             get
@@ -463,7 +469,7 @@ namespace PokemonGo.RocketAPI.Window

         public void SetSetting(double value, [CallerMemberName] string key = null)
         {
-            var customCulture = (CultureInfo) Thread.CurrentThread.CurrentCulture.Clone();
+            var customCulture = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone();
             customCulture.NumberFormat.NumberDecimalSeparator = ".";
             Thread.CurrentThread.CurrentCulture = customCulture;
             var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
diff --git a/src/RocketBotGUI/SettingsForm.Designer.cs b/src/RocketBotGUI/SettingsForm.Designer.cs
index 781e413..0688c62 100644
--- a/src/RocketBotGUI/SettingsForm.Designer.cs
+++ b/src/RocketBotGUI/SettingsForm.Designer.cs
@@ -55,6 +55,8 @@ namespace PokemonGo.RocketAPI.Window
             this.AdressBox = new System.Windows.Forms.TextBox();
             this.trackBar = new System.Windows.Forms.TrackBar();
             this.panel1 = new System.Windows.Forms.Panel();
+            this.useIncubatorsCb = new System.Windows.Forms.ComboBox();
+            this.useIncubatorsText = new System.Windows.Forms.Label();
             this.TravelSpeedBox = new System.Windows.Forms.TextBox();
             this.CatchPokemonBox = new System.Windows.Forms.CheckBox();
             this.CatchPokemonText = new System.Windows.Forms.Label();
@@ -75,6 +77,7 @@ namespace PokemonGo.RocketAPI.Window
             this.cbSelectAllTransfer = new System.Windows.Forms.CheckBox();
             this.clbTransfer = new System.Windows.Forms.CheckedListBox();
             this.tabItems = new System.Windows.Forms.TabPage();
+            this.flpItems = new System.Windows.Forms.FlowLayoutPanel();
             this.tabDevice = new System.Windows.Forms.TabPage();
             this.label22 = new System.Windows.Forms.Label();
             this.label20 = new System.Windows.Forms.Label();
@@ -109,7 +112,6 @@ namespace PokemonGo.RocketAPI.Window
             this.DeviceIdTb = new System.Windows.Forms.TextBox();
             this.deviceIdlb = new System.Windows.Forms.Label();
             this.label18 = new System.Windows.Forms.Label();
-            this.flpItems = new System.Windows.Forms.FlowLayoutPanel();
             ((System.ComponentModel.ISupportInitialize)(this.trackBar)).BeginInit();
             this.panel1.SuspendLayout();
             this.panel2.SuspendLayout();
@@ -136,8 +138,8 @@ namespace PokemonGo.RocketAPI.Window
             //
             this.authTypeCb.FormattingEnabled = true;
             this.authTypeCb.Items.AddRange(new object[] {
-            "google",
-            "Ptc"});
+            "Google",
+            "PTC"});
             this.authTypeCb.Location = new System.Drawing.Point(96, 5);
             this.authTypeCb.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.authTypeCb.Name = "authTypeCb";
@@ -202,7 +204,7 @@ namespace PokemonGo.RocketAPI.Window
             // label3
             //
             this.label3.AutoSize = true;
-            this.label3.Location = new System.Drawing.Point(3, 370);
+            this.label3.Location = new System.Drawing.Point(3, 387);
             this.label3.Name = "label3";
             this.label3.Size = new System.Drawing.Size(101, 15);
             this.label3.TabIndex = 8;
@@ -265,8 +267,8 @@ namespace PokemonGo.RocketAPI.Window
             //
             this.razzmodeCb.FormattingEnabled = true;
             this.razzmodeCb.Items.AddRange(new object[] {
-            "probability",
-            "cp"});
+            "Probability",
+            "CP"});
             this.razzmodeCb.Location = new System.Drawing.Point(138, 159);
             this.razzmodeCb.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.razzmodeCb.Name = "razzmodeCb";
@@ -311,7 +313,7 @@ namespace PokemonGo.RocketAPI.Window
             // evolveAllChk
             //
             this.evolveAllChk.AutoSize = true;
-            this.evolveAllChk.Location = new System.Drawing.Point(138, 370);
+            this.evolveAllChk.Location = new System.Drawing.Point(138, 387);
             this.evolveAllChk.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.evolveAllChk.Name = "evolveAllChk";
             this.evolveAllChk.Size = new System.Drawing.Size(15, 14);
@@ -322,7 +324,7 @@ namespace PokemonGo.RocketAPI.Window
             //
             this.saveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
             | System.Windows.Forms.AnchorStyles.Right)));
-            this.saveBtn.Location = new System.Drawing.Point(6, 412);
+            this.saveBtn.Location = new System.Drawing.Point(6, 419);
             this.saveBtn.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.saveBtn.Name = "saveBtn";
             this.saveBtn.Size = new System.Drawing.Size(248, 42);
@@ -357,7 +359,7 @@ namespace PokemonGo.RocketAPI.Window
             this.gMapControl1.ScaleMode = GMap.NET.WindowsForms.ScaleModes.Integer;
             this.gMapControl1.SelectedAreaFillColor = System.Drawing.Color.FromArgb(((int)(((byte)(33)))), ((int)(((byte)(65)))), ((int)(((byte)(105)))), ((int)(((byte)(225)))));
             this.gMapControl1.ShowTileGridLines = false;
-            this.gMapControl1.Size = new System.Drawing.Size(577, 378);
+            this.gMapControl1.Size = new System.Drawing.Size(586, 385);
             this.gMapControl1.TabIndex = 22;
             this.gMapControl1.Zoom = 0D;
             this.gMapControl1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.gMapControl1_MouseClick);
@@ -365,7 +367,7 @@ namespace PokemonGo.RocketAPI.Window
             // FindAdressButton
             //
             this.FindAdressButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
-            this.FindAdressButton.Location = new System.Drawing.Point(464, 393);
+            this.FindAdressButton.Location = new System.Drawing.Point(473, 400);
             this.FindAdressButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.FindAdressButton.Name = "FindAdressButton";
             this.FindAdressButton.Size = new System.Drawing.Size(119, 30);
@@ -379,10 +381,10 @@ namespace PokemonGo.RocketAPI.Window
             this.AdressBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
             | System.Windows.Forms.AnchorStyles.Right)));
             this.AdressBox.ForeColor = System.Drawing.Color.Gray;
-            this.AdressBox.Location = new System.Drawing.Point(6, 397);
+            this.AdressBox.Location = new System.Drawing.Point(6, 404);
             this.AdressBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.AdressBox.Name = "AdressBox";
-            this.AdressBox.Size = new System.Drawing.Size(452, 23);
+            this.AdressBox.Size = new System.Drawing.Size(461, 23);
             this.AdressBox.TabIndex = 25;
             this.AdressBox.Text = "Enter an address or a coordinate";
             this.AdressBox.Enter += new System.EventHandler(this.AdressBox_Enter);
@@ -392,7 +394,7 @@ namespace PokemonGo.RocketAPI.Window
             //
             this.trackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.trackBar.BackColor = System.Drawing.SystemColors.Info;
-            this.trackBar.Location = new System.Drawing.Point(536, 7);
+            this.trackBar.Location = new System.Drawing.Point(545, 7);
             this.trackBar.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.trackBar.Name = "trackBar";
             this.trackBar.Orientation = System.Windows.Forms.Orientation.Vertical;
@@ -403,6 +405,8 @@ namespace PokemonGo.RocketAPI.Window
             //
             // panel1
             //
+            this.panel1.Controls.Add(this.useIncubatorsCb);
+            this.panel1.Controls.Add(this.useIncubatorsText);
             this.panel1.Controls.Add(this.TravelSpeedBox);
             this.panel1.Controls.Add(this.CatchPokemonBox);
             this.panel1.Controls.Add(this.CatchPokemonText);
@@ -434,12 +438,33 @@ namespace PokemonGo.RocketAPI.Window
             this.panel1.Location = new System.Drawing.Point(0, 0);
             this.panel1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.panel1.Name = "panel1";
-            this.panel1.Size = new System.Drawing.Size(261, 458);
+            this.panel1.Size = new System.Drawing.Size(261, 465);
             this.panel1.TabIndex = 26;
             //
+            // useIncubatorsCb
+            //
+            this.useIncubatorsCb.FormattingEnabled = true;
+            this.useIncubatorsCb.Items.AddRange(new object[] {
+            "Disabled",
+            "Only Unlimited",
+            "All Incubators"});
+            this.useIncubatorsCb.Location = new System.Drawing.Point(138, 320);
+            this.useIncubatorsCb.Name = "useIncubatorsCb";
+            this.useIncubatorsCb.Size = new System.Drawing.Size(116, 23);
+            this.useIncubatorsCb.TabIndex = 26;
+            //
+            // useIncubatorsText
+            //
+            this.useIncubatorsText.AutoSize = true;
+            this.useIncubatorsText.Location = new System.Drawing.Point(3, 323);
+            this.useIncubatorsText.Name = "useIncubatorsText";
+            this.useIncubatorsText.Size = new System.Drawing.Size(117, 15);
+            this.useIncubatorsText.TabIndex = 27;
+            this.useIncubatorsText.Text = "Use Egg Incubators:";
+            //
             // TravelSpeedBox
             //
-            this.TravelSpeedBox.Location = new System.Drawing.Point(138, 314);
+            this.TravelSpeedBox.Location = new System.Drawing.Point(138, 283);
             this.TravelSpeedBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.TravelSpeedBox.Name = "TravelSpeedBox";
             this.TravelSpeedBox.Size = new System.Drawing.Size(116, 21);
@@ -449,7 +474,7 @@ namespace PokemonGo.RocketAPI.Window
             // CatchPokemonBox
             //
             this.CatchPokemonBox.AutoSize = true;
-            this.CatchPokemonBox.Location = new System.Drawing.Point(138, 344);
+            this.CatchPokemonBox.Location = new System.Drawing.Point(138, 363);
             this.CatchPokemonBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.CatchPokemonBox.Name = "CatchPokemonBox";
             this.CatchPokemonBox.Size = new System.Drawing.Size(15, 14);
@@ -459,7 +484,7 @@ namespace PokemonGo.RocketAPI.Window
             // CatchPokemonText
             //
             this.CatchPokemonText.AutoSize = true;
-            this.CatchPokemonText.Location = new System.Drawing.Point(3, 344);
+            this.CatchPokemonText.Location = new System.Drawing.Point(3, 362);
             this.CatchPokemonText.Name = "CatchPokemonText";
             this.CatchPokemonText.Size = new System.Drawing.Size(97, 15);
             this.CatchPokemonText.TabIndex = 25;
@@ -476,7 +501,7 @@ namespace PokemonGo.RocketAPI.Window
             // TravelSpeedText
             //
             this.TravelSpeedText.AutoSize = true;
-            this.TravelSpeedText.Location = new System.Drawing.Point(3, 318);
+            this.TravelSpeedText.Location = new System.Drawing.Point(3, 286);
             this.TravelSpeedText.Name = "TravelSpeedText";
             this.TravelSpeedText.Size = new System.Drawing.Size(112, 15);
             this.TravelSpeedText.TabIndex = 23;
@@ -497,7 +522,7 @@ namespace PokemonGo.RocketAPI.Window
             this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
             this.panel2.Location = new System.Drawing.Point(261, 0);
             this.panel2.Name = "panel2";
-            this.panel2.Size = new System.Drawing.Size(597, 458);
+            this.panel2.Size = new System.Drawing.Size(606, 465);
             this.panel2.TabIndex = 27;
             //
             // tabControl
@@ -511,7 +536,7 @@ namespace PokemonGo.RocketAPI.Window
             this.tabControl.Location = new System.Drawing.Point(0, 0);
             this.tabControl.Name = "tabControl";
             this.tabControl.SelectedIndex = 0;
-            this.tabControl.Size = new System.Drawing.Size(597, 458);
+            this.tabControl.Size = new System.Drawing.Size(606, 465);
             this.tabControl.TabIndex = 26;
             //
             // tabLocation
@@ -524,7 +549,7 @@ namespace PokemonGo.RocketAPI.Window
             this.tabLocation.Location = new System.Drawing.Point(4, 24);
             this.tabLocation.Name = "tabLocation";
             this.tabLocation.Padding = new System.Windows.Forms.Padding(3);
-            this.tabLocation.Size = new System.Drawing.Size(589, 430);
+            this.tabLocation.Size = new System.Drawing.Size(598, 437);
             this.tabLocation.TabIndex = 0;
             this.tabLocation.Text = "Location";
             //
@@ -537,7 +562,7 @@ namespace PokemonGo.RocketAPI.Window
             this.tabPokemon.Location = new System.Drawing.Point(4, 24);
             this.tabPokemon.Name = "tabPokemon";
             this.tabPokemon.Padding = new System.Windows.Forms.Padding(3);
-            this.tabPokemon.Size = new System.Drawing.Size(589, 430);
+            this.tabPokemon.Size = new System.Drawing.Size(598, 437);
             this.tabPokemon.TabIndex = 1;
             this.tabPokemon.Text = "Pokemon";
             //
@@ -656,10 +681,19 @@ namespace PokemonGo.RocketAPI.Window
             this.tabItems.Location = new System.Drawing.Point(4, 24);
             this.tabItems.Name = "tabItems";
             this.tabItems.Padding = new System.Windows.Forms.Padding(3);
-            this.tabItems.Size = new System.Drawing.Size(589, 430);
+            this.tabItems.Size = new System.Drawing.Size(598, 437);
             this.tabItems.TabIndex = 2;
             this.tabItems.Text = "Items";
             //
+            // flpItems
+            //
+            this.flpItems.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.flpItems.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
+            this.flpItems.Location = new System.Drawing.Point(3, 3);
+            this.flpItems.Name = "flpItems";
+            this.flpItems.Size = new System.Drawing.Size(592, 431);
+            this.flpItems.TabIndex = 0;
+            //
             // tabDevice
             //
             this.tabDevice.Controls.Add(this.label22);
@@ -697,7 +731,7 @@ namespace PokemonGo.RocketAPI.Window
             this.tabDevice.Controls.Add(this.label18);
             this.tabDevice.Location = new System.Drawing.Point(4, 24);
             this.tabDevice.Name = "tabDevice";
-            this.tabDevice.Size = new System.Drawing.Size(589, 430);
+            this.tabDevice.Size = new System.Drawing.Size(598, 437);
             this.tabDevice.TabIndex = 0;
             this.tabDevice.Text = "Device";
             //
@@ -1015,20 +1049,11 @@ namespace PokemonGo.RocketAPI.Window
             this.label18.TabIndex = 36;
             this.label18.Text = "Device Type:";
             //
-            // flpItems
-            //
-            this.flpItems.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.flpItems.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
-            this.flpItems.Location = new System.Drawing.Point(3, 3);
-            this.flpItems.Name = "flpItems";
-            this.flpItems.Size = new System.Drawing.Size(583, 424);
-            this.flpItems.TabIndex = 0;
-            //
             // SettingsForm
             //
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(858, 458);
+            this.ClientSize = new System.Drawing.Size(867, 465);
             this.Controls.Add(this.panel2);
             this.Controls.Add(this.panel1);
             this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F);
@@ -1144,5 +1169,7 @@ namespace PokemonGo.RocketAPI.Window
         private System.Windows.Forms.Label label22;
         private System.Windows.Forms.TabPage tabItems;
         private System.Windows.Forms.FlowLayoutPanel flpItems;
+        private System.Windows.Forms.Label useIncubatorsText;
+        private System.Windows.Forms.ComboBox useIncubatorsCb;
     }
 }
diff --git a/src/RocketBotGUI/SettingsForm.cs b/src/RocketBotGUI/SettingsForm.cs
index 844ce9a..3f1ff50 100644
--- a/src/RocketBotGUI/SettingsForm.cs
+++ b/src/RocketBotGUI/SettingsForm.cs
@@ -1,14 +1,14 @@
-using System;
+using GMap.NET;
+using GMap.NET.MapProviders;
+using POGOProtos.Enums;
+using POGOProtos.Inventory.Item;
+using System;
 using System.Collections.Generic;
 using System.Configuration;
 using System.Drawing;
 using System.Globalization;
 using System.Linq;
 using System.Windows.Forms;
-using GMap.NET;
-using GMap.NET.MapProviders;
-using POGOProtos.Enums;
-using POGOProtos.Inventory.Item;

 namespace PokemonGo.RocketAPI.Window
 {
@@ -17,6 +17,7 @@ namespace PokemonGo.RocketAPI.Window
         private DeviceHelper _deviceHelper;
         private List<DeviceInfo> _deviceInfos;
         private bool _doNotPopulate;
+
         private List<ItemId> itemSettings = new List<ItemId> {
             ItemId.ItemPokeBall,
             ItemId.ItemGreatBall,
@@ -46,7 +47,8 @@ namespace PokemonGo.RocketAPI.Window
                 clbEvolve.Items.Add(id);
             }

-            foreach (ItemId itemId in itemSettings) {
+            foreach (ItemId itemId in itemSettings)
+            {
                 ItemData item = new ItemData();
                 item.ItemId = itemId;
                 flpItems.Controls.Add(new ItemSetting(item));
@@ -56,7 +58,7 @@ namespace PokemonGo.RocketAPI.Window
         private void SettingsForm_Load(object sender, EventArgs e)
         {
             authTypeCb.Text = Settings.Instance.AuthType.ToString();
-            if (authTypeCb.Text == "google")
+            if (authTypeCb.Text.ToLower().Equals("google"))
             {
                 UserLoginBox.Text = Settings.Instance.GoogleUsername;
                 UserPasswordBox.Text = Settings.Instance.GooglePassword;
@@ -70,10 +72,12 @@ namespace PokemonGo.RocketAPI.Window
             longitudeText.Text = Settings.Instance.DefaultLongitude.ToString();
             razzmodeCb.Text = Settings.Instance.RazzBerryMode;
             razzSettingText.Text = Settings.Instance.RazzBerrySetting.ToString();
+            useIncubatorsCb.Text = Settings.Instance.UseIncubatorsMode.ToString();
             transferTypeCb.Text = Settings.Instance.TransferType;
             transferCpThresText.Text = Settings.Instance.TransferCpThreshold.ToString();
             transferIVThresText.Text = Settings.Instance.TransferIvThreshold.ToString();
             evolveAllChk.Checked = Settings.Instance.EvolveAllGivenPokemons;
+
             CatchPokemonBox.Checked = Settings.Instance.CatchPokemon;
             TravelSpeedBox.Text = Settings.Instance.TravelSpeed.ToString();
             // ImageSizeBox.Text = Settings.Instance.ImageSize.ToString();
@@ -92,7 +96,6 @@ namespace PokemonGo.RocketAPI.Window
             gMapControl1.Position = new PointLatLng(double.Parse(lat.Replace(",", "."), CultureInfo.InvariantCulture),
                 double.Parse(longit.Replace(",", "."), CultureInfo.InvariantCulture));

-
             //zoom min/max; default both = 2
             gMapControl1.DragButton = MouseButtons.Left;

@@ -144,9 +147,12 @@ namespace PokemonGo.RocketAPI.Window
             }

             var itemCounts = Settings.Instance.ItemCounts;
-            foreach (ItemSetting itemSetting in flpItems.Controls) {
-                foreach(var itemCount in itemCounts) {
-                    if (itemSetting.ItemData.ItemId == itemCount.ItemId) {
+            foreach (ItemSetting itemSetting in flpItems.Controls)
+            {
+                foreach (var itemCount in itemCounts)
+                {
+                    if (itemSetting.ItemData.ItemId == itemCount.ItemId)
+                    {
                         itemSetting.ItemData = itemCount;
                     }
                 }
@@ -182,7 +188,7 @@ namespace PokemonGo.RocketAPI.Window
         private void saveBtn_Click(object sender, EventArgs e)
         {
             Settings.Instance.SetSetting(authTypeCb.Text, "AuthType");
-            if (authTypeCb.Text == "google")
+            if (authTypeCb.Text.ToLower().Equals("google"))
             {
                 Settings.Instance.SetSetting(UserLoginBox.Text, "GoogleUsername");
                 Settings.Instance.SetSetting(UserPasswordBox.Text, "GooglePassword");
@@ -200,12 +206,12 @@ namespace PokemonGo.RocketAPI.Window
             lat.Replace(',', '.');
             longit.Replace(',', '.');

-
             Settings.Instance.SetSetting(razzmodeCb.Text, "RazzBerryMode");
             Settings.Instance.SetSetting(razzSettingText.Text, "RazzBerrySetting");
             Settings.Instance.SetSetting(transferTypeCb.Text, "TransferType");
             Settings.Instance.SetSetting(transferCpThresText.Text, "TransferCPThreshold");
             Settings.Instance.SetSetting(transferIVThresText.Text, "TransferIVThreshold");
+            Settings.Instance.SetSetting(useIncubatorsCb.Text, "useIncubatorsMode");
             Settings.Instance.SetSetting(TravelSpeedBox.Text, "TravelSpeed");
             //Settings.Instance.SetSetting(ImageSizeBox.Text, "ImageSize");
             Settings.Instance.SetSetting(evolveAllChk.Checked ? "true" : "false", "EvolveAllGivenPokemons");
@@ -240,7 +246,7 @@ namespace PokemonGo.RocketAPI.Window

         private void authTypeCb_SelectedIndexChanged(object sender, EventArgs e)
         {
-            if (authTypeCb.Text == "google")
+            if (authTypeCb.Text.ToLower().Equals("google"))
             {
                 UserLabel.Text = "Email:";
             }
You may download the files in Public Git.