/** * {@inheritdoc} */ public function serializedSize(\Protobuf\ComputeSizeContext $context) { $calculator = $context->getSizeCalculator(); $size = 0; if ($this->attack_scalar !== null) { foreach ($this->attack_scalar as $val) { $size += 1; $size += 4; } } if ($this->attack_type !== null) { $size += 1; $size += $calculator->computeVarintSize($this->attack_type->value()); } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; }
/** * {@inheritdoc} */ public function serializedSize(\Protobuf\ComputeSizeContext $context) { $calculator = $context->getSizeCalculator(); $size = 0; if ($this->pokemon_id !== null) { $size += 1; $size += $calculator->computeVarintSize($this->pokemon_id->value()); } if ($this->model_scale !== null) { $size += 1; $size += 4; } if ($this->type !== null) { $size += 1; $size += $calculator->computeVarintSize($this->type->value()); } if ($this->type_2 !== null) { $size += 1; $size += $calculator->computeVarintSize($this->type_2->value()); } if ($this->camera !== null) { $innerSize = $this->camera->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } if ($this->encounter !== null) { $innerSize = $this->encounter->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } if ($this->stats !== null) { $innerSize = $this->stats->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } if ($this->quick_moves !== null) { foreach ($this->quick_moves as $val) { $size += 1; $size += $calculator->computeVarintSize($val->value()); } } if ($this->cinematic_moves !== null) { foreach ($this->cinematic_moves as $val) { $size += 1; $size += $calculator->computeVarintSize($val->value()); } } if ($this->animation_time !== null) { foreach ($this->animation_time as $val) { $size += 1; $size += 4; } } if ($this->evolution_ids !== null) { foreach ($this->evolution_ids as $val) { $size += 1; $size += $calculator->computeVarintSize($val->value()); } } if ($this->evolution_pips !== null) { $size += 1; $size += $calculator->computeVarintSize($this->evolution_pips); } if ($this->rarity !== null) { $size += 1; $size += $calculator->computeVarintSize($this->rarity->value()); } if ($this->pokedex_height_m !== null) { $size += 1; $size += 4; } if ($this->pokedex_weight_kg !== null) { $size += 2; $size += 4; } if ($this->parent_pokemon_id !== null) { $size += 2; $size += $calculator->computeVarintSize($this->parent_pokemon_id->value()); } if ($this->height_std_dev !== null) { $size += 2; $size += 4; } if ($this->weight_std_dev !== null) { $size += 2; $size += 4; } if ($this->km_distance_to_hatch !== null) { $size += 2; $size += 4; } if ($this->family_id !== null) { $size += 2; $size += $calculator->computeVarintSize($this->family_id->value()); } if ($this->candy_to_evolve !== null) { $size += 2; $size += $calculator->computeVarintSize($this->candy_to_evolve); } if ($this->km_buddy_distance !== null) { $size += 2; $size += 4; } if ($this->buddy_size !== null) { $size += 2; $size += $calculator->computeVarintSize($this->buddy_size->value()); } if ($this->model_height !== null) { $size += 2; $size += 4; } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; }
/** * {@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; }
/** * {@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, 5); $this->incense_lifetime_seconds = $reader->readVarint($stream); continue; } if ($tag === 2) { $innerSize = $reader->readVarint($stream); $innerLimit = $stream->tell() + $innerSize; if ($this->pokemon_type === null) { $this->pokemon_type = new \Protobuf\EnumCollection(); } while ($stream->tell() < $innerLimit) { $this->pokemon_type->add(\POGOProtos\Enums\PokemonType::valueOf($reader->readVarint($stream))); } continue; } if ($tag === 3) { \Protobuf\WireFormat::assertWireType($wire, 2); $this->pokemon_incense_type_probability = $reader->readFloat($stream); continue; } if ($tag === 4) { \Protobuf\WireFormat::assertWireType($wire, 5); $this->standing_time_between_encounters_seconds = $reader->readVarint($stream); continue; } if ($tag === 5) { \Protobuf\WireFormat::assertWireType($wire, 5); $this->moving_time_between_encounter_seconds = $reader->readVarint($stream); continue; } if ($tag === 6) { \Protobuf\WireFormat::assertWireType($wire, 5); $this->distance_required_for_shorter_interval_meters = $reader->readVarint($stream); continue; } if ($tag === 7) { \Protobuf\WireFormat::assertWireType($wire, 5); $this->pokemon_attracted_length_sec = $reader->readVarint($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); } }