Simple option to choose used pokeball while catching. (#49)

Jan Niklas Richter [2016-07-20 18:53:49]
Simple option to choose used pokeball while catching. (#49)

* Fixed id of pokemon in inventory. Renamed pokemonId to pokemonType.

* Simple option to choose used pokeball while capturing.
Filename
PokemonGo/RocketAPI/Client.cs
PokemonGo/RocketAPI/Console/Program.cs
PokemonGo/RocketAPI/Settings.cs
diff --git a/PokemonGo/RocketAPI/Client.cs b/PokemonGo/RocketAPI/Client.cs
index 4a62fba..a406c4b 100644
--- a/PokemonGo/RocketAPI/Client.cs
+++ b/PokemonGo/RocketAPI/Client.cs
@@ -275,12 +275,13 @@ namespace PokemonGo.RocketAPI
         }

         public async Task<CatchPokemonResponse> CatchPokemon(ulong encounterId, string spawnPointGuid, double pokemonLat,
-            double pokemonLng)
+            double pokemonLng, MiscEnums.Item pokeball)
         {
+
             var customRequest = new Request.Types.CatchPokemonRequest()
             {
                 EncounterId = encounterId,
-                Pokeball = (int) MiscEnums.Item.ITEM_POKE_BALL,
+                Pokeball = (int) pokeball,
                 SpawnPointGuid = spawnPointGuid,
                 HitPokemon = 1,
                 NormalizedReticleSize = Utils.FloatAsUlong(1.950),
diff --git a/PokemonGo/RocketAPI/Console/Program.cs b/PokemonGo/RocketAPI/Console/Program.cs
index 76aded9..678016b 100644
--- a/PokemonGo/RocketAPI/Console/Program.cs
+++ b/PokemonGo/RocketAPI/Console/Program.cs
@@ -81,7 +81,7 @@ namespace PokemonGo.RocketAPI.Console
                 CatchPokemonResponse caughtPokemonResponse;
                 do
                 {
-                    caughtPokemonResponse = await client.CatchPokemon(pokemon.EncounterId, pokemon.SpawnpointId, pokemon.Latitude, pokemon.Longitude);
+                    caughtPokemonResponse = await client.CatchPokemon(pokemon.EncounterId, pokemon.SpawnpointId, pokemon.Latitude, pokemon.Longitude, Settings.UsedBall);
                 }
                 while(caughtPokemonResponse.Payload[0].Status == 2);

diff --git a/PokemonGo/RocketAPI/Settings.cs b/PokemonGo/RocketAPI/Settings.cs
index e01aa12..1cfa46c 100644
--- a/PokemonGo/RocketAPI/Settings.cs
+++ b/PokemonGo/RocketAPI/Settings.cs
@@ -3,6 +3,10 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using PokemonGo.RocketAPI.Enums;
+using PokemonGo.RocketAPI.GeneratedCode;
+using PokemonGo.RocketAPI.Helpers;
+using PokemonGo.RocketAPI.Extensions;

 namespace PokemonGo.RocketAPI
 {
@@ -15,6 +19,6 @@ namespace PokemonGo.RocketAPI
         public static string GoogleRefreshToken = string.Empty;
         public const double DefaultLatitude = 10;
         public const double DefaultLongitude = 10;
-
+        public const MiscEnums.Item UsedBall = MiscEnums.Item.ITEM_POKE_BALL;
     }
 }
You may download the files in Public Git.