diff --git a/src/RocketBotGUI/MainForm.cs b/src/RocketBotGUI/MainForm.cs
index de6b271..3af310b 100644
--- a/src/RocketBotGUI/MainForm.cs
+++ b/src/RocketBotGUI/MainForm.cs
@@ -950,11 +950,11 @@ namespace PokemonGo.RocketAPI.Window
}
}
- public static float Perfect(PokemonData poke)
+ public static double Perfect(PokemonData poke)
{
if (poke == null)
- return 0f;
- return (poke.IndividualAttack + poke.IndividualDefense + poke.IndividualStamina) / 45f * 100f;
+ return 0d;
+ return PokemonInfo.CalculatePokemonPerfection(poke) * 100d;
}
private async Task TransferAllGivenPokemons(Client client, IEnumerable<PokemonData> unwantedPokemons,
@@ -2216,20 +2216,24 @@ namespace PokemonGo.RocketAPI.Window
newName.Replace("{IA}", Convert.ToString(pokemon.IndividualAttack));
newName.Replace("{ID}", Convert.ToString(pokemon.IndividualDefense));
newName.Replace("{IS}", Convert.ToString(pokemon.IndividualStamina));
- nickname = newName.ToString();
if (nickname.Length > 12)
{
- ColoredConsoleWrite(Color.Red, $"\"{nickname}\" is too long, please choose another name");
+ ColoredConsoleWrite(Color.Red, $"\"{newName}\" is too long, please choose another name");
+ if (pokemons.Count() == 1)
+ {
+ SetState(true);
+ return;
+ }
continue;
}
- var response = await _client2.Inventory.NicknamePokemon(pokemon.Id, nickname);
+ var response = await _client2.Inventory.NicknamePokemon(pokemon.Id, newName.ToString());
if (response.Result == NicknamePokemonResponse.Types.Result.Success)
{
- ColoredConsoleWrite(Color.Green, $"Successfully renamed {pokemon.PokemonId} to \"{nickname}\"");
+ ColoredConsoleWrite(Color.Green, $"Successfully renamed {pokemon.PokemonId} to \"{newName}\"");
}
else
{
- ColoredConsoleWrite(Color.Red, $"Failed renaming {pokemon.PokemonId} to \"{nickname}\"");
+ ColoredConsoleWrite(Color.Red, $"Failed renaming {pokemon.PokemonId} to \"{newName}\"");
}
await Task.Delay(ACTIONDELAY);
}
diff --git a/src/RocketBotGUI/NicknamePokemonForm.Designer.cs b/src/RocketBotGUI/NicknamePokemonForm.Designer.cs
index 2aefa2d..4058c7b 100644
--- a/src/RocketBotGUI/NicknamePokemonForm.Designer.cs
+++ b/src/RocketBotGUI/NicknamePokemonForm.Designer.cs
@@ -24,12 +24,13 @@
/// </summary>
private void InitializeComponent() {
this.pnl = new System.Windows.Forms.Panel();
+ this.label4 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
this.txtNickname = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.btnNickname = new System.Windows.Forms.Button();
- this.label2 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.label4 = new System.Windows.Forms.Label();
+ this.closeRenameBtn = new System.Windows.Forms.Label();
this.pnl.SuspendLayout();
this.SuspendLayout();
//
@@ -37,6 +38,7 @@
//
this.pnl.BackColor = System.Drawing.SystemColors.Window;
this.pnl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.pnl.Controls.Add(this.closeRenameBtn);
this.pnl.Controls.Add(this.label4);
this.pnl.Controls.Add(this.label3);
this.pnl.Controls.Add(this.label2);
@@ -49,6 +51,40 @@
this.pnl.Size = new System.Drawing.Size(401, 205);
this.pnl.TabIndex = 0;
//
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.label4.Location = new System.Drawing.Point(191, 98);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(186, 45);
+ this.label4.TabIndex = 9;
+ this.label4.Text = "{IA} : Pokemon Individual Attack\r\n{ID} : Pokemon Individual Defense\r\n{IS} : Pokem" +
+ "on Individual Stamina";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.label3.Location = new System.Drawing.Point(13, 98);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(142, 45);
+ this.label3.TabIndex = 8;
+ this.label3.Text = "{Name} : Pokemon Name\r\n{CP} : Pokemon CP\r\n{IV} : Pokemon IV %";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.label2.Location = new System.Drawing.Point(11, 79);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(105, 15);
+ this.label2.TabIndex = 7;
+ this.label2.Text = "Rename Template:";
+ //
// txtNickname
//
this.txtNickname.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
@@ -86,39 +122,17 @@
this.btnNickname.Text = "Rename";
this.btnNickname.UseVisualStyleBackColor = true;
//
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
- this.label2.Location = new System.Drawing.Point(11, 79);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(105, 15);
- this.label2.TabIndex = 7;
- this.label2.Text = "Rename Template:";
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
- this.label3.Location = new System.Drawing.Point(13, 98);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(142, 45);
- this.label3.TabIndex = 8;
- this.label3.Text = "{Name} : Pokemon Name\r\n{CP} : Pokemon CP\r\n{IV} : Pokemon IV %";
- //
- // label4
+ // closeRenameBtn
//
- this.label4.AutoSize = true;
- this.label4.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
- this.label4.Location = new System.Drawing.Point(191, 98);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(186, 45);
- this.label4.TabIndex = 9;
- this.label4.Text = "{IA} : Pokemon Individual Attack\r\n{ID} : Pokemon Individual Defense\r\n{IS} : Pokem" +
- "on Individual Stamina";
+ this.closeRenameBtn.AutoSize = true;
+ this.closeRenameBtn.Font = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.closeRenameBtn.ForeColor = System.Drawing.Color.Gray;
+ this.closeRenameBtn.Location = new System.Drawing.Point(382, 0);
+ this.closeRenameBtn.Name = "closeRenameBtn";
+ this.closeRenameBtn.Size = new System.Drawing.Size(16, 17);
+ this.closeRenameBtn.TabIndex = 10;
+ this.closeRenameBtn.Text = "X";
+ this.closeRenameBtn.Click += new System.EventHandler(this.closeRenameBtn_Click);
//
// NicknamePokemonForm
//
@@ -145,5 +159,6 @@
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.Label closeRenameBtn;
}
}
\ No newline at end of file
diff --git a/src/RocketBotGUI/NicknamePokemonForm.cs b/src/RocketBotGUI/NicknamePokemonForm.cs
index b549819..170480f 100644
--- a/src/RocketBotGUI/NicknamePokemonForm.cs
+++ b/src/RocketBotGUI/NicknamePokemonForm.cs
@@ -25,6 +25,17 @@ namespace PokemonGo.RocketAPI.Window
DialogResult = DialogResult.OK;
Close();
}
+ if (e.KeyCode == Keys.Escape)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+ }
+
+ private void closeRenameBtn_Click(object sender, System.EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
}
}
}
\ No newline at end of file
You may download the files in Public Git.