Skip to content

Commit 31ec05c

Browse files
committed
fix conflict with upstream
2 parents 3c2fdf4 + 3a84f59 commit 31ec05c

15 files changed

+585
-270
lines changed

src/main/java/com/pokegoapi/api/inventory/Pokeball.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
package com.pokegoapi.api.inventory;
22

3+
import lombok.Getter;
4+
35
public enum Pokeball {
4-
POKEBALL (1),
5-
GREATBALL (2),
6-
ULTRABALL (3),
7-
MASTERBALL (4);
6+
POKEBALL(1),
7+
GREATBALL(2),
8+
ULTRABALL(3),
9+
MASTERBALL(4);
810

11+
@Getter
912
private final int balltype;
1013

1114
Pokeball(int i) {

src/main/java/com/pokegoapi/api/map/Map.java

+28-21
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import POGOProtos.Map.Fort.FortTypeOuterClass;
55
import POGOProtos.Map.MapCellOuterClass;
66
import POGOProtos.Map.Pokemon.MapPokemonOuterClass;
7+
import POGOProtos.Map.Pokemon.WildPokemonOuterClass;
78
import POGOProtos.Networking.Requests.Messages.*;
89
import POGOProtos.Networking.Requests.RequestTypeOuterClass;
910
import 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())

src/main/java/com/pokegoapi/api/map/MapObjects.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import POGOProtos.Map.Pokemon.NearbyPokemonOuterClass;
66
import POGOProtos.Map.Pokemon.WildPokemonOuterClass;
77
import POGOProtos.Map.SpawnPointOuterClass;
8+
import com.pokegoapi.api.PokemonGo;
9+
import com.pokegoapi.api.map.fort.Pokestop;
810
import lombok.Getter;
911
import lombok.ToString;
1012

@@ -13,6 +15,7 @@
1315

1416
@ToString
1517
public class MapObjects {
18+
1619
@Getter
1720
Collection<NearbyPokemonOuterClass.NearbyPokemon> nearbyPokemons = new ArrayList<NearbyPokemonOuterClass.NearbyPokemon>();
1821
@Getter
@@ -26,8 +29,13 @@ public class MapObjects {
2629
@Getter
2730
Collection<FortDataOuterClass.FortData> gyms = new ArrayList<FortDataOuterClass.FortData>();
2831
@Getter
29-
Collection<FortDataOuterClass.FortData> pokestops = new ArrayList<FortDataOuterClass.FortData>();
32+
Collection<Pokestop> pokestops = new ArrayList<>();
3033
boolean complete = false;
34+
private PokemonGo api;
35+
36+
public MapObjects(PokemonGo api) {
37+
this.api = api;
38+
}
3139

3240
public void addNearbyPokemons(Collection<NearbyPokemonOuterClass.NearbyPokemon> nearbyPokemons) {
3341
if (nearbyPokemons == null || nearbyPokemons.isEmpty()) {
@@ -82,7 +90,9 @@ public void addPokestops(Collection<FortDataOuterClass.FortData> pokestops) {
8290
return;
8391
}
8492
complete = true;
85-
this.pokestops.addAll(pokestops);
93+
for (FortDataOuterClass.FortData pokestop : pokestops) {
94+
this.pokestops.add(new Pokestop(api, pokestop));
95+
}
8696
}
8797

8898
/**

src/main/java/com/pokegoapi/api/map/Pokemon/CatchPokemonResult.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package com.pokegoapi.api.map.Pokemon;
22

3-
public enum CatchPokemonResult
4-
{
5-
SUCCESS (1),
6-
ESCAPE (2),
7-
FLEE (3),
8-
MISSED (4);
3+
public enum CatchPokemonResult {
4+
SUCCESS(1),
5+
ESCAPE(2),
6+
FLEE(3),
7+
MISSED(4);
98

109
private final int status;
1110

src/main/java/com/pokegoapi/api/map/Pokemon/CatchResult.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import POGOProtos.Enums.ActivityTypeOuterClass;
55
import POGOProtos.Networking.Responses.CatchPokemonResponseOuterClass.CatchPokemonResponse;
66
import POGOProtos.Networking.Responses.CatchPokemonResponseOuterClass.CatchPokemonResponse.CatchStatus;
7-
import lombok.Getter;
87
import lombok.Setter;
98
import lombok.ToString;
109

@@ -19,11 +18,10 @@ public class CatchResult {
1918
private boolean failed;
2019

2120
public CatchResult() {
22-
21+
setFailed(true);
2322
}
2423

25-
public CatchResult(CatchPokemonResponse response)
26-
{
24+
public CatchResult(CatchPokemonResponse response) {
2725
this.captureAward = response.getCaptureAward();
2826
this.response = response;
2927
}

0 commit comments

Comments
 (0)