mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-16 16:58:32 +01:00
64 lines
2.9 KiB
Text
64 lines
2.9 KiB
Text
|
|
/*----------------------------------------------------------------------------------------------------------\
|
|
| |
|
|
| [ 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_22(&$server, &$lgsl_need, &$lgsl_fp)
|
|
{
|
|
//---------------------------------------------------------+
|
|
|
|
fwrite($lgsl_fp,"\x03\x00\x00");
|
|
|
|
$buffer = fread($lgsl_fp, 4096);
|
|
$buffer = substr($buffer, 3); // REMOVE HEADER
|
|
|
|
if (!$buffer) { return FALSE; }
|
|
|
|
$response_type = ord(lgsl_cut_byte($buffer, 1)); // TYPE SHOULD BE 4
|
|
|
|
//---------------------------------------------------------+
|
|
|
|
$grf_count = ord(lgsl_cut_byte($buffer, 1));
|
|
|
|
for ($a=0; $a<$grf_count; $a++)
|
|
{
|
|
$server['e']['grf_'.$a.'_id'] = strtoupper(dechex(lgsl_unpack(lgsl_cut_byte($buffer, 4), "N")));
|
|
|
|
for ($b=0; $b<16; $b++)
|
|
{
|
|
$server['e']['grf_'.$a.'_md5'] .= strtoupper(dechex(ord(lgsl_cut_byte($buffer, 1))));
|
|
}
|
|
}
|
|
|
|
//---------------------------------------------------------+
|
|
|
|
$server['e']['date_current'] = lgsl_unpack(lgsl_cut_byte($buffer, 4), "L");
|
|
$server['e']['date_start'] = lgsl_unpack(lgsl_cut_byte($buffer, 4), "L");
|
|
$server['e']['companies_max'] = ord(lgsl_cut_byte($buffer, 1));
|
|
$server['e']['companies'] = ord(lgsl_cut_byte($buffer, 1));
|
|
$server['e']['spectators_max'] = ord(lgsl_cut_byte($buffer, 1));
|
|
$server['s']['name'] = lgsl_cut_string($buffer);
|
|
$server['e']['version'] = lgsl_cut_string($buffer);
|
|
$server['e']['language'] = ord(lgsl_cut_byte($buffer, 1));
|
|
$server['s']['password'] = ord(lgsl_cut_byte($buffer, 1));
|
|
$server['s']['playersmax'] = ord(lgsl_cut_byte($buffer, 1));
|
|
$server['s']['players'] = ord(lgsl_cut_byte($buffer, 1));
|
|
$server['e']['spectators'] = ord(lgsl_cut_byte($buffer, 1));
|
|
$server['s']['map'] = lgsl_cut_string($buffer);
|
|
$server['e']['map_width'] = lgsl_unpack(lgsl_cut_byte($buffer, 2), "S");
|
|
$server['e']['map_height'] = lgsl_unpack(lgsl_cut_byte($buffer, 2), "S");
|
|
$server['e']['map_set'] = ord(lgsl_cut_byte($buffer, 1));
|
|
$server['e']['dedicated'] = ord(lgsl_cut_byte($buffer, 1));
|
|
|
|
// DOES NOT RETURN PLAYER INFORMATION
|
|
|
|
//---------------------------------------------------------+
|
|
|
|
return TRUE;
|
|
}
|