Hello. I wrote a simple proxy that read packets from the server and the client, but how decode batch? PHP: if(($packet = Pool::getPacketFromPool(ord($buffer{0}))) !== null){ $packet->buffer = $buffer; $packet->decode(); if($packet instanceof DATA_PACKET_4){ foreach($packet->packets as $pk){ $id = ord($pk->buffer{0}); if($id !== 0x10 && $id !== 0x03){ $dataPacket = PacketPool::getPacket($pk->buffer); if($dataPacket instanceof BatchPacket){ $dataPacket->decode(); var_dump($dataPacket); //need decode batch here } } } }}
Use this to get every packet in a BatchPacket: PHP: if($dataPacket instanceof BatchPacket){ $dataPacket->decode(); foreach($dataPacket->getPackets() as $buf){ $pk = PacketPool::getPacketById(ord($buf{0})); if(!$pk->canBeBatched()){ continue; } $pk->setBuffer($buf, 1); //Now handle $pk like a normal Packet }} PS: I'm pretty bad at understanding the networking in pmmp, so this might be wrong.
Maybe. I got this Code: Warning: zlib_decode(): data error in \BatchPacket.php on line 59 or this Code: object(Generator)#144 (0) { } when use PHP: var_dump($dataPacket->getPackets());