diff --git a/PokemonGo/RocketAPI/Window/MainForm.Designer.cs b/PokemonGo/RocketAPI/Window/MainForm.Designer.cs
index a41b76d..2c3859c 100644
--- a/PokemonGo/RocketAPI/Window/MainForm.Designer.cs
+++ b/PokemonGo/RocketAPI/Window/MainForm.Designer.cs
@@ -33,7 +33,7 @@
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.statusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
- this.startBotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.startStopBotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.todoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.pokemonToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
@@ -79,7 +79,7 @@
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.startBotToolStripMenuItem,
+ this.startStopBotToolStripMenuItem,
this.mapToolStripMenuItem,
this.todoToolStripMenuItem,
this.pokemonToolStripMenuItem2,
@@ -93,10 +93,10 @@
//
// startBotToolStripMenuItem
//
- this.startBotToolStripMenuItem.Name = "startBotToolStripMenuItem";
- this.startBotToolStripMenuItem.Size = new System.Drawing.Size(64, 20);
- this.startBotToolStripMenuItem.Text = "Start Bot";
- this.startBotToolStripMenuItem.Click += new System.EventHandler(this.startBotToolStripMenuItem_Click);
+ this.startStopBotToolStripMenuItem.Name = "startStopBotToolStripMenuItem";
+ this.startStopBotToolStripMenuItem.Size = new System.Drawing.Size(64, 20);
+ this.startStopBotToolStripMenuItem.Text = "Start Bot";
+ this.startStopBotToolStripMenuItem.Click += new System.EventHandler(this.startStopBotToolStripMenuItem_Click);
//
// mapToolStripMenuItem
//
@@ -173,7 +173,7 @@
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem todoToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel statusLabel;
- private System.Windows.Forms.ToolStripMenuItem startBotToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem startStopBotToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem showAllToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem showAllToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem pokemonToolStripMenuItem2;
diff --git a/PokemonGo/RocketAPI/Window/MainForm.cs b/PokemonGo/RocketAPI/Window/MainForm.cs
index fa85042..bd50837 100644
--- a/PokemonGo/RocketAPI/Window/MainForm.cs
+++ b/PokemonGo/RocketAPI/Window/MainForm.cs
@@ -38,6 +38,7 @@ namespace PokemonGo.RocketAPI.Window
private static int Currentlevel = -1;
private static int TotalExperience = 0;
private static int TotalPokemon = 0;
+ private static bool Stopping = false;
private static bool ForceUnbanning = false;
private static bool FarmingStops = false;
private static bool FarmingPokemons = false;
@@ -110,6 +111,17 @@ namespace PokemonGo.RocketAPI.Window
}
}
+ public void ConsoleClear()
+ {
+ if (InvokeRequired)
+ {
+ Invoke(new Action(ConsoleClear));
+ return;
+ }
+
+ logTextBox.Clear();
+ }
+
public void SetStatusText(string text)
{
if (InvokeRequired)
@@ -284,10 +296,20 @@ namespace PokemonGo.RocketAPI.Window
await Task.Delay(25);
// await ForceUnban(client);
- ColoredConsoleWrite(Color.Red, $"No nearby useful locations found. Please wait 10 seconds.");
- await Task.Delay(10000);
- CheckVersion();
- Execute();
+ if (!Stopping)
+ {
+ ColoredConsoleWrite(Color.Red, $"No nearby useful locations found. Please wait 10 seconds.");
+ await Task.Delay(10000);
+ CheckVersion();
+ Execute();
+ } else
+ {
+ ConsoleClear();
+ ColoredConsoleWrite(Color.Red, $"Bot successfully stopped.");
+ startStopBotToolStripMenuItem.Text = "Start";
+ Stopping = false;
+ bot_started = false;
+ }
}
catch (TaskCanceledException) { ColoredConsoleWrite(Color.Red, "Task Canceled Exception - Restarting"); Execute(); }
catch (UriFormatException) { ColoredConsoleWrite(Color.Red, "System URI Format Exception - Restarting"); Execute(); }
@@ -342,7 +364,7 @@ namespace PokemonGo.RocketAPI.Window
foreach (var pokemon in pokemons)
{
- if (ForceUnbanning)
+ if (ForceUnbanning || Stopping)
break;
FarmingPokemons = true;
@@ -425,11 +447,11 @@ namespace PokemonGo.RocketAPI.Window
}
HashSet<FortData> pokeStopSet = new HashSet<FortData>(pokeStops);
IEnumerable<FortData> nextPokeStopList = null;
- if (!ForceUnbanning)
+ if (!ForceUnbanning && !Stopping)
ColoredConsoleWrite(Color.Cyan, $"Visiting {pokeStops.Count()} PokeStops");
foreach (var pokeStop in pokeStops)
{
- if (ForceUnbanning)
+ if (ForceUnbanning || Stopping)
break;
FarmingStops = true;
@@ -486,7 +508,7 @@ namespace PokemonGo.RocketAPI.Window
private async Task ForceUnban(Client client)
{
- if (!ForceUnbanning)
+ if (!ForceUnbanning && !Stopping)
{
ColoredConsoleWrite(Color.LightGreen, "Waiting for last farming action to be complete...");
ForceUnbanning = true;
@@ -539,7 +561,7 @@ namespace PokemonGo.RocketAPI.Window
}
else
{
- ColoredConsoleWrite(Color.Red, "A force unban attempt is in action... Please wait.");
+ ColoredConsoleWrite(Color.Red, "A action is in play... Please wait.");
}
@@ -945,26 +967,41 @@ namespace PokemonGo.RocketAPI.Window
settingsForm.Show();
}
- private void startBotToolStripMenuItem_Click(object sender, EventArgs e)
+ private static bool bot_started = false;
+ private void startStopBotToolStripMenuItem_Click(object sender, EventArgs e)
{
- startBotToolStripMenuItem.Enabled = false;
- Task.Run(() =>
+ if (!bot_started)
{
- try
+ bot_started = true;
+ startStopBotToolStripMenuItem.Text = "Stop Bot";
+ Task.Run(() =>
{
- //ColoredConsoleWrite(ConsoleColor.White, "Coded by Ferox - edited by NecronomiconCoding");
- CheckVersion();
- Execute();
- }
- catch (PtcOfflineException)
+ try
+ {
+ //ColoredConsoleWrite(ConsoleColor.White, "Coded by Ferox - edited by NecronomiconCoding");
+ CheckVersion();
+ Execute();
+ }
+ catch (PtcOfflineException)
+ {
+ ColoredConsoleWrite(Color.Red, "PTC Servers are probably down OR your credentials are wrong. Try google");
+ }
+ catch (Exception ex)
+ {
+ ColoredConsoleWrite(Color.Red, $"Unhandled exception: {ex}");
+ }
+ });
+ } else
+ {
+ if (!ForceUnbanning)
{
- ColoredConsoleWrite(Color.Red, "PTC Servers are probably down OR your credentials are wrong. Try google");
- }
- catch (Exception ex)
+ Stopping = true;
+ ColoredConsoleWrite(Color.Red, $"Stopping the bot.. Waiting for the last action to be complete.");
+ } else
{
- ColoredConsoleWrite(Color.Red, $"Unhandled exception: {ex}");
+ ColoredConsoleWrite(Color.Red, $"An action is in play, please wait until it's done.");
}
- });
+ }
}
private void showAllToolStripMenuItem3_Click(object sender, EventArgs e)
You may download the files in Public Git.