Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function serializedSize(\Protobuf\ComputeSizeContext $context)
 {
     $calculator = $context->getSizeCalculator();
     $size = 0;
     if ($this->id !== null) {
         $size += 1;
         $size += 8;
     }
     if ($this->pokemon_id !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->pokemon_id->value());
     }
     if ($this->cp !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->cp);
     }
     if ($this->stamina !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->stamina);
     }
     if ($this->stamina_max !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->stamina_max);
     }
     if ($this->move_1 !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->move_1->value());
     }
     if ($this->move_2 !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->move_2->value());
     }
     if ($this->deployed_fort_id !== null) {
         $size += 1;
         $size += $calculator->computeStringSize($this->deployed_fort_id);
     }
     if ($this->owner_name !== null) {
         $size += 1;
         $size += $calculator->computeStringSize($this->owner_name);
     }
     if ($this->is_egg !== null) {
         $size += 1;
         $size += 1;
     }
     if ($this->egg_km_walked_target !== null) {
         $size += 1;
         $size += 8;
     }
     if ($this->egg_km_walked_start !== null) {
         $size += 1;
         $size += 8;
     }
     if ($this->origin !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->origin);
     }
     if ($this->height_m !== null) {
         $size += 1;
         $size += 4;
     }
     if ($this->weight_kg !== null) {
         $size += 2;
         $size += 4;
     }
     if ($this->individual_attack !== null) {
         $size += 2;
         $size += $calculator->computeVarintSize($this->individual_attack);
     }
     if ($this->individual_defense !== null) {
         $size += 2;
         $size += $calculator->computeVarintSize($this->individual_defense);
     }
     if ($this->individual_stamina !== null) {
         $size += 2;
         $size += $calculator->computeVarintSize($this->individual_stamina);
     }
     if ($this->cp_multiplier !== null) {
         $size += 2;
         $size += 4;
     }
     if ($this->pokeball !== null) {
         $size += 2;
         $size += $calculator->computeVarintSize($this->pokeball->value());
     }
     if ($this->captured_cell_id !== null) {
         $size += 2;
         $size += $calculator->computeVarintSize($this->captured_cell_id);
     }
     if ($this->battles_attacked !== null) {
         $size += 2;
         $size += $calculator->computeVarintSize($this->battles_attacked);
     }
     if ($this->battles_defended !== null) {
         $size += 2;
         $size += $calculator->computeVarintSize($this->battles_defended);
     }
     if ($this->egg_incubator_id !== null) {
         $size += 2;
         $size += $calculator->computeStringSize($this->egg_incubator_id);
     }
     if ($this->creation_time_ms !== null) {
         $size += 2;
         $size += $calculator->computeVarintSize($this->creation_time_ms);
     }
     if ($this->num_upgrades !== null) {
         $size += 2;
         $size += $calculator->computeVarintSize($this->num_upgrades);
     }
     if ($this->additional_cp_multiplier !== null) {
         $size += 2;
         $size += 4;
     }
     if ($this->favorite !== null) {
         $size += 2;
         $size += $calculator->computeVarintSize($this->favorite);
     }
     if ($this->nickname !== null) {
         $size += 2;
         $size += $calculator->computeStringSize($this->nickname);
     }
     if ($this->from_fort !== null) {
         $size += 2;
         $size += $calculator->computeVarintSize($this->from_fort);
     }
     if ($this->buddy_candy_awarded !== null) {
         $size += 2;
         $size += $calculator->computeVarintSize($this->buddy_candy_awarded);
     }
     if ($this->buddy_total_km_walked !== null) {
         $size += 2;
         $size += 4;
     }
     if ($this->display_pokemon_id !== null) {
         $size += 2;
         $size += $calculator->computeVarintSize($this->display_pokemon_id);
     }
     if ($this->display_cp !== null) {
         $size += 2;
         $size += $calculator->computeVarintSize($this->display_cp);
     }
     if ($this->extensions !== null) {
         $size += $this->extensions->serializedSize($context);
     }
     return $size;
 }
 /**
  * {@inheritdoc}
  */
 public function readFrom(\Protobuf\ReadContext $context)
 {
     $reader = $context->getReader();
     $length = $context->getLength();
     $stream = $context->getStream();
     $limit = $length !== null ? $stream->tell() + $length : null;
     while ($limit === null || $stream->tell() < $limit) {
         if ($stream->eof()) {
             break;
         }
         $key = $reader->readVarint($stream);
         $wire = \Protobuf\WireFormat::getTagWireType($key);
         $tag = \Protobuf\WireFormat::getTagFieldNumber($key);
         if ($stream->eof()) {
             break;
         }
         if ($tag === 1) {
             \Protobuf\WireFormat::assertWireType($wire, 14);
             $this->pokemon_id = \POGOProtos\Enums\PokemonId::valueOf($reader->readVarint($stream));
             continue;
         }
         if ($tag === 3) {
             \Protobuf\WireFormat::assertWireType($wire, 2);
             $this->model_scale = $reader->readFloat($stream);
             continue;
         }
         if ($tag === 4) {
             \Protobuf\WireFormat::assertWireType($wire, 14);
             $this->type = \POGOProtos\Enums\PokemonType::valueOf($reader->readVarint($stream));
             continue;
         }
         if ($tag === 5) {
             \Protobuf\WireFormat::assertWireType($wire, 14);
             $this->type_2 = \POGOProtos\Enums\PokemonType::valueOf($reader->readVarint($stream));
             continue;
         }
         if ($tag === 6) {
             \Protobuf\WireFormat::assertWireType($wire, 11);
             $innerSize = $reader->readVarint($stream);
             $innerMessage = new \POGOProtos\Settings\Master\Pokemon\CameraAttributes();
             $this->camera = $innerMessage;
             $context->setLength($innerSize);
             $innerMessage->readFrom($context);
             $context->setLength($length);
             continue;
         }
         if ($tag === 7) {
             \Protobuf\WireFormat::assertWireType($wire, 11);
             $innerSize = $reader->readVarint($stream);
             $innerMessage = new \POGOProtos\Settings\Master\Pokemon\EncounterAttributes();
             $this->encounter = $innerMessage;
             $context->setLength($innerSize);
             $innerMessage->readFrom($context);
             $context->setLength($length);
             continue;
         }
         if ($tag === 8) {
             \Protobuf\WireFormat::assertWireType($wire, 11);
             $innerSize = $reader->readVarint($stream);
             $innerMessage = new \POGOProtos\Settings\Master\Pokemon\StatsAttributes();
             $this->stats = $innerMessage;
             $context->setLength($innerSize);
             $innerMessage->readFrom($context);
             $context->setLength($length);
             continue;
         }
         if ($tag === 9) {
             $innerSize = $reader->readVarint($stream);
             $innerLimit = $stream->tell() + $innerSize;
             if ($this->quick_moves === null) {
                 $this->quick_moves = new \Protobuf\EnumCollection();
             }
             while ($stream->tell() < $innerLimit) {
                 $this->quick_moves->add(\POGOProtos\Enums\PokemonMove::valueOf($reader->readVarint($stream)));
             }
             continue;
         }
         if ($tag === 10) {
             $innerSize = $reader->readVarint($stream);
             $innerLimit = $stream->tell() + $innerSize;
             if ($this->cinematic_moves === null) {
                 $this->cinematic_moves = new \Protobuf\EnumCollection();
             }
             while ($stream->tell() < $innerLimit) {
                 $this->cinematic_moves->add(\POGOProtos\Enums\PokemonMove::valueOf($reader->readVarint($stream)));
             }
             continue;
         }
         if ($tag === 11) {
             $innerSize = $reader->readVarint($stream);
             $innerLimit = $stream->tell() + $innerSize;
             if ($this->animation_time === null) {
                 $this->animation_time = new \Protobuf\ScalarCollection();
             }
             while ($stream->tell() < $innerLimit) {
                 $this->animation_time->add($reader->readFloat($stream));
             }
             continue;
         }
         if ($tag === 12) {
             $innerSize = $reader->readVarint($stream);
             $innerLimit = $stream->tell() + $innerSize;
             if ($this->evolution_ids === null) {
                 $this->evolution_ids = new \Protobuf\EnumCollection();
             }
             while ($stream->tell() < $innerLimit) {
                 $this->evolution_ids->add(\POGOProtos\Enums\PokemonId::valueOf($reader->readVarint($stream)));
             }
             continue;
         }
         if ($tag === 13) {
             \Protobuf\WireFormat::assertWireType($wire, 5);
             $this->evolution_pips = $reader->readVarint($stream);
             continue;
         }
         if ($tag === 14) {
             \Protobuf\WireFormat::assertWireType($wire, 14);
             $this->rarity = \POGOProtos\Enums\PokemonRarity::valueOf($reader->readVarint($stream));
             continue;
         }
         if ($tag === 15) {
             \Protobuf\WireFormat::assertWireType($wire, 2);
             $this->pokedex_height_m = $reader->readFloat($stream);
             continue;
         }
         if ($tag === 16) {
             \Protobuf\WireFormat::assertWireType($wire, 2);
             $this->pokedex_weight_kg = $reader->readFloat($stream);
             continue;
         }
         if ($tag === 17) {
             \Protobuf\WireFormat::assertWireType($wire, 14);
             $this->parent_pokemon_id = \POGOProtos\Enums\PokemonId::valueOf($reader->readVarint($stream));
             continue;
         }
         if ($tag === 18) {
             \Protobuf\WireFormat::assertWireType($wire, 2);
             $this->height_std_dev = $reader->readFloat($stream);
             continue;
         }
         if ($tag === 19) {
             \Protobuf\WireFormat::assertWireType($wire, 2);
             $this->weight_std_dev = $reader->readFloat($stream);
             continue;
         }
         if ($tag === 20) {
             \Protobuf\WireFormat::assertWireType($wire, 2);
             $this->km_distance_to_hatch = $reader->readFloat($stream);
             continue;
         }
         if ($tag === 21) {
             \Protobuf\WireFormat::assertWireType($wire, 14);
             $this->family_id = \POGOProtos\Enums\PokemonFamilyId::valueOf($reader->readVarint($stream));
             continue;
         }
         if ($tag === 22) {
             \Protobuf\WireFormat::assertWireType($wire, 5);
             $this->candy_to_evolve = $reader->readVarint($stream);
             continue;
         }
         if ($tag === 23) {
             \Protobuf\WireFormat::assertWireType($wire, 2);
             $this->km_buddy_distance = $reader->readFloat($stream);
             continue;
         }
         if ($tag === 24) {
             \Protobuf\WireFormat::assertWireType($wire, 14);
             $this->buddy_size = \POGOProtos\Settings\Master\PokemonSettings\BuddySize::valueOf($reader->readVarint($stream));
             continue;
         }
         if ($tag === 25) {
             \Protobuf\WireFormat::assertWireType($wire, 2);
             $this->model_height = $reader->readFloat($stream);
             continue;
         }
         $extensions = $context->getExtensionRegistry();
         $extension = $extensions ? $extensions->findByNumber(__CLASS__, $tag) : null;
         if ($extension !== null) {
             $this->extensions()->add($extension, $extension->readFrom($context, $wire));
             continue;
         }
         if ($this->unknownFieldSet === null) {
             $this->unknownFieldSet = new \Protobuf\UnknownFieldSet();
         }
         $data = $reader->readUnknown($stream, $wire);
         $unknown = new \Protobuf\Unknown($tag, $wire, $data);
         $this->unknownFieldSet->add($unknown);
     }
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function serializedSize(\Protobuf\ComputeSizeContext $context)
 {
     $calculator = $context->getSizeCalculator();
     $size = 0;
     if ($this->movement_id !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->movement_id->value());
     }
     if ($this->animation_id !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->animation_id);
     }
     if ($this->pokemon_type !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->pokemon_type->value());
     }
     if ($this->power !== null) {
         $size += 1;
         $size += 4;
     }
     if ($this->accuracy_chance !== null) {
         $size += 1;
         $size += 4;
     }
     if ($this->critical_chance !== null) {
         $size += 1;
         $size += 4;
     }
     if ($this->heal_scalar !== null) {
         $size += 1;
         $size += 4;
     }
     if ($this->stamina_loss_scalar !== null) {
         $size += 1;
         $size += 4;
     }
     if ($this->trainer_level_min !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->trainer_level_min);
     }
     if ($this->trainer_level_max !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->trainer_level_max);
     }
     if ($this->vfx_name !== null) {
         $size += 1;
         $size += $calculator->computeStringSize($this->vfx_name);
     }
     if ($this->duration_ms !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->duration_ms);
     }
     if ($this->damage_window_start_ms !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->damage_window_start_ms);
     }
     if ($this->damage_window_end_ms !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->damage_window_end_ms);
     }
     if ($this->energy_delta !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->energy_delta);
     }
     if ($this->extensions !== null) {
         $size += $this->extensions->serializedSize($context);
     }
     return $size;
 }