use of POGOProtos.Networking.Requests.Messages.DiskEncounterMessageOuterClass.DiskEncounterMessage in project PokeGOAPI-Java by Grover-c13.
the class DiskEncounter method encounter.
@Override
public EncounterResult encounter() throws RequestFailedException {
DiskEncounterMessage message = DiskEncounterMessage.newBuilder().setEncounterId(pokemon.encounterId).setFortId(pokemon.spawnPointId).setPlayerLatitude(api.latitude).setPlayerLongitude(api.longitude).build();
ServerRequest request = new ServerRequest(RequestType.DISK_ENCOUNTER, message);
ByteString responseData = api.requestHandler.sendServerRequests(request, true);
try {
DiskEncounterResponse response = DiskEncounterResponse.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