本文整理汇总了C#中Client.UpdatePlayerLocation方法的典型用法代码示例。如果您正苦于以下问题:C# Client.UpdatePlayerLocation方法的具体用法?C# Client.UpdatePlayerLocation怎么用?C# Client.UpdatePlayerLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client.UpdatePlayerLocation方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteCatchAllNearbyPokemons
private static async Task ExecuteCatchAllNearbyPokemons(Client client)
{
var mapObjects = await client.GetMapObjects();
var pokemons = mapObjects.Payload[0].Profile.SelectMany(i => i.MapPokemon);
foreach (var pokemon in pokemons)
{
var update = await client.UpdatePlayerLocation(pokemon.Latitude, pokemon.Longitude);
var encounterPokemonRespone = await client.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnpointId);
var caughtPokemonResponse = await client.CatchPokemon(pokemon.EncounterId, pokemon.SpawnpointId, pokemon.Latitude, pokemon.Longitude);
await Task.Delay(15000);
}
}
示例2: ExecuteFarmingPokestops
private static async Task ExecuteFarmingPokestops(Client client)
{
var mapObjects = await client.GetMapObjects();
var pokeStops = mapObjects.Payload[0].Profile.SelectMany(i => i.Fort).Where(i => i.FortType == (int)MiscEnums.FortType.CHECKPOINT && i.CooldownCompleteMs < DateTime.UtcNow.ToUnixTime());
foreach (var pokeStop in pokeStops)
{
var update = await client.UpdatePlayerLocation(pokeStop.Latitude, pokeStop.Longitude);
var fortInfo = await client.GetFort(pokeStop.FortId, pokeStop.Latitude, pokeStop.Longitude);
var fortSearch = await client.SearchFort(pokeStop.FortId, pokeStop.Latitude, pokeStop.Longitude);
var bag = fortSearch.Payload[0];
System.Console.WriteLine($"Farmed XP: {bag.XpAwarded}, Gems: { bag.GemsAwarded}, Eggs: {bag.EggPokemon} Items: {GetFriendlyItemsString(bag.Items)}");
await Task.Delay(15000);
}
}
示例3: ExecuteFarmingPokestopsAndPokemons
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);
System.Console.WriteLine($"[{DateTime.Now.ToString("HH:mm:ss")}] Farmed XP: {fortSearch.ExperienceAwarded}, Gems: { fortSearch.GemsAwarded}, Eggs: {fortSearch.PokemonDataEgg} Items: {StringUtils.GetSummedFriendlyNameOfItemAwardList(fortSearch.ItemsAwarded)}");
await Task.Delay(15000);
await ExecuteCatchAllNearbyPokemons(client);
}
}
示例4: ExecuteFarmingPokestopsAndPokemons
private static 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(ConsoleColor.Cyan, PokeStopOutput.ToString());
if (fortSearch.ExperienceAwarded != 0)
TotalExperience += (fortSearch.ExperienceAwarded);
await Task.Delay(15000);
await ExecuteCatchAllNearbyPokemons(client);
}
}
示例5: ExecuteCatchAllNearbyPokemons
private static 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;
var pokemonIV = Perfect(encounterPokemonResponse?.WildPokemon?.PokemonData);
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(ConsoleColor.Green, $"We caught a {pokemonName} with {pokemonCP} CP and {pokemonIV}% IV");
foreach (int xp in caughtPokemonResponse.Scores.Xp)
TotalExperience += xp;
TotalPokemon += 1;
}
else
ColoredConsoleWrite(ConsoleColor.Red, $"{pokemonName} with {pokemonCP} CP and {pokemonIV}% IV");
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);
else if (ClientSettings.TransferType == "iv")
await TransferAllGivenPokemons(client, pokemons2, ClientSettings.TransferIVThreshold);
await Task.Delay(3000);
}
}
示例6: ExecuteCatchAllNearbyPokemons
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)
{
if (ForceUnbanning || Stopping)
break;
FarmingPokemons = true;
await locationManager.update(pokemon.Latitude, pokemon.Longitude);
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);
await client.UpdatePlayerLocation(pokemon.Latitude, pokemon.Longitude);
UpdatePlayerLocation(pokemon.Latitude, pokemon.Longitude);
UpdateMap();
var encounterPokemonResponse = await client.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnpointId);
var pokemonCP = encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp;
var pokemonIV = Math.Round(Perfect(encounterPokemonResponse?.WildPokemon?.PokemonData));
CatchPokemonResponse caughtPokemonResponse;
ColoredConsoleWrite(Color.Green, $"Encounter a {pokemonName} with {pokemonCP} CP and {pokemonIV}% IV");
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);
if (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchSuccess)
{
Color c = Color.LimeGreen;
if (pokemonIV >= 80)
{
c = Color.Yellow;
}
ColoredConsoleWrite(c, $"We caught a {pokemonName} with {pokemonCP} CP and {pokemonIV}% IV");
foreach (int xp in caughtPokemonResponse.Scores.Xp)
TotalExperience += xp;
TotalPokemon += 1;
}
else
ColoredConsoleWrite(Color.Red, $"{pokemonName} with {pokemonCP} CP and {pokemonIV}% IV got away..");
// I believe a switch is more efficient and easier to read.
switch (ClientSettings.TransferType)
{
case "Leave Strongest":
await TransferAllButStrongestUnwantedPokemon(client);
break;
case "All":
await TransferAllGivenPokemons(client, pokemons2);
break;
case "CP Duplicate":
await TransferDuplicatePokemon(client);
break;
case "IV Duplicate":
await TransferDuplicateIVPokemon(client);
break;
case "CP/IV Duplicate":
await TransferDuplicateCPIVPokemon(client);
break;
case "CP":
await TransferAllWeakPokemon(client, ClientSettings.TransferCPThreshold);
break;
case "IV":
await TransferAllGivenPokemons(client, pokemons2, ClientSettings.TransferIVThreshold);
break;
default:
ColoredConsoleWrite(Color.DarkGray, "Transfering pokemon disabled");
break;
}
FarmingPokemons = false;
await Task.Delay(3000);
}
pokemons = null;
}
示例7: ExecuteFarmingPokestopsAndPokemons
private static 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($"[{DateTime.Now.ToString("HH:mm:ss")}] ");
if (fortInfo.Name != Empty)
PokeStopOutput.Write(Language.GetPhrases()["pokestop"].Replace("[pokestop]", fortInfo.Name));
if (fortSearch.ExperienceAwarded != 0)
PokeStopOutput.Write($", {Language.GetPhrases()["xp"].Replace("[xp]", Convert.ToString(fortSearch.ExperienceAwarded))}");
if (fortSearch.GemsAwarded != 0)
PokeStopOutput.Write($", {Language.GetPhrases()["gem"].Replace("[gem]", Convert.ToString(fortSearch.GemsAwarded))}");
if (fortSearch.PokemonDataEgg != null)
PokeStopOutput.Write($", {Language.GetPhrases()["egg"].Replace("[egg]", Convert.ToString(fortSearch.PokemonDataEgg))}");
if (GetFriendlyItemsString(fortSearch.ItemsAwarded) != Empty)
PokeStopOutput.Write($", {Language.GetPhrases()["item"].Replace("[item]", GetFriendlyItemsString(fortSearch.ItemsAwarded))}");
ColoredConsoleWrite(ConsoleColor.Cyan, PokeStopOutput.ToString());
if (fortSearch.ExperienceAwarded != 0)
_totalExperience += (fortSearch.ExperienceAwarded);
await Task.Delay(15000);
await ExecuteCatchAllNearbyPokemons(client);
}
}
示例8: ExecuteCatchAllNearbyPokemons
private static 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
{
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);
string pokemonName = Language.GetPokemons()[Convert.ToString(pokemon.PokemonId)];
if (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchSuccess)
{
ColoredConsoleWrite(ConsoleColor.Green, $"[{DateTime.Now.ToString("HH:mm:ss")}] {Language.GetPhrases()["caught_pokemon"].Replace("[pokemon]", pokemonName).Replace("[cp]", Convert.ToString(encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp))}");
TotalPokemon++;
}
else
ColoredConsoleWrite(ConsoleColor.Red, $"[{DateTime.Now.ToString("HH:mm:ss")}] {Language.GetPhrases()["pokemon_got_away"].Replace("[pokemon]", pokemonName).Replace("[cp]", Convert.ToString(encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp))}");
/*
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);
}
}
示例9: ExecuteFarmingPokestopsAndPokemons
private static async Task ExecuteFarmingPokestopsAndPokemons(Client client)
{
await Task.Delay(defaultDelay); ColoredConsoleWrite(ConsoleColor.White, $"GetMapObjects (Pokestops)");
var mapObjects = await client.GetMapObjects();
var pokeStops = mapObjects.MapCells.SelectMany(i => i.Forts).Where(i => i.Type == FortType.Checkpoint && i.CooldownCompleteTimestampMs < DateTime.UtcNow.ToUnixTime());
ColoredConsoleWrite(ConsoleColor.Red, $"[{DateTime.Now.ToString("HH:mm:ss")}] Number of Pokestop: {pokeStops.Count()}");
Location startLocation = new Location(client.getCurrentLat(), client.getCurrentLng());
IList<FortData> query = pokeStops.ToList();
while (query.Count > 10) //Ignore last 10 pokestop, usually far away
{
startLocation = new Location(client.getCurrentLat(), client.getCurrentLng());
query = query.OrderBy(pS => Spheroid.CalculateDistanceBetweenLocations(startLocation, new Location(pS.Latitude, pS.Longitude))).ToList();
var pokeStop = query.First();
query.RemoveAt(0);
Location endLocation = new Location(pokeStop.Latitude, pokeStop.Longitude);
var distanceToPokestop = Spheroid.CalculateDistanceBetweenLocations(startLocation, endLocation);
await Task.Delay(defaultDelay); ColoredConsoleWrite(ConsoleColor.White, $"UpdatePlayerLocation");
var update = await client.UpdatePlayerLocation(endLocation.latitude, endLocation.longitude);
ColoredConsoleWrite(ConsoleColor.White, $"[{DateTime.Now.ToString("HH:mm:ss")}] Moved {(int)distanceToPokestop}m, wait {25.0 * (int)distanceToPokestop}ms, Number of Pokestop in this zone: {query.Count}");
int delay = (int)(25.0 * distanceToPokestop);
if (delay < defaultDelay) delay = defaultDelay;
await Task.Delay(delay); ColoredConsoleWrite(ConsoleColor.White, $"fortInfo");
var fortInfo = await client.GetFort(pokeStop.Id, pokeStop.Latitude, pokeStop.Longitude);
await Task.Delay(defaultDelay); ColoredConsoleWrite(ConsoleColor.White, $"fortSearch");
var fortSearch = await client.SearchFort(pokeStop.Id, pokeStop.Latitude, pokeStop.Longitude);
StringWriter PokeStopOutput = new StringWriter();
PokeStopOutput.Write($"[{DateTime.Now.ToString("HH:mm:ss")}] ");
if (fortInfo.Name != string.Empty)
PokeStopOutput.Write(Language.GetPhrases()["pokestop"].Replace("[pokestop]", fortInfo.Name));
if (fortSearch.ExperienceAwarded != 0)
PokeStopOutput.Write($", {Language.GetPhrases()["xp"].Replace("[xp]", Convert.ToString(fortSearch.ExperienceAwarded))}");
if (fortSearch.GemsAwarded != 0)
PokeStopOutput.Write($", {Language.GetPhrases()["gem"].Replace("[gem]", Convert.ToString(fortSearch.GemsAwarded))}");
if (fortSearch.PokemonDataEgg != null)
PokeStopOutput.Write($", {Language.GetPhrases()["egg"].Replace("[egg]", Convert.ToString(fortSearch.PokemonDataEgg))}");
if (GetFriendlyItemsString(fortSearch.ItemsAwarded) != string.Empty)
PokeStopOutput.Write($", {Language.GetPhrases()["item"].Replace("[item]", GetFriendlyItemsString(fortSearch.ItemsAwarded))}");
ColoredConsoleWrite(ConsoleColor.Cyan, PokeStopOutput.ToString());
expDone += fortSearch.ExperienceAwarded;
ColoredConsoleWrite(ConsoleColor.Red, $"Exp/H: {expDone/GetRuntime()}");
if (fortSearch.ExperienceAwarded != 0)
TotalExperience += (fortSearch.ExperienceAwarded);
await ExecuteCatchAllNearbyPokemons(client);
}
ColoredConsoleWrite(ConsoleColor.White, $"[{DateTime.Now.ToString("HH:mm:ss")}] Finished pokestop route, reset position and restart.");
}
示例10: ExecuteCatchAllNearbyPokemons
private static async Task ExecuteCatchAllNearbyPokemons(Client client)
{
var mapObjects = await client.GetMapObjects();
var pokemons = mapObjects.Payload[0].Profile.SelectMany(i => i.MapPokemon);
foreach (var pokemon in pokemons)
{
var update = await client.UpdatePlayerLocation(pokemon.Latitude, pokemon.Longitude);
var encounterPokemonRespone = await client.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnpointId);
CatchPokemonResponse caughtPokemonResponse;
do
{
caughtPokemonResponse = await client.CatchPokemon(pokemon.EncounterId, pokemon.SpawnpointId, pokemon.Latitude, pokemon.Longitude);
}
while(caughtPokemonResponse.Payload[0].Status == 2);
System.Console.WriteLine(caughtPokemonResponse.Payload[0].Status == 1 ? $"We caught a {GetFriendlyPokemonName(pokemon.PokedexTypeId)}" : $"{GetFriendlyPokemonName(pokemon.PokedexTypeId)} got away..");
await Task.Delay(5000);
}
}
示例11: ExecuteCatchAllNearbyPokemons
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)
{
if (ForceUnbanning || Stopping)
break;
FarmingPokemons = true;
await locationManager.update(pokemon.Latitude, pokemon.Longitude);
string pokemonName;
if (ClientSettings.Language == "de")
{
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);
await client.UpdatePlayerLocation(pokemon.Latitude, pokemon.Longitude);
UpdatePlayerLocation(pokemon.Latitude, pokemon.Longitude);
UpdateMap();
var encounterPokemonResponse = await client.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnpointId);
var pokemonCP = encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp;
var pokemonIV = Math.Round(Perfect(encounterPokemonResponse?.WildPokemon?.PokemonData));
CatchPokemonResponse caughtPokemonResponse;
ColoredConsoleWrite(Color.Green, string.Format(Properties.Strings.encounter_pokemon, pokemonName, pokemonCP, pokemonIV));
do
{
if (ClientSettings.RazzBerryMode == Properties.Strings.RazzBerryMode_CP)
if (pokemonCP > ClientSettings.RazzBerrySetting)
await client.UseRazzBerry(client, pokemon.EncounterId, pokemon.SpawnpointId);
if (ClientSettings.RazzBerryMode == Properties.Strings.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);
if (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchSuccess)
{
Color c = Color.LimeGreen;
if (pokemonIV >= 80)
{
c = Color.Yellow;
}
ColoredConsoleWrite(Color.Green, string.Format(Properties.Strings.pokemon_caught, pokemonName, pokemonCP, pokemonIV));
foreach (int xp in caughtPokemonResponse.Scores.Xp)
TotalExperience += xp;
TotalPokemon += 1;
}
else
ColoredConsoleWrite(Color.Red, string.Format(Properties.Strings.pokemon_got_away, pokemonName, pokemonCP, pokemonIV));
// Need else if, because switch case handle only constant values
if(ClientSettings.TransferType == Properties.Strings.TransferType_Strongest)
await TransferAllButStrongestUnwantedPokemon(client);
else if(ClientSettings.TransferType == Properties.Strings.TransferType_All)
await TransferAllGivenPokemons(client, pokemons2);
else if(ClientSettings.TransferType == Properties.Strings.TransferType_Duplicate)
await TransferDuplicatePokemon(client);
else if (ClientSettings.TransferType == Properties.Strings.TransferType_IV_Duplicate)
await TransferDuplicateIVPokemon(client);
else if (ClientSettings.TransferType == Properties.Strings.TransferType_CP)
await TransferAllWeakPokemon(client, ClientSettings.TransferCPThreshold);
else if (ClientSettings.TransferType == Properties.Strings.TransferType_IV)
await TransferAllGivenPokemons(client, pokemons2, ClientSettings.TransferIVThreshold);
else
ColoredConsoleWrite(Color.DarkGray, Properties.Strings.transfering_disabled);
FarmingPokemons = false;
await Task.Delay(3000);
}
pokemons = null;
}
示例12: ExecuteCatchAllNearbyPokemons
private async Task ExecuteCatchAllNearbyPokemons(Client client)
{
var mapObjects = await client.GetMapObjects();
var pokemons = mapObjects.MapCells.SelectMany(i => i.CatchablePokemons);
foreach (var pokemon in pokemons)
{
var update = await client.UpdatePlayerLocation(pokemon.Latitude, pokemon.Longitude);
var encounterPokemonResponse = await client.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnpointId);
CatchPokemonResponse caughtPokemonResponse;
do
{
caughtPokemonResponse = await client.CatchPokemon(pokemon.EncounterId, pokemon.SpawnpointId, pokemon.Latitude, pokemon.Longitude, MiscEnums.Item.ITEM_POKE_BALL); //note: reverted from settings because this should not be part of settings but part of logic
}
while (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchMissed);
System.Console.WriteLine(caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchSuccess ? $"[{DateTime.Now.ToString("HH:mm:ss")}] We caught a {pokemon.PokemonId} with CP {encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp}" : $"[{DateTime.Now.ToString("HH:mm:ss")}] {pokemon.PokemonId} with CP {encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp} got away..");
await Task.Delay(5000);
}
}
示例13: ExecuteCatchAllNearbyPokemons
private async Task ExecuteCatchAllNearbyPokemons(Client client)
{
var mapObjects = await client.GetMapObjects();
var pokemons = mapObjects.MapCells.SelectMany(i => i.CatchablePokemons);
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;
var pokeball = await GetBestBall(pokemonCP);
CatchPokemonResponse caughtPokemonResponse;
do
{
if (encounterPokemonResponse?.CaptureProbability.CaptureProbability_.First() < 0.4)
{
//Throw berry is we can
await UseBerry(pokemon.EncounterId, pokemon.SpawnpointId);
}
caughtPokemonResponse = await client.CatchPokemon(pokemon.EncounterId, pokemon.SpawnpointId, pokemon.Latitude, pokemon.Longitude, pokeball);
await Task.Delay(2000);
}
while (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchMissed);
Logger.Write(caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchSuccess ? $"We caught a {pokemon.PokemonId} with CP {encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp} using a {pokeball}" : $"{pokemon.PokemonId} with CP {encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp} got away while using a {pokeball}..", LogLevel.Info);
await Task.Delay(15000);
}
}
示例14: ExecuteCatchAllNearbyPokemons
private async Task ExecuteCatchAllNearbyPokemons(Client client)
{
var mapObjects = await client.GetMapObjects();
var pokemons = mapObjects.MapCells.SelectMany(i => i.CatchablePokemons);
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;
var pokeball = await this.GetBestBall(pokemonCP);
CatchPokemonResponse caughtPokemonResponse;
do
{
var legandaryPokemonTypes = new[]
{
// Epics
PokemonId.Dragonite,
PokemonId.Snorlax,
PokemonId.Blastoise,
PokemonId.Charizard,
PokemonId.Venusaur,
PokemonId.Victreebell,
PokemonId.Rapidash,
PokemonId.Porygon,
PokemonId.Nidoqueen,
PokemonId.Nidoking,
PokemonId.Lapras,
PokemonId.Dewgong,
PokemonId.Cloyster,
PokemonId.Alakhazam,
PokemonId.Clefable,
PokemonId.Tauros,
// Legends
PokemonId.Mew,
PokemonId.Mewtwo,
PokemonId.Zapdos,
PokemonId.Ditto,
PokemonId.Moltres,
};
foreach (var wantedPokemonType in legandaryPokemonTypes)
{
if (wantedPokemonType == pokemon.PokemonId)
{
Console.WriteLine($"Found: {wantedPokemonType}");
if (MiscEnums.Item.ITEM_MASTER_BALL > 0)
{
pokeball = MiscEnums.Item.ITEM_MASTER_BALL;
Console.WriteLine("Threw master ball");
}
if (MiscEnums.Item.ITEM_GREAT_BALL > 0)
{
pokeball = MiscEnums.Item.ITEM_GREAT_BALL;
}
}
}
caughtPokemonResponse = await client.CatchPokemon(pokemon.EncounterId, pokemon.SpawnpointId, pokemon.Latitude, pokemon.Longitude, pokeball);
Console.WriteLine($"Log CP: {encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp} - {pokeball}");
}
while (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchMissed);
Console.WriteLine(caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchSuccess ? $"[{DateTime.Now.ToString("HH:mm:ss")}] We caught a {pokemon.PokemonId} with CP {encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp}" : $"[{DateTime.Now.ToString("HH:mm:ss")}] {pokemon.PokemonId} with CP {encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp} got away..");
if (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchSuccess)
{
var inventory = await _client.GetInventory();
var pokemons1 =
inventory.InventoryDelta.InventoryItems
.Select(i => i.InventoryItemData?.Pokemon)
.First(p => p != null && p?.PokemonId == pokemon.PokemonId);
await EvolveAllGivenPokemons(_client, new[] { pokemons1 });
await TransferAllButStrongestUnwantedPokemon(this._client);
}
await Task.Delay(5000);
}
}