mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-03 13:01:04 +01:00
59 lines
2.9 KiB
Plaintext
59 lines
2.9 KiB
Plaintext
|
|
/*----------------------------------------------------------------------------------------------------------\
|
|
| |
|
|
| [ 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;
|
|
}
|