Net_GameServerQuery
[ class tree: Net_GameServerQuery ] [ index: Net_GameServerQuery ] [ all elements ]

Source for file QuakeWorld.php

Documentation is available at QuakeWorld.php

  1. <?php
  2. // +----------------------------------------------------------------------+
  3. // | PHP version 4                                                        |
  4. // +----------------------------------------------------------------------+
  5. // | Copyright (c) 1997-2004 The PHP Group                                |
  6. // +----------------------------------------------------------------------+
  7. // | This source file is subject to version 3.0 of the PHP license,       |
  8. // | that is bundled with this package in the file LICENSE, and is        |
  9. // | available through the world-wide-web at the following url:           |
  10. // | http://www.php.net/license/3_0.txt.                                  |
  11. // | If you did not receive a copy of the PHP license and are unable to   |
  12. // | obtain it through the world-wide-web, please send a note to          |
  13. // | license@php.net so we can mail you a copy immediately.               |
  14. // +----------------------------------------------------------------------+
  15. // | Authors: Aidan Lister <aidan@php.net>                                |
  16. // |          Tom Buskens <ortega@php.net>                                |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: QuakeWorld.php,v 1.9 2004/09/14 11:20:49 ortega Exp $
  20.  
  21.  
  22. require_once 'Net\GameServerQuery\Protocol.php';
  23.  
  24.  
  25. /**
  26.  * QuakeWorld Protocol
  27.  *
  28.  * @category       Net
  29.  * @package        Net_GameServerQuery
  30.  * @author         Aidan Lister <aidan@php.net>
  31.  * @version        $Revision: 1.9 $
  32.  */
  33. {
  34.  
  35.     protected function _status ()
  36.     {
  37.         // Header
  38.         if (!$this->_match("\xFF\xFF\xFF\xFFn")) {
  39.             throw new Exception('Parsing error');
  40.         }
  41.  
  42.         // Normal variables
  43.         while ($this->_match('\\([^\\]+)\\([^\\]+)')) {
  44.             $this->_add($this->_result[1]$this->_result[2]);
  45.         }
  46.  
  47.         // Seperator
  48.         if (!$this->_match("\n")) {
  49.             throw new Exceptions('Parsing error');
  50.         }
  51.  
  52.         // Define player variables
  53.         $vars = array('id''score''time''ping''name''skin''color_top''color_bottom');
  54.         
  55.         // Parse players
  56.         while ($this->_match('(-?\d+) (-?\d+) (-?\d+) (-?\d+) \"(.*)\" \"(.*)\" (-?\d+) (-?\d+)')) {
  57.  
  58.             for ($i = 0; $i !== 8; $i++{
  59.                 $this->_addPlayer($vars[$i]$this->_result[$i-1]);
  60.             }
  61.         }
  62.  
  63.         return $this->_output;
  64.  
  65.     }
  66. }
  67. ?>

Documentation generated on Mon, 11 Mar 2019 13:58:55 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.