Add a bunch of reference docs

This commit is contained in:
Michael Morrison 2014-02-03 15:09:00 -06:00
parent bc6b5c9225
commit 473d9544b1
32 changed files with 1282 additions and 0 deletions

View file

@ -0,0 +1,57 @@
<?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: freelancer.php,v 1.2 2008/02/22 13:33:40 tombuskens Exp $
*/
[freelancer]
status = "\x00\x02\xf1\x26\x01\x26\xf0\x90\xa6\xf0\x26\x57\x4e\xac\xa0\xec\xf8\x68\xe4\x8d\x21"
require_once GAMEQ_BASE . 'Protocol.php';
/**
* Freelancer protocol
* UNTESTED
*
* @author Tom Buskens <t.buskens@deviation.nl>
* @version $Revision: 1.2 $
*/
class GameQ_Protocol_freelancer extends GameQ_Protocol
{
/*
* status packet
*/
public function status()
{
// Server name length @ 3
$this->p->skip(3);
$name_length = $this->p->readInt8() - 90;
// Max players @ 20
$this->p->skip(17);
$this->r->add('max_players', $this->p->readInt8() - 1);
// Num players @ 24
$this->p->skip(3);
$this->r->add('num_players', $this->p->readInt8() - 1);
// Servername @ 91
$this->p->skip(66);
$this->r->add('servername', $this->p->read($name_length));
}
}
?>

View file

@ -0,0 +1,58 @@
/*----------------------------------------------------------------------------------------------------------\
| |
| [ 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_14(&$server, &$lgsl_need, &$lgsl_fp)
{
//---------------------------------------------------------+
// REFERENCE: http://flstat.cryosphere.co.uk/global-list.php
fwrite($lgsl_fp, "\x00\x02\xf1\x26\x01\x26\xf0\x90\xa6\xf0\x26\x57\x4e\xac\xa0\xec\xf8\x68\xe4\x8d\x21");
$buffer = fread($lgsl_fp, 4096);
if (!$buffer) { return FALSE; }
//---------------------------------------------------------+
$buffer = substr($buffer, 4); // HEADER ( 00 03 F1 26 )
$buffer = substr($buffer, 4); // NOT USED ( 87 + NAME LENGTH )
$buffer = substr($buffer, 4); // NOT USED ( NAME END TO BUFFER END LENGTH )
$buffer = substr($buffer, 4); // UNKNOWN ( 80 )
$server['s']['map'] = "freelancer";
$server['s']['password'] = lgsl_unpack(lgsl_cut_byte($buffer, 4), "l") - 1 ? 1 : 0;
$server['s']['playersmax'] = lgsl_unpack(lgsl_cut_byte($buffer, 4), "l") - 1;
$server['s']['players'] = lgsl_unpack(lgsl_cut_byte($buffer, 4), "l") - 1;
$buffer = substr($buffer, 4); // UNKNOWN ( 88 )
$name_length = lgsl_unpack(lgsl_cut_byte($buffer, 4), "l");
$buffer = substr($buffer, 56); // UNKNOWN
$server['s']['name'] = lgsl_cut_byte($buffer, $name_length);
lgsl_cut_string($buffer, 0, ":");
lgsl_cut_string($buffer, 0, ":");
lgsl_cut_string($buffer, 0, ":");
lgsl_cut_string($buffer, 0, ":");
lgsl_cut_string($buffer, 0, ":");
// WHATS LEFT IS THE MOTD
$server['e']['motd'] = substr($buffer, 0, -1);
// REMOVE UTF-8 ENCODING NULLS
$server['s']['name'] = str_replace("\x00", "", $server['s']['name']);
$server['e']['motd'] = str_replace("\x00", "", $server['e']['motd']);
// DOES NOT RETURN PLAYER INFORMATION
//---------------------------------------------------------+
return TRUE;
}