@@ -77,14 +77,14 @@ protected Encounter(PokemonGo api, CatchablePokemon pokemon) {
77
77
*/
78
78
protected EncounterResult encounter () throws RequestFailedException {
79
79
EncounterMessage message = EncounterMessage .newBuilder ()
80
- .setEncounterId (pokemon .getEncounterId () )
81
- .setSpawnPointId (pokemon .getSpawnPointId () )
82
- .setPlayerLatitude (api .getLatitude () )
83
- .setPlayerLongitude (api .getLongitude () )
80
+ .setEncounterId (pokemon .encounterId )
81
+ .setSpawnPointId (pokemon .spawnPointId )
82
+ .setPlayerLatitude (api .latitude )
83
+ .setPlayerLongitude (api .longitude )
84
84
.build ();
85
85
86
86
ServerRequest request = new ServerRequest (RequestType .ENCOUNTER , message );
87
- ByteString responseData = api .getRequestHandler () .sendServerRequests (request , true );
87
+ ByteString responseData = api .requestHandler .sendServerRequests (request , true );
88
88
89
89
try {
90
90
EncounterResponse response = EncounterResponse .parseFrom (responseData );
@@ -110,10 +110,10 @@ protected EncounterResult encounter() throws RequestFailedException {
110
110
*/
111
111
public CatchPokemonResponse .CatchStatus throwPokeball (PokeballSelector selector , ThrowProperties throwProperties )
112
112
throws RequestFailedException , NoSuchItemException {
113
- List <Pokeball > pokeballs = api .getInventories (). getItemBag () .getUsablePokeballs ();
113
+ List <Pokeball > pokeballs = api .inventories . itemBag .getUsablePokeballs ();
114
114
if (pokeballs .size () > 0 ) {
115
115
Pokeball pokeball = selector .select (pokeballs , getCaptureProbability ());
116
- return throwPokeball (pokeball .getBallType () , throwProperties );
116
+ return throwPokeball (pokeball .ballType , throwProperties );
117
117
} else {
118
118
throw new NoSuchItemException ();
119
119
}
@@ -131,21 +131,21 @@ public CatchPokemonResponse.CatchStatus throwPokeball(PokeballSelector selector,
131
131
public CatchPokemonResponse .CatchStatus throwPokeball (ItemId pokeball , ThrowProperties throwProperties )
132
132
throws RequestFailedException , NoSuchItemException {
133
133
if (isActive ()) {
134
- ItemBag bag = api .getInventories (). getItemBag () ;
134
+ ItemBag bag = api .inventories . itemBag ;
135
135
Item item = bag .getItem (pokeball );
136
- if (item .getCount () > 0 ) {
136
+ if (item .count > 0 ) {
137
137
CatchPokemonMessage message = CatchPokemonMessage .newBuilder ()
138
- .setEncounterId (pokemon .getEncounterId () )
139
- .setSpawnPointId (pokemon .getSpawnPointId () )
138
+ .setEncounterId (pokemon .encounterId )
139
+ .setSpawnPointId (pokemon .spawnPointId )
140
140
.setPokeball (pokeball )
141
- .setNormalizedHitPosition (throwProperties .getNormalizedHitPosition () )
142
- .setNormalizedReticleSize (throwProperties .getNormalizedReticleSize () )
143
- .setSpinModifier (throwProperties .getSpinModifier () )
141
+ .setNormalizedHitPosition (throwProperties .normalizedHitPosition )
142
+ .setNormalizedReticleSize (throwProperties .normalizedReticleSize )
143
+ .setSpinModifier (throwProperties .spinModifier )
144
144
.setHitPokemon (throwProperties .shouldHitPokemon ())
145
145
.build ();
146
146
147
147
ServerRequest request = new ServerRequest (RequestType .CATCH_POKEMON , message );
148
- ByteString responseData = api .getRequestHandler () .sendServerRequests (request , true );
148
+ ByteString responseData = api .requestHandler .sendServerRequests (request , true );
149
149
150
150
try {
151
151
CatchPokemonResponse response = CatchPokemonResponse .parseFrom (responseData );
@@ -158,16 +158,16 @@ public CatchPokemonResponse.CatchStatus throwPokeball(ItemId pokeball, ThrowProp
158
158
}
159
159
160
160
if (status == CatchStatus .CATCH_SUCCESS || status == CatchStatus .CATCH_FLEE ) {
161
- pokemon .setDespawned ( true ) ;
162
- api .getPlayerProfile () .updateProfile ();
161
+ pokemon .despawned = true ;
162
+ api .playerProfile .updateProfile ();
163
163
}
164
164
165
165
if (status == CatchStatus .CATCH_ESCAPE ) {
166
166
activeItem = ItemId .UNRECOGNIZED ;
167
167
}
168
168
169
169
if (status != CatchStatus .CATCH_ERROR ) {
170
- item .setCount (item .getCount () - 1 );
170
+ item .setCount (item .count - 1 );
171
171
}
172
172
} catch (InvalidProtocolBufferException e ) {
173
173
throw new RequestFailedException (e );
@@ -188,25 +188,25 @@ public CatchPokemonResponse.CatchStatus throwPokeball(ItemId pokeball, ThrowProp
188
188
*/
189
189
public UseItemEncounterResponse .Status useItem (ItemId itemId ) throws RequestFailedException {
190
190
if (isActive ()) {
191
- ItemBag bag = api .getInventories (). getItemBag () ;
191
+ ItemBag bag = api .inventories . itemBag ;
192
192
Item item = bag .getItem (itemId );
193
- if (item .getCount () > 0 ) {
193
+ if (item .count > 0 ) {
194
194
if (getActiveItem () == null ) {
195
195
UseItemEncounterMessage message = UseItemEncounterMessage .newBuilder ()
196
- .setEncounterId (pokemon .getEncounterId () )
197
- .setSpawnPointGuid (pokemon .getSpawnPointId () )
196
+ .setEncounterId (pokemon .encounterId )
197
+ .setSpawnPointGuid (pokemon .spawnPointId )
198
198
.setItem (itemId )
199
199
.build ();
200
200
201
201
ServerRequest request = new ServerRequest (RequestType .USE_ITEM_ENCOUNTER , message );
202
- ByteString responseData = api .getRequestHandler () .sendServerRequests (request , true );
202
+ ByteString responseData = api .requestHandler .sendServerRequests (request , true );
203
203
204
204
try {
205
205
UseItemEncounterResponse response = UseItemEncounterResponse .parseFrom (responseData );
206
206
activeItem = response .getActiveItem ();
207
207
captureProbabilities = response .getCaptureProbability ();
208
208
if (response .getStatus () == Status .SUCCESS ) {
209
- item .setCount (item .getCount () - 1 );
209
+ item .setCount (item .count - 1 );
210
210
}
211
211
return response .getStatus ();
212
212
} catch (InvalidProtocolBufferException e ) {
0 commit comments