mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-06 15:17:36 +00:00
Add a bunch of reference docs
This commit is contained in:
parent
bc6b5c9225
commit
473d9544b1
32 changed files with 1282 additions and 0 deletions
56
reference/cs2d/gameq.txt
Normal file
56
reference/cs2d/gameq.txt
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of GameQ.
|
||||
*
|
||||
* GameQ is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GameQ is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* $Id: cs2d.php,v 1.1 2008/04/14 18:04:50 tombuskens Exp $
|
||||
*/
|
||||
|
||||
[cs2d]
|
||||
status = "\xfa\x00"
|
||||
|
||||
|
||||
require_once GAMEQ_BASE . 'Protocol.php';
|
||||
|
||||
|
||||
/**
|
||||
* Counterstrike 2d Protocol
|
||||
*
|
||||
* @author Tom Buskens <t.buskens@deviation.nl>
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
class GameQ_Protocol_cs2d extends GameQ_Protocol
|
||||
{
|
||||
public function status()
|
||||
{
|
||||
$this->p->skip(2);
|
||||
$this->r->add('hostname', $this->readString());
|
||||
$this->r->add('password', $this->p->readInt8());
|
||||
$this->r->add('mapname', $this->readString());
|
||||
$this->r->add('num_players', $this->p->readInt8());
|
||||
$this->r->add('max_players', $this->p->readInt8());
|
||||
$this->r->add('fog_of_war', $this->p->readInt8());
|
||||
$this->r->add('war_mode', $this->p->readInt8());
|
||||
$this->r->add('version', $this->readString());
|
||||
}
|
||||
|
||||
private function readString()
|
||||
{
|
||||
$str = $this->p->readString("\x0D");
|
||||
$this->p->skip(1);
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
?>
|
||||
70
reference/cs2d/lgsl.txt
Normal file
70
reference/cs2d/lgsl.txt
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
|
||||
/*----------------------------------------------------------------------------------------------------------\
|
||||
| |
|
||||
| [ LIVE GAME SERVER LIST ] [ © RICHARD PERRY FROM GREYCUBE.COM ] |
|
||||
| |
|
||||
| Released under the terms and conditions of the GNU General Public License Version 3 (http://gnu.org) |
|
||||
| |
|
||||
\-----------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
function lgsl_query_29(&$server, &$lgsl_need, &$lgsl_fp)
|
||||
{
|
||||
//---------------------------------------------------------+
|
||||
// REFERENCE: http://www.cs2d.com/servers.php
|
||||
|
||||
if ($lgsl_need['s'] || $lgsl_need['e'])
|
||||
{
|
||||
$lgsl_need['s'] = FALSE;
|
||||
$lgsl_need['e'] = FALSE;
|
||||
|
||||
fwrite($lgsl_fp, "\x01\x00\x03\x10\x21\xFB\x01\x75\x00");
|
||||
|
||||
$buffer = fread($lgsl_fp, 4096);
|
||||
|
||||
if (!$buffer) { return FALSE; }
|
||||
|
||||
$buffer = substr($buffer, 4); // REMOVE HEADER
|
||||
|
||||
$server['e']['bit_flags'] = ord(lgsl_cut_byte($buffer, 1)) - 48;
|
||||
$server['s']['name'] = lgsl_cut_pascal($buffer);
|
||||
$server['s']['map'] = lgsl_cut_pascal($buffer);
|
||||
$server['s']['players'] = ord(lgsl_cut_byte($buffer, 1));
|
||||
$server['s']['playersmax'] = ord(lgsl_cut_byte($buffer, 1));
|
||||
$server['e']['gamemode'] = ord(lgsl_cut_byte($buffer, 1));
|
||||
$server['e']['bots'] = ord(lgsl_cut_byte($buffer, 1));
|
||||
|
||||
$server['s']['password'] = ($server['e']['bit_flags'] & 1) ? "1" : "0";
|
||||
$server['e']['registered_only'] = ($server['e']['bit_flags'] & 2) ? "1" : "0";
|
||||
$server['e']['fog_of_war'] = ($server['e']['bit_flags'] & 4) ? "1" : "0";
|
||||
$server['e']['friendlyfire'] = ($server['e']['bit_flags'] & 8) ? "1" : "0";
|
||||
}
|
||||
|
||||
if ($lgsl_need['p'])
|
||||
{
|
||||
$lgsl_need['p'] = FALSE;
|
||||
|
||||
fwrite($lgsl_fp, "\x01\x00\xFB\x05");
|
||||
|
||||
$buffer = fread($lgsl_fp, 4096);
|
||||
|
||||
if (!$buffer) { return FALSE; }
|
||||
|
||||
$buffer = substr($buffer, 4); // REMOVE HEADER
|
||||
|
||||
$player_total = ord(lgsl_cut_byte($buffer, 1));
|
||||
|
||||
for ($i=0; $i<$player_total; $i++)
|
||||
{
|
||||
$server['p'][$i]['pid'] = ord(lgsl_cut_byte($buffer, 1));
|
||||
$server['p'][$i]['name'] = lgsl_cut_pascal($buffer);
|
||||
$server['p'][$i]['team'] = ord(lgsl_cut_byte($buffer, 1));
|
||||
$server['p'][$i]['score'] = lgsl_unpack(lgsl_cut_byte($buffer, 4), "l");
|
||||
$server['p'][$i]['deaths'] = lgsl_unpack(lgsl_cut_byte($buffer, 4), "l");
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------+
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue