Advertisement
stirante

queryIncensePokemon

Aug 13th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. static GetIncensePokemonResponse queryIncensePokemon() throws LoginFailedException, RemoteServerException {
  2. GetIncensePokemonMessageOuterClass.GetIncensePokemonMessage msg = GetIncensePokemonMessageOuterClass.GetIncensePokemonMessage.newBuilder().setPlayerLatitude(api.getLatitude()).setPlayerLongitude(api.getLongitude()).build();
  3. ServerRequest serverRequest = new ServerRequest(RequestTypeOuterClass.RequestType.GET_INCENSE_POKEMON, msg);
  4. api.getRequestHandler().sendServerRequests(serverRequest);
  5.  
  6. GetIncensePokemonResponse response;
  7. try {
  8. response = GetIncensePokemonResponse.parseFrom(serverRequest.getData());
  9. } catch (InvalidProtocolBufferException e) {
  10. throw new RemoteServerException(e);
  11. }
  12. if (response.getResult() != GetIncensePokemonResponse.Result.INCENSE_ENCOUNTER_AVAILABLE) return null;
  13. return response;//this should return CatchablePokemon so you would have to modify API to add constructor for it etc
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement