Advertisement
stirante

Untitled

Jul 24th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.71 KB | None | 0 0
  1. public class IncenseTest {
  2.  
  3.     public static PokemonGo api;
  4.  
  5.     public static UseIncenseResponseOuterClass.UseIncenseResponse useIncense(ItemIdOuterClass.ItemId type) throws RemoteServerException, LoginFailedException {
  6.         UseIncenseMessageOuterClass.UseIncenseMessage msg = UseIncenseMessageOuterClass.UseIncenseMessage.newBuilder().setIncenseType(type).build();
  7.         ServerRequest serverRequest = new ServerRequest(RequestTypeOuterClass.RequestType.USE_INCENSE, msg);
  8.         api.getRequestHandler().sendServerRequests(serverRequest);
  9.  
  10.         UseIncenseResponseOuterClass.UseIncenseResponse response;
  11.         try {
  12.             response = UseIncenseResponseOuterClass.UseIncenseResponse.parseFrom(serverRequest.getData());
  13.         } catch (InvalidProtocolBufferException e) {
  14.             throw new RemoteServerException(e);
  15.         }
  16.         return response;
  17.     }
  18.  
  19.     public static CatchablePokemon queryIncensePokemon() throws LoginFailedException, RemoteServerException {
  20.         GetIncensePokemonMessageOuterClass.GetIncensePokemonMessage msg = GetIncensePokemonMessageOuterClass.GetIncensePokemonMessage.newBuilder().setPlayerLatitude(api.getLatitude()).setPlayerLongitude(api.getLongitude()).build();
  21.         ServerRequest serverRequest = new ServerRequest(RequestTypeOuterClass.RequestType.GET_INCENSE_POKEMON, msg);
  22.         api.getRequestHandler().sendServerRequests(serverRequest);
  23.  
  24.         GetIncensePokemonResponse response;
  25.         try {
  26.             response = GetIncensePokemonResponse.parseFrom(serverRequest.getData());
  27.         } catch (InvalidProtocolBufferException e) {
  28.             throw new RemoteServerException(e);
  29.         }
  30.         return new CatchablePokemon(api, response);
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement