44import POGOProtos .Map .Fort .FortTypeOuterClass ;
55import POGOProtos .Map .MapCellOuterClass ;
66import POGOProtos .Map .Pokemon .MapPokemonOuterClass ;
7+ import POGOProtos .Map .Pokemon .WildPokemonOuterClass ;
78import POGOProtos .Networking .Requests .Messages .*;
89import POGOProtos .Networking .Requests .RequestTypeOuterClass ;
910import POGOProtos .Networking .Responses .*;
@@ -46,7 +47,7 @@ public Map(PokemonGo api) {
4647 */
4748 private MapObjects getRetainedMapObject () throws LoginFailedException , RemoteServerException {
4849 // get new MapObjects or used existing one
49- if (api .getLatitude () != lastLat && api .getLongitude () != lastLong || (System .currentTimeMillis ()- lastMapUpdate ) > NEW_MAP_OBJECTS_EXPIRY ) {
50+ if (api .getLatitude () != lastLat && api .getLongitude () != lastLong || (System .currentTimeMillis () - lastMapUpdate ) > NEW_MAP_OBJECTS_EXPIRY ) {
5051 getMapObjects (); // should update the lastMapObjects variable
5152 }
5253
@@ -59,11 +60,14 @@ private MapObjects getRetainedMapObject() throws LoginFailedException, RemoteSer
5960 * @return List<CatchablePokemon> at your current location
6061 */
6162 public List <CatchablePokemon > getCatchablePokemon () throws LoginFailedException , RemoteServerException {
62- List <CatchablePokemon > catchablePokemons = new ArrayList <CatchablePokemon >();
63- MapObjects objects = getRetainedMapObject ();
63+ List <CatchablePokemon > catchablePokemons = new ArrayList <>();
64+ MapObjects objects = getRetainedMapObject ();
6465
65- for (MapPokemonOuterClass .MapPokemon mapPokemon : objects .getCatchablePokemons () ) {
66- catchablePokemons .add (new CatchablePokemon (mapPokemon , this ));
66+ for (MapPokemonOuterClass .MapPokemon mapPokemon : objects .getCatchablePokemons ()) {
67+ catchablePokemons .add (new CatchablePokemon (api , mapPokemon ));
68+ }
69+ for (WildPokemonOuterClass .WildPokemon wildPokemon : objects .getWildPokemons ()) {
70+ catchablePokemons .add (new CatchablePokemon (api , wildPokemon ));
6771 }
6872
6973 return catchablePokemons ;
@@ -127,21 +131,21 @@ public MapObjects getMapObjects(double latitude, double longitude, int width) th
127131 return getMapObjects (getCellIds (latitude , longitude , width ), latitude , longitude );
128132 }
129133
130- /**
131- * Returns the cells requested
132- *
133- * @param cellIds
134- * @param latitude
135- * @param longitude
136- * @return MapObjects in the given cells
137- */
138- @ Deprecated
139- public MapObjects getMapObjects (List <Long > cellIds , double latitude , double longitude , double altitude ) throws LoginFailedException , RemoteServerException {
140- api .setLatitude (latitude );
141- api .setLongitude (longitude );
142- api .setAltitude (altitude );
143- return getMapObjects (cellIds );
144- }
134+ /**
135+ * Returns the cells requested
136+ *
137+ * @param cellIds
138+ * @param latitude
139+ * @param longitude
140+ * @return MapObjects in the given cells
141+ */
142+ @ Deprecated
143+ public MapObjects getMapObjects (List <Long > cellIds , double latitude , double longitude , double altitude ) throws LoginFailedException , RemoteServerException {
144+ api .setLatitude (latitude );
145+ api .setLongitude (longitude );
146+ api .setAltitude (altitude );
147+ return getMapObjects (cellIds );
148+ }
145149
146150 /**
147151 * Returns the cells requested
@@ -171,7 +175,7 @@ public MapObjects getMapObjects(List<Long> cellIds) throws LoginFailedException,
171175 throw new RemoteServerException (e );
172176 }
173177
174- MapObjects result = new MapObjects ();
178+ MapObjects result = new MapObjects (api );
175179 for (MapCellOuterClass .MapCell mapCell : response .getMapCellsList ()) {
176180 result .addNearbyPokemons (mapCell .getNearbyPokemonsList ());
177181 result .addCatchablePokemons (mapCell .getCatchablePokemonsList ());
@@ -244,6 +248,7 @@ public FortDetails getFortDetails(String id, long lon, long lat) throws LoginFai
244248 return new FortDetails (response );
245249 }
246250
251+ @ Deprecated
247252 public FortSearchResponseOuterClass .FortSearchResponse searchFort (FortDataOuterClass .FortData fortData ) throws LoginFailedException , RemoteServerException {
248253 FortSearchMessageOuterClass .FortSearchMessage reqMsg = FortSearchMessageOuterClass .FortSearchMessage .newBuilder ()
249254 .setFortId (fortData .getId ())
@@ -264,6 +269,7 @@ public FortSearchResponseOuterClass.FortSearchResponse searchFort(FortDataOuterC
264269 return response ;
265270 }
266271
272+ @ Deprecated
267273 public EncounterResponseOuterClass .EncounterResponse encounterPokemon (MapPokemonOuterClass .MapPokemon catchablePokemon ) throws LoginFailedException , RemoteServerException {
268274 EncounterMessageOuterClass .EncounterMessage reqMsg = EncounterMessageOuterClass .EncounterMessage .newBuilder ()
269275 .setEncounterId (catchablePokemon .getEncounterId ())
@@ -283,6 +289,7 @@ public EncounterResponseOuterClass.EncounterResponse encounterPokemon(MapPokemon
283289 return response ;
284290 }
285291
292+ @ Deprecated
286293 public CatchPokemonResponseOuterClass .CatchPokemonResponse catchPokemon (MapPokemonOuterClass .MapPokemon catchablePokemon , double normalizedHitPosition , double normalizedReticleSize , double spinModifier , int pokeball ) throws LoginFailedException , RemoteServerException {
287294 CatchPokemonMessageOuterClass .CatchPokemonMessage reqMsg = CatchPokemonMessageOuterClass .CatchPokemonMessage .newBuilder ()
288295 .setEncounterId (catchablePokemon .getEncounterId ())
0 commit comments