cvs: pear /Net_GameServerQuery/GameServerQuery/Protocol Doom3.php
| From: | Tom Buskens | Date: | Tue, 03 Aug 2004 10:13:07 +0000 |
| Subject: | cvs: pear /Net_GameServerQuery/GameServerQuery/Protocol Doom3.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-22511@lists.php.net to get a copy of this message | ||
ortega Tue Aug 3 06:13:07 2004 EDT
Added files:
/pear/Net_GameServerQuery/GameServerQuery/Protocol Doom3.php
Log:
initial commit, some data not extracted
http://cvs.php.net/co.php/pear/Net_GameServerQuery/GameServerQuery/Protocol/Doom3.php?r=1.1&p=1
Index: pear/Net_GameServerQuery/GameServerQuery/Protocol/Doom3.php
+++ pear/Net_GameServerQuery/GameServerQuery/Protocol/Doom3.php
<?php
// +----------------------------------------------------------------------+
// | PHP version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2004 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.php.net/license/3_0.txt.
|
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Aidan Lister <aidan@php.net> |
// | Tom Buskens <ortega@php.net> |
// +----------------------------------------------------------------------+
//
// $Id: Doom3.php,v 1.1 2004/08/03 10:13:06 ortega Exp $
/**
* Doom 3 Protocol
*
* @category Net
* @package Net_GameServerQuery
* @author Tom Buskens <ortega@php.net>
* @version $Revision: 1.1 $
*/
class Net_GameServerQuery_Protocol_Doom3 extends Net_GameServerQuery_Protocol
{
/**
* Constructor
*
* @access public
*/
public function __construct()
{
parent::__construct();
// Define packets
$this->_packets = array(
'getinfo' => "\xFF\xFFgetInfo\x00\x00\x00\x00\x00"
);
// Define packet mapping array
$this->_map = array(
'status' => 'getinfo'
);
}
/**
* Details packet
*
* @access private
* @return array Array containing formatted server response
*/
protected function _getinfo()
{
hexdump($this->_response);
// Header
if (!$this->_match("\xff\xffinfoResponse")) {
return false;
}
// Two integers probably, look at this later
if ($this->_match("(.{4})(.{4})\\x00")) {
print_r(unpack("Va", $this->_result[2]));
}
else {
return false;
}
// Variable / value pairs
while ($this->_match("([^\\x00]+)\\x00([^\\x00]*)\\x00")) {
$this->_addVar($this->_result[1], $this->_result[2]);
}
// End marker for variables?
if (!$this->_match("\\x00\\x00")) {
return false;
}
// Players (ping and score in here somehwere)
while ($this->_match("(.)(.{6})([^\\x00]+)\\x00")) {
$this->_addVar('playerid',
$this->_convert->toInt($this->_result[1], 8));
$this->_addVar('playername', $this->_result[3]));
}
return $this->_output;
}
}
?>