cvs: pear /Net_GameServerQuery/GameServerQuery/Protocol Doom3.php

From: Date: Tue, 03 Aug 2004 13:48:09 +0000
Subject: cvs: pear /Net_GameServerQuery/GameServerQuery/Protocol Doom3.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-22521@lists.php.net to get a copy of this message
ortega Tue Aug 3 09:48:09 2004 EDT Modified files: /pear/Net_GameServerQuery/GameServerQuery/Protocol Doom3.php Log: more variables added http://cvs.php.net/diff.php/pear/Net_GameServerQuery/GameServerQuery/Protocol/Doom3.php?r1=1.3&r2=1.4&ty=u Index: pear/Net_GameServerQuery/GameServerQuery/Protocol/Doom3.php diff -u pear/Net_GameServerQuery/GameServerQuery/Protocol/Doom3.php:1.3 pear/Net_GameServerQuery/GameServerQuery/Protocol/Doom3.php:1.4 --- pear/Net_GameServerQuery/GameServerQuery/Protocol/Doom3.php:1.3 Tue Aug 3 06:24:39 2004 +++ pear/Net_GameServerQuery/GameServerQuery/Protocol/Doom3.php Tue Aug 3 09:48:08 2004 @@ -16,7 +16,7 @@ // | Tom Buskens <ortega@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Doom3.php,v 1.3 2004/08/03 10:24:39 aidan Exp $ +// $Id: Doom3.php,v 1.4 2004/08/03 13:48:08 ortega Exp $ /** @@ -25,7 +25,7 @@ * @category Net * @package Net_GameServerQuery * @author Tom Buskens <ortega@php.net> - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ */ class Net_GameServerQuery_Protocol_Doom3 extends Net_GameServerQuery_Protocol { @@ -63,10 +63,8 @@ return false; } - // Two integers probably, look at this later - if ($this->_match("(.{4})(.{4})\\x00")) { - print_r(unpack("Va", $this->_result[2])); - } else { + // Probably a (protocol) version number + if (!$this->_match("(.{8})\\x00")) { return false; } @@ -81,9 +79,19 @@ } // Players (ping and score in here somehwere) - while ($this->_match("(.)(.{6})([^\\x00]+)\\x00")) { + while ($this->_match("(.)(..)(.)(.)(..)([^\\x00]+)\\x00")) { + $this->_addVar('playerid', $this->_convert->toInt($this->_result[1], 8)); - $this->_addVar('playername', $this->_result[3]); + $this->_addVar('playerping', $this->_convert->toInt($this->_result[2], 16)); + + // These are teamflags probably, either \x80\x3e or \x50\xc3, + // always \x80\x3e in deatmatch + $this->_addVar('tf0', $this->_convert->toInt($this->_result[3], 8)); + $this->_addVar('tf1', $this->_convert->toInt($this->_result[4], 8)); + + // Result[5] holds two bits, who always seem to be \x00\x00 + + $this->_addVar('playername', $this->_result[6]); } return $this->_output;

« previous php.pear.cvs (#22521) next »