mirror of
https://github.com/DaKerboul/perun.git
synced 2026-08-09 17:05:39 +02:00
Changed frames ids , updated readme
This commit is contained in:
@@ -69,35 +69,22 @@ public class DatabaseController
|
|||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
// General status information (diagnostic information)
|
// General status information (diagnostic information)
|
||||||
LogInfo = $"Players data received";
|
LogInfo = $"Status data updated";
|
||||||
|
|
||||||
TCPFrame.payload["v_win"] = "v" + Globals.VersionPerun; // Inject app version information (for database)
|
TCPFrame.payload.server["v_win"] = "v" + Globals.VersionPerun; // Inject app version information (for database)
|
||||||
Globals.VersionDCSHook = TCPFrame.payload.v_dcs_hook; // Pull DCS hook version (for app)
|
Globals.VersionDCSHook = TCPFrame.payload.v_dcs_hook; // Pull DCS hook version (for app)
|
||||||
|
|
||||||
SQLQueryTxt += "INSERT INTO `pe_OnlineStatus` (`pe_OnlineStatus_instance`) SELECT '" + Int32.Parse(TCPFrameInstance) + "' FROM DUAL WHERE NOT EXISTS(SELECT * FROM `pe_OnlineStatus` WHERE `pe_OnlineStatus_instance` = '" + Int32.Parse(TCPFrameInstance) + "');";
|
SQLQueryTxt += "INSERT INTO `pe_OnlineStatus` (`pe_OnlineStatus_instance`) SELECT '" + Int32.Parse(TCPFrameInstance) + "' FROM DUAL WHERE NOT EXISTS(SELECT * FROM `pe_OnlineStatus` WHERE `pe_OnlineStatus_instance` = '" + Int32.Parse(TCPFrameInstance) + "');";
|
||||||
SQLQueryTxt += "UPDATE `pe_OnlineStatus` SET `pe_OnlineStatus_perunversion_winapp` = '" + TCPFrame.payload.v_win + "', `pe_OnlineStatus_perunversion_dcshook` ='" + TCPFrame.payload.v_dcs_hook + "' WHERE `pe_OnlineStatus_instance` = '" + Int32.Parse(TCPFrameInstance) + "' ;";
|
SQLQueryTxt += "UPDATE `pe_OnlineStatus` SET `pe_OnlineStatus_perunversion_winapp` = '" + TCPFrame.payload.server.v_win + "', `pe_OnlineStatus_perunversion_dcshook` ='" + TCPFrame.payload.server.v_dcs_hook + "' WHERE `pe_OnlineStatus_instance` = '" + Int32.Parse(TCPFrameInstance) + "' ;";
|
||||||
|
|
||||||
DatabaseCommand = new MySqlCommand(SQLQueryTxt, DatabaseConnection);
|
|
||||||
TCPFramePayload = JsonConvert.SerializeObject(TCPFrame.payload); // Deserialize payload
|
|
||||||
DatabaseCommand.Parameters.AddWithValue("@PAR_TCPFramePayload", TCPFramePayload);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
// Status Data (basic mission etc)
|
|
||||||
LogInfo = $"Mission data received";
|
|
||||||
|
|
||||||
SQLQueryTxt += "DELETE FROM pe_OnlinePlayers WHERE pe_OnlinePlayers_instance = " + Int32.Parse(TCPFrameInstance) + ";";
|
SQLQueryTxt += "DELETE FROM pe_OnlinePlayers WHERE pe_OnlinePlayers_instance = " + Int32.Parse(TCPFrameInstance) + ";";
|
||||||
|
|
||||||
int player_count = 0;
|
int player_count = 0;
|
||||||
foreach (var record_player in TCPFrame.payload.players)
|
foreach (var record_player in TCPFrame.payload.clients)
|
||||||
{
|
{
|
||||||
SQLQueryTxt += "INSERT INTO `pe_OnlinePlayers` (`pe_OnlinePlayers_id`, `pe_OnlinePlayers_instance`, `pe_OnlinePlayers_ping`, `pe_OnlinePlayers_side`, `pe_OnlinePlayers_slot`, `pe_OnlinePlayers_ucid`) VALUES (" + record_player.id + ", '" + Int32.Parse(TCPFrameInstance) + "', '" + record_player.ping + "', '" + record_player.side + "', '" + record_player.slot + "', '" + record_player.ucid + "');";
|
SQLQueryTxt += "INSERT INTO `pe_OnlinePlayers` (`pe_OnlinePlayers_id`, `pe_OnlinePlayers_instance`, `pe_OnlinePlayers_ping`, `pe_OnlinePlayers_side`, `pe_OnlinePlayers_slot`, `pe_OnlinePlayers_ucid`) VALUES (" + record_player.id + ", '" + Int32.Parse(TCPFrameInstance) + "', '" + record_player.ping + "', '" + record_player.side + "', '" + record_player.slot + "', '" + record_player.ucid + "');";
|
||||||
player_count++;
|
player_count++;
|
||||||
Globals.CurrentMission.PlayerCount = player_count; // Save information for GUI - player count
|
Globals.CurrentMission.PlayerCount = player_count; // Save information for GUI - player count
|
||||||
}
|
}
|
||||||
|
|
||||||
//SQLQueryTxt += "DELETE FROM pe_OnlineStatus WHERE pe_OnlineStatus_instance = " + Int32.Parse(TCPFrameInstance) + ";";
|
|
||||||
SQLQueryTxt += "INSERT INTO `pe_OnlineStatus` (`pe_OnlineStatus_instance`) SELECT '" + Int32.Parse(TCPFrameInstance) + "' FROM DUAL WHERE NOT EXISTS(SELECT * FROM `pe_OnlineStatus` WHERE `pe_OnlineStatus_instance` = '" + Int32.Parse(TCPFrameInstance) + "');";
|
SQLQueryTxt += "INSERT INTO `pe_OnlineStatus` (`pe_OnlineStatus_instance`) SELECT '" + Int32.Parse(TCPFrameInstance) + "' FROM DUAL WHERE NOT EXISTS(SELECT * FROM `pe_OnlineStatus` WHERE `pe_OnlineStatus_instance` = '" + Int32.Parse(TCPFrameInstance) + "');";
|
||||||
SQLQueryTxt += "UPDATE `pe_OnlineStatus` SET `pe_OnlineStatus_theatre` = '" + TCPFrame.payload.mission.theatre + "', `pe_OnlineStatus_name` = '" + TCPFrame.payload.mission.name + "' , `pe_OnlineStatus_pause` = '" + TCPFrame.payload.mission.pause + "', `pe_OnlineStatus_multiplayer` = '" + TCPFrame.payload.mission.multiplayer + "', `pe_OnlineStatus_realtime` = '" + TCPFrame.payload.mission.realtime + "', `pe_OnlineStatus_modeltime` = '" + TCPFrame.payload.mission.modeltime + "', `pe_OnlineStatus_players` = " + player_count + " WHERE `pe_OnlineStatus_instance` = '" + Int32.Parse(TCPFrameInstance) + "';";
|
SQLQueryTxt += "UPDATE `pe_OnlineStatus` SET `pe_OnlineStatus_theatre` = '" + TCPFrame.payload.mission.theatre + "', `pe_OnlineStatus_name` = '" + TCPFrame.payload.mission.name + "' , `pe_OnlineStatus_pause` = '" + TCPFrame.payload.mission.pause + "', `pe_OnlineStatus_multiplayer` = '" + TCPFrame.payload.mission.multiplayer + "', `pe_OnlineStatus_realtime` = '" + TCPFrame.payload.mission.realtime + "', `pe_OnlineStatus_modeltime` = '" + TCPFrame.payload.mission.modeltime + "', `pe_OnlineStatus_players` = " + player_count + " WHERE `pe_OnlineStatus_instance` = '" + Int32.Parse(TCPFrameInstance) + "';";
|
||||||
|
|
||||||
@@ -113,9 +100,10 @@ public class DatabaseController
|
|||||||
Globals.CurrentMission.ModelTime = TCPFrame.payload.mission.modeltime; // Mission time
|
Globals.CurrentMission.ModelTime = TCPFrame.payload.mission.modeltime; // Mission time
|
||||||
Globals.CurrentMission.RealTime = TCPFrame.payload.mission.realtime; // Since start of server
|
Globals.CurrentMission.RealTime = TCPFrame.payload.mission.realtime; // Since start of server
|
||||||
break;
|
break;
|
||||||
case 3:
|
|
||||||
|
case 2:
|
||||||
// Slots Data (basic mission etc)
|
// Slots Data (basic mission etc)
|
||||||
LogInfo = $"Slots data received";
|
LogInfo = $"Slots data updated";
|
||||||
|
|
||||||
DatabaseCommand = new MySqlCommand(SQLQueryTxt, DatabaseConnection);
|
DatabaseCommand = new MySqlCommand(SQLQueryTxt, DatabaseConnection);
|
||||||
TCPFramePayload = JsonConvert.SerializeObject(TCPFrame.payload); // Deserialize payload
|
TCPFramePayload = JsonConvert.SerializeObject(TCPFrame.payload); // Deserialize payload
|
||||||
@@ -141,7 +129,7 @@ public class DatabaseController
|
|||||||
|
|
||||||
case 51:
|
case 51:
|
||||||
// Add entry to event log
|
// Add entry to event log
|
||||||
LogInfo = $"Game event \"{TCPFrame.payload.log_content}\" -> send";
|
LogInfo = $"Game event \"{TCPFrame.payload.log_content}\" -> saved";
|
||||||
|
|
||||||
SQLQueryTxt = "INSERT INTO `pe_DataMissionHashes` (`pe_DataMissionHashes_hash`,`pe_DataMissionHashes_instance`) SELECT '" + TCPFrame.payload.log_missionhash + "','" + TCPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataMissionHashes` where `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.log_missionhash + "' AND `pe_DataMissionHashes_instance`=" + TCPFrameInstance + ");";
|
SQLQueryTxt = "INSERT INTO `pe_DataMissionHashes` (`pe_DataMissionHashes_hash`,`pe_DataMissionHashes_instance`) SELECT '" + TCPFrame.payload.log_missionhash + "','" + TCPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataMissionHashes` where `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.log_missionhash + "' AND `pe_DataMissionHashes_instance`=" + TCPFrameInstance + ");";
|
||||||
SQLQueryTxt += "UPDATE `pe_DataMissionHashes` SET `pe_DataMissionHashes_datetime` = " + TCPFrameTimestamp + " WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.log_missionhash + "' AND `pe_DataMissionHashes_instance`=" + TCPFrameInstance + ";";
|
SQLQueryTxt += "UPDATE `pe_DataMissionHashes` SET `pe_DataMissionHashes_datetime` = " + TCPFrameTimestamp + " WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.log_missionhash + "' AND `pe_DataMissionHashes_instance`=" + TCPFrameInstance + ";";
|
||||||
@@ -189,14 +177,17 @@ public class DatabaseController
|
|||||||
// Switch to insert correct log information
|
// Switch to insert correct log information
|
||||||
switch (Int32.Parse(TCPFrameType))
|
switch (Int32.Parse(TCPFrameType))
|
||||||
{
|
{
|
||||||
|
case 3:
|
||||||
|
LogInfo = "Mission data updated";
|
||||||
|
break;
|
||||||
case 100:
|
case 100:
|
||||||
LogInfo = "DCS SRS data send";
|
LogInfo = "DCS SRS data updated";
|
||||||
break;
|
break;
|
||||||
case 101:
|
case 101:
|
||||||
LogInfo = "LotATC data send";
|
LogInfo = "LotATC data updated";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LogInfo = "Unknown data send";
|
LogInfo = "Unknown data updated";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
38
README.md
38
README.md
@@ -95,28 +95,26 @@ DCS API does not track carrier or FARP operations natively, so there is a trick
|
|||||||

|

|
||||||
|
|
||||||
## Data packets - send from lua to TCP port
|
## Data packets - send from lua to TCP port
|
||||||
* ```ID: 1```, contains version/diagnostic information
|
* ```ID: 1```, stats update [periodic update]
|
||||||
* perun version - for server administration usage
|
* server - various information for server administration usage
|
||||||
* player count - actual number of connected players
|
* mission - short information about runing mission
|
||||||
* ```ID: 2```, contains status data in the following sections
|
* mission name - name of the mission file
|
||||||
* mission name - name of the mission file
|
* model time - simulation time
|
||||||
* model time - simulation time
|
* real time - real time
|
||||||
* real time - real time
|
* pause - information if server is paused
|
||||||
* pause - information if server is paused
|
* multiplayer - information if this is multiplayer game (always true for dedicated server usage)
|
||||||
* multiplayer - information if this is multiplayer game (always true for dedicated server usage)
|
* theather - information about area of operation
|
||||||
* theather - information about area of operation
|
* clients - list of connected players
|
||||||
* weather - basic weather information
|
* ```ID: 2```, available slots list and coalitions [updated on mision start or Perun reconnection]
|
||||||
* players - connected players
|
|
||||||
* ```ID: 3```, available slots list and coalitions
|
|
||||||
* coalitions - available coalitions
|
* coalitions - available coalitions
|
||||||
* slots - available slots
|
* slots - available slots
|
||||||
* ```ID: 4```, stores mission data ; idea is to have whole DCS.getCurrentMission() result - currenlty commented out due to performance issues
|
* ```ID: 3```, stores mission data [updated on mision start or Perun reconnection]
|
||||||
* ```ID: 50```, chat event
|
* ```ID: 50```, chat event [event triggered]
|
||||||
* ```ID: 51```, game event
|
* ```ID: 51```, game event [event triggered]
|
||||||
* ```ID: 52```, player stats ; note that as DSC native stats are not reliable, seperate stats couting methods are used
|
* ```ID: 52```, player stats ; note that as DSC native stats are not reliable, seperate stats couting methods are used [event triggered]
|
||||||
* ```ID: 53```, player login to DCS server
|
* ```ID: 53```, player login to DCS server [event triggered]
|
||||||
* ```ID: 100```, DCS SRS's client-list.json
|
* ```ID: 100```, DCS SRS's client-list.json [updated every 60s, only between Perun and database]
|
||||||
* ```ID: 101```, LotATC's stats.json
|
* ```ID: 101```, LotATC's stats.json [updated every 60s,only between Perun and database]
|
||||||
|
|
||||||
# Project information
|
# Project information
|
||||||
## Built With
|
## Built With
|
||||||
|
|||||||
Reference in New Issue
Block a user