diff --git a/.vs/Pokemon Go Rocket API/v14/.suo b/.vs/Pokemon Go Rocket API/v14/.suo
index 08885fe..8c55091 100644
Binary files a/.vs/Pokemon Go Rocket API/v14/.suo and b/.vs/Pokemon Go Rocket API/v14/.suo differ
diff --git a/Pokemon Go Rocket API.sln b/Pokemon Go Rocket API.sln
index a479e7e..7e41e44 100644
--- a/Pokemon Go Rocket API.sln
+++ b/Pokemon Go Rocket API.sln
@@ -1,12 +1,14 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
-VisualStudioVersion = 14.0.23107.0
+VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PokemonGo.RocketAPI", "PokemonGo\RocketAPI\PokemonGo.RocketAPI.csproj", "{05D2DA44-1B8E-4CF7-94ED-4D52451CD095}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PokemonGo.RocketAPI.Console", "PokemonGo\RocketAPI\Console\PokemonGo.RocketAPI.Console.csproj", "{1FEA147E-F704-497B-A538-00B053B5F672}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PokemonGo.RocketAPI.Window", "PokemonGo\RocketAPI\Window\PokemonGo.RocketAPI.Window.csproj", "{C85B9D78-9CA3-4830-84CD-6B69090B987F}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -21,6 +23,10 @@ Global
{1FEA147E-F704-497B-A538-00B053B5F672}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1FEA147E-F704-497B-A538-00B053B5F672}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1FEA147E-F704-497B-A538-00B053B5F672}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C85B9D78-9CA3-4830-84CD-6B69090B987F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C85B9D78-9CA3-4830-84CD-6B69090B987F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C85B9D78-9CA3-4830-84CD-6B69090B987F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C85B9D78-9CA3-4830-84CD-6B69090B987F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/PokemonGo/RocketAPI/Window/App.config b/PokemonGo/RocketAPI/Window/App.config
new file mode 100644
index 0000000..6b47702
--- /dev/null
+++ b/PokemonGo/RocketAPI/Window/App.config
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
+ </startup>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+ <appSettings>
+ <add key="AuthType" value="Ptc" />
+ <!--Google/Ptc-->
+ <add key="PtcUsername" value="username" />
+ <!--Username-->
+ <add key="PtcPassword" value="pw" />
+ <!--Password-->
+ <add key="GoogleRefreshToken" value="" />
+ <add key="DefaultLatitude" value="-36.842887" />
+ <!--Default Viaduct Harbour, Auckland, New Zealand-->
+ <add key="DefaultLongitude" value="174.766365" />
+ <!--Default Viaduct Harbour, Auckland, New Zealand-->
+ <add key="LevelOutput" value="levelup" />
+ <!--2 Modes: "time": Every XXX seconds and "levelup" every levelup-->
+ <add key="LevelTimeInterval" value="1" />
+ <!--Pick 1 if levelup and time in seconds if "time"-->
+ <add key="Recycler" value="true" />
+ <!--Recycler master switch-->
+ <add key="RecycleItemsInterval" value="60" />
+ <!--Recycle Interval in seconds-->
+ <add key="Language" value="english" />
+ <!--Languages english/german-->
+ <add key="RazzBerryMode" value="probability" />
+ <!--When to use RazzBerry cp/probability-->
+ <add key="RazzBerrySetting" value="0.4" />
+ <!--Cp Mode: Use RazzBerry when Pokemon is over this value; pobability Mode: Use Razzberry when % between 0 and 1 of catching is under this value-->
+ <add key="TransferType" value="duplicate" />
+ <!--none/cp/leaveStrongest/duplicate/all Whitelists/blackslists for each type is in Program.cs-->
+ <add key="TransferCPThreshold" value="0" />
+ <!--transfer pokemon with CP less than this value if cp transfer type is selected. Whitelist in Program.cs-->
+ <add key="EvolveAllGivenPokemons" value="false" />
+ <add key="ClientSettingsProvider.ServiceUri" value="" />
+ </appSettings>
+</configuration>
\ No newline at end of file
diff --git a/PokemonGo/RocketAPI/Window/MainForm.Designer.cs b/PokemonGo/RocketAPI/Window/MainForm.Designer.cs
new file mode 100644
index 0000000..0842a56
--- /dev/null
+++ b/PokemonGo/RocketAPI/Window/MainForm.Designer.cs
@@ -0,0 +1,100 @@
+namespace PokemonGo.RocketAPI.Window
+{
+ partial class MainForm
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.logTextBox = new System.Windows.Forms.RichTextBox();
+ this.statusStrip1 = new System.Windows.Forms.StatusStrip();
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.todoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuStrip1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // logTextBox
+ //
+ this.logTextBox.BackColor = System.Drawing.Color.Black;
+ this.logTextBox.ForeColor = System.Drawing.Color.White;
+ this.logTextBox.Location = new System.Drawing.Point(12, 27);
+ this.logTextBox.Name = "logTextBox";
+ this.logTextBox.Size = new System.Drawing.Size(659, 225);
+ this.logTextBox.TabIndex = 0;
+ this.logTextBox.Text = "";
+ this.logTextBox.TextChanged += new System.EventHandler(this.logTextBox_TextChanged);
+ //
+ // statusStrip1
+ //
+ this.statusStrip1.Location = new System.Drawing.Point(0, 255);
+ this.statusStrip1.Name = "statusStrip1";
+ this.statusStrip1.Size = new System.Drawing.Size(683, 22);
+ this.statusStrip1.TabIndex = 1;
+ this.statusStrip1.Text = "statusStrip1";
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.todoToolStripMenuItem});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(683, 24);
+ this.menuStrip1.TabIndex = 2;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // todoToolStripMenuItem
+ //
+ this.todoToolStripMenuItem.Name = "todoToolStripMenuItem";
+ this.todoToolStripMenuItem.Size = new System.Drawing.Size(46, 20);
+ this.todoToolStripMenuItem.Text = "Todo";
+ //
+ // MainForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(683, 277);
+ this.Controls.Add(this.statusStrip1);
+ this.Controls.Add(this.menuStrip1);
+ this.Controls.Add(this.logTextBox);
+ this.MainMenuStrip = this.menuStrip1;
+ this.Name = "MainForm";
+ this.Text = "PokemonGo Rocket API";
+ this.Load += new System.EventHandler(this.MainForm_Load);
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.RichTextBox logTextBox;
+ private System.Windows.Forms.StatusStrip statusStrip1;
+ private System.Windows.Forms.MenuStrip menuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem todoToolStripMenuItem;
+ }
+}
+
diff --git a/PokemonGo/RocketAPI/Window/MainForm.cs b/PokemonGo/RocketAPI/Window/MainForm.cs
new file mode 100644
index 0000000..505b9e5
--- /dev/null
+++ b/PokemonGo/RocketAPI/Window/MainForm.cs
@@ -0,0 +1,744 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Reflection;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using System.Xml;
+using AllEnum;
+using PokemonGo.RocketAPI.Enums;
+using PokemonGo.RocketAPI.Exceptions;
+using PokemonGo.RocketAPI.Extensions;
+using PokemonGo.RocketAPI.GeneratedCode;
+
+namespace PokemonGo.RocketAPI.Window
+{
+ public partial class MainForm : Form
+ {
+ public MainForm()
+ {
+ InitializeComponent();
+ }
+
+ private void MainForm_Load(object sender, EventArgs e)
+ {
+ Task.Run(() =>
+ {
+ 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}");
+ }
+ });
+ }
+
+ private static ISettings ClientSettings = new Settings();
+ private static int Currentlevel = -1;
+ private static int TotalExperience = 0;
+ private static int TotalPokemon = 0;
+ private static DateTime TimeStarted = DateTime.Now;
+ public static DateTime InitSessionDateTime = DateTime.Now;
+
+ public static double GetRuntime()
+ {
+ return ((DateTime.Now - TimeStarted).TotalSeconds) / 3600;
+ }
+
+ public void CheckVersion()
+ {
+ try
+ {
+ var match =
+ new Regex(
+ @"\[assembly\: AssemblyVersion\(""(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})""\)\]")
+ .Match(DownloadServerVersion());
+
+ if (!match.Success) return;
+ var gitVersion =
+ new Version(
+ string.Format(
+ "{0}.{1}.{2}.{3}",
+ match.Groups[1],
+ match.Groups[2],
+ match.Groups[3],
+ match.Groups[4]));
+ if (gitVersion <= Assembly.GetExecutingAssembly().GetName().Version)
+ {
+ ColoredConsoleWrite(Color.Green, "Awesome! You have already got the newest version! " + Assembly.GetExecutingAssembly().GetName().Version);
+ return;
+ }
+
+ ColoredConsoleWrite(Color.Red, "There is a new Version available: " + gitVersion);
+ ColoredConsoleWrite(Color.Red, "You can find it at https://github.com/DetectiveSquirrel/Pokemon-Go-Rocket-API");
+ }
+ catch (Exception)
+ {
+ ColoredConsoleWrite(Color.Red, "Unable to check for updates now...");
+ }
+ }
+
+ private static string DownloadServerVersion()
+ {
+ using (var wC = new WebClient())
+ return
+ wC.DownloadString(
+ "https://raw.githubusercontent.com/DetectiveSquirrel/Pokemon-Go-Rocket-API/master/PokemonGo/RocketAPI/Console/Properties/AssemblyInfo.cs");
+ }
+
+ public void ColoredConsoleWrite(Color color, string text)
+ {
+ if (InvokeRequired)
+ {
+ Invoke(new Action<Color, string>(ColoredConsoleWrite), color, text);
+ return;
+ }
+ string textToAppend = DateTime.Now.ToString(CultureInfo.InvariantCulture) + " - " + text + "\r\n";
+ logTextBox.SelectionColor = color;
+ logTextBox.AppendText(textToAppend);
+ File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Logs.txt", "[" + DateTime.Now.ToString("HH:mm:ss tt") + "] " + text + "\n");
+ }
+
+ private async Task EvolveAllGivenPokemons(Client client, IEnumerable<PokemonData> pokemonToEvolve)
+ {
+ foreach (var pokemon in pokemonToEvolve)
+ {
+ /*
+ enum Holoholo.Rpc.Types.EvolvePokemonOutProto.Result {
+ UNSET = 0;
+ SUCCESS = 1;
+ FAILED_POKEMON_MISSING = 2;
+ FAILED_INSUFFICIENT_RESOURCES = 3;
+ FAILED_POKEMON_CANNOT_EVOLVE = 4;
+ FAILED_POKEMON_IS_DEPLOYED = 5;
+ }
+ }*/
+
+ var countOfEvolvedUnits = 0;
+ var xpCount = 0;
+
+ EvolvePokemonOut evolvePokemonOutProto;
+ do
+ {
+ evolvePokemonOutProto = await client.EvolvePokemon(pokemon.Id);
+ //todo: someone check whether this still works
+
+ if (evolvePokemonOutProto.Result == 1)
+ {
+ ColoredConsoleWrite(Color.Cyan,
+ $"Evolved {pokemon.PokemonId} successfully for {evolvePokemonOutProto.ExpAwarded}xp");
+
+ countOfEvolvedUnits++;
+ xpCount += evolvePokemonOutProto.ExpAwarded;
+ }
+ else
+ {
+ var result = evolvePokemonOutProto.Result;
+ /*
+ ColoredConsoleWrite(ConsoleColor.White, $"Failed to evolve {pokemon.PokemonId}. " +
+ $"EvolvePokemonOutProto.Result was {result}");
+
+ ColoredConsoleWrite(ConsoleColor.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);
+ }
+ }
+
+ private async void Execute()
+ {
+ var client = new Client(ClientSettings);
+ try
+ {
+ switch (ClientSettings.AuthType)
+ {
+ case AuthType.Ptc:
+ await client.DoPtcLogin(ClientSettings.PtcUsername, ClientSettings.PtcPassword);
+ break;
+ case AuthType.Google:
+ await client.DoGoogleLogin();
+ break;
+ }
+
+ await client.SetServer();
+ var profile = await client.GetProfile();
+ var settings = await client.GetSettings();
+ var mapObjects = await client.GetMapObjects();
+ var inventory = await client.GetInventory();
+ var pokemons =
+ inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.Pokemon)
+ .Where(p => p != null && p?.PokemonId > 0);
+
+ ConsoleLevelTitle(profile.Profile.Username, client);
+
+ // Write the players ingame details
+ ColoredConsoleWrite(Color.Yellow, "----------------------------");
+ if (ClientSettings.AuthType == AuthType.Ptc)
+ {
+ ColoredConsoleWrite(Color.Cyan, "Account: " + ClientSettings.PtcUsername);
+ ColoredConsoleWrite(Color.Cyan, "Password: " + ClientSettings.PtcPassword + "\n");
+ }
+ ColoredConsoleWrite(Color.DarkGray, "Name: " + profile.Profile.Username);
+ ColoredConsoleWrite(Color.DarkGray, "Team: " + profile.Profile.Team);
+ if (profile.Profile.Currency.ToArray()[0].Amount > 0) // If player has any pokecoins it will show how many they have.
+ ColoredConsoleWrite(Color.DarkGray, "Pokecoins: " + profile.Profile.Currency.ToArray()[0].Amount);
+ ColoredConsoleWrite(Color.DarkGray, "Stardust: " + profile.Profile.Currency.ToArray()[1].Amount + "\n");
+ ColoredConsoleWrite(Color.DarkGray, "Latitude: " + ClientSettings.DefaultLatitude);
+ ColoredConsoleWrite(Color.DarkGray, "Longitude: " + ClientSettings.DefaultLongitude);
+ try
+ {
+ ColoredConsoleWrite(Color.DarkGray, "Country: " + CallAPI("country", ClientSettings.DefaultLatitude, ClientSettings.DefaultLongitude));
+ ColoredConsoleWrite(Color.DarkGray, "Place: " + CallAPI("place", ClientSettings.DefaultLatitude, ClientSettings.DefaultLongitude));
+ }
+ catch (Exception)
+ {
+ ColoredConsoleWrite(Color.DarkGray, "Unable to get Country/Place");
+ }
+
+ ColoredConsoleWrite(Color.Yellow, "----------------------------");
+
+ // I believe a switch is more efficient and easier to read.
+ switch (ClientSettings.TransferType)
+ {
+ case "leaveStrongest":
+ await TransferAllButStrongestUnwantedPokemon(client);
+ break;
+ case "all":
+ await TransferAllGivenPokemons(client, pokemons);
+ break;
+ case "duplicate":
+ await TransferDuplicatePokemon(client);
+ break;
+ case "cp":
+ await TransferAllWeakPokemon(client, ClientSettings.TransferCPThreshold);
+ break;
+ default:
+ ColoredConsoleWrite(Color.DarkGray, "Transfering pokemon disabled");
+ break;
+ }
+
+ if (ClientSettings.EvolveAllGivenPokemons)
+ await EvolveAllGivenPokemons(client, pokemons);
+ if (ClientSettings.Recycler)
+ client.RecycleItems(client);
+
+ await Task.Delay(5000);
+ PrintLevel(client);
+ await ExecuteFarmingPokestopsAndPokemons(client);
+ ColoredConsoleWrite(Color.Red, $"No nearby usefull locations found. Please wait 10 seconds.");
+ await Task.Delay(10000);
+ CheckVersion();
+ Execute();
+ }
+ catch (TaskCanceledException) { ColoredConsoleWrite(Color.Red, "Task Canceled Exception - Restarting"); Execute(); }
+ catch (UriFormatException) { ColoredConsoleWrite(Color.Red, "System URI Format Exception - Restarting"); Execute(); }
+ catch (ArgumentOutOfRangeException) { ColoredConsoleWrite(Color.Red, "ArgumentOutOfRangeException - Restarting"); Execute(); }
+ catch (ArgumentNullException) { ColoredConsoleWrite(Color.Red, "Argument Null Refference - Restarting"); Execute(); }
+ catch (NullReferenceException) { ColoredConsoleWrite(Color.Red, "Null Refference - Restarting"); Execute(); }
+ catch (Exception ex) { ColoredConsoleWrite(Color.Red, ex.ToString()); Execute(); }
+ }
+
+ private static string CallAPI(string elem, double lat, double lon)
+ {
+ using (XmlReader reader = XmlReader.Create(@"http://api.geonames.org/findNearby?lat" + lat + "&lng=" + lon + "&username=demo"))
+ {
+ while (reader.Read())
+ {
+ if (reader.IsStartElement())
+ {
+ switch (elem)
+ {
+ case "country":
+ if (reader.Name == "countryName")
+ {
+ return reader.ReadString();
+ }
+ break;
+
+ case "place":
+ if (reader.Name == "toponymName")
+ {
+ return reader.ReadString();
+ }
+ break;
+ default:
+ return "N/A";
+ break;
+ }
+ }
+ }
+ }
+ return "Error";
+ }
+
+ private async Task ExecuteCatchAllNearbyPokemons(Client client)
+ {
+ var mapObjects = await client.GetMapObjects();
+
+ var pokemons = mapObjects.MapCells.SelectMany(i => i.CatchablePokemons);
+
+ var inventory2 = await client.GetInventory();
+ var pokemons2 = inventory2.InventoryDelta.InventoryItems
+ .Select(i => i.InventoryItemData?.Pokemon)
+ .Where(p => p != null && p?.PokemonId > 0)
+ .ToArray();
+
+ foreach (var pokemon in pokemons)
+ {
+ var update = await client.UpdatePlayerLocation(pokemon.Latitude, pokemon.Longitude);
+ var encounterPokemonResponse = await client.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnpointId);
+ var pokemonCP = encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp;
+ CatchPokemonResponse caughtPokemonResponse;
+ do
+ {
+ if (ClientSettings.RazzBerryMode == "cp")
+ if (pokemonCP > ClientSettings.RazzBerrySetting)
+ await client.UseRazzBerry(client, pokemon.EncounterId, pokemon.SpawnpointId);
+ if (ClientSettings.RazzBerryMode == "probability")
+ if (encounterPokemonResponse.CaptureProbability.CaptureProbability_.First() < ClientSettings.RazzBerrySetting)
+ await client.UseRazzBerry(client, pokemon.EncounterId, pokemon.SpawnpointId);
+ caughtPokemonResponse = await client.CatchPokemon(pokemon.EncounterId, pokemon.SpawnpointId, pokemon.Latitude, pokemon.Longitude, MiscEnums.Item.ITEM_POKE_BALL, pokemonCP); ; //note: reverted from settings because this should not be part of settings but part of logic
+ } while (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchMissed || caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchEscape);
+
+ string pokemonName;
+ if (ClientSettings.Language == "german")
+ {
+ string name_english = Convert.ToString(pokemon.PokemonId);
+ var request = (HttpWebRequest)WebRequest.Create("http://boosting-service.de/pokemon/index.php?pokeName=" + name_english);
+ var response = (HttpWebResponse)request.GetResponse();
+ pokemonName = new StreamReader(response.GetResponseStream()).ReadToEnd();
+ }
+ else
+ pokemonName = Convert.ToString(pokemon.PokemonId);
+ if (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchSuccess)
+ {
+ ColoredConsoleWrite(Color.Green, $"We caught a {pokemonName} with {encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp} CP");
+ foreach (int xp in caughtPokemonResponse.Scores.Xp)
+ TotalExperience += xp;
+ TotalPokemon += 1;
+ }
+ else
+ ColoredConsoleWrite(Color.Red, $"{pokemonName} with {encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp} CP got away..");
+
+ if (ClientSettings.TransferType == "leaveStrongest")
+ await TransferAllButStrongestUnwantedPokemon(client);
+ else if (ClientSettings.TransferType == "all")
+ await TransferAllGivenPokemons(client, pokemons2);
+ else if (ClientSettings.TransferType == "duplicate")
+ await TransferDuplicatePokemon(client);
+ else if (ClientSettings.TransferType == "cp")
+ await TransferAllWeakPokemon(client, ClientSettings.TransferCPThreshold);
+
+ await Task.Delay(3000);
+ }
+ }
+
+ private async Task ExecuteFarmingPokestopsAndPokemons(Client client)
+ {
+ var mapObjects = await client.GetMapObjects();
+
+ var pokeStops = mapObjects.MapCells.SelectMany(i => i.Forts).Where(i => i.Type == FortType.Checkpoint && i.CooldownCompleteTimestampMs < DateTime.UtcNow.ToUnixTime());
+
+ foreach (var pokeStop in pokeStops)
+ {
+ var update = await client.UpdatePlayerLocation(pokeStop.Latitude, pokeStop.Longitude);
+ var fortInfo = await client.GetFort(pokeStop.Id, pokeStop.Latitude, pokeStop.Longitude);
+ var fortSearch = await client.SearchFort(pokeStop.Id, pokeStop.Latitude, pokeStop.Longitude);
+
+ StringWriter PokeStopOutput = new StringWriter();
+ PokeStopOutput.Write($"");
+ if (fortInfo.Name != string.Empty)
+ PokeStopOutput.Write("PokeStop: " + fortInfo.Name);
+ if (fortSearch.ExperienceAwarded != 0)
+ PokeStopOutput.Write($", XP: {fortSearch.ExperienceAwarded}");
+ if (fortSearch.GemsAwarded != 0)
+ PokeStopOutput.Write($", Gems: {fortSearch.GemsAwarded}");
+ if (fortSearch.PokemonDataEgg != null)
+ PokeStopOutput.Write($", Eggs: {fortSearch.PokemonDataEgg}");
+ if (GetFriendlyItemsString(fortSearch.ItemsAwarded) != string.Empty)
+ PokeStopOutput.Write($", Items: {GetFriendlyItemsString(fortSearch.ItemsAwarded)} ");
+ ColoredConsoleWrite(Color.Cyan, PokeStopOutput.ToString());
+
+ if (fortSearch.ExperienceAwarded != 0)
+ TotalExperience += (fortSearch.ExperienceAwarded);
+ await Task.Delay(15000);
+ await ExecuteCatchAllNearbyPokemons(client);
+ }
+ }
+
+ private string GetFriendlyItemsString(IEnumerable<FortSearchResponse.Types.ItemAward> items)
+ {
+ var enumerable = items as IList<FortSearchResponse.Types.ItemAward> ?? items.ToList();
+
+ if (!enumerable.Any())
+ return string.Empty;
+
+ return enumerable.GroupBy(i => i.ItemId)
+ .Select(kvp => new { ItemName = kvp.Key.ToString().Substring(4), Amount = kvp.Sum(x => x.ItemCount) })
+ .Select(y => $"{y.Amount}x {y.ItemName}")
+ .Aggregate((a, b) => $"{a}, {b}");
+ }
+
+
+ private async Task TransferAllButStrongestUnwantedPokemon(Client client)
+ {
+ //ColoredConsoleWrite(ConsoleColor.White, $"Firing up the meat grinder");
+
+ var unwantedPokemonTypes = new[]
+ {
+ PokemonId.Pidgey,
+ PokemonId.Rattata,
+ PokemonId.Weedle,
+ PokemonId.Zubat,
+ PokemonId.Caterpie,
+ PokemonId.Pidgeotto,
+ PokemonId.NidoranFemale,
+ PokemonId.Paras,
+ PokemonId.Venonat,
+ PokemonId.Psyduck,
+ PokemonId.Poliwag,
+ PokemonId.Slowpoke,
+ PokemonId.Drowzee,
+ PokemonId.Gastly,
+ PokemonId.Goldeen,
+ PokemonId.Staryu,
+ PokemonId.Magikarp,
+ PokemonId.Clefairy,
+ PokemonId.Eevee,
+ PokemonId.Tentacool,
+ PokemonId.Dratini,
+ PokemonId.Ekans,
+ PokemonId.Jynx,
+ PokemonId.Lickitung,
+ PokemonId.Spearow,
+ PokemonId.NidoranFemale,
+ PokemonId.NidoranMale
+ };
+
+ var inventory = await client.GetInventory();
+ var pokemons = inventory.InventoryDelta.InventoryItems
+ .Select(i => i.InventoryItemData?.Pokemon)
+ .Where(p => p != null && p?.PokemonId > 0)
+ .ToArray();
+
+ foreach (var unwantedPokemonType in unwantedPokemonTypes)
+ {
+ var pokemonOfDesiredType = pokemons.Where(p => p.PokemonId == unwantedPokemonType)
+ .OrderByDescending(p => p.Cp)
+ .ToList();
+
+ var unwantedPokemon =
+ pokemonOfDesiredType.Skip(1) // keep the strongest one for potential battle-evolving
+ .ToList();
+
+ //ColoredConsoleWrite(ConsoleColor.White, $"Grinding {unwantedPokemon.Count} pokemons of type {unwantedPokemonType}");
+ await TransferAllGivenPokemons(client, unwantedPokemon);
+ }
+
+ //ColoredConsoleWrite(ConsoleColor.White, $"Finished grinding all the meat");
+ }
+
+ public static float Perfect(PokemonData poke)
+ {
+ return ((float)(poke.IndividualAttack + poke.IndividualDefense + poke.IndividualStamina) / (3.0f * 15.0f)) * 100.0f;
+ }
+
+ private async Task TransferAllGivenPokemons(Client client, IEnumerable<PokemonData> unwantedPokemons, float keepPerfectPokemonLimit = 80.0f)
+ {
+ foreach (var pokemon in unwantedPokemons)
+ {
+ if (Perfect(pokemon) >= keepPerfectPokemonLimit) continue;
+ ColoredConsoleWrite(Color.White, $"Pokemon {pokemon.PokemonId} with {pokemon.Cp} CP has IV percent less than {keepPerfectPokemonLimit}%");
+
+ if (pokemon.Favorite == 0)
+ {
+ var transferPokemonResponse = await client.TransferPokemon(pokemon.Id);
+
+ /*
+ ReleasePokemonOutProto.Status {
+ UNSET = 0;
+ SUCCESS = 1;
+ POKEMON_DEPLOYED = 2;
+ FAILED = 3;
+ ERROR_POKEMON_IS_EGG = 4;
+ }*/
+ string pokemonName;
+ if (ClientSettings.Language == "german")
+ {
+ ColoredConsoleWrite(Color.DarkCyan, "german");
+ string name_english = Convert.ToString(pokemon.PokemonId);
+ var request = (HttpWebRequest)WebRequest.Create("http://boosting-service.de/pokemon/index.php?pokeName=" + name_english);
+ var response = (HttpWebResponse)request.GetResponse();
+ pokemonName = new StreamReader(response.GetResponseStream()).ReadToEnd();
+ }
+ else
+ pokemonName = Convert.ToString(pokemon.PokemonId);
+ if (transferPokemonResponse.Status == 1)
+ {
+ ColoredConsoleWrite(Color.Magenta, $"Transferred {pokemonName} with {pokemon.Cp} CP");
+ }
+ else
+ {
+ var status = transferPokemonResponse.Status;
+
+ ColoredConsoleWrite(Color.Red, $"Somehow failed to transfer {pokemonName} with {pokemon.Cp} CP. " +
+ $"ReleasePokemonOutProto.Status was {status}");
+ }
+
+ await Task.Delay(3000);
+ }
+ }
+ }
+
+ private async Task TransferDuplicatePokemon(Client client)
+ {
+
+ //ColoredConsoleWrite(ConsoleColor.White, $"Check for duplicates");
+ var inventory = await client.GetInventory();
+ var allpokemons =
+ inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.Pokemon)
+ .Where(p => p != null && p?.PokemonId > 0);
+
+ var dupes = allpokemons.OrderBy(x => x.Cp).Select((x, i) => new { index = i, value = x })
+ .GroupBy(x => x.value.PokemonId)
+ .Where(x => x.Skip(1).Any());
+
+ for (var i = 0; i < dupes.Count(); i++)
+ {
+ for (var j = 0; j < dupes.ElementAt(i).Count() - 1; j++)
+ {
+ var dubpokemon = dupes.ElementAt(i).ElementAt(j).value;
+ if (dubpokemon.Favorite == 0)
+ {
+ var transfer = await client.TransferPokemon(dubpokemon.Id);
+ string pokemonName;
+ if (ClientSettings.Language == "german")
+ {
+ string name_english = Convert.ToString(dubpokemon.PokemonId);
+ var request = (HttpWebRequest)WebRequest.Create("http://boosting-service.de/pokemon/index.php?pokeName=" + name_english);
+ var response = (HttpWebResponse)request.GetResponse();
+ pokemonName = new StreamReader(response.GetResponseStream()).ReadToEnd();
+ }
+ else
+ pokemonName = Convert.ToString(dubpokemon.PokemonId);
+ ColoredConsoleWrite(Color.DarkGreen,
+ $"Transferred {pokemonName} with {dubpokemon.Cp} CP (Highest is {dupes.ElementAt(i).Last().value.Cp})");
+
+ }
+ }
+ }
+ }
+
+ private async Task TransferAllWeakPokemon(Client client, int cpThreshold)
+ {
+ //ColoredConsoleWrite(ConsoleColor.White, $"Firing up the meat grinder");
+
+ PokemonId[] doNotTransfer = new[] //these will not be transferred even when below the CP threshold
+ { // DO NOT EMPTY THIS ARRAY
+ //PokemonId.Pidgey,
+ //PokemonId.Rattata,
+ //PokemonId.Weedle,
+ //PokemonId.Zubat,
+ //PokemonId.Caterpie,
+ //PokemonId.Pidgeotto,
+ //PokemonId.NidoranFemale,
+ //PokemonId.Paras,
+ //PokemonId.Venonat,
+ //PokemonId.Psyduck,
+ //PokemonId.Poliwag,
+ //PokemonId.Slowpoke,
+ //PokemonId.Drowzee,
+ //PokemonId.Gastly,
+ //PokemonId.Goldeen,
+ //PokemonId.Staryu,
+ PokemonId.Magikarp,
+ PokemonId.Eevee//,
+ //PokemonId.Dratini
+ };
+
+ var inventory = await client.GetInventory();
+ var pokemons = inventory.InventoryDelta.InventoryItems
+ .Select(i => i.InventoryItemData?.Pokemon)
+ .Where(p => p != null && p?.PokemonId > 0)
+ .ToArray();
+
+ //foreach (var unwantedPokemonType in unwantedPokemonTypes)
+ {
+ List<PokemonData> pokemonToDiscard;
+ if (doNotTransfer.Count() != 0)
+ pokemonToDiscard = pokemons.Where(p => !doNotTransfer.Contains(p.PokemonId) && p.Cp < cpThreshold).OrderByDescending(p => p.Cp).ToList();
+ else
+ pokemonToDiscard = pokemons.Where(p => p.Cp < cpThreshold).OrderByDescending(p => p.Cp).ToList();
+
+
+ //var unwantedPokemon = pokemonOfDesiredType.Skip(1) // keep the strongest one for potential battle-evolving
+ // .ToList();
+ ColoredConsoleWrite(Color.Gray, $"Grinding {pokemonToDiscard.Count} pokemon below {cpThreshold} CP.");
+ await TransferAllGivenPokemons(client, pokemonToDiscard);
+
+ }
+
+ ColoredConsoleWrite(Color.Gray, $"Finished grinding all the meat");
+ }
+
+ public async Task PrintLevel(Client client)
+ {
+ var inventory = await client.GetInventory();
+ var stats = inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.PlayerStats).ToArray();
+ foreach (var v in stats)
+ if (v != null)
+ {
+ int XpDiff = GetXpDiff(client, v.Level);
+ if (ClientSettings.LevelOutput == "time")
+ ColoredConsoleWrite(Color.Yellow, $"Current Level: " + v.Level + " (" + (v.Experience - XpDiff) + "/" + (v.NextLevelXp - XpDiff) + ")");
+ else if (ClientSettings.LevelOutput == "levelup")
+ if (Currentlevel != v.Level)
+ {
+ Currentlevel = v.Level;
+ ColoredConsoleWrite(Color.Magenta, $"Current Level: " + v.Level + ". XP needed for next Level: " + (v.NextLevelXp - v.Experience));
+ }
+ }
+ if (ClientSettings.LevelOutput == "levelup")
+ await Task.Delay(1000);
+ else
+ await Task.Delay(ClientSettings.LevelTimeInterval * 1000);
+ PrintLevel(client);
+ }
+
+ // Pulled from NecronomiconCoding
+ public static string _getSessionRuntimeInTimeFormat()
+ {
+ return (DateTime.Now - InitSessionDateTime).ToString(@"dd\.hh\:mm\:ss");
+ }
+
+ public static async Task ConsoleLevelTitle(string Username, Client client)
+ {
+ var inventory = await client.GetInventory();
+ var stats = inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.PlayerStats).ToArray();
+ var profile = await client.GetProfile();
+ foreach (var v in stats)
+ if (v != null)
+ {
+ int XpDiff = GetXpDiff(client, v.Level);
+ System.Console.Title = string.Format(Username + " | Level: {0:0} - ({2:0} / {3:0}) | Runtime {1} | Stardust: {4:0}", v.Level, _getSessionRuntimeInTimeFormat(), (v.Experience - v.PrevLevelXp - XpDiff), (v.NextLevelXp - v.PrevLevelXp - XpDiff), profile.Profile.Currency.ToArray()[1].Amount) + " | XP/Hour: " + Math.Round(TotalExperience / GetRuntime()) + " | Pokemon/Hour: " + Math.Round(TotalPokemon / GetRuntime());
+ }
+ await Task.Delay(1000);
+ ConsoleLevelTitle(Username, client);
+ }
+
+ public static int GetXpDiff(Client client, int Level)
+ {
+ switch (Level)
+ {
+ case 1:
+ return 0;
+ case 2:
+ return 1000;
+ case 3:
+ return 2000;
+ case 4:
+ return 3000;
+ case 5:
+ return 4000;
+ case 6:
+ return 5000;
+ case 7:
+ return 6000;
+ case 8:
+ return 7000;
+ case 9:
+ return 8000;
+ case 10:
+ return 9000;
+ case 11:
+ return 10000;
+ case 12:
+ return 10000;
+ case 13:
+ return 10000;
+ case 14:
+ return 10000;
+ case 15:
+ return 15000;
+ case 16:
+ return 20000;
+ case 17:
+ return 20000;
+ case 18:
+ return 20000;
+ case 19:
+ return 25000;
+ case 20:
+ return 25000;
+ case 21:
+ return 50000;
+ case 22:
+ return 75000;
+ case 23:
+ return 100000;
+ case 24:
+ return 125000;
+ case 25:
+ return 150000;
+ case 26:
+ return 190000;
+ case 27:
+ return 200000;
+ case 28:
+ return 250000;
+ case 29:
+ return 300000;
+ case 30:
+ return 350000;
+ case 31:
+ return 500000;
+ case 32:
+ return 500000;
+ case 33:
+ return 750000;
+ case 34:
+ return 1000000;
+ case 35:
+ return 1250000;
+ case 36:
+ return 1500000;
+ case 37:
+ return 2000000;
+ case 38:
+ return 2500000;
+ case 39:
+ return 1000000;
+ case 40:
+ return 1000000;
+ }
+ return 0;
+ }
+
+ private void logTextBox_TextChanged(object sender, EventArgs e)
+ {
+ logTextBox.SelectionStart = logTextBox.Text.Length;
+ logTextBox.ScrollToCaret();
+ }
+ }
+}
diff --git a/PokemonGo/RocketAPI/Window/MainForm.resx b/PokemonGo/RocketAPI/Window/MainForm.resx
new file mode 100644
index 0000000..6beaffa
--- /dev/null
+++ b/PokemonGo/RocketAPI/Window/MainForm.resx
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>133, 17</value>
+ </metadata>
+</root>
\ No newline at end of file
diff --git a/PokemonGo/RocketAPI/Window/PokemonGo.RocketAPI.Window.csproj b/PokemonGo/RocketAPI/Window/PokemonGo.RocketAPI.Window.csproj
new file mode 100644
index 0000000..1f7cf66
--- /dev/null
+++ b/PokemonGo/RocketAPI/Window/PokemonGo.RocketAPI.Window.csproj
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{C85B9D78-9CA3-4830-84CD-6B69090B987F}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>PokemonGo.RocketAPI.Window</RootNamespace>
+ <AssemblyName>PokemonGo.RocketAPI.Window</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Google.Protobuf">
+ <HintPath>..\..\..\packages\Google.Protobuf.3.0.0-beta3\lib\dotnet\Google.Protobuf.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Configuration" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Deployment" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="MainForm.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="MainForm.Designer.cs">
+ <DependentUpon>MainForm.cs</DependentUpon>
+ </Compile>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Settings.cs" />
+ <EmbeddedResource Include="MainForm.resx">
+ <DependentUpon>MainForm.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\PokemonGo.RocketAPI.csproj">
+ <Project>{05D2DA44-1B8E-4CF7-94ED-4D52451CD095}</Project>
+ <Name>PokemonGo.RocketAPI</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
diff --git a/PokemonGo/RocketAPI/Window/Program.cs b/PokemonGo/RocketAPI/Window/Program.cs
new file mode 100644
index 0000000..31d2a64
--- /dev/null
+++ b/PokemonGo/RocketAPI/Window/Program.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace PokemonGo.RocketAPI.Window
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new MainForm());
+ }
+ }
+}
diff --git a/PokemonGo/RocketAPI/Window/Properties/AssemblyInfo.cs b/PokemonGo/RocketAPI/Window/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..c985a5a
--- /dev/null
+++ b/PokemonGo/RocketAPI/Window/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("PokemonGo.RocketAPI.Window")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("PokemonGo.RocketAPI.Window")]
+[assembly: AssemblyCopyright("Copyright © 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("c85b9d78-9ca3-4830-84cd-6b69090b987f")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// 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.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/PokemonGo/RocketAPI/Window/Properties/Resources.Designer.cs b/PokemonGo/RocketAPI/Window/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..a7333b1
--- /dev/null
+++ b/PokemonGo/RocketAPI/Window/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace PokemonGo.RocketAPI.Window.Properties
+{
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PokemonGo.RocketAPI.Window.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/PokemonGo/RocketAPI/Window/Properties/Resources.resx b/PokemonGo/RocketAPI/Window/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/PokemonGo/RocketAPI/Window/Properties/Resources.resx
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
diff --git a/PokemonGo/RocketAPI/Window/Properties/Settings.Designer.cs b/PokemonGo/RocketAPI/Window/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..cd1bc5c
--- /dev/null
+++ b/PokemonGo/RocketAPI/Window/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace PokemonGo.RocketAPI.Window.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/PokemonGo/RocketAPI/Window/Properties/Settings.settings b/PokemonGo/RocketAPI/Window/Properties/Settings.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/PokemonGo/RocketAPI/Window/Properties/Settings.settings
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile>
diff --git a/PokemonGo/RocketAPI/Window/Settings.cs b/PokemonGo/RocketAPI/Window/Settings.cs
new file mode 100644
index 0000000..61887cc
--- /dev/null
+++ b/PokemonGo/RocketAPI/Window/Settings.cs
@@ -0,0 +1,105 @@
+#region
+
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using AllEnum;
+using PokemonGo.RocketAPI.Enums;
+
+#endregion
+
+namespace PokemonGo.RocketAPI.Window
+{
+ public class Settings : ISettings
+ {
+ /// <summary>
+ /// Don't touch. User settings are in Console/App.config
+ /// </summary>
+ public string TransferType => GetSetting() != string.Empty ? GetSetting() : "none";
+ public int TransferCPThreshold => GetSetting() != string.Empty ? int.Parse(GetSetting(), CultureInfo.InvariantCulture) : 0;
+ public bool EvolveAllGivenPokemons => GetSetting() != string.Empty ? System.Convert.ToBoolean(GetSetting(), CultureInfo.InvariantCulture) : false;
+
+
+ public AuthType AuthType => (GetSetting() != string.Empty ? GetSetting() : "Ptc") == "Ptc" ? AuthType.Ptc : AuthType.Google;
+ public string PtcUsername => GetSetting() != string.Empty ? GetSetting() : "username";
+ public string PtcPassword => GetSetting() != string.Empty ? GetSetting() : "password";
+
+ public double DefaultLatitude
+ {
+ get { return GetSetting() != string.Empty ? double.Parse(GetSetting(), CultureInfo.InvariantCulture) : 51.22640; }
+ set { SetSetting(value); }
+ }
+
+
+ public double DefaultLongitude
+ {
+ get { return GetSetting() != string.Empty ? double.Parse(GetSetting(), CultureInfo.InvariantCulture) : 6.77874; }
+ set { SetSetting(value); }
+ }
+
+
+ public string LevelOutput => GetSetting() != string.Empty ? GetSetting() : "time";
+
+ public int LevelTimeInterval => GetSetting() != string.Empty ? System.Convert.ToInt16(GetSetting()) : 600;
+
+ public bool Recycler => GetSetting() != string.Empty ? System.Convert.ToBoolean(GetSetting(), CultureInfo.InvariantCulture) : false;
+
+ ICollection<KeyValuePair<ItemId, int>> ISettings.ItemRecycleFilter
+ {
+ get
+ {
+ //Type and amount to keep
+ return new[]
+ {
+ new KeyValuePair<ItemId, int>(ItemId.ItemPokeBall, 20),
+ new KeyValuePair<ItemId, int>(ItemId.ItemGreatBall, 50),
+ new KeyValuePair<ItemId, int>(ItemId.ItemUltraBall, 100),
+ new KeyValuePair<ItemId, int>(ItemId.ItemMasterBall, 200),
+ new KeyValuePair<ItemId, int>(ItemId.ItemRazzBerry, 20),
+ new KeyValuePair<ItemId, int>(ItemId.ItemRevive, 20),
+ new KeyValuePair<ItemId, int>(ItemId.ItemPotion, 0),
+ new KeyValuePair<ItemId, int>(ItemId.ItemSuperPotion, 0),
+ new KeyValuePair<ItemId, int>(ItemId.ItemHyperPotion, 50)
+ };
+ }
+ }
+
+ public int RecycleItemsInterval => GetSetting() != string.Empty ? Convert.ToInt16(GetSetting()) : 60;
+
+ public string Language => GetSetting() != string.Empty ? GetSetting() : "english";
+
+ public string RazzBerryMode => GetSetting() != string.Empty ? GetSetting() : "cp";
+
+ public double RazzBerrySetting => GetSetting() != string.Empty ? double.Parse(GetSetting(), CultureInfo.InvariantCulture) : 500;
+
+ public string GoogleRefreshToken
+ {
+ get { return GetSetting() != string.Empty ? GetSetting() : string.Empty; }
+ set { SetSetting(value); }
+ }
+
+ private string GetSetting([CallerMemberName] string key = null)
+ {
+ return ConfigurationManager.AppSettings[key];
+ }
+
+ private void SetSetting(string value, [CallerMemberName] string key = null)
+ {
+ var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
+ if (key != null) configFile.AppSettings.Settings[key].Value = value;
+ configFile.Save();
+ }
+
+ private void SetSetting(double value, [CallerMemberName] string key = null)
+ {
+ CultureInfo customCulture = (CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
+ customCulture.NumberFormat.NumberDecimalSeparator = ".";
+ System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;
+ var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
+ if (key != null) configFile.AppSettings.Settings[key].Value = value.ToString();
+ configFile.Save();
+ }
+ }
+}
You may download the files in Public Git.