/**
  * Creates a new A2MGETSERVERSBATCH2 request object, filtering by the
  * given paramters
  *
  * @param int $regionCode The region code to filter servers by region.
  * @param string $startIp This should be the last IP received from the
  *        master server or 0.0.0.0
  * @param string $filter The filters to apply in the form
  *        ("\filtername\value...")
  */
 public function __construct($regionCode = MasterServer::REGION_ALL, $startIp = '0.0.0.0', $filter = '')
 {
     parent::__construct(SteamPacket::A2M_GET_SERVERS_BATCH2_HEADER);
     $this->filter = $filter;
     $this->regionCode = $regionCode;
     $this->startIp = $startIp;
 }
 /**
  * Creates a new S2A_PLAYER response object based on the given data
  *
  * @param string $contentData The raw packet data sent by the server
  * @throws PacketFormatException if the packet data is missing
  */
 public function __construct($contentData)
 {
     if (empty($contentData)) {
         throw new PacketFormatException('Wrong formatted S2A_PLAYER packet.');
     }
     parent::__construct(SteamPacket::S2A_PLAYER_HEADER, $contentData);
     $this->contentData->getByte();
     $this->playerHash = [];
     while ($this->contentData->remaining() > 0) {
         $playerData = [$this->contentData->getByte(), $this->contentData->getString(), $this->contentData->getLong(), $this->contentData->getFloat()];
         $this->playerHash[$playerData[1]] = new SteamPlayer($playerData[0], $playerData[1], $playerData[2], $playerData[3]);
     }
 }
 /**
  * Creates a new M2A_SERVER_BATCH response object based on the given data
  *
  * @param string $data The raw packet data replied from the server
  * @throws PacketFormatException if the packet data is not well formatted
  */
 public function __construct($data)
 {
     parent::__construct(SteamPacket::M2A_SERVER_BATCH_HEADER, $data);
     if ($this->contentData->getByte() != 10) {
         throw new PacketFormatException('Master query response is missing additional 0x0A byte.');
     }
     do {
         $firstOctet = $this->contentData->getByte();
         $secondOctet = $this->contentData->getByte();
         $thirdOctet = $this->contentData->getByte();
         $fourthOctet = $this->contentData->getByte();
         $portNumber = $this->contentData->getShort();
         $portNumber = (($portNumber & 0xff) << 8) + ($portNumber >> 8);
         $this->serverArray[] = "{$firstOctet}.{$secondOctet}.{$thirdOctet}.{$fourthOctet}:{$portNumber}";
     } while ($this->contentData->remaining() > 0);
 }
 /**
  * Creates a new S2A_RULES response object based on the given data
  *
  * @param string $contentData The raw packet data sent by the server
  * @throws PacketFormatException if the packet data is missing
  */
 public function __construct($contentData)
 {
     if (empty($contentData)) {
         throw new PacketFormatException('Wrong formatted S2A_RULES packet.');
     }
     parent::__construct(SteamPacket::S2A_RULES_HEADER, $contentData);
     $rulesCount = $this->contentData->getShort();
     $this->rulesArray = [];
     for ($x = 0; $x < $rulesCount; $x++) {
         $rule = $this->contentData->getString();
         $value = $this->contentData->getString();
         if (empty($rule)) {
             break;
         }
         $this->rulesArray[$rule] = $value;
     }
 }
 /**
  * Creates a RCON command response for the given command output
  *
  * @param string $commandResponse The output of the command executed on the
  *        server
  */
 public function __construct($commandResponse)
 {
     parent::__construct(SteamPacket::RCON_GOLDSRC_RESPONSE_HEADER, $commandResponse);
 }
 /**
  * Creates a request for the given request string
  *
  * The request string has the form <var>rcon {challenge number} {RCON
  * password} {command}</var>.
  *
  * @param string $request The request string to send to the server
  */
 public function __construct($request)
 {
     parent::__construct(0x0, $request);
 }
예제 #7
0
 /**
  * Creates a new RCON packet object with the given request ID, type and
  * content data
  *
  * @param int $requestId The request ID for the current RCON communication
  * @param int $rconHeader The header for the packet type
  * @param string $rconData The raw packet data
  */
 public function __construct($requestId, $rconHeader, $rconData = null)
 {
     parent::__construct($rconHeader, "{$rconData}");
     $this->requestId = $requestId;
 }