use of POGOProtos.Networking.Responses.IncenseEncounterResponseOuterClass.IncenseEncounterResponse in project PokeGOAPI-Java by Grover-c13.
the class IncenseEncounter method encounter.
@Override
public EncounterResult encounter() throws RequestFailedException {
IncenseEncounterMessage message = IncenseEncounterMessage.newBuilder().setEncounterId(pokemon.getEncounterId()).setEncounterLocation(pokemon.getSpawnPointId()).build();
ServerRequest request = new ServerRequest(RequestType.INCENSE_ENCOUNTER, message);
ByteString responseData = api.getRequestHandler().sendServerRequests(request, true);
try {
IncenseEncounterResponse response = IncenseEncounterResponse.parseFrom(responseData);
encounterResult = EncounterResult.from(response.getResult());
activeItem = response.getActiveItem();
captureProbabilities = response.getCaptureProbability();
encounteredPokemon = response.getPokemonData();
} catch (InvalidProtocolBufferException e) {
throw new RequestFailedException(e);
}
return encounterResult;
}
Aggregations