mirror of
https://github.com/DaKerboul/perun.git
synced 2026-08-09 19:55:40 +02:00
Compare commits
105 Commits
v0.8.3
...
v0.11.0-ho
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e28b5b735 | ||
|
|
b07ec7b9c3 | ||
|
|
d591da2c43 | ||
|
|
174bb1e2ef | ||
|
|
a4ce9ed254 | ||
|
|
ff268a47e4 | ||
|
|
37fd76c8ae | ||
|
|
167f3e9021 | ||
|
|
4723702d28 | ||
|
|
f6d1ec82d5 | ||
|
|
fd6b0a65ab | ||
|
|
78310771c3 | ||
|
|
18b6d8b0ce | ||
|
|
dcb9510802 | ||
|
|
d35ceafab2 | ||
|
|
84e1d97c8e | ||
|
|
9f22b0e4df | ||
|
|
699787c00e | ||
|
|
403b3df59a | ||
|
|
c2fa89e364 | ||
|
|
5b96f2387e | ||
|
|
52891a19e7 | ||
|
|
466171a756 | ||
|
|
d8a38059da | ||
|
|
57583c3501 | ||
|
|
d41495a8ab | ||
|
|
4bceb1b944 | ||
|
|
a2ac6cfcd8 | ||
|
|
c5fd25d996 | ||
|
|
fdd1f72edf | ||
|
|
b054ebc59f | ||
|
|
85260cb98a | ||
|
|
66b4702954 | ||
|
|
a1253d8057 | ||
|
|
bba09a9158 | ||
|
|
4c52f91fbb | ||
|
|
18e03947f3 | ||
|
|
7b75eba79b | ||
|
|
8e4f60649a | ||
|
|
c68a0aecd1 | ||
|
|
fc9c976387 | ||
|
|
a3c1fecae3 | ||
|
|
e37b73a4f1 | ||
|
|
1540615814 | ||
|
|
d700430333 | ||
|
|
f42a3e60a2 | ||
|
|
ff78ba1cfe | ||
|
|
a117d37bc0 | ||
|
|
c36befd5a0 | ||
|
|
1cadd04092 | ||
|
|
4cca5ee405 | ||
|
|
ca48b4bc0a | ||
|
|
c55c4efaf8 | ||
|
|
30502e6fcc | ||
|
|
7d16dc197c | ||
|
|
7ad493f5f0 | ||
|
|
2821ee9cd6 | ||
|
|
946d60c5f5 | ||
|
|
c831835dfa | ||
|
|
28b614662b | ||
|
|
5fbd071b9b | ||
|
|
26bf326e0a | ||
|
|
fc6b1d9629 | ||
|
|
c1fc566f03 | ||
|
|
382def09da | ||
|
|
fdcb82cafa | ||
|
|
fe2b9cd3f1 | ||
|
|
15707672d2 | ||
|
|
63fbb0b3bb | ||
|
|
885bbf2989 | ||
|
|
9349309645 | ||
|
|
8c6e87120e | ||
|
|
18bebf887b | ||
|
|
5b22ddd66e | ||
|
|
01d8b6ceba | ||
|
|
4d989167ba | ||
|
|
1c13b8896a | ||
|
|
a9e87b1049 | ||
|
|
c8b7abc41c | ||
|
|
7270ff8bab | ||
|
|
ed8ed6d62a | ||
|
|
9b54a0be8d | ||
|
|
becbce25c0 | ||
|
|
7c1b533d79 | ||
|
|
6c10f5bace | ||
|
|
c2b5f6258b | ||
|
|
61d2a1b16e | ||
|
|
7f9a74f57b | ||
|
|
0385aa8ee5 | ||
|
|
6423f6534c | ||
|
|
ddd72adea3 | ||
|
|
a6e809a3b1 | ||
|
|
c01d5da10f | ||
|
|
087dbe84af | ||
|
|
078ba09cc7 | ||
|
|
14c5a8896f | ||
|
|
57f90954d3 | ||
|
|
a341d06dc8 | ||
|
|
75f1e0d316 | ||
|
|
4bd536f556 | ||
|
|
fcdf6ed0be | ||
|
|
6d64f7f6e0 | ||
|
|
5b0ee02e11 | ||
|
|
55fe32f0fd | ||
|
|
ec1d6b3a5e |
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
[]
|
||||
@@ -8,13 +8,19 @@ EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{5A710507-92E9-4664-9B91-918B8B82F107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5A710507-92E9-4664-9B91-918B8B82F107}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5A710507-92E9-4664-9B91-918B8B82F107}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{5A710507-92E9-4664-9B91-918B8B82F107}.Debug|x64.Build.0 = Debug|x64
|
||||
{5A710507-92E9-4664-9B91-918B8B82F107}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5A710507-92E9-4664-9B91-918B8B82F107}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5A710507-92E9-4664-9B91-918B8B82F107}.Release|x64.ActiveCfg = Release|x64
|
||||
{5A710507-92E9-4664-9B91-918B8B82F107}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -21,7 +21,6 @@ public class DatabaseController
|
||||
string TCPFrameTimestamp = TCPFrame.timestamp;
|
||||
string TCPFrameInstance = TCPFrame.instance;
|
||||
string TCPFramePayload;
|
||||
string TCPFramePayload_Perun;
|
||||
string SQLQueryTxt;
|
||||
int ReturnValue = 1;
|
||||
|
||||
@@ -49,39 +48,36 @@ public class DatabaseController
|
||||
{
|
||||
// Add entry to chat log
|
||||
SQLQueryTxt = "INSERT INTO `pe_DataPlayers` (`pe_DataPlayers_ucid`) SELECT '" + TCPFrame.payload.ucid + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataPlayers` where `pe_DataPlayers_ucid` = '" + TCPFrame.payload.ucid + "' );";
|
||||
SQLQueryTxt += "UPDATE `pe_DataPlayers` SET `pe_DataPlayers_updated` = " + TCPFrameTimestamp + ",`pe_DataPlayers_lastname`='" + TCPFrame.payload.player + "' WHERE `pe_DataPlayers_ucid`='" + TCPFrame.payload.ucid + "' ;";
|
||||
SQLQueryTxt += "UPDATE `pe_DataPlayers` SET `pe_DataPlayers_updated` = " + TCPFrameTimestamp + ",`pe_DataPlayers_lastname`=@PAR_payload_player WHERE `pe_DataPlayers_ucid`='" + TCPFrame.payload.ucid + "' ;";
|
||||
SQLQueryTxt += "INSERT INTO `pe_DataMissionHashes` (`pe_DataMissionHashes_hash`,`pe_DataMissionHashes_instance`) SELECT '" + TCPFrame.payload.missionhash + "','" + TCPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataMissionHashes` where `pe_DataMissionHashes_hash` ='" + TCPFrame.payload.missionhash + "' AND `pe_DataMissionHashes_instance`=" + TCPFrameInstance + ");";
|
||||
SQLQueryTxt += "UPDATE `pe_DataMissionHashes` SET `pe_DataMissionHashes_datetime` = " + TCPFrameTimestamp + " WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.missionhash + "' AND `pe_DataMissionHashes_instance`=" + TCPFrameInstance + " ;";
|
||||
SQLQueryTxt += "INSERT INTO `pe_LogChat` (`pe_LogChat_id`,`pe_LogChat_datetime`, `pe_LogChat_playerid`, `pe_LogChat_msg`, `pe_LogChat_all`,`pe_LogChat_missionhash_id`) VALUES (NULL,'" + TCPFrame.payload.datetime + "', (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + TCPFrame.payload.ucid + "'), '" + TCPFrame.payload.msg + "', '" + TCPFrame.payload.all + "',(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.missionhash + "'));";
|
||||
SQLQueryTxt += "INSERT INTO `pe_LogChat` (`pe_LogChat_id`,`pe_LogChat_datetime`, `pe_LogChat_playerid`, `pe_LogChat_msg`, `pe_LogChat_all`,`pe_LogChat_missionhash_id`) VALUES (NULL,'" + TCPFrame.payload.datetime + "', (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + TCPFrame.payload.ucid + "'), @PAR_payload_msg, '" + TCPFrame.payload.all + "',(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.missionhash + "'));";
|
||||
}
|
||||
else if (TCPFrameType == "51")
|
||||
{
|
||||
// Add entry to event log
|
||||
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 += "INSERT INTO `pe_LogEvent` (`pe_LogEvent_arg1`,`pe_LogEvent_arg2`,`pe_LogEvent_id`, `pe_LogEvent_datetime`, `pe_LogEvent_type`, `pe_LogEvent_content`,`pe_LogEvent_missionhash_id`) VALUES ('" + TCPFrame.payload.log_arg_1 + "','" + TCPFrame.payload.log_arg_2 + "', NULL, '" + TCPFrame.payload.log_datetime + "', '" + TCPFrame.payload.log_type + "', '" + TCPFrame.payload.log_content + "', (SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.log_missionhash + "'));";
|
||||
SQLQueryTxt += "INSERT INTO `pe_LogEvent` (`pe_LogEvent_arg1`,`pe_LogEvent_arg2`,`pe_LogEvent_id`, `pe_LogEvent_datetime`, `pe_LogEvent_type`, `pe_LogEvent_content`,`pe_LogEvent_missionhash_id`) VALUES ('" + TCPFrame.payload.log_arg_1 + "','" + TCPFrame.payload.log_arg_2 + "', NULL, '" + TCPFrame.payload.log_datetime + "', '" + TCPFrame.payload.log_type + "', @PAR_log_content, (SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.log_missionhash + "'));";
|
||||
}
|
||||
else if (TCPFrameType == "52")
|
||||
{
|
||||
// Update user stats
|
||||
TCPFramePayload = JsonConvert.SerializeObject(TCPFrame.payload.stat_data_dcs); // Deserialize payload
|
||||
TCPFramePayload_Perun = JsonConvert.SerializeObject(TCPFrame.payload.stat_data_perun); // Deserialize payload
|
||||
|
||||
SQLQueryTxt = "INSERT INTO `pe_DataMissionHashes` (`pe_DataMissionHashes_hash`,`pe_DataMissionHashes_instance`) SELECT '" + TCPFrame.payload.stat_missionhash + "','" + TCPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataMissionHashes` where `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.stat_missionhash + "' AND `pe_DataMissionHashes_instance`=" + TCPFrameInstance + ");";
|
||||
SQLQueryTxt += "UPDATE `pe_DataMissionHashes` SET `pe_DataMissionHashes_datetime` = " + TCPFrameTimestamp + " WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.stat_missionhash + "' AND `pe_DataMissionHashes_instance`=" + TCPFrameInstance + " ;";
|
||||
SQLQueryTxt += "INSERT INTO `pe_DataPlayers` (`pe_DataPlayers_ucid`) SELECT '" + TCPFrame.payload.stat_ucid + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataPlayers` where `pe_DataPlayers_ucid` = '" + TCPFrame.payload.stat_ucid + "');";
|
||||
SQLQueryTxt += "UPDATE `pe_DataPlayers` SET `pe_DataPlayers_updated`=" + TCPFrameTimestamp + " WHERE `pe_DataPlayers_ucid`='" + TCPFrame.payload.stat_ucid + "';";
|
||||
SQLQueryTxt += "INSERT INTO `pe_DataTypes` (`pe_DataTypes_name`) SELECT '" + TCPFrame.payload.stat_data_type + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + TCPFrame.payload.stat_data_type + "');";
|
||||
SQLQueryTxt += "INSERT INTO `pe_LogStats` (`pe_LogStats_playerid`,`pe_LogStats_missionhash_id`,`pe_LogStats_typeid`) SELECT (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + TCPFrame.payload.stat_ucid + "'), (SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.stat_missionhash + "'), (SELECT pe_DataTypes_id FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + TCPFrame.payload.stat_data_type + "') FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_LogStats` WHERE `pe_LogStats_missionhash_id`=(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.stat_missionhash + "') AND `pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + TCPFrame.payload.stat_ucid + "') AND `pe_LogStats_typeid`= (SELECT pe_DataTypes_id FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + TCPFrame.payload.stat_data_type + "'));";
|
||||
SQLQueryTxt += "UPDATE `pe_LogStats` SET `ps_kills_fortification`=" + TCPFrame.payload.stat_data_perun.ps_kills_fortification + ",`ps_other_landings`=" + TCPFrame.payload.stat_data_perun.ps_other_landings + ",`ps_other_takeoffs`=" + TCPFrame.payload.stat_data_perun.ps_other_takeoffs + ",`ps_pvp`=" + TCPFrame.payload.stat_data_perun.ps_pvp + ",`ps_deaths`=" + TCPFrame.payload.stat_data_perun.ps_deaths + ",`ps_ejections`=" + TCPFrame.payload.stat_data_perun.ps_ejections + ",`ps_crashes`=" + TCPFrame.payload.stat_data_perun.ps_crashes + ",`ps_teamkills`=" + TCPFrame.payload.stat_data_perun.ps_teamkills + ",`ps_kills_planes`=" + TCPFrame.payload.stat_data_perun.ps_kills_planes + ",`ps_kills_helicopters`=" + TCPFrame.payload.stat_data_perun.ps_kills_helicopters + ",`ps_kills_air_defense`=" + TCPFrame.payload.stat_data_perun.ps_kills_air_defense + ",`ps_kills_armor`=" + TCPFrame.payload.stat_data_perun.ps_kills_armor + ",`ps_kills_unarmed`=" + TCPFrame.payload.stat_data_perun.ps_kills_unarmed + ",`ps_kills_infantry`=" + TCPFrame.payload.stat_data_perun.ps_kills_infantry + ",`ps_kills_ships`=" + TCPFrame.payload.stat_data_perun.ps_kills_ships + ",`ps_kills_other`=" + TCPFrame.payload.stat_data_perun.ps_kills_other + ",`ps_airfield_takeoffs`=" + TCPFrame.payload.stat_data_perun.ps_airfield_takeoffs + ",`ps_airfield_landings`=" + TCPFrame.payload.stat_data_perun.ps_airfield_landings + ",`ps_ship_takeoffs`=" + TCPFrame.payload.stat_data_perun.ps_ship_takeoffs + ",`ps_ship_landings`=" + TCPFrame.payload.stat_data_perun.ps_ship_landings + ",`ps_farp_takeoffs`=" + TCPFrame.payload.stat_data_perun.ps_farp_takeoffs + ",`ps_farp_landings`=" + TCPFrame.payload.stat_data_perun.ps_farp_landings + ", `pe_LogStats_datetime`='" + TCPFrame.payload.stat_datetime + "',`pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + TCPFrame.payload.stat_ucid + "'),`pe_LogStats_missionhash_id`=(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.stat_missionhash + "') WHERE `pe_LogStats_missionhash_id`=(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.stat_missionhash + "') AND `pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + TCPFrame.payload.stat_ucid + "') AND `pe_LogStats_typeid`=(SELECT pe_DataTypes_id FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + TCPFrame.payload.stat_data_type + "');";
|
||||
SQLQueryTxt += "UPDATE `pe_LogStats` SET `ps_time`=" + TCPFrame.payload.stat_data_perun.ps_time + ",`pe_LogStats_seat`=" + TCPFrame.payload.stat_data_subslot + ",`pe_LogStats_masterslot`=" + TCPFrame.payload.stat_data_masterslot + ",`ps_kills_fortification`=" + TCPFrame.payload.stat_data_perun.ps_kills_fortification +",`ps_kills_artillery`=" + TCPFrame.payload.stat_data_perun.ps_kills_artillery + ",`ps_other_landings`=" + TCPFrame.payload.stat_data_perun.ps_other_landings + ",`ps_other_takeoffs`=" + TCPFrame.payload.stat_data_perun.ps_other_takeoffs + ",`ps_pvp`=" + TCPFrame.payload.stat_data_perun.ps_pvp + ",`ps_deaths`=" + TCPFrame.payload.stat_data_perun.ps_deaths + ",`ps_ejections`=" + TCPFrame.payload.stat_data_perun.ps_ejections + ",`ps_crashes`=" + TCPFrame.payload.stat_data_perun.ps_crashes + ",`ps_teamkills`=" + TCPFrame.payload.stat_data_perun.ps_teamkills + ",`ps_kills_planes`=" + TCPFrame.payload.stat_data_perun.ps_kills_planes + ",`ps_kills_helicopters`=" + TCPFrame.payload.stat_data_perun.ps_kills_helicopters + ",`ps_kills_air_defense`=" + TCPFrame.payload.stat_data_perun.ps_kills_air_defense + ",`ps_kills_armor`=" + TCPFrame.payload.stat_data_perun.ps_kills_armor + ",`ps_kills_unarmed`=" + TCPFrame.payload.stat_data_perun.ps_kills_unarmed + ",`ps_kills_infantry`=" + TCPFrame.payload.stat_data_perun.ps_kills_infantry + ",`ps_kills_ships`=" + TCPFrame.payload.stat_data_perun.ps_kills_ships + ",`ps_kills_other`=" + TCPFrame.payload.stat_data_perun.ps_kills_other + ",`ps_airfield_takeoffs`=" + TCPFrame.payload.stat_data_perun.ps_airfield_takeoffs + ",`ps_airfield_landings`=" + TCPFrame.payload.stat_data_perun.ps_airfield_landings + ",`ps_ship_takeoffs`=" + TCPFrame.payload.stat_data_perun.ps_ship_takeoffs + ",`ps_ship_landings`=" + TCPFrame.payload.stat_data_perun.ps_ship_landings + ",`ps_farp_takeoffs`=" + TCPFrame.payload.stat_data_perun.ps_farp_takeoffs + ",`ps_farp_landings`=" + TCPFrame.payload.stat_data_perun.ps_farp_landings + ", `pe_LogStats_datetime`='" + TCPFrame.payload.stat_datetime + "',`pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + TCPFrame.payload.stat_ucid + "'),`pe_LogStats_missionhash_id`=(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.stat_missionhash + "') WHERE `pe_LogStats_missionhash_id`=(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.stat_missionhash + "') AND `pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + TCPFrame.payload.stat_ucid + "') AND `pe_LogStats_typeid`=(SELECT pe_DataTypes_id FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + TCPFrame.payload.stat_data_type + "');";
|
||||
}
|
||||
else if (TCPFrameType == "53")
|
||||
{
|
||||
// User logged in to DCS server
|
||||
|
||||
SQLQueryTxt = "INSERT INTO `pe_DataPlayers` (`pe_DataPlayers_ucid`) SELECT '" + TCPFrame.payload.login_ucid + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataPlayers` where pe_DataPlayers_ucid='" + TCPFrame.payload.login_ucid + "');";
|
||||
SQLQueryTxt += "UPDATE `pe_DataPlayers` SET pe_DataPlayers_lastip='" + TCPFrame.payload.login_ipaddr + "', pe_DataPlayers_lastname='" + TCPFrame.payload.login_name + "',pe_DataPlayers_updated='" + TCPFrame.payload.login_datetime + "' WHERE `pe_DataPlayers_ucid`= '" + TCPFrame.payload.login_ucid + "';";
|
||||
SQLQueryTxt += "INSERT INTO `pe_LogLogins` (`pe_LogLogins_datetime`, `pe_LogLogins_playerid`, `pe_LogLogins_name`, `pe_LogLogins_ip`,`pe_LogLogins_instance`) VALUES ('" + TCPFrame.payload.login_datetime + "', (SELECT pe_DataPlayers_id from pe_DataPlayers WHERE pe_DataPlayers_ucid = '" + TCPFrame.payload.login_ucid + "'), '" + TCPFrame.payload.login_name + "', '" + TCPFrame.payload.login_ipaddr + "','" + TCPFrameInstance + "');";
|
||||
SQLQueryTxt += "UPDATE `pe_DataPlayers` SET pe_DataPlayers_lastip='" + TCPFrame.payload.login_ipaddr + "', pe_DataPlayers_lastname=@PAR_login_name,pe_DataPlayers_updated='" + TCPFrame.payload.login_datetime + "' WHERE `pe_DataPlayers_ucid`= '" + TCPFrame.payload.login_ucid + "';";
|
||||
SQLQueryTxt += "INSERT INTO `pe_LogLogins` (`pe_LogLogins_datetime`, `pe_LogLogins_playerid`, `pe_LogLogins_name`, `pe_LogLogins_ip`,`pe_LogLogins_instance`) VALUES ('" + TCPFrame.payload.login_datetime + "', (SELECT pe_DataPlayers_id from pe_DataPlayers WHERE pe_DataPlayers_ucid = '" + TCPFrame.payload.login_ucid + "'), @PAR_login_name, '" + TCPFrame.payload.login_ipaddr + "','" + TCPFrameInstance + "');";
|
||||
}
|
||||
else if (TCPFrameType == "-1")
|
||||
{
|
||||
@@ -91,12 +87,44 @@ public class DatabaseController
|
||||
else
|
||||
{
|
||||
// General definition used for 1-10 type packets
|
||||
TCPFramePayload = JsonConvert.SerializeObject(TCPFrame.payload); // Deserialize payload
|
||||
|
||||
|
||||
SQLQueryTxt = "INSERT INTO `pe_DataRaw` (`pe_dataraw_type`,`pe_dataraw_instance`) SELECT '" + TCPFrameType + "','" + TCPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataRaw` WHERE `pe_dataraw_type` = '" + TCPFrameType + "' AND `pe_dataraw_instance` = " + TCPFrameInstance + ");";
|
||||
SQLQueryTxt += "UPDATE `pe_DataRaw` SET `pe_dataraw_payload` = JSON_QUOTE('" + TCPFramePayload + "'), `pe_dataraw_updated`=" + TCPFrameTimestamp + " WHERE `pe_dataraw_type`=" + TCPFrameType + " AND `pe_dataraw_instance` = " + TCPFrameInstance + ";";
|
||||
SQLQueryTxt += "UPDATE `pe_DataRaw` SET `pe_dataraw_payload` = @PAR_TCPFramePayload, `pe_dataraw_updated`=" + TCPFrameTimestamp + " WHERE `pe_dataraw_type`=" + TCPFrameType + " AND `pe_dataraw_instance` = " + TCPFrameInstance + ";";
|
||||
}
|
||||
|
||||
// Handling of special data (like parsing JSONs to DB)
|
||||
switch (Int32.Parse(TCPFrameType))
|
||||
{
|
||||
case 1:
|
||||
// General status information
|
||||
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) + "' ;";
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// SRS Data
|
||||
SQLQueryTxt += "DELETE FROM pe_OnlinePlayers WHERE pe_OnlinePlayers_instance = " + Int32.Parse(TCPFrameInstance) +";";
|
||||
|
||||
int player_count = 0;
|
||||
foreach (var record_player in TCPFrame.payload.players)
|
||||
{
|
||||
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++;
|
||||
}
|
||||
|
||||
//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 += "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) + "';";
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Connect to mysql and execute sql
|
||||
try
|
||||
{
|
||||
@@ -108,6 +136,28 @@ public class DatabaseController
|
||||
DatabaseConnection.Open();
|
||||
DatabaseStatus = true;
|
||||
MySqlCommand DatabaseCommand = new MySqlCommand(SQLQueryTxt, DatabaseConnection);
|
||||
|
||||
// Add parameters - prevent SQL injection
|
||||
if (TCPFrameType == "50")
|
||||
{
|
||||
DatabaseCommand.Parameters.AddWithValue("@PAR_payload_player", TCPFrame.payload.player);
|
||||
DatabaseCommand.Parameters.AddWithValue("@PAR_payload_msg", TCPFrame.payload.msg);
|
||||
}
|
||||
else if (TCPFrameType == "51")
|
||||
{
|
||||
DatabaseCommand.Parameters.AddWithValue("@PAR_log_content", TCPFrame.payload.log_content);
|
||||
}
|
||||
else if (TCPFrameType == "53")
|
||||
{
|
||||
DatabaseCommand.Parameters.AddWithValue("@PAR_login_name", TCPFrame.payload.login_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
TCPFramePayload = JsonConvert.SerializeObject(TCPFrame.payload); // Deserialize payload
|
||||
DatabaseCommand.Parameters.AddWithValue("@PAR_TCPFramePayload", TCPFramePayload);
|
||||
}
|
||||
// End of add parameters
|
||||
|
||||
MySqlDataReader DatabaseReader = DatabaseCommand.ExecuteReader();
|
||||
|
||||
if (DatabaseReader.HasRows)
|
||||
@@ -180,19 +230,30 @@ public class DatabaseController
|
||||
{
|
||||
case 1042: // Unable to connect to any of the specified MySQL hosts (Check Server,Port)
|
||||
PerunHelper.AddLog(ref Globals.AppLogHistory, "ERROR MySQL - unable to connect, error: " + m_ex.Message,1,1, TCPFrameType);
|
||||
DatabaseStatus = false;
|
||||
ReturnValue = 0;
|
||||
break;
|
||||
case 0: // Access denied (Check DB name,username,password)
|
||||
PerunHelper.AddLog(ref Globals.AppLogHistory, "ERROR MySQL - access denied, error: " + m_ex.Message,1,1, TCPFrameType);
|
||||
DatabaseStatus = false;
|
||||
ReturnValue = 0;
|
||||
break;
|
||||
case 1064: // Incorrect query
|
||||
PerunHelper.AddLog(ref Globals.AppLogHistory, "ERROR MySQL - query: " + SQLQueryTxt, 1, 1, TCPFrameType);
|
||||
PerunHelper.AddLog(ref Globals.AppLogHistory, "ERROR MySQL - error: " + m_ex.Message, 1, 1, TCPFrameType);
|
||||
DatabaseStatus = true; // True as connection is not broken
|
||||
ReturnValue = 1; // Return a value to remove this query from quae
|
||||
break;
|
||||
default:
|
||||
PerunHelper.AddLog(ref Globals.AppLogHistory, "ERROR MySQL - error id: " + m_ex.Number,1,1, TCPFrameType);
|
||||
PerunHelper.AddLog(ref Globals.AppLogHistory, "ERROR MySQL - query: " + SQLQueryTxt, 1, 1, TCPFrameType);
|
||||
PerunHelper.AddLog(ref Globals.AppLogHistory, "ERROR MySQL - error: " + m_ex.Message,1,1, TCPFrameType);
|
||||
DatabaseStatus = false;
|
||||
ReturnValue = 0;
|
||||
break;
|
||||
}
|
||||
Globals.ErrorsGame++;
|
||||
DatabaseStatus = false;
|
||||
ReturnValue = 0;
|
||||
|
||||
}
|
||||
DatabaseConnection.Close();
|
||||
Console.WriteLine("Sending data to MySQL - Done");
|
||||
|
||||
@@ -48,7 +48,7 @@ internal class PerunHelper
|
||||
Globals.AppUpdateGUI = true;
|
||||
}
|
||||
// Add the entry to log file
|
||||
LogController.WriteLog(DateTime.Now.ToString("yyyy-dd-MM ") + " " + DateTime.Now.ToString("HH:mm:ss") + " | Instance: "+ Globals.AppInstanceID + " | " + LogMarker + " | "+ LogDirection + " | "+ strType + " | " + strEntryToAdd);
|
||||
LogController.WriteLog(DateTime.Now.ToString("yyyy-MM-dd ") + " " + DateTime.Now.ToString("HH:mm:ss") + " | Instance: "+ Globals.AppInstanceID + " | " + LogMarker + " | "+ LogDirection + " | "+ strType + " | " + strEntryToAdd);
|
||||
}
|
||||
|
||||
public static string GetAppVersion(string strBeginning)
|
||||
@@ -60,6 +60,7 @@ internal class PerunHelper
|
||||
|
||||
public static int CheckVersions()
|
||||
{
|
||||
#if !DEBUG
|
||||
// Checks the versions of APP, DCS Hook and MySQL database
|
||||
Match match = Regex.Match(Globals.VersionPerun, @"^\d+.\d+.\d+", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
string VersionApp = "v" + match.Groups[0].Value;
|
||||
@@ -90,5 +91,8 @@ internal class PerunHelper
|
||||
}
|
||||
|
||||
return ReturnValue;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,7 @@
|
||||
this.con_img_dcs = new System.Windows.Forms.PictureBox();
|
||||
this.con_img_db = new System.Windows.Forms.PictureBox();
|
||||
this.con_Button_Add_Marker = new System.Windows.Forms.Button();
|
||||
this.TIM_Autostart = new System.Windows.Forms.Timer(this.components);
|
||||
this.con_GroupBox_1.SuspendLayout();
|
||||
this.con_GroupBox_2.SuspendLayout();
|
||||
this.con_GroupBox_3.SuspendLayout();
|
||||
@@ -157,11 +158,11 @@
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(41, 48);
|
||||
this.label6.Location = new System.Drawing.Point(19, 48);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(59, 13);
|
||||
this.label6.Size = new System.Drawing.Size(81, 13);
|
||||
this.label6.TabIndex = 9;
|
||||
this.label6.Text = "Server port";
|
||||
this.label6.Text = "MySQL DB port";
|
||||
//
|
||||
// con_txt_mysql_port
|
||||
//
|
||||
@@ -198,20 +199,20 @@
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(47, 74);
|
||||
this.label2.Location = new System.Drawing.Point(18, 74);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(53, 13);
|
||||
this.label2.Size = new System.Drawing.Size(82, 13);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "Database";
|
||||
this.label2.Text = "Database name";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(22, 22);
|
||||
this.label1.Location = new System.Drawing.Point(3, 22);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(78, 13);
|
||||
this.label1.Size = new System.Drawing.Size(100, 13);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Server address";
|
||||
this.label1.Text = "MySQL DB address";
|
||||
//
|
||||
// con_txt_mysql_database
|
||||
//
|
||||
@@ -359,11 +360,11 @@
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(41, 45);
|
||||
this.label8.Location = new System.Drawing.Point(7, 45);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(62, 13);
|
||||
this.label8.Size = new System.Drawing.Size(93, 13);
|
||||
this.label8.TabIndex = 12;
|
||||
this.label8.Text = "Instance ID";
|
||||
this.label8.Text = "Perun Instance ID";
|
||||
//
|
||||
// con_txt_dcs_instance
|
||||
//
|
||||
@@ -375,11 +376,11 @@
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(41, 19);
|
||||
this.label7.Location = new System.Drawing.Point(44, 19);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(59, 13);
|
||||
this.label7.Size = new System.Drawing.Size(56, 13);
|
||||
this.label7.TabIndex = 10;
|
||||
this.label7.Text = "Server port";
|
||||
this.label7.Text = "Perun port";
|
||||
//
|
||||
// con_txt_dcs_server_port
|
||||
//
|
||||
@@ -524,6 +525,10 @@
|
||||
this.con_Button_Add_Marker.UseVisualStyleBackColor = true;
|
||||
this.con_Button_Add_Marker.Click += new System.EventHandler(this.con_Button_Add_Marker_Click);
|
||||
//
|
||||
// TIM_Autostart
|
||||
//
|
||||
this.TIM_Autostart.Interval = 500;
|
||||
//
|
||||
// form_Main
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@@ -573,7 +578,10 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.con_img_db)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
// TIM_Autostart
|
||||
//
|
||||
this.TIM_Autostart.Tick += new System.EventHandler(this.TIM_Autostart_Tick);
|
||||
//
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -625,6 +633,7 @@
|
||||
private System.Windows.Forms.Label label13;
|
||||
private System.Windows.Forms.Label label14;
|
||||
private System.Windows.Forms.Button con_Button_Add_Marker;
|
||||
private System.Windows.Forms.Timer TIM_Autostart;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,36 +36,65 @@ namespace Perun_v1
|
||||
{
|
||||
// Get argument server port
|
||||
if (args[1] != null)
|
||||
{
|
||||
if (args[1] != "-1")
|
||||
{
|
||||
con_txt_dcs_server_port.Text = args[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (args.Length > 2)
|
||||
{
|
||||
// Get argument instance id
|
||||
if (args[2] != null)
|
||||
{
|
||||
if (args[2] != "-1")
|
||||
{
|
||||
con_txt_dcs_instance.Text = args[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (args.Length > 3)
|
||||
{
|
||||
// Get argument DCS SRS file path
|
||||
if (args[3] != null)
|
||||
{
|
||||
if (args[3] != "-1")
|
||||
{
|
||||
con_txt_3rd_srs.Text = args[3];
|
||||
con_check_3rd_srs.Checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (args.Length > 4)
|
||||
{
|
||||
// Get argument lotATC file path
|
||||
if (args[4] != null)
|
||||
{
|
||||
if (args[4] != "-1")
|
||||
{
|
||||
con_txt_3rd_lotatc.Text = args[4];
|
||||
con_check_3rd_lotatc.Checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (args.Length > 5)
|
||||
{
|
||||
// Get argument lotATC file path
|
||||
if (args[5] != null)
|
||||
{
|
||||
if (args[5] == "1")
|
||||
{
|
||||
if (args[5] != "-1")
|
||||
{
|
||||
TIM_Autostart.Enabled = true;
|
||||
PerunHelper.AddLog(ref Globals.AppLogHistory, "Autostart parameter provided", 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize controls
|
||||
con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected");
|
||||
@@ -197,6 +226,7 @@ namespace Perun_v1
|
||||
// Send initial data
|
||||
Tim_MySQL_Tick(null, null);
|
||||
tim_3rdparties_Tick(null, null);
|
||||
TIM_Autostart.Enabled = false;
|
||||
}
|
||||
|
||||
private void con_Button_Listen_OFF_Click(object sender, EventArgs e)
|
||||
@@ -506,46 +536,27 @@ namespace Perun_v1
|
||||
ExtSRSJson = System.IO.File.ReadAllText(con_txt_3rd_srs.Text);
|
||||
dynamic raw_lotatc = JsonConvert.DeserializeObject(ExtSRSJson);
|
||||
|
||||
for (int i = 0; i < raw_lotatc.Count; i++)
|
||||
for (int i = 0; i < raw_lotatc.Clients.Count; i++)
|
||||
{
|
||||
|
||||
if (raw_lotatc[i].RadioInfo != null)
|
||||
if (raw_lotatc.Clients[i].RadioInfo != null)
|
||||
{
|
||||
|
||||
int temp = raw_lotatc[i].RadioInfo.radios.Count - 1;
|
||||
int temp = raw_lotatc.Clients[i].RadioInfo.radios.Count - 1;
|
||||
for (int j = temp; j >= 0; j--)
|
||||
{
|
||||
raw_lotatc[i].RadioInfo.radios[j].enc.Parent.Remove();
|
||||
raw_lotatc[i].RadioInfo.radios[j].encKey.Parent.Remove();
|
||||
raw_lotatc[i].RadioInfo.radios[j].encMode.Parent.Remove();
|
||||
raw_lotatc[i].RadioInfo.radios[j].freqMax.Parent.Remove();
|
||||
raw_lotatc[i].RadioInfo.radios[j].freqMin.Parent.Remove();
|
||||
raw_lotatc[i].RadioInfo.radios[j].modulation.Parent.Remove();
|
||||
raw_lotatc[i].RadioInfo.radios[j].freqMode.Parent.Remove();
|
||||
raw_lotatc[i].RadioInfo.radios[j].volMode.Parent.Remove();
|
||||
raw_lotatc[i].RadioInfo.radios[j].expansion.Parent.Remove();
|
||||
raw_lotatc[i].RadioInfo.radios[j].channel.Parent.Remove();
|
||||
raw_lotatc[i].RadioInfo.radios[j].simul.Parent.Remove();
|
||||
|
||||
if (raw_lotatc[i].RadioInfo.radios[j].name == "No Radio")
|
||||
if (raw_lotatc.Clients[i].RadioInfo.radios[j].name == "No Radio")
|
||||
{
|
||||
raw_lotatc[i].RadioInfo.radios[j].Remove();
|
||||
raw_lotatc.Clients[i].RadioInfo.radios[j].Remove();
|
||||
}
|
||||
}
|
||||
raw_lotatc[i].ClientChannelId.Parent.Remove();
|
||||
raw_lotatc[i].RadioInfo.simultaneousTransmission.Parent.Remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (raw_lotatc.Count > 0)
|
||||
{
|
||||
ExtSRSJson = JsonConvert.SerializeObject(raw_lotatc);
|
||||
ExtSRSJson = "{'type':'100','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':'" + ExtSRSJson + "'}";
|
||||
}
|
||||
else
|
||||
{
|
||||
ExtSRSJson = "{'type':'100','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':{'ignore':'false'}}"; // No SRS clients connected
|
||||
}
|
||||
|
||||
ExtSRSUseDefault = false;
|
||||
PerunHelper.AddLog(ref Globals.AppLogHistory, "SRS data loaded", 3, 0, "100", true);
|
||||
ExtSRSStatus = true;
|
||||
@@ -563,8 +574,11 @@ namespace Perun_v1
|
||||
{
|
||||
ExtSRSJson = "{'type':'100','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':{'ignore':'true'}}";
|
||||
}
|
||||
if (ExtSRSStatus)
|
||||
{
|
||||
DatabaseConnection.SendToMySql(ExtSRSJson);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle LotATC
|
||||
if (Globals.StatusConnection)
|
||||
@@ -594,8 +608,11 @@ namespace Perun_v1
|
||||
{
|
||||
ExtLotATCJson = "{'type':'101','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':{'ignore':'true'}}"; // No LotATC controller connected
|
||||
}
|
||||
if (ExtLotATCStatus)
|
||||
{
|
||||
DatabaseConnection.SendToMySql(ExtLotATCJson);
|
||||
}
|
||||
}
|
||||
|
||||
// Let's do not risk int overload
|
||||
Globals.ErrorsDatabase = (Globals.ErrorsDatabase > 999) ? 999 : Globals.ErrorsDatabase;
|
||||
@@ -636,5 +653,12 @@ namespace Perun_v1
|
||||
// Added user marker
|
||||
PerunHelper.AddLog(ref Globals.AppLogHistory, "User Marker", 0, 1);
|
||||
}
|
||||
|
||||
private void TIM_Autostart_Tick(object sender, EventArgs e)
|
||||
{
|
||||
// Handle autostart parameter from command line
|
||||
TIM_Autostart.Enabled = false; // Disable timer
|
||||
con_Button_Listen_ON_Click(sender,e); // Simulate button click
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,6 +419,9 @@
|
||||
<metadata name="tim_MySQL.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>687, 19</value>
|
||||
</metadata>
|
||||
<metadata name="TIM_Autostart.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>800, 4</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>26</value>
|
||||
</metadata>
|
||||
|
||||
@@ -12,29 +12,27 @@
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>ftp://s18.mydevil.net/perun/</PublishUrl>
|
||||
<PublishUrl>C:\Users\DCS\Desktop\Perun\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Web</InstallFrom>
|
||||
<UpdateEnabled>true</UpdateEnabled>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<InstallUrl>http://share.porwolik.com/ftp/perun/</InstallUrl>
|
||||
<SupportUrl>https://github.com/szporwolik/perun</SupportUrl>
|
||||
<ErrorReportUrl>https://github.com/szporwolik/perun</ErrorReportUrl>
|
||||
<TargetCulture>en</TargetCulture>
|
||||
<ProductName>Perun for DCS World</ProductName>
|
||||
<PublisherName>szporwolik</PublisherName>
|
||||
<SuiteName>Perun</SuiteName>
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>Perun.htm</WebPage>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>0.8.3.%2a</ApplicationVersion>
|
||||
<ApplicationRevision>1</ApplicationRevision>
|
||||
<ApplicationVersion>0.11.1.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
@@ -50,6 +48,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>SecurityRules.ruleset</CodeAnalysisRuleSet>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -88,6 +87,28 @@
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>SecurityRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.3.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
|
||||
<HintPath>..\packages\BouncyCastle.1.8.3.1\lib\BouncyCastle.Crypto.dll</HintPath>
|
||||
|
||||
@@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Szymon Porwolik")]
|
||||
[assembly: AssemblyProduct("Perun for DCS World")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019-2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -33,7 +33,7 @@ using System.Runtime.InteropServices;
|
||||
// Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki
|
||||
// przy użyciu symbolu „*”, tak jak pokazano poniżej:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.8.3.0")]
|
||||
[assembly: AssemblyFileVersion("0.8.3.0")]
|
||||
[assembly: AssemblyVersion("0.11.1.0")]
|
||||
[assembly: AssemblyFileVersion("0.11.1.0")]
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
||||
|
||||
|
||||
@@ -8,35 +8,6 @@ SET time_zone = "+00:00";
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
CREATE DATABASE IF NOT EXISTS `m1081_perun` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
USE `m1081_perun`;
|
||||
|
||||
DELIMITER $$
|
||||
DROP PROCEDURE IF EXISTS `sp_CleanDatabase`$$
|
||||
CREATE DEFINER=`m1081`@`%.devil` PROCEDURE `sp_CleanDatabase` () MODIFIES SQL DATA
|
||||
BEGIN
|
||||
DELETE FROM pe_DataMissionHashes;
|
||||
DELETE FROM pe_DataPlayers;
|
||||
DELETE FROM pe_DataRaw;
|
||||
DELETE FROM pe_LogChat;
|
||||
DELETE FROM pe_LogEvent;
|
||||
DELETE FROM pe_LogLogins;
|
||||
DELETE FROM pe_LogStats;
|
||||
|
||||
ALTER TABLE pe_DataMissionHashes AUTO_INCREMENT = 1;
|
||||
ALTER TABLE pe_DataPlayers AUTO_INCREMENT = 1;
|
||||
ALTER TABLE pe_DataRaw AUTO_INCREMENT = 1;
|
||||
ALTER TABLE pe_LogChat AUTO_INCREMENT = 1;
|
||||
ALTER TABLE pe_LogEvent AUTO_INCREMENT = 1;
|
||||
ALTER TABLE pe_LogLogins AUTO_INCREMENT = 1;
|
||||
ALTER TABLE pe_LogStats AUTO_INCREMENT = 1;
|
||||
|
||||
END$$
|
||||
|
||||
DROP PROCEDURE IF EXISTS `sp_SyncForumGame`$$
|
||||
$$
|
||||
|
||||
DELIMITER ;
|
||||
|
||||
DROP TABLE IF EXISTS `pe_Config`;
|
||||
CREATE TABLE IF NOT EXISTS `pe_Config` (
|
||||
@@ -46,7 +17,7 @@ CREATE TABLE IF NOT EXISTS `pe_Config` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `pe_Config` (`pe_Config_id`, `pe_Config_payload`) VALUES
|
||||
(1, 'v0.8.3');
|
||||
(1, 'v0.11.0');
|
||||
|
||||
DROP TABLE IF EXISTS `pe_DataMissionHashes`;
|
||||
CREATE TABLE IF NOT EXISTS `pe_DataMissionHashes` (
|
||||
@@ -57,26 +28,28 @@ CREATE TABLE IF NOT EXISTS `pe_DataMissionHashes` (
|
||||
PRIMARY KEY (`pe_DataMissionHashes_id`),
|
||||
UNIQUE KEY `UNIQUE_hash` (`pe_DataMissionHashes_hash`),
|
||||
KEY `pe_DataMissionHashes_instance` (`pe_DataMissionHashes_instance`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=818 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `pe_DataPlayers`;
|
||||
CREATE TABLE IF NOT EXISTS `pe_DataPlayers` (
|
||||
`pe_DataPlayers_id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`pe_DataPlayers_ucid` varchar(150) NOT NULL,
|
||||
`pe_DataPlayers_lastname` varchar(150) NOT NULL,
|
||||
`pe_DataPlayers_lastip` varchar(100) NOT NULL,
|
||||
`pe_DataPlayers_lastname` varchar(150) DEFAULT NULL,
|
||||
`pe_DataPlayers_lastip` varchar(100) DEFAULT NULL,
|
||||
`pe_DataPlayers_updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`pe_DataPlayers_id`),
|
||||
UNIQUE KEY `UNIQUE_UCID` (`pe_DataPlayers_ucid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=219 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `pe_DataRaw`;
|
||||
CREATE TABLE IF NOT EXISTS `pe_DataRaw` (
|
||||
`pe_dataraw_type` tinyint(4) NOT NULL,
|
||||
`pe_dataraw_instance` smallint(5) UNSIGNED NOT NULL,
|
||||
`pe_dataraw_payload` text NOT NULL,
|
||||
`pe_dataraw_payload` text,
|
||||
`pe_dataraw_updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`pe_dataraw_type`,`pe_dataraw_instance`)
|
||||
PRIMARY KEY (`pe_dataraw_type`,`pe_dataraw_instance`),
|
||||
KEY `pe_dataraw_type_pe_dataraw_instance` (`pe_dataraw_type`,`pe_dataraw_instance`),
|
||||
KEY `pe_dataraw_updated` (`pe_dataraw_updated`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `pe_DataTypes`;
|
||||
@@ -86,7 +59,7 @@ CREATE TABLE IF NOT EXISTS `pe_DataTypes` (
|
||||
`pe_DataTypes_update` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`pe_DataTypes_id`),
|
||||
UNIQUE KEY `UNIQUE_TYPE_NAME` (`pe_DataTypes_name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `pe_LogChat`;
|
||||
CREATE TABLE IF NOT EXISTS `pe_LogChat` (
|
||||
@@ -99,8 +72,9 @@ CREATE TABLE IF NOT EXISTS `pe_LogChat` (
|
||||
PRIMARY KEY (`pe_LogChat_id`),
|
||||
KEY `pe_LogChat_missionhash_id` (`pe_LogChat_missionhash_id`),
|
||||
KEY `pe_LogChat_playerid` (`pe_LogChat_playerid`),
|
||||
KEY `pe_LogChat_datetime` (`pe_LogChat_datetime`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=19739 DEFAULT CHARSET=utf8;
|
||||
KEY `pe_LogChat_datetime` (`pe_LogChat_datetime`),
|
||||
KEY `pe_LogChat_all` (`pe_LogChat_all`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `pe_LogEvent`;
|
||||
CREATE TABLE IF NOT EXISTS `pe_LogEvent` (
|
||||
@@ -111,10 +85,12 @@ CREATE TABLE IF NOT EXISTS `pe_LogEvent` (
|
||||
`pe_LogEvent_content` text NOT NULL,
|
||||
`pe_LogEvent_arg1` varchar(150) DEFAULT NULL,
|
||||
`pe_LogEvent_arg2` varchar(150) DEFAULT NULL,
|
||||
`pe_LogEvent_argPlayers` varchar(150) DEFAULT NULL,
|
||||
PRIMARY KEY (`pe_LogEvent_id`),
|
||||
KEY `pe_LogEvent_missionhash_id` (`pe_LogEvent_missionhash_id`),
|
||||
KEY `pe_LogEvent_datetime` (`pe_LogEvent_datetime`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=93657 DEFAULT CHARSET=utf8;
|
||||
KEY `pe_LogEvent_datetime` (`pe_LogEvent_datetime`),
|
||||
KEY `pe_LogEvent_type_2` (`pe_LogEvent_type`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `pe_LogLogins`;
|
||||
CREATE TABLE IF NOT EXISTS `pe_LogLogins` (
|
||||
@@ -126,8 +102,9 @@ CREATE TABLE IF NOT EXISTS `pe_LogLogins` (
|
||||
`pe_LogLogins_ip` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`pe_LogLogins_id`),
|
||||
KEY `pe_LogLogins_playerid` (`pe_LogLogins_playerid`),
|
||||
KEY `pe_LogLogins_datetime` (`pe_LogLogins_datetime`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10742 DEFAULT CHARSET=utf8;
|
||||
KEY `pe_LogLogins_datetime` (`pe_LogLogins_datetime`),
|
||||
KEY `pe_LogLogins_instance` (`pe_LogLogins_instance`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `pe_LogStats`;
|
||||
CREATE TABLE IF NOT EXISTS `pe_LogStats` (
|
||||
@@ -136,7 +113,9 @@ CREATE TABLE IF NOT EXISTS `pe_LogStats` (
|
||||
`pe_LogStats_missionhash_id` bigint(20) DEFAULT NULL,
|
||||
`pe_LogStats_playerid` bigint(20) DEFAULT NULL,
|
||||
`pe_LogStats_typeid` int(11) DEFAULT NULL,
|
||||
`ps_kills` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`pe_LogStats_masterslot` int(11) DEFAULT NULL,
|
||||
`pe_LogStats_seat` int(10) DEFAULT NULL,
|
||||
`ps_kills_X` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ps_pvp` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ps_deaths` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ps_ejections` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
@@ -150,6 +129,7 @@ CREATE TABLE IF NOT EXISTS `pe_LogStats` (
|
||||
`ps_kills_infantry` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ps_kills_ships` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ps_kills_fortification` int(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ps_kills_artillery` int(10) NOT NULL DEFAULT '0',
|
||||
`ps_kills_other` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ps_airfield_takeoffs` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ps_airfield_landings` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
@@ -159,41 +139,31 @@ CREATE TABLE IF NOT EXISTS `pe_LogStats` (
|
||||
`ps_farp_landings` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ps_other_landings` int(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ps_other_takeoffs` int(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ps_time` int(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`pe_LogStats_mstatus` enum('?','RTB','MIA','KIA') DEFAULT NULL,
|
||||
`ps_takeoffs` int(10) UNSIGNED DEFAULT '0',
|
||||
`ps_landings` int(10) UNSIGNED DEFAULT '0',
|
||||
`ps_kills_AA` int(10) UNSIGNED DEFAULT '0',
|
||||
`ps_kills_AG` int(10) UNSIGNED DEFAULT '0',
|
||||
`ps_kills_AS` int(10) UNSIGNED DEFAULT '0',
|
||||
`ps_kills_AAA` int(10) UNSIGNED DEFAULT '0',
|
||||
PRIMARY KEY (`pe_LogStats_id`),
|
||||
UNIQUE KEY `UNIQUE_STATS_PER_MISSION_AND_UCID_AND_TYPE` (`pe_LogStats_playerid`,`pe_LogStats_missionhash_id`,`pe_LogStats_typeid`) USING BTREE,
|
||||
KEY `pe_LogStats_missionhash_id` (`pe_LogStats_missionhash_id`),
|
||||
KEY `pe_LogStats_playerid` (`pe_LogStats_playerid`),
|
||||
KEY `pe_LogStats_typeid` (`pe_LogStats_typeid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=9595 DEFAULT CHARSET=utf8;
|
||||
KEY `pe_LogStats_typeid` (`pe_LogStats_typeid`),
|
||||
KEY `pe_LogStats_masterslot` (`pe_LogStats_masterslot`),
|
||||
KEY `pe_LogStats_mstatus` (`pe_LogStats_mstatus`),
|
||||
KEY `pe_LogStats_seat` (`pe_LogStats_seat`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
DROP TRIGGER IF EXISTS `pe_LogStats_UPDATE`;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `pe_LogStats_UPDATE` BEFORE UPDATE ON `pe_LogStats` FOR EACH ROW BEGIN
|
||||
|
||||
SET NEW.ps_takeoffs = NEW.ps_airfield_takeoffs + NEW.ps_farp_takeoffs + NEW.ps_other_takeoffs + NEW.ps_ship_takeoffs;
|
||||
SET NEW.ps_landings = NEW.ps_airfield_landings + NEW.ps_farp_landings + NEW.ps_other_landings + NEW.ps_ship_landings;
|
||||
SET NEW.ps_kills_AA = NEW.ps_kills_planes + NEW.ps_kills_helicopters;
|
||||
SET NEW.ps_kills_AG = NEW.ps_kills_armor + NEW.ps_kills_unarmed + NEW.ps_kills_fortification;
|
||||
SET NEW.ps_kills_AS = NEW.ps_kills_ships;
|
||||
SET NEW.ps_kills_AAA = NEW.ps_kills_air_defense;
|
||||
|
||||
IF NEW.ps_ejections > 0 THEN
|
||||
SET NEW.pe_LogStats_mstatus = "MIA";
|
||||
ELSEIF NEW.ps_deaths > 0 THEN
|
||||
SET NEW.pe_LogStats_mstatus = "KIA";
|
||||
ELSEIF NEW.ps_landings >= NEW.ps_takeoffs THEN
|
||||
IF NEW.ps_takeoffs > 0 or NEW.ps_landings > 0 THEN
|
||||
ELSEIF (NEW.ps_airfield_landings + NEW.ps_farp_landings + NEW.ps_other_landings + NEW.ps_ship_landings) >= (NEW.ps_airfield_takeoffs + NEW.ps_farp_takeoffs + NEW.ps_other_takeoffs + NEW.ps_ship_takeoffs) THEN
|
||||
IF (NEW.ps_airfield_takeoffs + NEW.ps_farp_takeoffs + NEW.ps_other_takeoffs + NEW.ps_ship_takeoffs) > 0 or (NEW.ps_airfield_landings + NEW.ps_farp_landings + NEW.ps_other_landings + NEW.ps_ship_landings) > 0 THEN
|
||||
SET NEW.pe_LogStats_mstatus = "RTB";
|
||||
ELSE
|
||||
SET NEW.pe_LogStats_mstatus = "?";
|
||||
END IF;
|
||||
ELSEIF NEW.ps_takeoffs > NEW.ps_landings and NEW.ps_ejections=0 and NEW.ps_deaths=0 THEN
|
||||
ELSEIF (NEW.ps_airfield_takeoffs + NEW.ps_farp_takeoffs + NEW.ps_other_takeoffs + NEW.ps_ship_takeoffs) > (NEW.ps_airfield_landings + NEW.ps_farp_landings + NEW.ps_other_landings + NEW.ps_ship_landings) and NEW.ps_ejections=0 and NEW.ps_deaths=0 THEN
|
||||
SET NEW.pe_LogStats_mstatus = "MIA";
|
||||
ELSE
|
||||
SET NEW.pe_LogStats_mstatus = "?";
|
||||
@@ -202,8 +172,40 @@ END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
DROP TABLE IF EXISTS `pe_OnlinePlayers`;
|
||||
CREATE TABLE IF NOT EXISTS `pe_OnlinePlayers` (
|
||||
`pe_OnlinePlayers_id` int(11) NOT NULL,
|
||||
`pe_OnlinePlayers_instance` int(11) NOT NULL,
|
||||
`pe_OnlinePlayers_ping` int(11) NOT NULL,
|
||||
`pe_OnlinePlayers_side` int(11) NOT NULL,
|
||||
`pe_OnlinePlayers_slot` varchar(255) NOT NULL,
|
||||
`pe_OnlinePlayers_ucid` varchar(255) NOT NULL,
|
||||
`pe_OnlinePlayers_updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `pe_OnlineStatus`;
|
||||
CREATE TABLE IF NOT EXISTS `pe_OnlineStatus` (
|
||||
`pe_OnlineStatus_instance` int(11) NOT NULL,
|
||||
`pe_OnlineStatus_theatre` varchar(255) NOT NULL,
|
||||
`pe_OnlineStatus_name` varchar(255) NOT NULL,
|
||||
`pe_OnlineStatus_pause` varchar(255) NOT NULL,
|
||||
`pe_OnlineStatus_multiplayer` varchar(255) NOT NULL,
|
||||
`pe_OnlineStatus_realtime` varchar(255) NOT NULL,
|
||||
`pe_OnlineStatus_modeltime` varchar(255) NOT NULL,
|
||||
`pe_OnlineStatus_players` int(11) NOT NULL,
|
||||
`pe_OnlineStatus_perunversion_winapp` varchar(255) NOT NULL,
|
||||
`pe_OnlineStatus_perunversion_dcshook` varchar(255) NOT NULL,
|
||||
`pe_OnlineStatus_updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
ALTER TABLE `pe_DataMissionHashes` ADD FULLTEXT KEY `pe_DataMissionHashes_hash` (`pe_DataMissionHashes_hash`);
|
||||
|
||||
ALTER TABLE `pe_DataPlayers` ADD FULLTEXT KEY `pe_DataPlayers_ucid` (`pe_DataPlayers_ucid`);
|
||||
|
||||
ALTER TABLE `pe_DataTypes` ADD FULLTEXT KEY `pe_DataTypes_name` (`pe_DataTypes_name`);
|
||||
|
||||
ALTER TABLE `pe_LogChat` ADD FULLTEXT KEY `pe_LogChat_msg` (`pe_LogChat_msg`);
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
|
||||
BIN
04_Misc/01_Logo/PaganWinterPoster.png
Normal file
BIN
04_Misc/01_Logo/PaganWinterPoster.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 446 KiB |
BIN
04_Misc/01_Logo/Perun_logo.png
Normal file
BIN
04_Misc/01_Logo/Perun_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.1 KiB |
BIN
04_Misc/01_Logo/Perun_logo.xcf
Normal file
BIN
04_Misc/01_Logo/Perun_logo.xcf
Normal file
Binary file not shown.
183
04_Misc/05_PHP_Example/index.php
Normal file
183
04_Misc/05_PHP_Example/index.php
Normal file
@@ -0,0 +1,183 @@
|
||||
<!-- This is integration example for https://github.com/szporwolik/perun - please keep the code as simple and straightforward as possible -->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Perun - Example of PHP Integration</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="Example of PHP integration of Perun for DCS World">
|
||||
<meta name="keywords" content="dcs world perun">
|
||||
<meta name="author" content="VladMordock">
|
||||
|
||||
<style>
|
||||
body {
|
||||
background-color: #eeeeee;
|
||||
padding: 0 20px 0 20px;
|
||||
}
|
||||
|
||||
h1,h2,h3 {
|
||||
color: navy;
|
||||
|
||||
}
|
||||
|
||||
#header{
|
||||
padding: 10px 0 10px 0px;
|
||||
}
|
||||
|
||||
#content{
|
||||
border-top: 1px solid navy;
|
||||
border-bottom: 1px solid navy;
|
||||
padding: 10px 0 10px 0px;
|
||||
}
|
||||
|
||||
#footer{
|
||||
padding: 10px 0 10px 0px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table, td{
|
||||
border: 1px solid navy;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header">
|
||||
<h1>Perun Integration Example</h2>
|
||||
<h2>PHP Integration example for Perun for DCS World</h2>
|
||||
<h3>Get support at our <a href="https://discord.gg/MTahREx">Discord</a>
|
||||
</div>
|
||||
<div id="content">
|
||||
<?php
|
||||
// Configure database connection - put your database address and credentials here
|
||||
$config_db_username="CHANGE_ME"; // <<=== CHANGE TO YOUR MYSQL SERVER USERNAME
|
||||
$config_db_password="CHANGE_ME"; // <<=== CHANGE TO YOUR MYSQL SERVER PASSWORD
|
||||
$config_db_host="CHANGE_ME"; // <<=== CHANGE TO YOUR MYSQL SERVER ADDRESS
|
||||
$config_db_database="CHANGE_ME"; // <<=== CHANGE TO YOUR MYSQL DATABASE
|
||||
|
||||
// Try to connect to the database
|
||||
$mysqli = new mysqli($config_db_host, $config_db_username, $config_db_password, $config_db_database);
|
||||
|
||||
// Check connection
|
||||
if ($mysqli->connect_errno) {
|
||||
printf("Connect failed: %s\n", $mysqli->connect_error);
|
||||
exit();
|
||||
}
|
||||
|
||||
// Some Examples
|
||||
// List last 5 missions at the server
|
||||
echo "<h3>List last 5 missions at the server</h3>";
|
||||
if ($result = $mysqli->query("SELECT * FROM `pe_DataMissionHashes` ORDER BY `pe_DataMissionHashes`.`pe_DataMissionHashes_datetime` DESC LIMIT 5")) {
|
||||
echo "<table>";
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>" . $row['pe_DataMissionHashes_id'] . "</td>";
|
||||
echo "<td>" . $row['pe_DataMissionHashes_hash'] . "</td>";
|
||||
echo "<td>" . $row['pe_DataMissionHashes_datetime'] . "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
$result->close();
|
||||
}
|
||||
|
||||
// List last 5
|
||||
echo "<h3>List last 5 players known server </h3>";
|
||||
if ($result = $mysqli->query("SELECT * FROM `pe_DataPlayers` ORDER BY `pe_DataPlayers`.`pe_DataPlayers_updated` DESC LIMIT 5")) {
|
||||
echo "<table>";
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>" . $row['pe_DataPlayers_id'] . "</td>";
|
||||
echo "<td>" . $row['pe_DataPlayers_ucid'] . "</td>";
|
||||
echo "<td>" . $row['pe_DataPlayers_lastname'] . "</td>";
|
||||
echo "<td>" . $row['pe_DataPlayers_updated'] . "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
$result->close();
|
||||
}
|
||||
|
||||
// List last 5 chat messages
|
||||
echo "<h3>List last 5 chat messages (note: INNER JOIN is used to pull the player's name from other table)</h3>";
|
||||
if ($result = $mysqli->query("SELECT * FROM `pe_LogChat` INNER JOIN `pe_DataPlayers` on `pe_LogChat`.pe_LogChat_playerid = `pe_DataPlayers`.pe_DataPlayers_id ORDER BY `pe_LogChat`.`pe_LogChat_datetime` DESC LIMIT 5")) {
|
||||
echo "<table>";
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>" . $row['pe_LogChat_datetime'] . "</td>";
|
||||
echo "<td>" . $row['pe_DataPlayers_lastname'] . "</td>";
|
||||
echo "<td>" . $row['pe_LogChat_msg'] . "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
$result->close();
|
||||
}
|
||||
|
||||
|
||||
// List last 5 events
|
||||
echo "<h3>List last 5 events</h3>";
|
||||
if ($result = $mysqli->query("SELECT * FROM `pe_LogEvent` ORDER BY `pe_LogEvent_datetime` DESC LIMIT 5")) {
|
||||
echo "<table>";
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>" . $row['pe_LogEvent_datetime'] . "</td>";
|
||||
echo "<td>" . $row['pe_LogEvent_content'] . "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
$result->close();
|
||||
}
|
||||
|
||||
// List last statistics
|
||||
echo "<h3>List last statistics (note: multiple INNER JOINs is used to pull information from other table)</h3>";
|
||||
if ($result = $mysqli->query("SELECT * FROM `pe_LogStats` INNER JOIN `pe_DataMissionHashes` ON `pe_LogStats`.pe_LogStats_missionhash_id = `pe_DataMissionHashes`.pe_DataMissionHashes_id INNER JOIN `pe_DataPlayers` ON `pe_LogStats`.pe_LogStats_playerid = `pe_DataPlayers`.pe_DataPlayers_id INNER JOIN `pe_DataTypes` ON `pe_LogStats`.pe_LogStats_typeid = `pe_DataTypes`.pe_DataTypes_id ORDER BY pe_LogStats_datetime desc LIMIT 5")) {
|
||||
echo "<table>";
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>" . $row['pe_LogStats_datetime'] . "</td>";
|
||||
echo "<td>" . $row['pe_DataPlayers_lastname'] . "</td>";
|
||||
echo "<td>" . $row['pe_DataTypes_name'] . "</td>";
|
||||
echo "<td>" . $row['ps_crashes'] . "</td>";
|
||||
echo "<td>" . $row['ps_kills_planes'] . "</td>";
|
||||
echo "<td>" . $row['ps_kills_armor'] . "</td>";
|
||||
// TIP: See documentation there is many more counted events which can be displayed here
|
||||
echo "<td>" . $row['pe_LogStats_mstatus'] . "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
$result->close();
|
||||
}
|
||||
|
||||
// Get JSON objects with actual server information including LotATC and DCS SRS information
|
||||
echo "<h3>Get JSON objects with actual server information including LotATC and DCS SRS information</h3>";
|
||||
if ($result = $mysqli->query("SELECT * FROM `pe_DataRaw`")) {
|
||||
echo "<table>";
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>" . $row['pe_dataraw_updated'] . "</td>";
|
||||
echo "<td>" . $row['pe_dataraw_payload'] . "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
$result->close();
|
||||
}
|
||||
|
||||
// Close database connection
|
||||
$mysqli->close();
|
||||
?>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<a href="https://github.com/szporwolik/perun">
|
||||
<img src="https://camo.githubusercontent.com/50a1df184e069b36f3ddf9223bf16582f49aa16c/68747470733a2f2f692e696d6775722e636f6d2f5072496b714e412e706e67" alt="Perun_Logo">
|
||||
</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
48
README.md
48
README.md
@@ -1,24 +1,25 @@
|
||||

|
||||

|
||||

|
||||

|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ZBW8R5L25A8QW¤cy_code=EUR&source=url)
|
||||
|
||||

|
||||

|
||||
|
||||
# Perun for DCS World
|
||||
Included lua script extracts data from DCS World multiplayer server and sends information to TCP port and JSON file for further processing.
|
||||
Included lua script extracts data from DCS World multiplayer server and sends information to TCP port for further processing.
|
||||
|
||||
Provided windows app puts received TCP packets to MySQL database; additionaly Perun windows application can be used to merge LotATC and DCS SRS data in one database making Perun for DCS World wannabe ultimate integration tool for the server admins.
|
||||
|
||||
However, this software is intended to be used by experienced users - the output is MySQL data and/or JSON file; you will need to process/display it yourself.
|
||||
However, this software is intended to be used by experienced users - the output is MySQL data; you will need to process/display it yourself.
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
Discord server: https://discord.gg/MTahREx
|
||||
|
||||
## Prerequisites
|
||||
Core:
|
||||
* For JSON Export:
|
||||
* DCS World stable or DCS World beta
|
||||
* **(Optional)** For MySQL Export:
|
||||
* MySQL database with read/write access running at min. 5.7 server (tested with v5.7.21; native JSON support is required)
|
||||
* .NET Framework 4.8.0
|
||||
|
||||
@@ -29,13 +30,12 @@ Core:
|
||||
## Installing
|
||||
* Download latest [release](https://github.com/szporwolik/perun/releases)
|
||||
* Copy contents of [01_DCS](https://github.com/szporwolik/perun/tree/master/01_DCS) to your \Scripts folder (located inside DCS folder in your Saved Games)
|
||||
* **optionaly** create MySQL database using SQL script located in [03_MySQL](https://github.com/szporwolik/perun/tree/master/03_MySQL); note that you need just a one database per DCS server machine - multiple instances pushing data to the one database are supported
|
||||
* Create MySQL database using SQL script located in [03_MySQL](https://github.com/szporwolik/perun/tree/master/03_MySQL); note that you need just a one database per DCS server machine - multiple instances pushing data to the one database are supported
|
||||
|
||||
## Running
|
||||
* Start DCS World and host multiplayer session
|
||||
* by default the JSON is written into Scripts\Json folder located in your Saved Games DCS folder tree
|
||||
* by default the TCP port 48620 is in use as target port
|
||||
* **optionaly** run the Win32 application
|
||||
* by default the TCP port 48620 is in use as target port - ensure that port and instance ID in the options sections of the Lua file matches data
|
||||
* run the Win32 application
|
||||
* set MySQL connection data
|
||||
* **optionaly** point LotATC json file location
|
||||
* **optionaly** point DCS SRS json file location
|
||||
@@ -48,13 +48,22 @@ Windows app supports command line arguments, what may be handy in case of multip
|
||||
The following arguments are accepted (keep the order!):
|
||||
* server port (shall be the same as in the lua file!)
|
||||
* instance ID (shall be the same as in the lua file!)
|
||||
* path to SRS client-list.json
|
||||
* path to LotATC stats.json
|
||||
* path to SRS client-list.json OR put -1 if you do not want to use DCS SRS
|
||||
* path to LotATC stats.json OR put -1 if you do not want to use LotATC
|
||||
* numeric value (without quotes), set 1 for Autostart (Perun will start within 500ms after starting up)
|
||||
|
||||
Example for windows shortcut:
|
||||
```
|
||||
C:\Perun_v1\Perun.exe 48621 1 "G:\DCS SRS\clients-list.json" "C:\Users\DCS\Saved Games\DCS\Mods\tech\LotAtc\stats.json"
|
||||
```
|
||||
## Displaying data
|
||||
Data displaying and handling is not in the current scope of this project. Since the end of 2018 the Perun data displaying has been hardcoded at forum.gildia.org , website for the Polish DCS community; examples:
|
||||

|
||||

|
||||
Due to resource limitations, "Perun for DCS World" will focus on pulling the data from DCS (and external modules) and pushing it to MySQL server, but if anyone would like to develop open sourced PHP applets for data/statistics displaying we're willing to cooperate and support such projects. Unfortunetly it's not possible to share the hardcoded code from forum.gildia.org.
|
||||
|
||||
Basic example was provided [HERE](/04_Misc/05_PHP_Example/index.php) , support is available via Perun community at our [Discord](https://discord.gg/MTahREx).
|
||||
|
||||
## Troubleshooting - FAQ
|
||||
- [I keep getting 1305 MySQL error](#i-keep-getting-1305-mysql-error)
|
||||
- [Carrier landing are not tracked correctly](#carrier-landing-are-not-tracked-correctly)
|
||||
@@ -62,8 +71,11 @@ C:\Perun_v1\Perun.exe 48621 1 "G:\DCS SRS\clients-list.json" "C:\Users\DCS\Saved
|
||||
### I keep getting 1305 MySQL error
|
||||
That probably means that your database does not support JSON functions, you shall upgrade your MySQL server to at lease 5.7 version.
|
||||
|
||||
### I keep getting 1364 MySQL error
|
||||
Make sure that STRICT_TRANS_TABLES is disabled at your MySQL server, see: https://stackoverflow.com/questions/37964325/how-to-find-and-disable-mysql-strict-mode
|
||||
|
||||
### Carrier landing are not tracked correctly
|
||||
DCS API does not track carrier landing natively, so there is a trick to achive that. You shall set your carrier to a propoer group name to have landings tracked.
|
||||
DCS API does not track carrier or FARP operations natively, so there is a trick to achive that. At this point of time to detect FARP operations, the FARPs shall have "FARP" string in the group name (set in mission editor). For carrier operations the string "SHIP" is required within group name.
|
||||
|
||||
# API documentation (for expert users)
|
||||
## MySQL database structure
|
||||
@@ -76,6 +88,8 @@ DCS API does not track carrier landing natively, so there is a trick to achive t
|
||||
* table: pe_LogLogins - holds login to server event history
|
||||
* table: pe_LogStats - holds static information
|
||||
|
||||

|
||||
|
||||
## Data packets - send from lua to TCP port
|
||||
* ```ID: 1```, contains version/diagnostic information
|
||||
* perun version - for server administration usage
|
||||
@@ -106,7 +120,7 @@ DCS API does not track carrier landing natively, so there is a trick to achive t
|
||||
* [Notepad++](https://notepad-plus-plus.org/)
|
||||
|
||||
## Contributing
|
||||
Please contact me if you'd like to contribute.
|
||||
Please contact me if you'd like to contribute. Short rule is that all pull request shall come to "dev" branch, pull requests to "master" will be deleted.
|
||||
|
||||
## Versioning
|
||||
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/szporwolik/perun/tags).
|
||||
@@ -119,6 +133,10 @@ See also the list of [contributors](https://github.com/szporwolik/perun/contribu
|
||||
## License
|
||||
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
||||
|
||||
## Donation
|
||||
This software is provide "as it is" without any warranties, but if you would like to thank me for development/support please
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ZBW8R5L25A8QW¤cy_code=EUR&source=url)
|
||||
|
||||
## Acknowledgments
|
||||

|
||||
|
||||
|
||||
Reference in New Issue
Block a user