-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[V7.0.0 Latest] Satisfactory query not working anymore #229
Comments
Hey! Sorry to bother you @tltneon . Any news about this? :D |
Found this: https://satisfactory.wiki.gg/wiki/Dedicated_servers/Lightweight_Query_API#Server_State . I hope this helps |
I hope this helps you: $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
if (!$socket) {
die("Failed to create socket\n");
}
// Server address and port
$serverAddress = 'satisfactory';
$serverPort = 7777;
// Unique identifier (cookie) for the request
$cookie = microtime(true) * 1000000;
// Construct PollServerState message
$protocolMagic = 0xF6D5;
$messageType = 0; // Poll Server State
$protocolVersion = 1;
$terminatorByte = 0x1;
$message = pack('vCCP', $protocolMagic, $messageType, $protocolVersion, $cookie) . chr($terminatorByte);
// Send the message to the server
socket_sendto($socket, $message, strlen($message), 0, $serverAddress, $serverPort);
// Receive the response from the server
$response = '';
$from = '';
$port = 0;
socket_recvfrom($socket, $response, 1024, 0, $from, $port);
// Parse the response
if (strlen($response) > 0) {
$offset = 0;
$responseProtocolMagic = unpack('v', substr($response, $offset, 2))[1];
$offset += 2;
$responseType = unpack('C', substr($response, $offset, 1))[1];
$offset += 1;
$responseProtocolVersion = unpack('C', substr($response, $offset, 1))[1];
$offset += 1;
$responseCookie = unpack('P', substr($response, $offset, 8))[1];
$offset += 8;
$serverState = unpack('C', substr($response, $offset, 1))[1];
$offset += 1;
$serverNetCL = unpack('V', substr($response, $offset, 4))[1];
$offset += 4;
$serverFlags = unpack('P', substr($response, $offset, 8))[1];
$offset += 8;
$numSubStates = unpack('C', substr($response, $offset, 1))[1];
$offset += 1;
// Calculate the size of SubStates
$subStatesSize = $numSubStates * 3; // Each SubState is 3 bytes (1 byte for SubStateId and 2 bytes for SubStateVersion)
$offset += $subStatesSize;
$serverNameLength = unpack('v', substr($response, $offset, 2))[1];
$offset += 2;
$serverName = substr($response, $offset, $serverNameLength);
$serverStateDescriptions = [
0 => 'Offline',
1 => 'Idle',
2 => 'Loading',
3 => 'Playing'
];
// Output the parsed response
echo "Response Protocol Magic: $responseProtocolMagic\n";
echo "Response Type: $responseType\n";
echo "Response Protocol Version: $responseProtocolVersion\n";
echo "Response Cookie: $responseCookie\n";
echo "Server State: {$serverStateDescriptions[$serverState]}\n";
echo "Server NetCL: $serverNetCL\n";
echo "Server Flags: $serverFlags\n";
echo "Number of Sub States: $numSubStates\n";
echo "Server Name: $serverName\n";
}
// Close the socket
socket_close($socket); I can`t find any way to get onlinePlayers or maxPlayers (most of the time is 4) Also this might help: https://satisfactory.wiki.gg/wiki/Dedicated_servers/HTTPS_API but there is one small problem to get it working (it also sends a lot more info): Get auth token:
but if server has password you need to do this:
both requests will return: {
"data": {
"authenticationToken": "++SECRET++"
}
} then you can query server info:
this will respond with: {
"data": {
"serverGameState": {
"activeSessionName": "Satisfactory Server",
"numConnectedPlayers": 0,
"playerLimit": 4,
"techTier": 2,
"activeSchematic": "/Script/Engine.BlueprintGeneratedClass'/Game/FactoryGame/Schematics/Progression/Schematic_2-2.Schematic_2-2_C'",
"gamePhase": "/Script/FactoryGame.FGGamePhase'/Game/FactoryGame/GamePhases/GP_Project_Assembly_Phase_0.GP_Project_Assembly_Phase_0'",
"isGameRunning": true,
"totalGameDuration": 4676,
"isGamePaused": true,
"averageTickRate": 29.950733184814453,
"autoLoadSessionName": "Satisfactory Server"
}
}
} But there are 2 things:
Hope this helps you more! |
After I updated server to release 1.0, lgsl can`t query server anymore.
I updated my lgsl admin to use 7777 for query too but no data, server shows as offline but it is online
The text was updated successfully, but these errors were encountered: