protected function processPlayers(Buffer $buffer)
    {

        // Set the result to a new result instance
        $result = new Result();

        // We need to read the number of players because this response has other data at the end usually
        $num_players = $buffer->readInt8();

        // Player count
        $result->add('num_players', $num_players);

        // No players, no work
        if ($num_players == 0) {
            return $result->fetch();
        }

        // Players list
        for ($player = 0; $player < $num_players; $player++) {
            $result->addPlayer('id', $buffer->readInt8());
            $result->addPlayer('name', $buffer->readString());
            $result->addPlayer('score', $buffer->readInt32Signed());
            $result->addPlayer('time', $buffer->readFloat32());
        }

        // Extra data
        if ($buffer->getLength() > 0) {
            for ($player = 0; $player < $num_players; $player++) {
                $result->addPlayer('deaths', $buffer->readInt32Signed());
                $result->addPlayer('money', $buffer->readInt32Signed());
            }
        }

        unset($buffer);

        return $result->fetch();
    }
protected function processPlayers(Buffer $buffer)
    {

        // Set the result to a new result instance
        $result = new Result();

        // We need to read the number of players because this response has other data at the end usually
        $num_players = $buffer->readInt8();

        // Player count
        $result->add('num_players', $num_players);

        // No players, no work
        if ($num_players == 0) {
            return $result->fetch();
        }

        // Players list
        for ($player = 0; $player < $num_players; $player++) {
            $result->addPlayer('id', $buffer->readInt8());
            $result->addPlayer('name', $buffer->readString());
            $result->addPlayer('score', $buffer->readInt32Signed());
            $result->addPlayer('time', $buffer->readFloat32());
        }

        // Extra data
        if ($buffer->getLength() > 0) {
            for ($player = 0; $player < $num_players; $player++) {
                $result->addPlayer('deaths', $buffer->readInt32Signed());
                $result->addPlayer('money', $buffer->readInt32Signed());
            }
        }

        unset($buffer);

        return $result->fetch();
    }
protected function processPlayers ( Buffer $ buffer ) { // Set the result to a new result instance $ result = new Result ( ) ; // We need to read the number of players because this response has other data at the end usually $ num_players = $ buffer -> readInt8 ( ) ; // Player count $ result -> add ( 'num_players' , $ num_players ) ; // No players, no work if ( $ num_players == 0 ) { return $ result -> fetch ( ) ; } // Players list for ( $ player = 0 ; $ player < $ num_players ; $ player ++ ) { $ result -> addPlayer ( 'id' , $ buffer -> readInt8 ( ) ) ; $ result -> addPlayer ( 'name' , $ buffer -> readString ( ) ) ; $ result -> addPlayer ( 'score' , $ buffer -> readInt32Signed ( ) ) ; $ result -> addPlayer ( 'time' , $ buffer -> readFloat32 ( ) ) ; } // Extra data if ( $ buffer -> getLength ( ) > 0 ) { for ( $ player = 0 ; $ player < $ num_players ; $ player ++ ) { $ result -> addPlayer ( 'deaths' , $ buffer -> readInt32Signed ( ) ) ; $ result -> addPlayer ( 'money' , $ buffer -> readInt32Signed ( ) ) ; } } unset ( $ buffer ) ; return $ result -> fetch ( ) ; }
Specific player parse for The Ship

Player response has unknown data after the last real player

@param \GameQ\Buffer $buffer

@return array
Specific player parse for The Ship