コード例 #1
0
 /**
  * Creates a new S2A_INFO_DETAILED response object based on the given data
  *
  * @param string $data The raw packet data replied from the server
  */
 public function __construct($data)
 {
     parent::__construct(SteamPacket::S2A_INFO_DETAILED_HEADER, $data);
     $this->info['serverIp'] = $this->contentData->getString();
     $this->info['serverName'] = $this->contentData->getString();
     $this->info['mapName'] = $this->contentData->getString();
     $this->info['gameDir'] = $this->contentData->getString();
     $this->info['gameDescription'] = $this->contentData->getString();
     $this->info['numberOfPlayers'] = $this->contentData->getByte();
     $this->info['maxPlayers'] = $this->contentData->getByte();
     $this->info['networkVersion'] = $this->contentData->getByte();
     $this->info['dedicated'] = $this->contentData->getByte();
     $this->info['operatingSystem'] = $this->contentData->getByte();
     $this->info['passwordProtected'] = $this->contentData->getByte() == 1;
     $this->info['isMod'] = $this->contentData->getByte() == 1;
     if ($this->info['isMod']) {
         $this->info['modInfo']['urlInfo'] = $this->contentData->getString();
         $this->info['modInfo']['urlDl'] = $this->contentData->getString();
         $this->contentData->getByte();
         if ($this->contentData->remaining() == 12) {
             $this->info['modInfo']['modVersion'] = $this->contentData->getLong();
             $this->info['modInfo']['modSize'] = $this->contentData->getLong();
             $this->info['modInfo']['svOnly'] = $this->contentData->getByte() == 1;
             $this->info['modInfo']['clDll'] = $this->contentData->getByte() == 1;
             $this->info['secure'] = $this->contentData->getByte() == 1;
             $this->info['numberOfBots'] = $this->contentData->getByte();
         }
     } else {
         $this->info['secure'] = $this->contentData->getByte() == 1;
         $this->info['numberOfBots'] = $this->contentData->getByte();
     }
 }
コード例 #2
0
 /**
  * Creates a new S2A_INFO2 response object based on the given data
  *
  * @param string $data The raw packet data replied from the server
  */
 public function __construct($data)
 {
     parent::__construct(SteamPacket::S2A_INFO2_HEADER, $data);
     $this->info['networkVersion'] = $this->contentData->getByte();
     $this->info['serverName'] = $this->contentData->getString();
     $this->info['mapName'] = $this->contentData->getString();
     $this->info['gameDir'] = $this->contentData->getString();
     $this->info['gameDesc'] = $this->contentData->getString();
     $this->info['appId'] = $this->contentData->getShort();
     $this->info['numberOfPlayers'] = $this->contentData->getByte();
     $this->info['maxPlayers'] = $this->contentData->getByte();
     $this->info['botNumber'] = $this->contentData->getByte();
     $this->info['dedicated'] = chr($this->contentData->getByte());
     $this->info['operatingSystem'] = chr($this->contentData->getByte());
     $this->info['passwordProtected'] = $this->contentData->getByte() == 1;
     $this->info['secureServer'] = $this->contentData->getByte() == 1;
     $this->info['gameVersion'] = $this->contentData->getString();
     if ($this->contentData->remaining() > 0) {
         $extraDataFlag = $this->contentData->getByte();
         if ($extraDataFlag & self::EDF_GAME_PORT) {
             $this->info['serverPort'] = $this->contentData->getShort();
         }
         if ($extraDataFlag & self::EDF_SERVER_ID) {
             $this->info['serverId'] = $this->contentData->getUnsignedLong() | $this->contentData->getUnsignedLong() << 32;
         }
         if ($extraDataFlag & self::EDF_SOURCE_TV) {
             $this->info['tvPort'] = $this->contentData->getShort();
             $this->info['tvName'] = $this->contentData->getString();
         }
         if ($extraDataFlag & self::EDF_SERVER_TAGS) {
             $this->info['serverTags'] = $this->contentData->getString();
         }
         if ($extraDataFlag & self::EDF_GAME_ID) {
             $this->info['gameId'] = $this->contentData->getUnsignedLong() | $this->contentData->getUnsignedLong() << 32;
         }
     }
 }