Transfer Duplicates
diff --git a/PokemonGo/RocketAPI/Client.cs b/PokemonGo/RocketAPI/Client.cs
index e8fe500..85dd31d 100644
--- a/PokemonGo/RocketAPI/Client.cs
+++ b/PokemonGo/RocketAPI/Client.cs
@@ -436,5 +436,21 @@ namespace PokemonGo.RocketAPI
var inventoryRequest = RequestBuilder.GetRequest(_unknownAuth, _currentLat, _currentLng, 30, RequestType.GET_INVENTORY);
return await _httpClient.PostProto<Request, InventoryResponse>($"https://{_apiUrl}/rpc", inventoryRequest);
}
+
+ public async Task<InventoryResponse.Types.TransferPokemonOutProto> TransferPokemon(ulong pokemonId)
+ {
+ var customRequest = new InventoryResponse.Types.TransferPokemonProto
+ {
+ PokemonId = pokemonId
+ };
+
+ var releasePokemonRequest = RequestBuilder.GetRequest(_unknownAuth, _currentLat, _currentLng, 30,
+ new Request.Types.Requests()
+ {
+ Type = (int)RequestType.RELEASE_POKEMON,
+ Message = customRequest.ToByteString()
+ });
+ return await _httpClient.PostProto<Request, InventoryResponse.Types.TransferPokemonOutProto>($"https://{_apiUrl}/rpc", releasePokemonRequest);
+ }
}
}
diff --git a/PokemonGo/RocketAPI/Console/Program.cs b/PokemonGo/RocketAPI/Console/Program.cs
index 4eecbc5..b5ecbea 100644
--- a/PokemonGo/RocketAPI/Console/Program.cs
+++ b/PokemonGo/RocketAPI/Console/Program.cs
@@ -67,6 +67,8 @@ namespace PokemonGo.RocketAPI.Console
}
}
+ private static int checkForDuplicates = -1;
+
private static async Task ExecuteCatchAllNearbyPokemons(Client client)
{
var mapObjects = await client.GetMapObjects();
@@ -86,6 +88,30 @@ namespace PokemonGo.RocketAPI.Console
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..");
+
+ checkForDuplicates++;
+ if (checkForDuplicates % 50 == 0)
+ {
+ checkForDuplicates = 0;
+ System.Console.WriteLine($"Check for duplicates");
+ var inventory = await client.GetInventory();
+ var allpokemons = inventory.Payload[0].Bag.Items.Select(i => i.Item?.Pokemon).Where(p => p != null && p?.PokemonType != InventoryResponse.Types.PokemonProto.Types.PokemonIds.PokemonUnset);
+
+ var dupes = allpokemons.OrderBy(x => x.Cp).Select((x, i) => new { index = i, value = x })
+ .GroupBy(x => x.value.PokemonType)
+ .Where(x => x.Skip(1).Any());
+
+ for (int i = 0; i < dupes.Count(); i++)
+ {
+ for (int j = 0; j < dupes.ElementAt(i).Count() - 1; j++)
+ {
+ var dubpokemon = dupes.ElementAt(i).ElementAt(j).value;
+ var transfer = await client.TransferPokemon(dubpokemon.Id);
+ System.Console.WriteLine($"Transfer {dubpokemon.PokemonType} with {dubpokemon.Cp} CP (highest has {dupes.ElementAt(i).Last().value.Cp})");
+ }
+ }
+ }
+
await Task.Delay(5000);
}
}
You may download the files in Public Git.