NicklasWallgren / PokemonGoAPI-PHP

Pokemon Go API PHP library
BSD 2-Clause "Simplified" License
130 stars 51 forks source link

Error with "getPokeBank" #145

Closed jacobtruman closed 7 years ago

jacobtruman commented 7 years ago

This works for one account, but not another:

// Retrieve the pokemon go api instance
$pokemonGoApi = $this->application->getPokemonGoApi();

// Retrieve the inventory
$inventory = $pokemonGoApi->getInventory();

// Retrieve the poke bank
$pokeBank = $inventory->getPokeBank();

I am getting the following error:

Fatal error: Uncaught Exception: Incorrect wire format for field 14, expected: 0 got: 4 in ./PokemonGoAPI-PHP/vendor/nicklasw/pogoprotos-php/src/POGOProtos/Data/PokemonData.php:175 Stack trace: #0 ./PokemonGoAPI-PHP/vendor/nicklasw/pogoprotos-php/src/protocolbuffers.inc.php(84): POGOProtos\Data\PokemonData->read(Resource id #32, 6) #1 ./PokemonGoAPI-PHP/vendor/nicklasw/pogoprotos-php/src/POGOProtos/Data/PokemonData.php(50): ProtobufMessage->__construct(Resource id #32, 6) #2 ./PokemonGoAPI-PHP/vendor/nicklasw/pogoprotos-php/src/POGOProtos/Inventory/InventoryItemData.php(48): POGOProtos\Data\PokemonData->__construct(Resource id #32, 6) #3 ./PokemonGoAPI-PHP/vendor/nicklasw/pogoprotos-php/src/protocolbuffers.inc.php(84): POGOProtos\Inventory\InventoryItemData->read(Resource id #32, 0) #4 ./PokemonGoAPI-PHP/vendor/nicklasw/pogoprotos-php/src/POGOProtos/Inventory/InventoryItemData.php(30): ProtobufMessage->__construct(Resource id # in ./PokemonGoAPI-PHP/vendor/nicklasw/pogoprotos-php/src/POGOProtos/Data/PokemonData.php on line 175
jacobtruman commented 7 years ago

UPDATE: this seems to only be a problem for an account that has a "Buddy" Pokemon that has collected candy from walking

zunfix commented 7 years ago

Real isssue as there is for the moment no way to remove a buddy - only change for another.

Ni42 commented 7 years ago

We can't really fix this bug for now because of proto format changes in 0.37. As soon as the protobuf repository gets fixed upstream, it might be possible again. Just don't select a buddy pokemon if you want to use this API (or any of the others I guess).

nickpoulos commented 7 years ago

Can somebody elaborate on this .37 proto issue a little? It seems other bots I monitor, like the original Python bot, dont have this issue? I started a PHP conversion of this awhile ago, compiled some protos myself, so I am wondering if we can't solve this instead of waiting for the protobuf repository to get fixed.

In other news, apparently the forced .39.1 upgrade has added a new kind of encryption that .35 does not use, everybody is bitching about it in the other bot's slack forum.

DrDelay commented 7 years ago

Same problem as #142.

nickpoulos commented 7 years ago

I dont think that is entirely accurate. I am seeing reports of .37 version working fine with this PHP api, AS LONG AS the user has not selected a buddy pokemon. As soon as you are on .37 and select a buddy, we get the extra data and therefore this error. I read that there are updated protos for the buddy data, does anybody know where these are? I can recompile for PHP, or attempt to at least, I've done it before.

DrDelay commented 7 years ago

@voxx pointed out that it only affects users that selected a buddy in #142 aswell. If this is another problem please give some additional information.