diff --git a/PokemonGo/RocketAPI/Client.cs b/PokemonGo/RocketAPI/Client.cs
index 097f82d..c3d5094 100644
--- a/PokemonGo/RocketAPI/Client.cs
+++ b/PokemonGo/RocketAPI/Client.cs
@@ -160,7 +160,27 @@ namespace PokemonGo.RocketAPI
releasePokemonRequest);
}
- private async Task<MiscEnums.Item> GetBestBall(int? pokemonCP)
+
+ public async Task<EvolvePokemonOut> PowerUp(ulong pokemonId)
+ {
+ var customRequest = new EvolvePokemon
+ {
+ PokemonId = pokemonId
+ };
+
+ var releasePokemonRequest = RequestBuilder.GetRequest(_unknownAuth, _currentLat, _currentLng, 30,
+ new Request.Types.Requests
+ {
+ Type = (int)RequestType.UPGRADE_POKEMON,
+ Message = customRequest.ToByteString()
+ });
+ return
+ await
+ _httpClient.PostProtoPayload<Request, EvolvePokemonOut>($"https://{_apiUrl}/rpc",
+ releasePokemonRequest);
+ }
+
+ private async Task<MiscEnums.Item> GetBestBall(int? pokemonCP)
{
var inventory = await GetInventory();
diff --git a/PokemonGo/RocketAPI/Window/PokeUi.Designer.cs b/PokemonGo/RocketAPI/Window/PokeUi.Designer.cs
index e47c24b..0e9d877 100644
--- a/PokemonGo/RocketAPI/Window/PokeUi.Designer.cs
+++ b/PokemonGo/RocketAPI/Window/PokeUi.Designer.cs
@@ -28,104 +28,116 @@
/// </summary>
private void InitializeComponent()
{
- this.components = new System.ComponentModel.Container();
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PokeUi));
- this.listView1 = new System.Windows.Forms.ListView();
- this.button1 = new System.Windows.Forms.Button();
- this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
- this.button2 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.contextMenuStrip1.SuspendLayout();
- this.SuspendLayout();
- //
- // listView1
- //
- this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
+ this.components = new System.ComponentModel.Container();
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PokeUi));
+ this.listView1 = new System.Windows.Forms.ListView();
+ this.button1 = new System.Windows.Forms.Button();
+ this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.button2 = new System.Windows.Forms.Button();
+ this.button3 = new System.Windows.Forms.Button();
+ this.btnUpgrade = new System.Windows.Forms.Button();
+ this.contextMenuStrip1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // listView1
+ //
+ this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.listView1.Location = new System.Drawing.Point(18, 18);
- this.listView1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.listView1.Name = "listView1";
- this.listView1.Size = new System.Drawing.Size(614, 521);
- this.listView1.TabIndex = 0;
- this.listView1.UseCompatibleStateImageBehavior = false;
- this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
- this.listView1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseClick);
- //
- // button1
- //
- this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ this.listView1.Location = new System.Drawing.Point(16, 14);
+ this.listView1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.listView1.Name = "listView1";
+ this.listView1.Size = new System.Drawing.Size(585, 451);
+ this.listView1.TabIndex = 0;
+ this.listView1.UseCompatibleStateImageBehavior = false;
+ this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
+ this.listView1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseClick);
+ //
+ // button1
+ //
+ this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.button1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.button1.Location = new System.Drawing.Point(17, 566);
- this.button1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(616, 40);
- this.button1.TabIndex = 3;
- this.button1.Text = "Reload";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // contextMenuStrip1
- //
- this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
- this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.button1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.button1.Location = new System.Drawing.Point(15, 486);
+ this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(587, 32);
+ this.button1.TabIndex = 3;
+ this.button1.Text = "Reload";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
+ // contextMenuStrip1
+ //
+ this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
+ this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem1});
- this.contextMenuStrip1.Name = "contextMenuStrip1";
- this.contextMenuStrip1.Size = new System.Drawing.Size(159, 34);
- //
- // toolStripMenuItem1
- //
- this.toolStripMenuItem1.Name = "toolStripMenuItem1";
- this.toolStripMenuItem1.Size = new System.Drawing.Size(158, 30);
- this.toolStripMenuItem1.Text = "Transfer";
- this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
- //
- // button2
- //
- this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ this.contextMenuStrip1.Name = "contextMenuStrip1";
+ this.contextMenuStrip1.Size = new System.Drawing.Size(137, 30);
+ //
+ // toolStripMenuItem1
+ //
+ this.toolStripMenuItem1.Name = "toolStripMenuItem1";
+ this.toolStripMenuItem1.Size = new System.Drawing.Size(136, 26);
+ this.toolStripMenuItem1.Text = "Transfer";
+ this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
+ //
+ // button2
+ //
+ this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.button2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.button2.Location = new System.Drawing.Point(16, 616);
- this.button2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(616, 40);
- this.button2.TabIndex = 4;
- this.button2.Text = "Evolve Selected";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // button3
- //
- this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ this.button2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.button2.Location = new System.Drawing.Point(16, 526);
+ this.button2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.button2.Name = "button2";
+ this.button2.Size = new System.Drawing.Size(288, 32);
+ this.button2.TabIndex = 4;
+ this.button2.Text = "Evolve Selected";
+ this.button2.UseVisualStyleBackColor = true;
+ this.button2.Click += new System.EventHandler(this.button2_Click);
+ //
+ // button3
+ //
+ this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.button3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.button3.Location = new System.Drawing.Point(17, 666);
- this.button3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(616, 40);
- this.button3.TabIndex = 5;
- this.button3.Text = "Transfer Selected";
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // PokeUi
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(652, 731);
- this.Controls.Add(this.button3);
- this.Controls.Add(this.button2);
- this.Controls.Add(this.button1);
- this.Controls.Add(this.listView1);
- this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
- this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.Name = "PokeUi";
- this.Text = "PokeUi";
- this.Load += new System.EventHandler(this.PokeUi_Load);
- this.contextMenuStrip1.ResumeLayout(false);
- this.ResumeLayout(false);
+ this.button3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.button3.Location = new System.Drawing.Point(16, 573);
+ this.button3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.button3.Name = "button3";
+ this.button3.Size = new System.Drawing.Size(585, 32);
+ this.button3.TabIndex = 5;
+ this.button3.Text = "Transfer Selected";
+ this.button3.UseVisualStyleBackColor = true;
+ this.button3.Click += new System.EventHandler(this.button3_Click);
+ //
+ // btnUpgrade
+ //
+ this.btnUpgrade.Location = new System.Drawing.Point(314, 525);
+ this.btnUpgrade.Name = "btnUpgrade";
+ this.btnUpgrade.Size = new System.Drawing.Size(287, 33);
+ this.btnUpgrade.TabIndex = 6;
+ this.btnUpgrade.Text = "Upgrade Selected";
+ this.btnUpgrade.UseVisualStyleBackColor = true;
+ this.btnUpgrade.Click += new System.EventHandler(this.btnUpgrade_Click);
+ //
+ // PokeUi
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(619, 618);
+ this.Controls.Add(this.btnUpgrade);
+ this.Controls.Add(this.button3);
+ this.Controls.Add(this.button2);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.listView1);
+ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+ this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.Name = "PokeUi";
+ this.Text = "PokeUi";
+ this.Load += new System.EventHandler(this.PokeUi_Load);
+ this.contextMenuStrip1.ResumeLayout(false);
+ this.ResumeLayout(false);
}
@@ -137,5 +149,6 @@
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
- }
+ private System.Windows.Forms.Button btnUpgrade;
+ }
}
\ No newline at end of file
diff --git a/PokemonGo/RocketAPI/Window/PokeUi.cs b/PokemonGo/RocketAPI/Window/PokeUi.cs
index 41e68b3..1975c4f 100644
--- a/PokemonGo/RocketAPI/Window/PokeUi.cs
+++ b/PokemonGo/RocketAPI/Window/PokeUi.cs
@@ -32,11 +32,9 @@ namespace PokemonGo.RocketAPI.Window
private async void Execute()
{
- button1.Enabled = false;
- button2.Enabled = false;
- button3.Enabled = false;
+ EnabledButton(false);
- client = new Client(ClientSettings);
+ client = new Client(ClientSettings);
try
{
@@ -101,11 +99,10 @@ namespace PokemonGo.RocketAPI.Window
}
- button1.Enabled = true;
- button2.Enabled = true;
- button3.Enabled = true;
+ EnabledButton(true);
- }
+
+ }
catch (TaskCanceledException) { Execute(); }
catch (UriFormatException) { Execute(); }
catch (ArgumentOutOfRangeException) { Execute(); }
@@ -114,6 +111,13 @@ namespace PokemonGo.RocketAPI.Window
catch (Exception ex) { Execute(); }
}
+ private void EnabledButton(bool enabled)
+ {
+ button1.Enabled = enabled;
+ button2.Enabled = enabled;
+ button3.Enabled = enabled;
+ btnUpgrade.Enabled = enabled;
+ }
private static Bitmap GetPokemonImage(int pokemonId)
{
@@ -257,5 +261,49 @@ namespace PokemonGo.RocketAPI.Window
catch (NullReferenceException) { await transferPokemon(pokemon); }
catch (Exception ex) { await transferPokemon(pokemon); }
}
- }
+
+ private async void btnUpgrade_Click(object sender, EventArgs e)
+ {
+ var selectedItems = listView1.SelectedItems;
+
+ foreach (ListViewItem selectedItem in selectedItems)
+ {
+ await PowerUp((PokemonData)selectedItem.Tag);
+ }
+
+ listView1.Clear();
+ Execute();
+ }
+
+ private static async Task PowerUp(PokemonData pokemon)
+ {
+ try
+ {
+ var evolvePokemonResponse = await client.PowerUp(pokemon.Id);
+ string message = "";
+ string caption = "";
+ MessageBoxButtons buttons = MessageBoxButtons.OK;
+ DialogResult result;
+
+ if (evolvePokemonResponse.Result == 1)
+ {
+ message = $"{pokemon.PokemonId} successfully upgraded.";
+ caption = $"{pokemon.PokemonId} upgraded";
+ }
+ else
+ {
+ message = $"{pokemon.PokemonId} could not be upgraded";
+ caption = $"Upgrade {pokemon.PokemonId} failed";
+ }
+
+ result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Information);
+ }
+ catch (TaskCanceledException) { await PowerUp(pokemon); }
+ catch (UriFormatException) { await PowerUp(pokemon); }
+ catch (ArgumentOutOfRangeException) { await PowerUp(pokemon); }
+ catch (ArgumentNullException) { await PowerUp(pokemon); }
+ catch (NullReferenceException) { await PowerUp(pokemon); }
+ catch (Exception ex) { await PowerUp(pokemon); }
+ }
+ }
}
\ No newline at end of file
diff --git a/PokemonGo/RocketAPI/Window/Properties/AssemblyInfo.cs b/PokemonGo/RocketAPI/Window/Properties/AssemblyInfo.cs
index 8919cf1..b614cd6 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.6.5.0")]
+[assembly: AssemblyVersion("1.6.5.1")]
[assembly: AssemblyFileVersion("1.0.0.0")]
You may download the files in Public Git.