use of POGOProtos.Networking.Responses.EvolvePokemonResponseOuterClass.EvolvePokemonResponse in project PokeGOAPI-Java by Grover-c13.
the class Pokemon method evolve.
/**
* Evolves pokemon with evolution item
*
* @param evolutionItem the evolution item to evolve with
* @return the evolution result
* @throws RequestFailedException if an exception occurred while sending requests
*/
public EvolutionResult evolve(ItemId evolutionItem) throws RequestFailedException {
EvolvePokemonMessage.Builder messageBuilder = EvolvePokemonMessage.newBuilder().setPokemonId(getId());
if (evolutionItem != null) {
messageBuilder.setEvolutionItemRequirement(evolutionItem);
}
ServerRequest serverRequest = new ServerRequest(RequestType.EVOLVE_POKEMON, messageBuilder.build());
api.requestHandler.sendServerRequests(serverRequest, true);
EvolvePokemonResponse response;
try {
response = EvolvePokemonResponse.parseFrom(serverRequest.getData());
} catch (InvalidProtocolBufferException e) {
return null;
}
return new EvolutionResult(api, response);
}
Aggregations