Added printing the level
Sen66 [2016-07-22 02:26:48]
Added printing the level
Printing the Level in 2 modes:
Time, every xxxx secconds
Levelup, Only on levelup (and on start)
diff --git a/PokemonGo/RocketAPI/Console/Program.cs b/PokemonGo/RocketAPI/Console/Program.cs
index aeb7e17..ecffc4b 100644
--- a/PokemonGo/RocketAPI/Console/Program.cs
+++ b/PokemonGo/RocketAPI/Console/Program.cs
@@ -1,4 +1,4 @@
-#region
+#region
using System;
using System.Collections.Generic;
@@ -26,10 +26,10 @@ namespace PokemonGo.RocketAPI.Console
internal class Program
{
private static readonly ISettings ClientSettings = new Settings();
-
+ static int Currentlevel = -1;
public static void CheckVersion()
- {
+ {
try
{
var match =
@@ -157,8 +157,6 @@ namespace PokemonGo.RocketAPI.Console
ColoredConsoleWrite(ConsoleColor.DarkGray, "Random Profile Data\n");
ColoredConsoleWrite(ConsoleColor.DarkGray, profile.ToString());
-
-
try
{
ColoredConsoleWrite(ConsoleColor.Cyan, "\nFarming Started");
@@ -177,6 +175,7 @@ namespace PokemonGo.RocketAPI.Console
await EvolveAllGivenPokemons(client, pokemons);
await Task.Delay(5000);
+ PrintLevel(client);
await ExecuteFarmingPokestopsAndPokemons(client);
ColoredConsoleWrite(ConsoleColor.Red, $"[{DateTime.Now.ToString("HH:mm:ss")}] Unexpected stop? Restarting in 20 seconds.");
await Task.Delay(20000);
@@ -460,5 +459,24 @@ namespace PokemonGo.RocketAPI.Console
ColoredConsoleWrite(ConsoleColor.Gray, $"[{DateTime.Now.ToString("HH:mm:ss")}] Finished grinding all the meat");
}
+
+ public static 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)
+ if (ClientSettings.LevelOutput == "time")
+ ColoredConsoleWrite(ConsoleColor.Yellow, $"[{DateTime.Now.ToString("HH:mm:ss")}] Current Level: " + v.Level + " (" + v.Experience + "/" + v.NextLevelXp + ")");
+ else if (ClientSettings.LevelOutput == "levelup")
+ if (Currentlevel != v.Level)
+ {
+ Currentlevel = v.Level;
+ ColoredConsoleWrite(ConsoleColor.Magenta, $"[{DateTime.Now.ToString("HH:mm:ss")}] Levelup! Current Level: " + v.Level);
+ }
+
+ await Task.Delay(ClientSettings.LevelTimeInterval * 1000);
+ PrintLevel(client);
+ }
}
}
You may download the files in Public Git.