Example #1
0
        private async Task StatsLog(Client client)
        {
            dontspam++;
            var profile = await _client.GetCachedProfile();

            var playerStats = await _inventory.GetPlayerStats();

            var stats = playerStats.First();

            var expneeded       = stats.NextLevelXp - stats.PrevLevelXp - StringUtils.getExpDiff(stats.Level);
            var curexp          = stats.Experience - stats.PrevLevelXp - StringUtils.getExpDiff(stats.Level);
            var curexppercent   = Convert.ToDouble(curexp) / Convert.ToDouble(expneeded) * 100;
            var pokemonToEvolve = (await _inventory.GetPokemonToEvolve()).Count();

            Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "-----------------------[PLAYER STATS]-----------------------");
            Logger.ColoredConsoleWrite(ConsoleColor.Cyan, $"Level/EXP: {stats.Level} {curexp.ToString("N0")}/{expneeded.ToString("N0")} ({Math.Round(curexppercent, 2)}%)");
            Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "EXP to Level-UP: " + (stats.NextLevelXp - stats.Experience).ToString("N0"));
            Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "PokeStops visited: " + stats.PokeStopVisits.ToString("N0"));
            Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "KM walked: " + stats.KmWalked.ToString("N0"));
            Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "Pokemon: " + await _inventory.GetPokemonCount() + " + " + await _inventory.GetEggsCount() + " Eggs /" + profile.Profile.PokeStorage + " (" + pokemonToEvolve + " Evolvable)");
            Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "Items: " + await _inventory.GetInventoryCount() + "/" + profile.Profile.ItemStorage);
            Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "Stardust: " + profile.Profile.Currency.ToArray()[1].Amount.ToString("N0"));
            Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "------------------------------------------------------------");
            //if (dontspam >= 3)
            //{
            //    dontspam = 0;
            //    PokeService data = null;
            //    try
            //    {
            //        var clientx = new WebClient();
            //        clientx.Headers.Add("user-agent", "PokegoBot-Ar1i-Github");
            //        var jsonString = clientx.DownloadString("https://go.jooas.com/status");
            //        data = new JavaScriptSerializer().Deserialize<PokeService>(jsonString);
            //    }
            //    catch (Exception)
            //    {

            //    }

            //    if (data != null)
            //    {
            //        Logger.ColoredConsoleWrite(ConsoleColor.White, "");
            //        Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "PokemonGO Server Status:");
            //        if (data.go_online)
            //        {
            //            if (data.go_idle > 60)
            //            {
            //                int gohour = Convert.ToInt32(data.go_idle / 60);

            //                if (gohour > 24)
            //                {
            //                    int goday = gohour / 24;

            //                    Logger.ColoredConsoleWrite(ConsoleColor.Green, "Online since ~" + goday + " day(s).");
            //                }
            //                else
            //                {
            //                    Logger.ColoredConsoleWrite(ConsoleColor.Green, "Online since ~" + gohour + "h.");
            //                }
            //            }
            //            else
            //            {
            //                Logger.ColoredConsoleWrite(ConsoleColor.Green, "Online since ~" + data.go_idle + " min.");
            //            }

            //            Logger.ColoredConsoleWrite(ConsoleColor.Green, "Server anwsers in ~" + data.go_response + " seconds.");
            //        }
            //        else
            //        {
            //            Logger.ColoredConsoleWrite(ConsoleColor.Red, "Pokemon GO Servers: Offline.");
            //        }
            //        Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "Pokemon Trainer Club Server Status:");
            //        if (data.ptc_online)
            //        {
            //            if (data.ptc_idle > 60)
            //            {
            //                int ptchour = Convert.ToInt32(data.ptc_idle / 60);

            //                if (ptchour > 24)
            //                {
            //                    int ptcday = ptchour / 24;
            //                    Logger.ColoredConsoleWrite(ConsoleColor.Green, "Online since ~" + ptcday + " day(s).");

            //                }
            //                else
            //                {
            //                    Logger.ColoredConsoleWrite(ConsoleColor.Green, "Online since ~" + ptchour + "h.");
            //                }
            //            }
            //            else
            //            {
            //                Logger.ColoredConsoleWrite(ConsoleColor.Green, "Online since ~" + data.ptc_idle + " min.");
            //            }

            //            Logger.ColoredConsoleWrite(ConsoleColor.Green, "Server anwsers in ~" + data.ptc_response + " seconds.");
            //        }
            //        else
            //        {
            //            Logger.ColoredConsoleWrite(ConsoleColor.Red, "Pokemon Trainer Club: Offline.");
            //        }
            //    }
            //    else
            //    {
            //        Logger.ColoredConsoleWrite(ConsoleColor.Red, "Cant get Server Status from https://go.jooas.com/status");
            //    }
            //}

            System.Console.Title = profile.Profile.Username + " lvl" + stats.Level + "-(" + (stats.Experience - stats.PrevLevelXp -
                                                                                             StringUtils.getExpDiff(stats.Level)).ToString("N0") + "/" + (stats.NextLevelXp - stats.PrevLevelXp - StringUtils.getExpDiff(stats.Level)).ToString("N0") + "|" + Math.Round(curexppercent, 2) + "%)| Stardust: " + profile.Profile.Currency.ToArray()[1].Amount + "| " + _botStats.ToString();
        }