Merge fix

FeroxRev [2016-07-21 00:59:02]
Merge fix
Filename
PokemonGo/RocketAPI/Client.cs
PokemonGo/RocketAPI/Console/Program.cs
PokemonGo/RocketAPI/Console/Settings.cs
diff --git a/PokemonGo/RocketAPI/Client.cs b/PokemonGo/RocketAPI/Client.cs
index e9a8c73..55f434e 100644
--- a/PokemonGo/RocketAPI/Client.cs
+++ b/PokemonGo/RocketAPI/Client.cs
@@ -291,21 +291,5 @@ namespace PokemonGo.RocketAPI
             var inventoryRequest = RequestBuilder.GetRequest(_unknownAuth, _currentLat, _currentLng, 30, RequestType.GET_INVENTORY);
             return await _httpClient.PostProtoPayload<Request, GetInventoryResponse>($"https://{_apiUrl}/rpc", inventoryRequest);
         }
-
-        public async Task<InventoryResponse.Types.TransferPokemonOutProto> TransferPokemon(ulong pokemonId)
-        {
-            var customRequest = new InventoryResponse.Types.TransferPokemonProto
-            {
-                PokemonId = pokemonId
-            };
-
-            var releasePokemonRequest = RequestBuilder.GetRequest(_unknownAuth, _currentLat, _currentLng, 30,
-                new Request.Types.Requests()
-                {
-                    Type = (int)RequestType.RELEASE_POKEMON,
-                    Message = customRequest.ToByteString()
-                });
-            return await _httpClient.PostProto<Request, InventoryResponse.Types.TransferPokemonOutProto>($"https://{_apiUrl}/rpc", releasePokemonRequest);
-        }
     }
 }
diff --git a/PokemonGo/RocketAPI/Console/Program.cs b/PokemonGo/RocketAPI/Console/Program.cs
index 0328577..91e091d 100644
--- a/PokemonGo/RocketAPI/Console/Program.cs
+++ b/PokemonGo/RocketAPI/Console/Program.cs
@@ -102,30 +102,9 @@ namespace PokemonGo.RocketAPI.Console
                 }
                 while(caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchMissed);

-                System.Console.WriteLine(caughtPokemonResponse.Payload[0].Status == 1 ? $"We caught a {GetFriendlyPokemonName(pokemon.PokedexTypeId)}" : $"{GetFriendlyPokemonName(pokemon.PokedexTypeId)} got away..");
-
-                checkForDuplicates++;
-                if (checkForDuplicates % 50 == 0)
-                {
-                    checkForDuplicates = 0;
-                    System.Console.WriteLine($"Check for duplicates");
-                    var inventory = await client.GetInventory();
-                    var allpokemons = inventory.Payload[0].Bag.Items.Select(i => i.Item?.Pokemon).Where(p => p != null && p?.PokemonType != InventoryResponse.Types.PokemonProto.Types.PokemonIds.PokemonUnset);
-
-                    var dupes = allpokemons.OrderBy(x => x.Cp).Select((x, i) => new { index = i, value = x })
-                      .GroupBy(x => x.value.PokemonType)
-                      .Where(x => x.Skip(1).Any());
-
-                    for (int i = 0; i < dupes.Count(); i++)
-                    {
-                        for (int j = 0; j < dupes.ElementAt(i).Count() - 1; j++)
-                        {
-                            var dubpokemon = dupes.ElementAt(i).ElementAt(j).value;
-                            var transfer = await client.TransferPokemon(dubpokemon.Id);
-                            System.Console.WriteLine($"Transfer {dubpokemon.PokemonType} with {dubpokemon.Cp} CP (highest has {dupes.ElementAt(i).Last().value.Cp})");
-                        }
-                    }
-                }
+                System.Console.WriteLine(caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchSuccess ? $"[{DateTime.Now.ToString("HH:mm:ss")}] We caught a {pokemon.PokemonId}" : $"[{DateTime.Now.ToString("HH:mm:ss")}] {pokemon.PokemonId} got away..");
+                await Task.Delay(5000);
+

                 await Task.Delay(5000);
             }
@@ -144,5 +123,32 @@ namespace PokemonGo.RocketAPI.Console
                           .Select(y => $"{y.Amount} x {y.ItemName}")
                           .Aggregate((a, b) => $"{a}, {b}");
         }
+
+        private static async void TransferDuplicatePokemon(Client client)
+        {
+
+            checkForDuplicates++;
+            if (checkForDuplicates % 50 == 0)
+            {
+                checkForDuplicates = 0;
+                System.Console.WriteLine($"Check for duplicates");
+                var inventory = await client.GetInventory();
+                var allpokemons = inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.Pokemon).Where(p => p != null && p?.PokemonId >0);
+
+                var dupes = allpokemons.OrderBy(x => x.Cp).Select((x, i) => new { index = i, value = x })
+                  .GroupBy(x => x.value.PokemonId)
+                  .Where(x => x.Skip(1).Any());
+
+                for (int i = 0; i < dupes.Count(); i++)
+                {
+                    for (int j = 0; j < dupes.ElementAt(i).Count() - 1; j++)
+                    {
+                        var dubpokemon = dupes.ElementAt(i).ElementAt(j).value;
+                        var transfer = await client.TransferPokemon(dubpokemon.Id);
+                        System.Console.WriteLine($"Transfer {dubpokemon.PokemonId} with {dubpokemon.Cp} CP (highest has {dupes.ElementAt(i).Last().value.Cp})");
+                    }
+                }
+            }
+        }
     }
 }
diff --git a/PokemonGo/RocketAPI/Console/Settings.cs b/PokemonGo/RocketAPI/Console/Settings.cs
index 149e634..33ce9f8 100644
--- a/PokemonGo/RocketAPI/Console/Settings.cs
+++ b/PokemonGo/RocketAPI/Console/Settings.cs
@@ -2,6 +2,7 @@
 using PokemonGo.RocketAPI.Enums;
 using PokemonGo.RocketAPI.GeneratedCode;
 using System;
+using System.Globalization;
 using System.Runtime.CompilerServices;

 namespace PokemonGo.RocketAPI.Console
You may download the files in Public Git.