本文整理汇总了C#中Client.GetInventory方法的典型用法代码示例。如果您正苦于以下问题:C# Client.GetInventory方法的具体用法?C# Client.GetInventory怎么用?C# Client.GetInventory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client.GetInventory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
private async void Execute()
{
var client = new Client(ClientSettings);
try
{
await client.Login();
await client.SetServer();
var inventory = await client.GetInventory();
var pokemons =
inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.Pokemon)
.Where(p => p != null && p?.PokemonId > 0).OrderByDescending(key => key.Cp);
foreach (var pokemon in pokemons)
{
ListViewItem lvi = new ListViewItem(pokemon.PokemonId.ToString());
listView1.Items.Add(lvi);
lvi.SubItems.Add(pokemon.Cp.ToString());
}
}
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(); }
}
示例2: Execute
static async void Execute()
{
var client = new Client(Settings.DefaultLatitude, Settings.DefaultLongitude);
if (Settings.UsePTC)
{
await client.LoginPtc(Settings.PtcUsername, Settings.PtcPassword);
}
else
{
await client.LoginGoogle(Settings.DeviceId, Settings.Email, Settings.LongDurationToken);
}
var serverResponse = await client.GetServer();
var profile = await client.GetProfile();
var settings = await client.GetSettings();
var mapObjects = await client.GetMapObjects();
var inventory = await client.GetInventory();
var pokemons = inventory.Payload[0].Bag.Items.Select(i => i.Item?.Pokemon).Where(p => p != null && p?.PokemonId != InventoryResponse.Types.PokemonProto.Types.PokemonIds.PokemonUnset);
ExecutePrintPokemonPowerQuotient(pokemons);
//await ExecuteFarmingPokestopsAndPokemons(client);
//await ExecuteCatchAllNearbyPokemons(client);
}
示例3: Execute
static async void Execute()
{
var client = new Client(Settings.DefaultLatitude, Settings.DefaultLongitude);
//await client.LoginPtc("FeroxRev", "Sekret");
//await client.LoginGoogle(Settings.DeviceId, Settings.Email, Settings.LongDurationToken);
await client.LoginGoogle();
var serverResponse = await client.GetServer();
var profile = await client.GetProfile();
var settings = await client.GetSettings();
var mapObjects = await client.GetMapObjects();
var inventory = await client.GetInventory();
await ExecuteFarmingPokestops(client);
await ExecuteCatchAllNearbyPokemons(client);
}
示例4: ConsoleLevelTitle
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);
}
示例5: TransferAllWeakPokemon
private static 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(ConsoleColor.Gray, $"Grinding {pokemonToDiscard.Count} pokemon below {cpThreshold} CP.");
await TransferAllGivenPokemons(client, pokemonToDiscard);
}
ColoredConsoleWrite(ConsoleColor.Gray, $"Finished grinding all the meat");
}
示例6: TransferAllButStrongestUnwantedPokemon
private static 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");
}
示例7: Execute
private static 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(ConsoleColor.Yellow, "----------------------------");
if (ClientSettings.AuthType == AuthType.Ptc)
{
ColoredConsoleWrite(ConsoleColor.Cyan, "Account: " + ClientSettings.PtcUsername);
ColoredConsoleWrite(ConsoleColor.Cyan, "Password: " + ClientSettings.PtcPassword + "\n");
}
ColoredConsoleWrite(ConsoleColor.DarkGray, "Name: " + profile.Profile.Username);
ColoredConsoleWrite(ConsoleColor.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(ConsoleColor.DarkGray, "Pokecoins: " + profile.Profile.Currency.ToArray()[0].Amount);
ColoredConsoleWrite(ConsoleColor.DarkGray, "Stardust: " + profile.Profile.Currency.ToArray()[1].Amount + "\n");
ColoredConsoleWrite(ConsoleColor.DarkGray, "Latitude: " + ClientSettings.DefaultLatitude);
ColoredConsoleWrite(ConsoleColor.DarkGray, "Longitude: " + ClientSettings.DefaultLongitude);
try
{
ColoredConsoleWrite(ConsoleColor.DarkGray, "Area: " + CallAPI("place", ClientSettings.DefaultLatitude, ClientSettings.DefaultLongitude));
ColoredConsoleWrite(ConsoleColor.DarkGray, "Country: " + CallAPI("country", ClientSettings.DefaultLatitude, ClientSettings.DefaultLongitude));
}
catch (Exception)
{
ColoredConsoleWrite(ConsoleColor.DarkGray, "Unable to get Country/Place");
}
ColoredConsoleWrite(ConsoleColor.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;
case "iv":
await TransferAllGivenPokemons(client, pokemons, ClientSettings.TransferIVThreshold);
break;
default:
ColoredConsoleWrite(ConsoleColor.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(ConsoleColor.Red, $"No nearby useful locations found. Please wait 10 seconds.");
await Task.Delay(10000);
CheckVersion();
Execute();
}
catch (TaskCanceledException) { ColoredConsoleWrite(ConsoleColor.Red, "Task Canceled Exception - Restarting"); Execute(); }
catch (UriFormatException) { ColoredConsoleWrite(ConsoleColor.Red, "System URI Format Exception - Restarting"); Execute(); }
catch (ArgumentOutOfRangeException) { ColoredConsoleWrite(ConsoleColor.Red, "ArgumentOutOfRangeException - Restarting"); Execute(); }
catch (ArgumentNullException) { ColoredConsoleWrite(ConsoleColor.Red, "Argument Null Refference - Restarting"); Execute(); }
catch (NullReferenceException) { ColoredConsoleWrite(ConsoleColor.Red, "Null Refference - Restarting"); Execute(); }
catch (Exception ex) { ColoredConsoleWrite(ConsoleColor.Red, ex.ToString()); Execute(); }
}
示例8: EvolvePokemons
private async Task EvolvePokemons(Client client)
{
var inventory = await client.GetInventory();
var pokemons =
inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.Pokemon)
.Where(p => p != null && p?.PokemonId > 0);
await EvolveAllGivenPokemons(client, pokemons);
}
示例9: TransferAllButStrongestUnwantedPokemon
private async Task TransferAllButStrongestUnwantedPokemon(Client client)
{
var unwantedPokemonTypes = new List<PokemonId>();
for (int i = 1; i <= 151; i++)
{
unwantedPokemonTypes.Add((PokemonId)i);
}
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();
await TransferAllGivenPokemons(client, unwantedPokemon);
}
}
示例10: Execute
private async void Execute()
{
EnabledButton(false);
textBox1.Text = "Reloading Pokemon list.";
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();
profile = await client.GetProfile();
inventory = await client.GetInventory();
pokemons =
inventory.InventoryDelta.InventoryItems
.Select(i => i.InventoryItemData?.Pokemon)
.Where(p => p != null && p?.PokemonId > 0)
.OrderByDescending(key => key.Cp);
var families = inventory.InventoryDelta.InventoryItems
.Select(i => i.InventoryItemData?.PokemonFamily)
.Where(p => p != null && (int)p?.FamilyId > 0)
.OrderByDescending(p => (int)p.FamilyId);
var imageSize = 50;
var imageList = new ImageList { ImageSize = new Size(imageSize, imageSize) };
listView1.ShowItemToolTips = true;
listView1.SmallImageList = imageList;
var templates = await client.GetItemTemplates();
var myPokemonSettings = templates.ItemTemplates.Select(i => i.PokemonSettings).Where(p => p != null && p?.FamilyId != PokemonFamilyId.FamilyUnset);
var pokemonSettings = myPokemonSettings.ToList();
var myPokemonFamilies = inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.PokemonFamily).Where(p => p != null && p?.FamilyId != PokemonFamilyId.FamilyUnset);
var pokemonFamilies = myPokemonFamilies.ToArray();
listView1.DoubleBuffered(true);
listView1.View = View.Details;
ColumnHeader columnheader;
columnheader = new ColumnHeader();
columnheader.Text = "Name";
listView1.Columns.Add(columnheader);
columnheader = new ColumnHeader();
columnheader.Text = "CP";
listView1.Columns.Add(columnheader);
columnheader = new ColumnHeader();
columnheader.Text = "IV A-D-S";
listView1.Columns.Add(columnheader);
columnheader = new ColumnHeader();
columnheader.Text = "Candy";
listView1.Columns.Add(columnheader);
columnheader = new ColumnHeader();
columnheader.Text = "Evolvable?";
listView1.Columns.Add(columnheader);
columnheader = new ColumnHeader();
columnheader.Text = "Height";
listView1.Columns.Add(columnheader);
columnheader = new ColumnHeader();
columnheader.Text = "Weight";
listView1.Columns.Add(columnheader);
columnheader = new ColumnHeader();
columnheader.Text = "Attack";
listView1.Columns.Add(columnheader);
columnheader = new ColumnHeader();
columnheader.Text = "SpecialAttack";
listView1.Columns.Add(columnheader);
foreach (var pokemon in pokemons)
{
Bitmap pokemonImage = null;
await Task.Run(() =>
{
pokemonImage = GetPokemonImage((int)pokemon.PokemonId);
});
imageList.Images.Add(pokemon.PokemonId.ToString(), pokemonImage);
listView1.LargeImageList = imageList;
var listViewItem = new ListViewItem();
listViewItem.Tag = pokemon;
var currentCandy = families
.Where(i => (int)i.FamilyId <= (int)pokemon.PokemonId)
.Select(f => f.Candy)
.First();
var currIv = Math.Round(Perfect(pokemon));
listViewItem.SubItems.Add(string.Format("{0}", pokemon.Cp));
listViewItem.SubItems.Add(string.Format("{0}% {1}-{2}-{3}", currIv, pokemon.IndividualAttack, pokemon.IndividualDefense, pokemon.IndividualStamina));
listViewItem.SubItems.Add(string.Format("{0}", currentCandy));
//.........这里部分代码省略.........
示例11: StatsLog
private async Task StatsLog(Client client)
{
var inventory = await client.GetInventory();
var profil = await client.GetProfile();
var stats = inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData.PlayerStats).ToArray();
foreach (var c in stats)
{
if (c != null)
{
int l = c.Level;
var expneeded = ((c.NextLevelXp - c.PrevLevelXp) - StringUtils.getExpDiff(c.Level));
var curexp = ((c.Experience - c.PrevLevelXp) - StringUtils.getExpDiff(c.Level));
var curexppercent = (Convert.ToDouble(curexp) / Convert.ToDouble(expneeded)) * 100;
var pokemonToEvolve = (await _inventory.GetPokemonToEvolve(null)).Count();
Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "_____________________________");
Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "Level: " + c.Level);
Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "EXP Needed: " + expneeded);
Logger.ColoredConsoleWrite(ConsoleColor.Cyan, $"Current EXP: {curexp} ({Math.Round(curexppercent)}%)");
Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "EXP to Level up: " + ((c.NextLevelXp) - (c.Experience)));
Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "KM Walked: " + c.KmWalked);
Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "PokeStops visited: " + c.PokeStopVisits);
Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "Stardust: " + profil.Profile.Currency.ToArray()[1].Amount);
Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "Pokemon to evolve: " + pokemonToEvolve);
Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "_____________________________");
System.Console.Title = profil.Profile.Username + " Level " + c.Level + " - (" + ((c.Experience - c.PrevLevelXp) -
StringUtils.getExpDiff(c.Level)) + " / " + ((c.NextLevelXp - c.PrevLevelXp) - StringUtils.getExpDiff(c.Level)) + " | " + Math.Round(curexppercent) + "%) | Stardust: " + profil.Profile.Currency.ToArray()[1].Amount + " | " + _botStats.ToString();
}
}
}
示例12: Execute
private async void Execute()
{
EnabledButton(false);
textBox1.Text = "Reloading Pokemon list.";
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();
profile = await client.GetProfile();
inventory = await client.GetInventory();
pokemons =
inventory.InventoryDelta.InventoryItems
.Select(i => i.InventoryItemData?.Pokemon)
.Where(p => p != null && p?.PokemonId > 0)
.OrderByDescending(key => key.Cp);
var families = inventory.InventoryDelta.InventoryItems
.Select(i => i.InventoryItemData?.PokemonFamily)
.Where(p => p != null && (int)p?.FamilyId > 0)
.OrderByDescending(p => (int)p.FamilyId);
var imageSize = 50;
var imageList = new ImageList { ImageSize = new Size(imageSize, imageSize) };
listView1.ShowItemToolTips = true;
var templates = await client.GetItemTemplates();
var myPokemonSettings = templates.ItemTemplates.Select(i => i.PokemonSettings).Where(p => p != null && p?.FamilyId != PokemonFamilyId.FamilyUnset);
var pokemonSettings = myPokemonSettings.ToList();
var myPokemonFamilies = inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.PokemonFamily).Where(p => p != null && p?.FamilyId != PokemonFamilyId.FamilyUnset);
var pokemonFamilies = myPokemonFamilies.ToArray();
listView1.DoubleBuffered(true);
foreach (var pokemon in pokemons)
{
Bitmap pokemonImage = null;
await Task.Run(() =>
{
pokemonImage = GetPokemonImage((int)pokemon.PokemonId);
});
imageList.Images.Add(pokemon.PokemonId.ToString(), pokemonImage);
listView1.LargeImageList = imageList;
var listViewItem = new ListViewItem();
listViewItem.Tag = pokemon;
var currentCandy = families
.Where(i => (int)i.FamilyId <= (int)pokemon.PokemonId)
.Select(f => f.Candy)
.First();
var currIv = Math.Round(Perfect(pokemon));
//listViewItem.SubItems.Add();
listViewItem.ImageKey = pokemon.PokemonId.ToString();
var pokemonId2 = pokemon.PokemonId;
var pokemonName = pokemon.Id;
listViewItem.Text = string.Format("{0}\n{1} CP", pokemon.PokemonId, pokemon.Cp);
listViewItem.ToolTipText = currentCandy + " Candy\n" + currIv + "% IV";
var settings = pokemonSettings.Single(x => x.PokemonId == pokemon.PokemonId);
var familyCandy = pokemonFamilies.Single(x => settings.FamilyId == x.FamilyId);
if (settings.EvolutionIds.Count > 0 && familyCandy.Candy > settings.CandyToEvolve)
listViewItem.Checked = true;
listView1.Items.Add(listViewItem);
}
Text = "Pokemon List | User: " + profile.Profile.Username + " | Pokemons: " + pokemons.Count() + "/" + profile.Profile.PokeStorage;
EnabledButton(true);
textBox1.Text = string.Empty;
}
catch (TaskCanceledException e) {
textBox1.Text = e.Message;
Execute();
}
catch (UriFormatException e) {
textBox1.Text = e.Message;
Execute();
}
catch (ArgumentOutOfRangeException e) {
textBox1.Text = e.Message;
Execute();
}
catch (ArgumentNullException e) {
textBox1.Text = e.Message;
//.........这里部分代码省略.........
示例13: TransferDuplicatePokemon
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 (language == "german")
pokemonName = LanguageSetting.GermanName[(int)dubpokemon.PokemonId - 1];
else if (language == "french")
pokemonName = LanguageSetting.frenchPokemons[(int)dubpokemon.PokemonId - 1];
else
pokemonName = Convert.ToString(dubpokemon.PokemonId);
ColoredConsoleWrite(Color.DarkGreen,
$"Transferred {pokemonName} with {dubpokemon.Cp} CP (Highest is {dupes.ElementAt(i).Last().value.Cp})");
}
}
}
}
示例14: TransferAllButStrongestUnwantedPokemon
private async Task TransferAllButStrongestUnwantedPokemon(Client client)
{
//ColoredConsoleWrite(ConsoleColor.White, $"Firing up the meat grinder");
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 TransfertAndEvolveSetting.toTransfert)
{
var pokemonOfDesiredType = pokemons.Where(p => p.PokemonId == unwantedPokemonType)
.OrderByDescending(p => p.Cp)
.ToList();
var unwantedPokemon =
pokemonOfDesiredType.Skip(1);
//ColoredConsoleWrite(ConsoleColor.White, $"Grinding {unwantedPokemon.Count} pokemons of type {unwantedPokemonType}");
await TransferAllGivenPokemons(client, unwantedPokemon);
}
//ColoredConsoleWrite(ConsoleColor.White, $"Finished grinding all the meat");
}
示例15: TransfertAllBellowIV
private async Task TransfertAllBellowIV(Client client)
{
int iv = ClientSettings.TransferIVThreshold;
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 TransfertAndEvolveSetting.toTransfert)
{
var unwantedPokemons = pokemons.Where(p => p.PokemonId == unwantedPokemonType && Perfect(p) < iv)
.OrderByDescending(p => Perfect(p)).ThenBy(p => p.Cp).ToList();
//ColoredConsoleWrite(ConsoleColor.White, $"Grinding {unwantedPokemon.Count} pokemons of type {unwantedPokemonType}");
await TransferAllGivenPokemons(client, unwantedPokemons);
}
//ColoredConsoleWrite(ConsoleColor.White, $"Finished grinding all the meat");
}