public static async Task Execute(ISession session) { var trainerLevel = 40; var highestsPokemonCp = await session.Inventory.GetHighestsCp(session.LogicSettings.AmountOfPokemonToDisplayOnStart); var pokemonPairedWithStatsCp = highestsPokemonCp?.Select(pokemon => new PokemonAnalysis(pokemon, trainerLevel)).ToList(); var highestsPokemonPerfect = await session.Inventory.GetHighestsPerfect(session.LogicSettings.AmountOfPokemonToDisplayOnStart); var pokemonPairedWithStatsIv = highestsPokemonPerfect?.Select(pokemon => new PokemonAnalysis(pokemon, trainerLevel)).ToList(); session.EventDispatcher.Send( new DisplayHighestsPokemonEvent { SortedBy = "CP", PokemonList = pokemonPairedWithStatsCp, DisplayPokemonMaxPoweredCp = session.LogicSettings.DisplayPokemonMaxPoweredCp, DisplayPokemonMovesetRank = session.LogicSettings.DisplayPokemonMovesetRank }); await Task.Delay(session.LogicSettings.DelayDisplayPokemon); session.EventDispatcher.Send( new DisplayHighestsPokemonEvent { SortedBy = "IV", PokemonList = pokemonPairedWithStatsIv, DisplayPokemonMaxPoweredCp = session.LogicSettings.DisplayPokemonMaxPoweredCp, DisplayPokemonMovesetRank = session.LogicSettings.DisplayPokemonMovesetRank }); var allPokemonInBag = session.LogicSettings.PrioritizeIvOverCp ? await session.Inventory.GetHighestsPerfect(1000) : await session.Inventory.GetHighestsCp(1000); if (session.LogicSettings.DumpPokemonStats) { const string dumpFileName = "PokeBagStats"; var toDumpCsv = "Name,Level,CP,IV,Move1,Move2\r\n"; var toDumpTxt = ""; Dumper.ClearDumpFile(session, dumpFileName); Dumper.ClearDumpFile(session, dumpFileName, "csv"); if (allPokemonInBag != null) { foreach (var pokemon in allPokemonInBag) { toDumpTxt += $"NAME: {session.Translation.GetPokemonName(pokemon.PokemonId).PadRight(16, ' ')}Lvl: {PokemonInfo.GetLevel(pokemon).ToString("00")}\t\tCP: {pokemon.Cp.ToString().PadRight(8, ' ')}\t\t IV: {pokemon.CalculatePokemonPerfection().ToString("0.00")}%\t\t\tMOVE1: {pokemon.Move1}\t\t\tMOVE2: {pokemon.Move2}\r\n"; toDumpCsv += $"{session.Translation.GetPokemonName(pokemon.PokemonId)},{PokemonInfo.GetLevel(pokemon).ToString("00")},{pokemon.Cp},{pokemon.CalculatePokemonPerfection().ToString("0.00")}%,{pokemon.Move1},{pokemon.Move2}\r\n"; } } Dumper.Dump(session, toDumpTxt, dumpFileName); Dumper.Dump(session, toDumpCsv, dumpFileName, "csv"); } await Task.Delay(session.LogicSettings.DelayDisplayPokemon); }
public static async Task Execute(ISession session) { var highestsPokemonCp = await session.Inventory.GetHighestsCp(session.LogicSettings.AmountOfPokemonToDisplayOnStart); var pokemonPairedWithStatsCp = highestsPokemonCp.Select(pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon))).ToList(); var highestsPokemonPerfect = await session.Inventory.GetHighestsPerfect(session.LogicSettings.AmountOfPokemonToDisplayOnStart); var pokemonPairedWithStatsIv = highestsPokemonPerfect.Select(pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon))).ToList(); session.EventDispatcher.Send( new DisplayHighestsPokemonEvent { SortedBy = "CP", PokemonList = pokemonPairedWithStatsCp }); await Task.Delay(500); session.EventDispatcher.Send( new DisplayHighestsPokemonEvent { SortedBy = "IV", PokemonList = pokemonPairedWithStatsIv }); var allPokemonInBag = session.LogicSettings.PrioritizeIvOverCp ? await session.Inventory.GetHighestsPerfect(1000) : await session.Inventory.GetHighestsCp(1000); if (session.LogicSettings.DumpPokemonStats) { const string dumpFileName = "PokeBagStats"; Dumper.ClearDumpFile(session, dumpFileName); foreach (var pokemon in allPokemonInBag) { Dumper.Dump(session, $"NAME: {pokemon.PokemonId.ToString().PadRight(16, ' ')}Lvl: { PokemonInfo.GetLevel(pokemon).ToString("00")}\t\tCP: { pokemon.Cp.ToString().PadRight(8, ' ')}\t\t IV: { PokemonInfo.CalculatePokemonPerfection(pokemon).ToString("0.00")}%", dumpFileName); } } await Task.Delay(500); }
public static async Task Execute(ISession session) { var highestsPokemonCp = await session.Inventory.GetHighestsCp(session.LogicSettings.AmountOfPokemonToDisplayOnStart); var highestsPokemonCpForUpgrade = await session.Inventory.GetHighestsCp(50); var highestsPokemonIvForUpgrade = await session.Inventory.GetHighestsPerfect(50); var pokemonPairedWithStatsCp = highestsPokemonCp.Select( pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon))).ToList(); var pokemonPairedWithStatsCpForUpgrade = highestsPokemonCpForUpgrade.Select( pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon))).ToList(); var highestsPokemonPerfect = await session.Inventory.GetHighestsPerfect(session.LogicSettings.AmountOfPokemonToDisplayOnStart); var pokemonPairedWithStatsIv = highestsPokemonPerfect.Select( pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon))).ToList(); var pokemonPairedWithStatsIvForUpgrade = highestsPokemonIvForUpgrade.Select( pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon))).ToList(); session.EventDispatcher.Send( new DisplayHighestsPokemonEvent { SortedBy = "CP", PokemonList = pokemonPairedWithStatsCp }); await Task.Delay(500); session.EventDispatcher.Send( new DisplayHighestsPokemonEvent { SortedBy = "IV", PokemonList = pokemonPairedWithStatsIv }); foreach (var pokemon in pokemonPairedWithStatsIvForUpgrade) { var dgdfs = pokemon.ToString(); var tokens = dgdfs.Split(new[] { "id" }, StringSplitOptions.None); var splitone = tokens[1].Split('"'); var iv = session.Inventory.GetPerfect(pokemon.Item1); if (iv >= session.LogicSettings.UpgradePokemonIvMinimum) { PokemonId.Add(ulong.Parse(splitone[2])); } } foreach (var t in pokemonPairedWithStatsCpForUpgrade) { var dgdfs = t.ToString(); var tokens = dgdfs.Split(new[] { "id" }, StringSplitOptions.None); var splitone = tokens[1].Split('"'); var tokensSplit = tokens[1].Split(new[] { "cp" }, StringSplitOptions.None); var tokenSplitAgain = tokensSplit[1].Split(' '); var tokenSplitAgain2 = tokenSplitAgain[1].Split(','); if (float.Parse(tokenSplitAgain2[0]) >= session.LogicSettings.UpgradePokemonCpMinimum) { PokemonIdcp.Add(ulong.Parse(splitone[2])); } } var allPokemonInBag = session.LogicSettings.PrioritizeIvOverCp ? await session.Inventory.GetHighestsPerfect(1000) : await session.Inventory.GetHighestsCp(1000); if (session.LogicSettings.DumpPokemonStats) { const string dumpFileName = "PokeBagStats"; Dumper.ClearDumpFile(session, dumpFileName); foreach (var pokemon in allPokemonInBag) { Dumper.Dump(session, $"NAME: {pokemon.PokemonId.ToString().PadRight(16, ' ')}Lvl: {PokemonInfo.GetLevel(pokemon).ToString("00")}\t\tCP: {pokemon.Cp.ToString().PadRight(8, ' ')}\t\t IV: {PokemonInfo.CalculatePokemonPerfection(pokemon).ToString("0.00")}%\t\t\tMOVE1: {pokemon.Move1}\t\t\tMOVE2: {pokemon.Move2}", dumpFileName); } } await Task.Delay(500); }
public static async Task Execute(ISession session) { var myPokemonFamilies = await session.Inventory.GetPokemonFamilies(); var myPokeSettings = await session.Inventory.GetPokemonSettings(); var highestsPokemonCp = await session.Inventory.GetHighestsCp(session.LogicSettings.AmountOfPokemonToDisplayOnStart); var pokemonPairedWithStatsCp = highestsPokemonCp.Select( pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon), PokemonInfo.GetCandy(pokemon, myPokemonFamilies, myPokeSettings))).ToList(); var highestsPokemonPerfect = await session.Inventory.GetHighestsPerfect(session.LogicSettings.AmountOfPokemonToDisplayOnStart); var pokemonPairedWithStatsIv = highestsPokemonPerfect.Select( pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon), PokemonInfo.GetCandy(pokemon, myPokemonFamilies, myPokeSettings))).ToList(); session.EventDispatcher.Send( new DisplayHighestsPokemonEvent { SortedBy = "CP", PokemonList = pokemonPairedWithStatsCp }); session.EventDispatcher.Send( new DisplayHighestsPokemonEvent { SortedBy = "IV", PokemonList = pokemonPairedWithStatsIv }); var allPokemonInBag = session.LogicSettings.PrioritizeIvOverCp ? await session.Inventory.GetHighestsPerfect(1000) : await session.Inventory.GetHighestsCp(1000); if (session.LogicSettings.DumpPokemonStats) { const string dumpFileName = "PokeBagStats"; try { Dumper.ClearDumpFile(session, dumpFileName); Dumper.Dump(session, "pokemonid,pokemonlevel,cp,perfection,stamina,staminamax,move1,move2,candy,ownername,origin,heightm,weightkg,individualattack,individualdefense,individualstamina,cpmultiplier,battlesattacked,battlesdefended,creationtimems,numupgrades,additionalcpmultiplier,favorite,nickname", dumpFileName); foreach (var pokemon in allPokemonInBag) { Dumper.Dump(session, $"{session.Translation.GetPokemonTranslation(pokemon.PokemonId)},{PokemonInfo.GetLevel(pokemon)},{pokemon.Cp},{PokemonInfo.CalculatePokemonPerfection(pokemon)},{pokemon.Stamina},{pokemon.StaminaMax},{pokemon.Move1},{pokemon.Move2},{PokemonInfo.GetCandy(pokemon, myPokemonFamilies, myPokeSettings)},{pokemon.OwnerName},{pokemon.Origin},{pokemon.HeightM},{pokemon.WeightKg},{pokemon.IndividualAttack},{pokemon.IndividualDefense},{pokemon.IndividualStamina},{pokemon.CpMultiplier},{pokemon.BattlesAttacked},{pokemon.BattlesDefended},{pokemon.CreationTimeMs},{pokemon.NumUpgrades},{pokemon.AdditionalCpMultiplier},{pokemon.Favorite},{pokemon.Nickname}", dumpFileName); } } catch (IOException) { session.EventDispatcher.Send(new ErrorEvent { Message = $"Could not write {dumpFileName} dump file." }); } } }
public static async Task Execute(ISession session) { var myPokemonFamilies = await session.Inventory.GetPokemonFamilies(); var myPokeSettings = await session.Inventory.GetPokemonSettings(); var highestsPokemonCp = await session.Inventory.GetHighestsCp(session.LogicSettings.AmountOfPokemonToDisplayOnStart); var pokemonPairedWithStatsCp = highestsPokemonCp.Select( pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon), PokemonInfo.GetCandy(pokemon, myPokemonFamilies, myPokeSettings))).ToList(); var highestsPokemonPerfect = await session.Inventory.GetHighestsPerfect(session.LogicSettings.AmountOfPokemonToDisplayOnStart); var pokemonPairedWithStatsIv = highestsPokemonPerfect.Select( pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon), PokemonInfo.GetCandy(pokemon, myPokemonFamilies, myPokeSettings))).ToList(); session.EventDispatcher.Send( new DisplayHighestsPokemonEvent { SortedBy = "CP", PokemonList = pokemonPairedWithStatsCp }); session.EventDispatcher.Send( new DisplayHighestsPokemonEvent { SortedBy = "IV", PokemonList = pokemonPairedWithStatsIv }); var allPokemonInBag = session.LogicSettings.PrioritizeIvOverCp ? await session.Inventory.GetHighestsPerfect(1000) : await session.Inventory.GetHighestsCp(1000); if (session.LogicSettings.DumpPokemonStats) { const string dumpFileName = "PokeBagStats"; try { Dumper.ClearDumpFile(session, dumpFileName); string[] data = { "pokemonid", "pokemonlevel", "cp", "perfection", "stamina", "staminamax", "move1", "move2", "candy", "ownername", "origin", "heightm", "weightkg", "individualattack", "individualdefense", "individualstamina", "cpmultiplier", "battlesattacked", "battlesdefended", "creationtimems", "numupgrades", "additionalcpmultiplier", "favorite", "nickname" }; Dumper.Dump(session, data, dumpFileName); // set culture to OS default CultureInfo prevCulture = Thread.CurrentThread.CurrentCulture; CultureInfo culture = CultureInfo.CurrentUICulture; Thread.CurrentThread.CurrentCulture = culture; foreach (var pokemon in allPokemonInBag) { string[] pokemonData = { session.Translation.GetPokemonTranslation(pokemon.PokemonId), PokemonInfo.GetLevel(pokemon).ToString(), pokemon.Cp.ToString(), PokemonInfo.CalculatePokemonPerfection(pokemon).ToString(), pokemon.Stamina.ToString(), pokemon.StaminaMax.ToString(), pokemon.Move1.ToString(), pokemon.Move2.ToString(), PokemonInfo.GetCandy(pokemon, myPokemonFamilies,myPokeSettings).ToString(), pokemon.OwnerName, pokemon.Origin.ToString(), pokemon.HeightM.ToString(), pokemon.WeightKg.ToString(), pokemon.IndividualAttack.ToString(), pokemon.IndividualDefense.ToString(), pokemon.IndividualStamina.ToString(), pokemon.CpMultiplier.ToString(), pokemon.BattlesAttacked.ToString(), pokemon.BattlesDefended.ToString(), pokemon.CreationTimeMs.ToString(), pokemon.NumUpgrades.ToString(), pokemon.AdditionalCpMultiplier.ToString(), pokemon.Favorite.ToString(), pokemon.Nickname }; Dumper.Dump(session, pokemonData, dumpFileName); } // restore culture Thread.CurrentThread.CurrentCulture = prevCulture; } catch (System.IO.IOException) { session.EventDispatcher.Send(new ErrorEvent { Message = $"Could not write {dumpFileName} dump file." }); } } }
public static async Task Execute(ISession session) { var highestsPokemonCp = await session.Inventory.GetHighestsCp(session.LogicSettings.AmountOfPokemonToDisplayOnStart).ConfigureAwait(false); var pokemonPairedWithStatsCp = highestsPokemonCp.Select( pokemon => Tuple.Create( pokemon, PokemonInfo.CalculateMaxCp(pokemon.PokemonId), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon), PokemonInfo.GetCandy(session, pokemon).Result ) ) .ToList(); var highestsPokemonPerfect = await session.Inventory.GetHighestsPerfect(session.LogicSettings.AmountOfPokemonToDisplayOnStart).ConfigureAwait(false); var pokemonPairedWithStatsIv = highestsPokemonPerfect.Select( pokemon => Tuple.Create( pokemon, PokemonInfo.CalculateMaxCp(pokemon.PokemonId), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon), PokemonInfo.GetCandy(session, pokemon).Result ) ) .ToList(); session.EventDispatcher.Send( new DisplayHighestsPokemonEvent { SortedBy = "CP", PokemonList = pokemonPairedWithStatsCp }); session.EventDispatcher.Send( new DisplayHighestsPokemonEvent { SortedBy = "IV", PokemonList = pokemonPairedWithStatsIv }); var allPokemonInBag = session.LogicSettings.PrioritizeIvOverCp ? await session.Inventory.GetHighestsPerfect(1000).ConfigureAwait(false) : await session.Inventory.GetHighestsCp(1000).ConfigureAwait(false); if (session.LogicSettings.DumpPokemonStats) { _MultiAccountManager = new MultiAccountManager(); var account = _MultiAccountManager.GetCurrentAccount(); string dumpFileName = account.Nickname; // "-PokeBagStats"; //If user dump file exists then cancel file dump if (File.Exists(Path.Combine(Path.Combine(session.LogicSettings.ProfilePath, "Dumps"), $"{dumpFileName}-NecroBot2 DumpFile.csv"))) { return; } try { Dumper.ClearDumpFile(session, dumpFileName); string[] data = { "Pokemon", "Candies", "Slashed", "Nickname", "Level", "CP", "IV", "Power Ups", "Favorite", "Stamina", "Stamina Max", "Move1", "Move2", "Owner Name", "Origin", "Height(M)", "Weight(KG)", "Attack", "Defense", "Stamina", "CP Multi", "Gyms Attacked", "Gyms Defended", "Creationtimems", "Add CP Multi" }; Dumper.Dump(session, data, dumpFileName); // set culture to OS default CultureInfo prevCulture = Thread.CurrentThread.CurrentCulture; CultureInfo culture = CultureInfo.CurrentUICulture; Thread.CurrentThread.CurrentCulture = culture; foreach (var pokemon in allPokemonInBag) { string[] pokemonData = { session.Translation.GetPokemonTranslation(pokemon.PokemonId).Replace(' ', '_'), session.Inventory.GetCandyCount(pokemon.PokemonId).ToString(), // PokemonInfo.GetCandy(session, pokemon.PokemonId).ToString(), pokemon.IsBad.ToString(), pokemon.Nickname.Replace(' ', '_'), PokemonInfo.GetLevel(pokemon).ToString(), pokemon.Cp.ToString(), PokemonInfo.CalculatePokemonPerfection(pokemon).ToString(), pokemon.NumUpgrades.ToString(), pokemon.Favorite.ToString(), pokemon.Stamina.ToString(), pokemon.StaminaMax.ToString(), pokemon.Move1.ToString(), pokemon.Move2.ToString(), pokemon.OwnerName, pokemon.Origin.ToString(), pokemon.HeightM.ToString(), pokemon.WeightKg.ToString(), pokemon.IndividualAttack.ToString(), pokemon.IndividualDefense.ToString(), pokemon.IndividualStamina.ToString(), pokemon.CpMultiplier.ToString(), pokemon.BattlesAttacked.ToString(), pokemon.BattlesDefended.ToString(), pokemon.CreationTimeMs.ToString(), pokemon.AdditionalCpMultiplier.ToString() }; Dumper.Dump(session, pokemonData, dumpFileName); } // restore culture Thread.CurrentThread.CurrentCulture = prevCulture; } catch (IOException) { session.EventDispatcher.Send( new ErrorEvent { Message = $"Could not write {dumpFileName} dump file." } ); } } }
public static async Task Execute(ISession session) { var myPokemonFamilies = await session.Inventory.GetPokemonFamilies(); var myPokeSettings = await session.Inventory.GetPokemonSettings(); var highestsPokemonCp = await session.Inventory.GetHighestsCp(session.LogicSettings.AmountOfPokemonToDisplayOnStart); var highestsPokemonCpForUpgrade = await session.Inventory.GetHighestsCp(50); var highestsPokemonIvForUpgrade = await session.Inventory.GetHighestsPerfect(50); var pokemonPairedWithStatsCp = highestsPokemonCp.Select( pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon), PokemonInfo.GetCandy(pokemon, myPokemonFamilies, myPokeSettings))).ToList(); var pokemonPairedWithStatsCpForUpgrade = highestsPokemonCpForUpgrade.Select( pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon))).ToList(); var highestsPokemonPerfect = await session.Inventory.GetHighestsPerfect(session.LogicSettings.AmountOfPokemonToDisplayOnStart); var pokemonPairedWithStatsIv = highestsPokemonPerfect.Select( pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon), PokemonInfo.GetCandy(pokemon, myPokemonFamilies, myPokeSettings))).ToList(); var pokemonPairedWithStatsIvForUpgrade = highestsPokemonIvForUpgrade.Select( pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon))).ToList(); session.EventDispatcher.Send( new DisplayHighestsPokemonEvent { SortedBy = "CP", PokemonList = pokemonPairedWithStatsCp }); await Task.Delay(500); session.EventDispatcher.Send( new DisplayHighestsPokemonEvent { SortedBy = "IV", PokemonList = pokemonPairedWithStatsIv }); foreach (var pokemon in pokemonPairedWithStatsIvForUpgrade) { var dgdfs = pokemon.ToString(); var tokens = dgdfs.Split(new[] { "id" }, StringSplitOptions.None); var splitone = tokens[1].Split('"'); var iv = session.Inventory.GetPerfect(pokemon.Item1); if (iv >= session.LogicSettings.UpgradePokemonIvMinimum) { PokemonId.Add(ulong.Parse(splitone[2])); } } foreach (var t in pokemonPairedWithStatsCpForUpgrade) { var dgdfs = t.ToString(); var tokens = dgdfs.Split(new[] { "id" }, StringSplitOptions.None); var splitone = tokens[1].Split('"'); var tokensSplit = tokens[1].Split(new[] { "cp" }, StringSplitOptions.None); var tokenSplitAgain = tokensSplit[1].Split(' '); var tokenSplitAgain2 = tokenSplitAgain[1].Split(','); if (float.Parse(tokenSplitAgain2[0]) >= session.LogicSettings.UpgradePokemonCpMinimum) { PokemonIdcp.Add(ulong.Parse(splitone[2])); } } var allPokemonInBag = session.LogicSettings.PrioritizeIvOverCp ? await session.Inventory.GetHighestsPerfect(1000) : await session.Inventory.GetHighestsCp(1000); if (session.LogicSettings.DumpPokemonStats) { const string dumpFileName = "PokeBagStats"; Dumper.ClearDumpFile(session, dumpFileName); Dumper.Dump(session, "pokemonid,pokemonlevel,cp,perfection,stamina,staminamax,move1,move2,candy,ownername,origin,heightm,weightkg,individualattack,individualdefense,individualstamina,cpmultiplier,battlesattacked,battlesdefended,creationtimems,numupgrades,additionalcpmultiplier,favorite,nickname", dumpFileName); foreach (var pokemon in allPokemonInBag) { Dumper.Dump(session, $"{pokemon.PokemonId},{PokemonInfo.GetLevel(pokemon)},{pokemon.Cp},{PokemonInfo.CalculatePokemonPerfection(pokemon)},{pokemon.Stamina},{pokemon.StaminaMax},{pokemon.Move1},{pokemon.Move2},{PokemonInfo.GetCandy(pokemon, myPokemonFamilies, myPokeSettings)},{pokemon.OwnerName},{pokemon.Origin},{pokemon.HeightM},{pokemon.WeightKg},{pokemon.IndividualAttack},{pokemon.IndividualDefense},{pokemon.IndividualStamina},{pokemon.CpMultiplier},{pokemon.BattlesAttacked},{pokemon.BattlesDefended},{pokemon.CreationTimeMs},{pokemon.NumUpgrades},{pokemon.AdditionalCpMultiplier},{pokemon.Favorite},{pokemon.Nickname}", dumpFileName); } } await Task.Delay(500); }
public static async Task Execute(ISession session) { var highestsPokemonCp = await session.Inventory.GetHighestsCp(session.LogicSettings.AmountOfPokemonToDisplayOnStart); var highestsPokemonCpForUpgrade = await session.Inventory.GetHighestsCp(50); var highestsPokemonIvForUpgrade = await session.Inventory.GetHighestsPerfect(50); var pokemonPairedWithStatsCp = highestsPokemonCp.Select( pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon), (PokemonMoveInfo.GetPokemonMoveSet(PokemonMoveInfo.GetMoveSetCombinationIndex(pokemon.PokemonId, PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon))) != null ? PokemonMoveInfo.GetPokemonMoveSet(PokemonMoveInfo.GetMoveSetCombinationIndex(pokemon.PokemonId, PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon))).GetRankVsType("Average") : 0) )).ToList(); var pokemonPairedWithStatsCpForUpgrade = highestsPokemonCpForUpgrade.Select( pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon), (PokemonMoveInfo.GetPokemonMoveSet(PokemonMoveInfo.GetMoveSetCombinationIndex(pokemon.PokemonId, PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon))) != null ? PokemonMoveInfo.GetPokemonMoveSet(PokemonMoveInfo.GetMoveSetCombinationIndex(pokemon.PokemonId, PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon))).GetRankVsType("Average") : 0) )).ToList(); var highestsPokemonPerfect = await session.Inventory.GetHighestsPerfect(session.LogicSettings.AmountOfPokemonToDisplayOnStart); var pokemonPairedWithStatsIv = highestsPokemonPerfect.Select( pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon), (PokemonMoveInfo.GetPokemonMoveSet(PokemonMoveInfo.GetMoveSetCombinationIndex(pokemon.PokemonId, PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon))) != null ? PokemonMoveInfo.GetPokemonMoveSet(PokemonMoveInfo.GetMoveSetCombinationIndex(pokemon.PokemonId, PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon))).GetRankVsType("Average") : 0) )).ToList(); var pokemonPairedWithStatsIvForUpgrade = highestsPokemonIvForUpgrade.Select( pokemon => Tuple.Create(pokemon, PokemonInfo.CalculateMaxCp(pokemon), PokemonInfo.CalculatePokemonPerfection(pokemon), PokemonInfo.GetLevel(pokemon), PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon), (PokemonMoveInfo.GetPokemonMoveSet(PokemonMoveInfo.GetMoveSetCombinationIndex(pokemon.PokemonId, PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon))) != null ? PokemonMoveInfo.GetPokemonMoveSet(PokemonMoveInfo.GetMoveSetCombinationIndex(pokemon.PokemonId, PokemonInfo.GetPokemonMove1(pokemon), PokemonInfo.GetPokemonMove2(pokemon))).GetRankVsType("Average") : 0) )).ToList(); session.EventDispatcher.Send( new DisplayHighestsPokemonEvent { SortedBy = "CP", PokemonList = pokemonPairedWithStatsCp }); if (session.LogicSettings.Teleport) { await Task.Delay(session.LogicSettings.DelayDisplayPokemon); } else { await Task.Delay(500); } session.EventDispatcher.Send( new DisplayHighestsPokemonEvent { SortedBy = "IV", PokemonList = pokemonPairedWithStatsIv }); var allPokemonInBag = session.LogicSettings.PrioritizeIvOverCp ? await session.Inventory.GetHighestsPerfect(1000) : await session.Inventory.GetHighestsCp(1000); if (session.LogicSettings.DumpPokemonStats) { const string dumpFileName = "PokeBagStats"; string toDumpCSV = "Name,Level,CP,IV,Move1,Move2\r\n"; string toDumpTXT = ""; Dumper.ClearDumpFile(session, dumpFileName); Dumper.ClearDumpFile(session, dumpFileName, "csv"); foreach (var pokemon in allPokemonInBag) { toDumpTXT += $"NAME: {session.Translation.GetPokemonName(pokemon.PokemonId).PadRight(16, ' ')}Lvl: {PokemonInfo.GetLevel(pokemon).ToString("00")}\t\tCP: {pokemon.Cp.ToString().PadRight(8, ' ')}\t\t IV: {PokemonInfo.CalculatePokemonPerfection(pokemon).ToString("0.00")}%\t\t\tMOVE1: {pokemon.Move1}\t\t\tMOVE2: {pokemon.Move2}\r\n"; toDumpCSV += $"{session.Translation.GetPokemonName(pokemon.PokemonId)},{PokemonInfo.GetLevel(pokemon).ToString("00")},{pokemon.Cp},{PokemonInfo.CalculatePokemonPerfection(pokemon).ToString("0.00")}%,{pokemon.Move1},{pokemon.Move2}\r\n"; } Dumper.Dump(session, toDumpTXT, dumpFileName); Dumper.Dump(session, toDumpCSV, dumpFileName, "csv"); } if (session.LogicSettings.Teleport) { await Task.Delay(session.LogicSettings.DelayDisplayPokemon); } else { await Task.Delay(500); } }