/**
  * Function for update the user profile, called for retrieve user data
  */
 public function updateProfile()
 {
     $getPLayerRequestMessage = new GetPlayerMessage();
     $getPlayerRequest = new ServerRequest(RequestType::GET_PLAYER, $getPLayerRequestMessage);
     $this->PokemonGoAPI->getRequestHandler()->sendServerRequests($getPlayerRequest);
     $playerResponse = new GetPlayerResponse($getPlayerRequest->getData());
     $playerData = $playerResponse->getPlayerData();
     $this->badge = $playerData->getEquippedBadge();
     $this->creationTime = $playerData->getCreationTimestampMs();
     $this->itemStorage = $playerData->getMaxItemStorage();
     $this->pokemonStorage = $playerData->getMaxPokemonStorage();
     $this->team = (new Team($playerData->getTeam()))->getValue();
     $this->username = $playerData->getUsername();
     $avatarApi = new PlayerAvatar();
     $bonusApi = new DailyBonus();
     $contactApi = new ContactSettings();
     foreach ($playerResponse->getPlayerData()->getCurrenciesArray() as $currency) {
         $this->addCurrency($currency->getName(), $currency->getAmount());
     }
     $avatarApi->setGender($playerResponse->getPlayerData()->getAvatar()->getGender());
     $avatarApi->setBackpack($playerResponse->getPlayerData()->getAvatar()->getBackpack());
     $avatarApi->setEyes($playerResponse->getPlayerData()->getAvatar()->getEyes());
     $avatarApi->setHair($playerResponse->getPlayerData()->getAvatar()->getHair());
     $avatarApi->setHat($playerResponse->getPlayerData()->getAvatar()->getHat());
     $avatarApi->setPants($playerResponse->getPlayerData()->getAvatar()->getPants());
     $avatarApi->setShirt($playerResponse->getPlayerData()->getAvatar()->getShirt());
     $avatarApi->setShoes($playerResponse->getPlayerData()->getAvatar()->getShoes());
     $avatarApi->setSkin($playerResponse->getPlayerData()->getAvatar()->getSkin());
     $bonusApi->setNextCollectedTimestampMs($playerResponse->getPlayerData()->getDailyBonus()->getNextCollectedTimestampMs());
     $bonusApi->setNextCollectedTimestampMs($playerResponse->getPlayerData()->getDailyBonus()->getNextDefenderBonusCollectTimestampMs());
     $this->avatar = $avatarApi;
     $this->dailyBonus = $bonusApi;
 }
Exemple #2
0
 /**
  * @return PlayerAvatar
  */
 public function toProto()
 {
     $playerAvatar = new PlayerAvatar();
     $playerAvatar->setSkin($this->getSkin());
     $playerAvatar->setHair($this->getHair());
     $playerAvatar->setShirt($this->getShirt());
     $playerAvatar->setPants($this->getPants());
     $playerAvatar->setHat($this->getHat());
     $playerAvatar->setShoes($this->getShoes());
     $playerAvatar->setGender(Gender::valueOf($this->getGender()));
     $playerAvatar->setEyes($this->getEyes());
     $playerAvatar->setBackpack($this->getBackpack());
     return $playerAvatar;
 }