NicklasWallgren / PokemonGoAPI-PHP

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

Number of Gyms conquered? #117

Open Spettacolo83 opened 8 years ago

Spettacolo83 commented 8 years ago

Do you know if I can get the number of the current gyms conquered? Thank you very much!

NicklasWallgren commented 8 years ago

What do you mean by "current" gyms conquered? As in gyms you currently defend?

* @method int getBattleAttackWon()
* @method int getBattleAttackTotal()
* @method int getBattleDefendedWon()
* @method int getBattleTrainingWon()
* @method int getBattleTrainingTotal()
Ni42 commented 8 years ago

Those methods are global stats. He is probably looking for the number that shows in game on the shop that decides how many pokecoins you can get if you claim them now. It might be somewhere under the "DailyDefenderBonus" protos, but I can't pinpoint it right now ...

Spettacolo83 commented 8 years ago

Yes @Ni42 exactly!

NicklasWallgren commented 8 years ago

One way of achieving it, probably not the best way.

$deployedPokemons = $pokebank->getPokemons()->filter(function (Pokemon $pokemon) {
    return $pokemon->isDeployed();
});

$numberOfDeployedPokemons = count($deployedPokemons);
Spettacolo83 commented 8 years ago

I tried it but does not work!