Merge remote-tracking branch 'refs/remotes/origin/Beta-Build'

Brian [2016-08-02 14:27:23]
Merge remote-tracking branch 'refs/remotes/origin/Beta-Build'
Filename
PokemonGo/RocketAPI/Window/MainForm.Designer.cs
PokemonGo/RocketAPI/Window/MainForm.cs
PokemonGo/RocketAPI/Window/Properties/AssemblyInfo.cs
diff --git a/PokemonGo/RocketAPI/Window/MainForm.Designer.cs b/PokemonGo/RocketAPI/Window/MainForm.Designer.cs
index bf0442f..bfeb935 100644
--- a/PokemonGo/RocketAPI/Window/MainForm.Designer.cs
+++ b/PokemonGo/RocketAPI/Window/MainForm.Designer.cs
@@ -69,7 +69,7 @@
             //
             this.logTextBox.BackColor = System.Drawing.Color.Black;
             this.logTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
-            this.logTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+            this.logTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.logTextBox.ForeColor = System.Drawing.Color.White;
             this.logTextBox.ImeMode = System.Windows.Forms.ImeMode.Off;
             this.logTextBox.Location = new System.Drawing.Point(0, 24);
@@ -209,50 +209,50 @@
             this.objectListView1.MultiSelect = false;
             this.objectListView1.Name = "objectListView1";
             this.objectListView1.RowHeight = 32;
-            this.objectListView1.SelectAllOnControlA = false;
             this.objectListView1.ShowGroups = false;
-            this.objectListView1.Size = new System.Drawing.Size(668, 215);
+            this.objectListView1.Size = new System.Drawing.Size(668, 220);
             this.objectListView1.SmallImageList = this.smallPokemonImageList;
             this.objectListView1.TabIndex = 25;
             this.objectListView1.UseCompatibleStateImageBehavior = false;
             this.objectListView1.View = System.Windows.Forms.View.Details;
-            this.objectListView1.SelectedIndexChanged += new System.EventHandler(this.objectListView1_SelectedIndexChanged);
             //
             // pkmnName
             //
             this.pkmnName.AspectName = "PokemonId";
             this.pkmnName.AspectToStringFormat = "";
             this.pkmnName.Text = "Name";
-            this.pkmnName.Width = 130;
+            this.pkmnName.Width = 120;
             //
             // pkmnCP
             //
             this.pkmnCP.AspectName = "Cp";
             this.pkmnCP.Text = "CP";
+            this.pkmnCP.Width = 50;
             //
             // pkmnAtkIV
             //
             this.pkmnAtkIV.AspectName = "IndividualAttack";
-            this.pkmnAtkIV.Text = "Attack IV";
-            this.pkmnAtkIV.Width = 70;
+            this.pkmnAtkIV.Text = "Atk IV";
+            this.pkmnAtkIV.Width = 50;
             //
             // pkmnDefIV
             //
             this.pkmnDefIV.AspectName = "IndividualDefense";
-            this.pkmnDefIV.Text = "Defense IV";
-            this.pkmnDefIV.Width = 70;
+            this.pkmnDefIV.Text = "Def IV";
+            this.pkmnDefIV.Width = 50;
             //
             // pkmnStaIV
             //
             this.pkmnStaIV.AspectName = "IndividualStamina";
-            this.pkmnStaIV.Text = "Stamina IV";
-            this.pkmnStaIV.Width = 70;
+            this.pkmnStaIV.Text = "Sta IV";
+            this.pkmnStaIV.Width = 50;
             //
             // pkmnIV
             //
             this.pkmnIV.AspectName = "GetIV";
             this.pkmnIV.AspectToStringFormat = "{0:P2}";
-            this.pkmnIV.Text = "Perfection";
+            this.pkmnIV.Text = "IV %";
+            this.pkmnIV.Width = 50;
             //
             // pkmnTransferButton
             //
@@ -274,6 +274,7 @@
             //
             this.pkmnEvolveButton.AspectName = "Id";
             this.pkmnEvolveButton.AspectToStringFormat = "Evolve";
+            this.pkmnEvolveButton.ButtonSizing = BrightIdeasSoftware.OLVColumn.ButtonSizingMode.CellBounds;
             this.pkmnEvolveButton.IsButton = true;
             this.pkmnEvolveButton.Text = "";
             //
diff --git a/PokemonGo/RocketAPI/Window/MainForm.cs b/PokemonGo/RocketAPI/Window/MainForm.cs
index 97acf92..e330388 100644
--- a/PokemonGo/RocketAPI/Window/MainForm.cs
+++ b/PokemonGo/RocketAPI/Window/MainForm.cs
@@ -47,8 +47,8 @@ namespace PokemonGo.RocketAPI.Window

         public MainForm()
         {
-            synchronizationContext = SynchronizationContext.Current;
             InitializeComponent();
+            synchronizationContext = SynchronizationContext.Current;
             ClientSettings = Settings.Instance;
             Client.OnConsoleWrite += Client_OnConsoleWrite;
             Instance = this;
@@ -88,7 +88,6 @@ namespace PokemonGo.RocketAPI.Window
         private void InitializeMap()
         {
             playerMarker.Position = new PointLatLng(ClientSettings.DefaultLatitude, ClientSettings.DefaultLongitude);
-
             searchAreaOverlay.Polygons.Clear();
             S2GMapDrawer.DrawS2Cells(S2Helper.GetNearbyCellIds(ClientSettings.DefaultLongitude, ClientSettings.DefaultLatitude), searchAreaOverlay);
         }
@@ -219,6 +218,7 @@ namespace PokemonGo.RocketAPI.Window
             foreach (var pokemon in pokemonToEvolve)
             {
                 var countOfEvolvedUnits = 0;
+                var xpCount = 0;

                 EvolvePokemonOut evolvePokemonOutProto;
                 do
@@ -228,25 +228,16 @@ namespace PokemonGo.RocketAPI.Window

                     if (evolvePokemonOutProto.Result == 1)
                     {
-                        ColoredConsoleWrite(Color.Cyan,
-                            $"Evolved {pokemon.PokemonId} successfully for {evolvePokemonOutProto.ExpAwarded}xp");
-
                         countOfEvolvedUnits++;
+                        xpCount += evolvePokemonOutProto.ExpAwarded;
                         TotalExperience += evolvePokemonOutProto.ExpAwarded;
                     }
-                    else
-                    {
-                        var result = evolvePokemonOutProto.Result;
-                        ColoredConsoleWrite(Color.White, $"Failed to evolve {pokemon.PokemonId}. " +
-                                                 $"EvolvePokemonOutProto.Result was {result}");
-                        ColoredConsoleWrite(Color.White, $"Due to above error, stopping evolving {pokemon.PokemonId}");
-                    }
                 } while (evolvePokemonOutProto.Result == 1);
-                /*
+
                 if (countOfEvolvedUnits > 0)
                     ColoredConsoleWrite(Color.Cyan,
                         $"Evolved {countOfEvolvedUnits} pieces of {pokemon.PokemonId} for {xpCount}xp");
-                        */
+
                 await Task.Delay(3000);
             }
         }
@@ -369,6 +360,7 @@ namespace PokemonGo.RocketAPI.Window
                     startStopBotToolStripMenuItem.Text = "Start";
                     Stopping = false;
                     bot_started = false;
+                    pokeStops = null;
                 }
             }
             catch (TaskCanceledException) { ColoredConsoleWrite(Color.Red, "Task Canceled Exception - Restarting"); if (!Stopping) Execute(); }
@@ -560,6 +552,7 @@ namespace PokemonGo.RocketAPI.Window
                     }
                 }

+                searchAreaOverlay.Polygons.Clear();
                 S2GMapDrawer.DrawS2Cells(S2Helper.GetNearbyCellIds(ClientSettings.DefaultLongitude, ClientSettings.DefaultLatitude), searchAreaOverlay);
             }), null);
         }
@@ -1229,35 +1222,31 @@ namespace PokemonGo.RocketAPI.Window
         #region POKEMON LIST
         private IEnumerable<PokemonFamily> families;

-
         private void InitializePokemonForm()
         {
             objectListView1.ButtonClick += PokemonListButton_Click;

             pkmnName.ImageGetter = delegate (object rowObject)
-           {
-               PokemonData pokemon = (PokemonData)rowObject;
-
-               String key = pokemon.PokemonId.ToString();
-               if (!objectListView1.SmallImageList.Images.ContainsKey(key))
-               {
-                   Image img = GetPokemonImage((int)pokemon.PokemonId);
-                   objectListView1.SmallImageList.Images.Add(key, img);
-               }
-               return key;
-           };
+            {
+                PokemonData pokemon = (PokemonData)rowObject;
+
+                String key = pokemon.PokemonId.ToString();
+                if (!objectListView1.SmallImageList.Images.ContainsKey(key))
+                {
+                    Image img = GetPokemonImage((int)pokemon.PokemonId);
+                    objectListView1.SmallImageList.Images.Add(key, img);
+                }
+                return key;
+            };

             objectListView1.CellToolTipShowing += delegate (object sender, ToolTipShowingEventArgs args)
             {
                 PokemonData pokemon = (PokemonData)args.Model;
-                if (args.ColumnIndex == 8)
-                {
-                    int candyOwned = families
-                            .Where(i => (int)i.FamilyId <= (int)pokemon.PokemonId)
-                            .Select(f => f.Candy)
-                            .First();
-                    args.Text = candyOwned + " Candy";
-                }
+
+                var family = families
+                        .Where(i => (int)i.FamilyId <= (int)pokemon.PokemonId)
+                        .First();
+                args.Text = $"You have {family.Candy} {((PokemonId)((int)family.FamilyId)).ToString()} Candy";
             };
         }

@@ -1283,9 +1272,9 @@ namespace PokemonGo.RocketAPI.Window
                    .Where(p => p != null && (int)p?.FamilyId > 0)
                    .OrderByDescending(p => (int)p.FamilyId);

-                var currentScrollPosition = objectListView1.LowLevelScrollPosition;
+                var prevTopItem = objectListView1.TopItemIndex;
                 objectListView1.SetObjects(pokemons);
-                objectListView1.LowLevelScroll(currentScrollPosition.X, currentScrollPosition.Y);
+                objectListView1.TopItemIndex = prevTopItem;
             }
             catch (Exception ex) { ColoredConsoleWrite(Color.Red, ex.ToString()); client2 = null; }

@@ -1319,66 +1308,47 @@ namespace PokemonGo.RocketAPI.Window
             if (MessageBox.Show($"Are you sure you want to transfer {pokemon.PokemonId.ToString()} with {pokemon.Cp} CP?", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                 var transferPokemonResponse = await client2.TransferPokemon(pokemon.Id);
-                string message = "";
-                string caption = "";

                 if (transferPokemonResponse.Status == 1)
                 {
-                    message = $"{pokemon.PokemonId} was transferred\n{transferPokemonResponse.CandyAwarded} candy awarded";
-                    caption = $"{pokemon.PokemonId} transferred";
+                    ColoredConsoleWrite(Color.Magenta, $"{pokemon.PokemonId} was transferred. {transferPokemonResponse.CandyAwarded} candy awarded");
                     ReloadPokemonList();
                 }
                 else
                 {
-                    message = $"{pokemon.PokemonId} could not be transferred";
-                    caption = $"Transfer {pokemon.PokemonId} failed";
+                    ColoredConsoleWrite(Color.Magenta, $"{pokemon.PokemonId} could not be transferred");
                 }
-
-                MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }

         private async void PowerUpPokemon(PokemonData pokemon)
         {
             var evolvePokemonResponse = await client2.PowerUp(pokemon.Id);
-            string message = "";
-            string caption = "";

             if (evolvePokemonResponse.Result == 1)
             {
-                message = $"{pokemon.PokemonId} successfully upgraded.";
-                caption = $"{pokemon.PokemonId} upgraded";
+                ColoredConsoleWrite(Color.Magenta, $"{pokemon.PokemonId} successfully upgraded.");
                 ReloadPokemonList();
             }
             else
             {
-                message = $"{pokemon.PokemonId} could not be upgraded";
-                caption = $"Upgrade {pokemon.PokemonId} failed";
+                ColoredConsoleWrite(Color.Magenta, $"{pokemon.PokemonId} could not be upgraded");
             }
-
-            MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
         }

         private async void EvolvePokemon(PokemonData pokemon)
         {
             var evolvePokemonResponse = await client2.EvolvePokemon(pokemon.Id);
-            string message = "";
-            string caption = "";

             if (evolvePokemonResponse.Result == 1)
             {
-                message = $"{pokemon.PokemonId} successfully evolved into {evolvePokemonResponse.EvolvedPokemon.PokemonType}\n{evolvePokemonResponse.ExpAwarded} experience awarded\n{evolvePokemonResponse.CandyAwarded} candy awarded";
-                caption = $"{pokemon.PokemonId} evolved into {evolvePokemonResponse.EvolvedPokemon.PokemonType}";
-                TotalExperience += (evolvePokemonResponse.ExpAwarded);
+                ColoredConsoleWrite(Color.Magenta, $"{pokemon.PokemonId} successfully evolved into {evolvePokemonResponse.EvolvedPokemon.PokemonType}\n{evolvePokemonResponse.ExpAwarded} experience awarded\n{evolvePokemonResponse.CandyAwarded} candy awarded");
                 ReloadPokemonList();
             }
             else
             {
-                message = $"{pokemon.PokemonId} could not be evolved";
-                caption = $"Evolve {pokemon.PokemonId} failed";
+                ColoredConsoleWrite(Color.Magenta, $"{pokemon.PokemonId} could not be evolved");
             }
-
-            MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
         }

         private void button1_Click(object sender, EventArgs e)
diff --git a/PokemonGo/RocketAPI/Window/Properties/AssemblyInfo.cs b/PokemonGo/RocketAPI/Window/Properties/AssemblyInfo.cs
index 6700f82..bb8d2be 100644
--- a/PokemonGo/RocketAPI/Window/Properties/AssemblyInfo.cs
+++ b/PokemonGo/RocketAPI/Window/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.7.3.1")]
+[assembly: AssemblyVersion("1.7.3.2")]
 [assembly: AssemblyFileVersion("1.0.0.0")]
You may download the files in Public Git.