PokemonGoAPI-PHP icon indicating copy to clipboard operation
PokemonGoAPI-PHP copied to clipboard

Number of Gyms conquered?

Open Spettacolo83 opened this issue 9 years ago • 5 comments

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

Spettacolo83 avatar Aug 17 '16 17:08 Spettacolo83

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()

NicklasWallgren avatar Aug 19 '16 13:08 NicklasWallgren

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 ...

Ni42 avatar Aug 19 '16 15:08 Ni42

Yes @Ni42 exactly!

Spettacolo83 avatar Aug 19 '16 15:08 Spettacolo83

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

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

$numberOfDeployedPokemons = count($deployedPokemons);

NicklasWallgren avatar Aug 19 '16 16:08 NicklasWallgren

I tried it but does not work!

Spettacolo83 avatar Sep 13 '16 14:09 Spettacolo83