4
4
import POGOProtos .Map .Fort .FortTypeOuterClass ;
5
5
import POGOProtos .Map .MapCellOuterClass ;
6
6
import POGOProtos .Map .Pokemon .MapPokemonOuterClass ;
7
+ import POGOProtos .Map .Pokemon .WildPokemonOuterClass ;
7
8
import POGOProtos .Networking .Requests .Messages .*;
8
9
import POGOProtos .Networking .Requests .RequestTypeOuterClass ;
9
10
import POGOProtos .Networking .Responses .*;
@@ -46,7 +47,7 @@ public Map(PokemonGo api) {
46
47
*/
47
48
private MapObjects getRetainedMapObject () throws LoginFailedException , RemoteServerException {
48
49
// 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 ) {
50
51
getMapObjects (); // should update the lastMapObjects variable
51
52
}
52
53
@@ -59,11 +60,14 @@ private MapObjects getRetainedMapObject() throws LoginFailedException, RemoteSer
59
60
* @return List<CatchablePokemon> at your current location
60
61
*/
61
62
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 ();
64
65
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 ));
67
71
}
68
72
69
73
return catchablePokemons ;
@@ -127,21 +131,21 @@ public MapObjects getMapObjects(double latitude, double longitude, int width) th
127
131
return getMapObjects (getCellIds (latitude , longitude , width ), latitude , longitude );
128
132
}
129
133
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
+ }
145
149
146
150
/**
147
151
* Returns the cells requested
@@ -171,7 +175,7 @@ public MapObjects getMapObjects(List<Long> cellIds) throws LoginFailedException,
171
175
throw new RemoteServerException (e );
172
176
}
173
177
174
- MapObjects result = new MapObjects ();
178
+ MapObjects result = new MapObjects (api );
175
179
for (MapCellOuterClass .MapCell mapCell : response .getMapCellsList ()) {
176
180
result .addNearbyPokemons (mapCell .getNearbyPokemonsList ());
177
181
result .addCatchablePokemons (mapCell .getCatchablePokemonsList ());
@@ -244,6 +248,7 @@ public FortDetails getFortDetails(String id, long lon, long lat) throws LoginFai
244
248
return new FortDetails (response );
245
249
}
246
250
251
+ @ Deprecated
247
252
public FortSearchResponseOuterClass .FortSearchResponse searchFort (FortDataOuterClass .FortData fortData ) throws LoginFailedException , RemoteServerException {
248
253
FortSearchMessageOuterClass .FortSearchMessage reqMsg = FortSearchMessageOuterClass .FortSearchMessage .newBuilder ()
249
254
.setFortId (fortData .getId ())
@@ -264,6 +269,7 @@ public FortSearchResponseOuterClass.FortSearchResponse searchFort(FortDataOuterC
264
269
return response ;
265
270
}
266
271
272
+ @ Deprecated
267
273
public EncounterResponseOuterClass .EncounterResponse encounterPokemon (MapPokemonOuterClass .MapPokemon catchablePokemon ) throws LoginFailedException , RemoteServerException {
268
274
EncounterMessageOuterClass .EncounterMessage reqMsg = EncounterMessageOuterClass .EncounterMessage .newBuilder ()
269
275
.setEncounterId (catchablePokemon .getEncounterId ())
@@ -283,6 +289,7 @@ public EncounterResponseOuterClass.EncounterResponse encounterPokemon(MapPokemon
283
289
return response ;
284
290
}
285
291
292
+ @ Deprecated
286
293
public CatchPokemonResponseOuterClass .CatchPokemonResponse catchPokemon (MapPokemonOuterClass .MapPokemon catchablePokemon , double normalizedHitPosition , double normalizedReticleSize , double spinModifier , int pokeball ) throws LoginFailedException , RemoteServerException {
287
294
CatchPokemonMessageOuterClass .CatchPokemonMessage reqMsg = CatchPokemonMessageOuterClass .CatchPokemonMessage .newBuilder ()
288
295
.setEncounterId (catchablePokemon .getEncounterId ())
0 commit comments