mirror of
https://github.com/DaKerboul/perun.git
synced 2026-08-10 00:15:39 +02:00
Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
@@ -9,9 +9,9 @@ package.cpath = package.cpath..";"..lfs.currentdir().."/LuaSocket/?.dll"
|
|||||||
|
|
||||||
Perun.RefreshStatus = 15 -- (int) [default: 60] Base refresh rate in seconds to send status update
|
Perun.RefreshStatus = 15 -- (int) [default: 60] Base refresh rate in seconds to send status update
|
||||||
Perun.RefreshMission = 60 -- (int) [default: 120] Refresh rate in seconds to send mission information
|
Perun.RefreshMission = 60 -- (int) [default: 120] Refresh rate in seconds to send mission information
|
||||||
Perun.TCPTargetPort = 48622 -- (int) [default: 48621] TCP port to send data to
|
Perun.TCPTargetPort = 48620 -- (int) [default: 48621] TCP port to send data to
|
||||||
Perun.TCPPerunHost = "localhost" -- (string) [default: "localhost"] IP adress of the Perun instance or "localhost"
|
Perun.TCPPerunHost = "localhost" -- (string) [default: "localhost"] IP adress of the Perun instance or "localhost"
|
||||||
Perun.Instance = 2 -- (int) [default: 1] Id number of instance (if multiple DCS instances are to run at the same PC)
|
Perun.Instance = 1 -- (int) [default: 1] Id number of instance (if multiple DCS instances are to run at the same PC)
|
||||||
Perun.JsonStatusLocation = "Scripts\\Json\\" -- (string) [default: "Scripts\\Json\\"] Folder relative do user's SaveGames DCS folder -> status file updated each RefreshMission
|
Perun.JsonStatusLocation = "Scripts\\Json\\" -- (string) [default: "Scripts\\Json\\"] Folder relative do user's SaveGames DCS folder -> status file updated each RefreshMission
|
||||||
Perun.MissionStartNoDeathWindow = 300 -- (int) [default: 300] Number of secounds after mission start when death of the pilot will not go to statistics, shall avoid death penalty during spawning DCS bugs
|
Perun.MissionStartNoDeathWindow = 300 -- (int) [default: 300] Number of secounds after mission start when death of the pilot will not go to statistics, shall avoid death penalty during spawning DCS bugs
|
||||||
Perun.DebugMode = 2 -- (int) [0 (default),1,2] Value greater than 0 will display Perun information in DCS log file, values: 1 - minimal verbose, 2 - all log information will be logged
|
Perun.DebugMode = 2 -- (int) [0 (default),1,2] Value greater than 0 will display Perun information in DCS log file, values: 1 - minimal verbose, 2 - all log information will be logged
|
||||||
@@ -22,24 +22,27 @@ Perun.MOTD_L2 = "Wymagamy obecnosci DCS SRS oraz TeamSpeak - szczegoly na forum"
|
|||||||
-- ###################### END OF SETTINGS - DO NOT MODIFY OUTSIDE THIS SECTION ######################
|
-- ###################### END OF SETTINGS - DO NOT MODIFY OUTSIDE THIS SECTION ######################
|
||||||
|
|
||||||
-- Variable init
|
-- Variable init
|
||||||
Perun.Version = "v0.9.0"
|
Perun.Version = "v0.10.0"
|
||||||
Perun.StatusData = {}
|
Perun.StatusData = {}
|
||||||
Perun.SlotsData = {}
|
Perun.SlotsData = {}
|
||||||
Perun.MissionData = {}
|
Perun.MissionData = {}
|
||||||
Perun.ServerData = {}
|
Perun.ServerData = {}
|
||||||
Perun.StatData = {}
|
Perun.StatData = {}
|
||||||
Perun.StatDataLastType = {}
|
Perun.StatDataLastType = {}
|
||||||
|
Perun.PlayersTableCache = {}
|
||||||
Perun.MissionHash=""
|
Perun.MissionHash=""
|
||||||
|
Perun.ReconnectTimeout = 30
|
||||||
Perun.lastSentStatus = 0
|
Perun.lastSentStatus = 0
|
||||||
Perun.lastSentMission = 0
|
Perun.lastSentMission = 0
|
||||||
Perun.lastSentKeepAlive = 0
|
Perun.lastSentKeepAlive = 0
|
||||||
Perun.lastConnectionError = 0
|
Perun.lastConnectionError = 0
|
||||||
Perun.lastReconnect = 0
|
Perun.lastTimer = 0
|
||||||
Perun.SendRetries = 3
|
Perun.lastReconnect = (-1) * Perun.ReconnectTimeout
|
||||||
|
Perun.SendRetries = 2
|
||||||
Perun.RefreshKeepAlive = 3
|
Perun.RefreshKeepAlive = 3
|
||||||
Perun.JsonStatusLocation = lfs.writedir() .. Perun.JsonStatusLocation
|
Perun.JsonStatusLocation = lfs.writedir() .. Perun.JsonStatusLocation
|
||||||
Perun.socket = require("socket")
|
Perun.socket = require("socket")
|
||||||
Perun.IsServer = true --DCS.isServer( ) -- TBD looks like DCS API error, always returning True
|
Perun.IsServer = DCS.isServer( )
|
||||||
Perun.ConnectionError = "[Perun] ERROR: Connection broken - contact server admin!"
|
Perun.ConnectionError = "[Perun] ERROR: Connection broken - contact server admin!"
|
||||||
|
|
||||||
-- ################################ Helper function definitions ################################
|
-- ################################ Helper function definitions ################################
|
||||||
@@ -134,21 +137,27 @@ function stripChars(str)
|
|||||||
end
|
end
|
||||||
|
|
||||||
Perun.GetCategory = function(id)
|
Perun.GetCategory = function(id)
|
||||||
-- Helper function returns object category basing on I via https://pastebin.com/GUAXrd2U TBD: rewrite
|
-- Helper function returns object category basing on https://pastebin.com/GUAXrd2U
|
||||||
local _killed_target_category = DCS.getUnitTypeAttribute(id, "category")
|
local _killed_target_category = "Other"
|
||||||
|
|
||||||
-- Below, simple hack to get the propper category when DCS API is not returning correct value
|
-- Sometimes we get empty object id (seems like DCS API bug)
|
||||||
if _killed_target_category == nil then
|
if id ~= nil and id ~= "" then
|
||||||
local _killed_target_cat_check_ship = DCS.getUnitTypeAttribute(id, "DeckLevel")
|
_killed_target_category = DCS.getUnitTypeAttribute(id, "category")
|
||||||
local _killed_target_cat_check_plane = DCS.getUnitTypeAttribute(id, "WingSpan")
|
|
||||||
if _killed_target_cat_check_ship ~= nil and _killed_target_cat_check_plane == nil then
|
-- Below, simple hack to get the propper category when DCS API is not returning correct value
|
||||||
_killed_target_category = "Ships"
|
if _killed_target_category == nil then
|
||||||
elseif _killed_target_cat_check_ship == nil and _killed_target_cat_check_plane ~= nil then
|
local _killed_target_cat_check_ship = DCS.getUnitTypeAttribute(id, "DeckLevel")
|
||||||
_killed_target_category = "Planes"
|
local _killed_target_cat_check_plane = DCS.getUnitTypeAttribute(id, "WingSpan")
|
||||||
else
|
if _killed_target_cat_check_ship ~= nil and _killed_target_cat_check_plane == nil then
|
||||||
_killed_target_category = "Helicopters"
|
_killed_target_category = "Ships"
|
||||||
end
|
elseif _killed_target_cat_check_ship == nil and _killed_target_cat_check_plane ~= nil then
|
||||||
end
|
_killed_target_category = "Planes"
|
||||||
|
else
|
||||||
|
_killed_target_category = "Helicopters"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return _killed_target_category
|
return _killed_target_category
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -160,7 +169,11 @@ Perun.SideID2Name = function(id)
|
|||||||
[2] = 'BLUE',
|
[2] = 'BLUE',
|
||||||
[3] = 'NEUTRAL', -- TBD check once this is released in DCS
|
[3] = 'NEUTRAL', -- TBD check once this is released in DCS
|
||||||
}
|
}
|
||||||
return _sides[id]
|
if id > 0 then
|
||||||
|
return _sides[id]
|
||||||
|
else
|
||||||
|
return "?"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.AddLog = function(text,LogLevel)
|
Perun.AddLog = function(text,LogLevel)
|
||||||
@@ -179,11 +192,15 @@ end
|
|||||||
Perun.GetMulticrewAllParameters = function (PlayerId)
|
Perun.GetMulticrewAllParameters = function (PlayerId)
|
||||||
-- Gets all multicrew parameters
|
-- Gets all multicrew parameters
|
||||||
local _result = ""
|
local _result = ""
|
||||||
local _player_slot=net.get_player_info(PlayerId, 'slot')
|
|
||||||
local _master_type= "?"
|
local _master_type= "?"
|
||||||
local _master_slot = nil
|
local _master_slot = nil
|
||||||
local _sub_slot = nil
|
local _sub_slot = nil
|
||||||
|
|
||||||
|
local _player_slot = net.get_player_info(PlayerId, 'slot')
|
||||||
|
if not _player_slot then
|
||||||
|
_player_slot=Perun.PlayersTableCache["p"..PlayerId].slot
|
||||||
|
end
|
||||||
|
|
||||||
if _player_slot and _player_slot ~= '' and not (string.find(_player_slot, 'red') or string.find(_player_slot, 'blue')) then
|
if _player_slot and _player_slot ~= '' and not (string.find(_player_slot, 'red') or string.find(_player_slot, 'blue')) then
|
||||||
-- Player took model
|
-- Player took model
|
||||||
_master_slot = _player_slot
|
_master_slot = _player_slot
|
||||||
@@ -214,6 +231,9 @@ Perun.GetMulticrewAllParameters = function (PlayerId)
|
|||||||
end
|
end
|
||||||
_master_slot = -1
|
_master_slot = -1
|
||||||
_sub_slot = 0
|
_sub_slot = 0
|
||||||
|
else
|
||||||
|
_master_slot = -1
|
||||||
|
_sub_slot = -1
|
||||||
end
|
end
|
||||||
return _master_type,_master_slot,_sub_slot
|
return _master_type,_master_slot,_sub_slot
|
||||||
end
|
end
|
||||||
@@ -278,6 +298,29 @@ Perun.GetMulticrewCrewNames = function (owner_playerID)
|
|||||||
return _result_text
|
return _result_text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Perun.GetTakeOffLandingEvent = function (takeoff,location)
|
||||||
|
-- Get correct event type for statistics basing on objecy which served as runway/farp
|
||||||
|
local _operation = ""
|
||||||
|
if takeoff == true then
|
||||||
|
_operation="tookoff_"
|
||||||
|
else
|
||||||
|
_operation="landing_"
|
||||||
|
end
|
||||||
|
|
||||||
|
local _temp_type = ""
|
||||||
|
if string.find(location, "FARP",1,true) then
|
||||||
|
_temp_type = "FARP"
|
||||||
|
elseif string.find(location, "CVN-74 John C. Stennis",1,true) or string.find(location, "LHA-1 Tarawa",1,true) or string.find(location, "SHIP",1,true) then
|
||||||
|
_temp_type = "SHIP"
|
||||||
|
elseif location ~= "" then
|
||||||
|
_temp_type = "AIRFIELD"
|
||||||
|
else
|
||||||
|
_temp_type = "OTHER"
|
||||||
|
end
|
||||||
|
|
||||||
|
return _operation .. _temp_type
|
||||||
|
end
|
||||||
|
|
||||||
-- ################################ TCP Connection ################################
|
-- ################################ TCP Connection ################################
|
||||||
|
|
||||||
Perun.ConnectToPerun = function ()
|
Perun.ConnectToPerun = function ()
|
||||||
@@ -293,8 +336,9 @@ Perun.ConnectToPerun = function ()
|
|||||||
else
|
else
|
||||||
-- Connected
|
-- Connected
|
||||||
Perun.AddLog("Success - connected to TCP server",2)
|
Perun.AddLog("Success - connected to TCP server",2)
|
||||||
Perun.lastReconnect = _now
|
|
||||||
end
|
end
|
||||||
|
local _now = DCS.getRealTime()
|
||||||
|
Perun.lastReconnect = _now
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.SendToPerun = function(data_id, data_package)
|
Perun.SendToPerun = function(data_id, data_package)
|
||||||
@@ -315,12 +359,15 @@ Perun.SendToPerun = function(data_id, data_package)
|
|||||||
local _dropped = true
|
local _dropped = true
|
||||||
|
|
||||||
-- Try to send a few times (defind in settings section)
|
-- Try to send a few times (defind in settings section)
|
||||||
|
local _now = DCS.getRealTime()
|
||||||
while _intStatus == nil and _intTries < Perun.SendRetries do
|
while _intStatus == nil and _intTries < Perun.SendRetries do
|
||||||
_intStatus, _err = Perun.TCP:send(_TCPFrame)
|
_intStatus, _err = Perun.TCP:send(_TCPFrame)
|
||||||
if _err then
|
if _err then
|
||||||
-- Failure, packet was not send
|
-- Failure, packet was not send
|
||||||
Perun.AddLog("Packed not send : " .. data_id .. " , error: " .. _err .. ", tries: " .. _intTries,2)
|
Perun.AddLog("Packed not send : " .. data_id .. " , error: " .. _err .. ", tries: " .. _intTries,2)
|
||||||
Perun.ConnectToPerun()
|
if _now > Perun.lastReconnect + Perun.ReconnectTimeout then
|
||||||
|
Perun.ConnectToPerun()
|
||||||
|
end
|
||||||
else
|
else
|
||||||
-- Succes, packet was send
|
-- Succes, packet was send
|
||||||
Perun.AddLog("Packet send : " .. data_id .. " , tries:" .. _intTries,2)
|
Perun.AddLog("Packet send : " .. data_id .. " , tries:" .. _intTries,2)
|
||||||
@@ -332,8 +379,7 @@ Perun.SendToPerun = function(data_id, data_package)
|
|||||||
if _dropped == true then
|
if _dropped == true then
|
||||||
-- Add information to log file and send chat message to all that Perun connection is broken
|
-- Add information to log file and send chat message to all that Perun connection is broken
|
||||||
Perun.AddLog("ERROR - packed dropped : " .. data_id,1)
|
Perun.AddLog("ERROR - packed dropped : " .. data_id,1)
|
||||||
local _now = DCS.getRealTime()
|
if _now > Perun.lastConnectionError + Perun.ReconnectTimeout then
|
||||||
if _now > Perun.lastConnectionError + 60 then
|
|
||||||
-- Informs all players that there is Peron error; below hack for DCS net.send_chat not working
|
-- Informs all players that there is Peron error; below hack for DCS net.send_chat not working
|
||||||
local _all_players = net.get_player_list()
|
local _all_players = net.get_player_list()
|
||||||
for PlayerIDIndex, _playerID in ipairs(_all_players) do
|
for PlayerIDIndex, _playerID in ipairs(_all_players) do
|
||||||
@@ -390,8 +436,8 @@ Perun.LogStats = function(playerID)
|
|||||||
_TempData['stat_data_type']= _PlayerStatsTable['ps_type'];
|
_TempData['stat_data_type']= _PlayerStatsTable['ps_type'];
|
||||||
_TempData['stat_data_masterslot'] = _PlayerStatsTable['ps_masterslot'];
|
_TempData['stat_data_masterslot'] = _PlayerStatsTable['ps_masterslot'];
|
||||||
_TempData['stat_data_subslot'] = _PlayerStatsTable['ps_subslot'];
|
_TempData['stat_data_subslot'] = _PlayerStatsTable['ps_subslot'];
|
||||||
_TempData['stat_ucid']=net.get_player_info(playerID, 'ucid')
|
_TempData['stat_ucid']=_PlayerStatsTable['ps_ucid'];
|
||||||
_TempData['stat_name']=net.get_player_info(playerID, 'name')
|
_TempData['stat_name']=_PlayerStatsTable['ps_name'];
|
||||||
_TempData['stat_datetime']=os.date('%Y-%m-%d %H:%M:%S')
|
_TempData['stat_datetime']=os.date('%Y-%m-%d %H:%M:%S')
|
||||||
_TempData['stat_missionhash']=Perun.MissionHash
|
_TempData['stat_missionhash']=Perun.MissionHash
|
||||||
|
|
||||||
@@ -399,6 +445,16 @@ Perun.LogStats = function(playerID)
|
|||||||
Perun.SendToPerun(52,_TempData)
|
Perun.SendToPerun(52,_TempData)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Perun.LogAllStats = function()
|
||||||
|
-- Log all players data
|
||||||
|
local _all_players = net.get_player_list()
|
||||||
|
for PlayerIDIndex, _playerID in ipairs(_all_players) do
|
||||||
|
if _playerID ~= 1 then
|
||||||
|
Perun.LogStats(_playerID)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
Perun.LogLogin = function(playerID)
|
Perun.LogLogin = function(playerID)
|
||||||
-- Player logged in
|
-- Player logged in
|
||||||
local _TempData={}
|
local _TempData={}
|
||||||
@@ -413,13 +469,18 @@ end
|
|||||||
|
|
||||||
--- ################################ Calculate stats ################################
|
--- ################################ Calculate stats ################################
|
||||||
|
|
||||||
Perun.LogStatsCount = function(argPlayerID,argAction)
|
Perun.LogStatsCount = function(argPlayerID,argAction,argTimer)
|
||||||
-- Creates or updates Perun statistics array
|
-- Creates or updates Perun statistics array
|
||||||
local _player_hash=net.get_player_info(argPlayerID, 'ucid')..Perun.GetMulticrewParameter(argPlayerID,"subtype")
|
local _player_hash=net.get_player_info(argPlayerID, 'ucid')..Perun.GetMulticrewParameter(argPlayerID,"subtype")
|
||||||
|
|
||||||
|
-- By default we will be sending stats
|
||||||
|
argTimer = argTimer or false
|
||||||
|
|
||||||
if Perun.StatData[_player_hash] == nil then
|
if Perun.StatData[_player_hash] == nil then
|
||||||
-- Create empty element
|
-- Create empty element
|
||||||
local _TempData={}
|
local _TempData={}
|
||||||
|
_TempData['ps_ucid'] = net.get_player_info(argPlayerID, 'ucid')
|
||||||
|
_TempData['ps_name'] = net.get_player_info(argPlayerID, 'name')
|
||||||
_TempData['ps_type'] = Perun.GetMulticrewParameter(argPlayerID,"subtype")
|
_TempData['ps_type'] = Perun.GetMulticrewParameter(argPlayerID,"subtype")
|
||||||
_TempData['ps_masterslot'] = Perun.GetMulticrewParameter(argPlayerID,"masterslot")
|
_TempData['ps_masterslot'] = Perun.GetMulticrewParameter(argPlayerID,"masterslot")
|
||||||
_TempData['ps_subslot'] = Perun.GetMulticrewParameter(argPlayerID,"subslot")
|
_TempData['ps_subslot'] = Perun.GetMulticrewParameter(argPlayerID,"subslot")
|
||||||
@@ -428,6 +489,7 @@ Perun.LogStatsCount = function(argPlayerID,argAction)
|
|||||||
_TempData['ps_ejections'] = 0
|
_TempData['ps_ejections'] = 0
|
||||||
_TempData['ps_crashes'] = 0
|
_TempData['ps_crashes'] = 0
|
||||||
_TempData['ps_teamkills'] = 0
|
_TempData['ps_teamkills'] = 0
|
||||||
|
_TempData['ps_time'] = 0
|
||||||
_TempData['ps_kills_planes'] = 0
|
_TempData['ps_kills_planes'] = 0
|
||||||
_TempData['ps_kills_helicopters'] = 0
|
_TempData['ps_kills_helicopters'] = 0
|
||||||
_TempData['ps_kills_air_defense'] = 0
|
_TempData['ps_kills_air_defense'] = 0
|
||||||
@@ -436,6 +498,7 @@ Perun.LogStatsCount = function(argPlayerID,argAction)
|
|||||||
_TempData['ps_kills_infantry'] = 0
|
_TempData['ps_kills_infantry'] = 0
|
||||||
_TempData['ps_kills_ships'] = 0
|
_TempData['ps_kills_ships'] = 0
|
||||||
_TempData['ps_kills_fortification'] = 0
|
_TempData['ps_kills_fortification'] = 0
|
||||||
|
_TempData['ps_kills_artillery'] = 0
|
||||||
_TempData['ps_kills_other'] = 0
|
_TempData['ps_kills_other'] = 0
|
||||||
_TempData['ps_airfield_takeoffs'] = 0
|
_TempData['ps_airfield_takeoffs'] = 0
|
||||||
_TempData['ps_airfield_landings'] = 0
|
_TempData['ps_airfield_landings'] = 0
|
||||||
@@ -449,15 +512,12 @@ Perun.LogStatsCount = function(argPlayerID,argAction)
|
|||||||
Perun.StatData[_player_hash]=_TempData
|
Perun.StatData[_player_hash]=_TempData
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TBD BELLOW SEEMS TO BE OBSOLETE, CHECK AND DELETE
|
if Perun.GetMulticrewParameter(argPlayerID,"subtype") ~= nil then
|
||||||
if argType ~= nil then
|
|
||||||
Perun.StatData[_player_hash]['ps_type']=Perun.GetMulticrewParameter(argPlayerID,"subtype");
|
|
||||||
Perun.StatDataLastType[net.get_player_info(argPlayerID, 'ucid')]=_player_hash
|
Perun.StatDataLastType[net.get_player_info(argPlayerID, 'ucid')]=_player_hash
|
||||||
else
|
else
|
||||||
-- Do nothing
|
-- Do nothing
|
||||||
end
|
end
|
||||||
-- TBD ABOVE SEEMS TO BE OBSOLETE, CHECK AND DELETE
|
|
||||||
|
|
||||||
if argAction == "eject" then
|
if argAction == "eject" then
|
||||||
Perun.StatData[_player_hash]['ps_ejections']=Perun.StatData[_player_hash]['ps_ejections']+1
|
Perun.StatData[_player_hash]['ps_ejections']=Perun.StatData[_player_hash]['ps_ejections']+1
|
||||||
elseif argAction == "pilot_death" then
|
elseif argAction == "pilot_death" then
|
||||||
@@ -497,6 +557,8 @@ Perun.LogStatsCount = function(argPlayerID,argAction)
|
|||||||
Perun.StatData[_player_hash]['ps_kills_infantry']=Perun.StatData[_player_hash]['ps_kills_infantry']+1
|
Perun.StatData[_player_hash]['ps_kills_infantry']=Perun.StatData[_player_hash]['ps_kills_infantry']+1
|
||||||
elseif argAction == "kill_Fortification" then
|
elseif argAction == "kill_Fortification" then
|
||||||
Perun.StatData[_player_hash]['ps_kills_fortification']=Perun.StatData[_player_hash]['ps_kills_fortification']+1
|
Perun.StatData[_player_hash]['ps_kills_fortification']=Perun.StatData[_player_hash]['ps_kills_fortification']+1
|
||||||
|
elseif argAction == "kill_Artillery" then
|
||||||
|
Perun.StatData[_player_hash]['ps_kills_artillery']=Perun.StatData[_player_hash]['ps_kills_artillery']+1
|
||||||
elseif argAction == "kill_Other" then
|
elseif argAction == "kill_Other" then
|
||||||
Perun.StatData[_player_hash]['ps_kills_other']=Perun.StatData[_player_hash]['ps_kills_other']+1
|
Perun.StatData[_player_hash]['ps_kills_other']=Perun.StatData[_player_hash]['ps_kills_other']+1
|
||||||
elseif argAction == "kill_PvP" then
|
elseif argAction == "kill_PvP" then
|
||||||
@@ -505,6 +567,8 @@ Perun.LogStatsCount = function(argPlayerID,argAction)
|
|||||||
Perun.StatData[_player_hash]['ps_other_landings']=Perun.StatData[_player_hash]['ps_other_landings']+1
|
Perun.StatData[_player_hash]['ps_other_landings']=Perun.StatData[_player_hash]['ps_other_landings']+1
|
||||||
elseif argAction == "tookoff_OTHER" then
|
elseif argAction == "tookoff_OTHER" then
|
||||||
Perun.StatData[_player_hash]['ps_other_takeoffs']=Perun.StatData[_player_hash]['ps_other_takeoffs']+1
|
Perun.StatData[_player_hash]['ps_other_takeoffs']=Perun.StatData[_player_hash]['ps_other_takeoffs']+1
|
||||||
|
elseif argAction == "timer" then
|
||||||
|
Perun.StatData[_player_hash]['ps_time']=Perun.StatData[_player_hash]['ps_time']+1
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Always update slots
|
-- Always update slots
|
||||||
@@ -512,7 +576,11 @@ Perun.LogStatsCount = function(argPlayerID,argAction)
|
|||||||
Perun.StatData[_player_hash]['ps_subslot'] = Perun.GetMulticrewParameter(argPlayerID,"subslot")
|
Perun.StatData[_player_hash]['ps_subslot'] = Perun.GetMulticrewParameter(argPlayerID,"subslot")
|
||||||
|
|
||||||
Perun.AddLog("Stats data prepared",2)
|
Perun.AddLog("Stats data prepared",2)
|
||||||
Perun.LogStats(argPlayerID);
|
|
||||||
|
-- If this is timer request do not send data to database
|
||||||
|
if argTimer ~= true then
|
||||||
|
Perun.LogStats(argPlayerID);
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.LogStatsCountCrew = function (MasterPilotID,ActionType)
|
Perun.LogStatsCountCrew = function (MasterPilotID,ActionType)
|
||||||
@@ -525,22 +593,27 @@ end
|
|||||||
-- ################################ Data preparation ################################
|
-- ################################ Data preparation ################################
|
||||||
|
|
||||||
Perun.LogStatsGet = function(playerID)
|
Perun.LogStatsGet = function(playerID)
|
||||||
-- Gets Perun statistics array per player TBD rewrite
|
-- Gets Perun statistics array per player
|
||||||
local next = next -- Make next function local - this improves performance TBD
|
local next = next -- Make next function local - this improves performance
|
||||||
local _player_hash = nil
|
local _player_hash = nil
|
||||||
|
|
||||||
if next(Perun.StatDataLastType) == nil then
|
local _ucid = net.get_player_info(playerID, 'ucid')
|
||||||
-- Array is empty
|
if not _ucid then
|
||||||
_player_hash=net.get_player_info(playerID, 'ucid')..Perun.GetMulticrewParameter(playerID,"subtype")
|
_ucid=Perun.PlayersTableCache["p"..playerID].ucid
|
||||||
elseif Perun.StatDataLastType[net.get_player_info(playerID, 'ucid')]== nil then
|
|
||||||
-- Last type entry is empty
|
|
||||||
_player_hash=net.get_player_info(playerID, 'ucid')..Perun.GetMulticrewParameter(playerID,"subtype")
|
|
||||||
else
|
|
||||||
-- Return last type entry
|
|
||||||
_player_hash=Perun.StatDataLastType[net.get_player_info(playerID, 'ucid')]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local next = next -- Make next function local - this improves performance TBD
|
if next(Perun.StatDataLastType) == nil then
|
||||||
|
-- Array is empty
|
||||||
|
_player_hash=_ucid..Perun.GetMulticrewParameter(playerID,"subtype")
|
||||||
|
elseif Perun.StatDataLastType[net.get_player_info(playerID, 'ucid')]== nil then
|
||||||
|
-- Last type entry is empty
|
||||||
|
_player_hash=_ucid..Perun.GetMulticrewParameter(playerID,"subtype")
|
||||||
|
else
|
||||||
|
-- Return last type entry
|
||||||
|
_player_hash=Perun.StatDataLastType[_ucid]
|
||||||
|
end
|
||||||
|
|
||||||
|
local next = next -- Make next function local - this improves performance
|
||||||
if next(Perun.StatData) == nil then
|
if next(Perun.StatData) == nil then
|
||||||
-- Array is empty
|
-- Array is empty
|
||||||
Perun.LogStatsCount(playerID,'init') -- Init statistics
|
Perun.LogStatsCount(playerID,'init') -- Init statistics
|
||||||
@@ -554,21 +627,6 @@ Perun.LogStatsGet = function(playerID)
|
|||||||
return Perun.StatData[_player_hash];
|
return Perun.StatData[_player_hash];
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.UpdateJsonStatus = function()
|
|
||||||
-- Updates status json file
|
|
||||||
local _TempData={}
|
|
||||||
_TempData["1"]=Perun.ServerData
|
|
||||||
_TempData["2"]=Perun.StatusData
|
|
||||||
_TempData["3"]=Perun.SlotsData
|
|
||||||
-- _TempData["4"]=Perun.MissionData -- TBD: hangs for some large missions
|
|
||||||
|
|
||||||
-- Export data to JSON file
|
|
||||||
local _perun_export = io.open(Perun.JsonStatusLocation .. "perun_status_data.json", "w")
|
|
||||||
_perun_export:write(net.lua2json(_TempData) .. "\n")
|
|
||||||
_perun_export:close()
|
|
||||||
Perun.AddLog("Updated JSON",2)
|
|
||||||
end
|
|
||||||
|
|
||||||
Perun.UpdateStatus = function()
|
Perun.UpdateStatus = function()
|
||||||
-- Main function for status updates
|
-- Main function for status updates
|
||||||
|
|
||||||
@@ -650,7 +708,7 @@ Perun.onSimulationStart = function()
|
|||||||
Perun.LogEvent("SimStart","Mission " .. Perun.MissionHash .. " started",nil,nil);
|
Perun.LogEvent("SimStart","Mission " .. Perun.MissionHash .. " started",nil,nil);
|
||||||
Perun.StatData = {}
|
Perun.StatData = {}
|
||||||
Perun.StatDataLastType = {}
|
Perun.StatDataLastType = {}
|
||||||
-- TBD send this to Perun
|
Perun.PlayersTableCache = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.onSimulationStop = function()
|
Perun.onSimulationStop = function()
|
||||||
@@ -659,13 +717,21 @@ Perun.onSimulationStop = function()
|
|||||||
Perun.MissionHash=Perun.GenerateMissionHash();
|
Perun.MissionHash=Perun.GenerateMissionHash();
|
||||||
Perun.StatData = {}
|
Perun.StatData = {}
|
||||||
Perun.StatDataLastType = {}
|
Perun.StatDataLastType = {}
|
||||||
-- TBD send this to Perun
|
Perun.LogAllStats()
|
||||||
|
Perun.PlayersTableCache = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.onPlayerDisconnect = function(id, err_code)
|
Perun.onPlayerDisconnect = function(id, err_code)
|
||||||
-- Player disconnected - TBD DCS Bug, this is not triggered at this point of time
|
-- Player disconnected
|
||||||
Perun.LogEvent("disconnect", "Player " .. net.get_player_info(id, "name") .. " disconnected; " .. err_code,net.get_player_info(id, "name"),err_code);
|
Perun.LogEvent("disconnect", "Player " .. id .. " disconnected.(?)",nil,nil);
|
||||||
-- TBD send this to Perun
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
Perun.onPlayerStop = function (id)
|
||||||
|
-- Player left the simulation (happens right before a disconnect, if player exited by desire)
|
||||||
|
Perun.LogEvent("quit", "Player " .. id .. " quit the server.",nil,nil);
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.onSimulationFrame = function()
|
Perun.onSimulationFrame = function()
|
||||||
@@ -682,7 +748,6 @@ Perun.onSimulationFrame = function()
|
|||||||
Perun.lastSentMission = _now
|
Perun.lastSentMission = _now
|
||||||
|
|
||||||
Perun.UpdateMission()
|
Perun.UpdateMission()
|
||||||
Perun.UpdateJsonStatus()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Send status update
|
-- Send status update
|
||||||
@@ -697,6 +762,19 @@ Perun.onSimulationFrame = function()
|
|||||||
Perun.lastSentKeepAlive = _now
|
Perun.lastSentKeepAlive = _now
|
||||||
Perun.SendToPerun(0,nil)
|
Perun.SendToPerun(0,nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Calucalate time on slot per each of players
|
||||||
|
if _now > Perun.lastTimer + 60 then
|
||||||
|
Perun.lastTimer = _now;
|
||||||
|
local _all_players = net.get_player_list()
|
||||||
|
for PlayerIDIndex, _playerID in ipairs(_all_players) do
|
||||||
|
if _playerID ~= 1 then
|
||||||
|
Perun.LogStatsCount(_playerID,"timer",true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.onPlayerStart = function (id)
|
Perun.onPlayerStart = function (id)
|
||||||
@@ -717,6 +795,34 @@ end
|
|||||||
Perun.onGameEvent = function (eventName,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
Perun.onGameEvent = function (eventName,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
||||||
-- Game event has occured
|
-- Game event has occured
|
||||||
Perun.AddLog("Event handler for ".. eventName .. " started",2)
|
Perun.AddLog("Event handler for ".. eventName .. " started",2)
|
||||||
|
|
||||||
|
-- Below debug helper
|
||||||
|
local event_arguments = eventName
|
||||||
|
|
||||||
|
if arg1 ~= "" then
|
||||||
|
event_arguments = event_arguments .. " arg1: " .. arg1
|
||||||
|
end
|
||||||
|
if arg2 ~= "" then
|
||||||
|
event_arguments = event_arguments .. " arg2: ".. arg2
|
||||||
|
end
|
||||||
|
if arg3 ~= "" then
|
||||||
|
event_arguments = event_arguments .. " arg3: ".. arg3
|
||||||
|
end
|
||||||
|
if arg4 ~= "" then
|
||||||
|
event_arguments = event_arguments .. " arg4: ".. arg4
|
||||||
|
end
|
||||||
|
if arg5 ~= "" then
|
||||||
|
event_arguments = event_arguments .. " arg5: ".. arg5
|
||||||
|
end
|
||||||
|
if arg6 ~= "" then
|
||||||
|
event_arguments = event_arguments .. " arg6: ".. arg6
|
||||||
|
end
|
||||||
|
if arg7 ~= "" then
|
||||||
|
event_arguments = event_arguments .. " arg7: ".. arg7
|
||||||
|
end
|
||||||
|
|
||||||
|
Perun.AddLog("DEBUG onGameEvent:" .. event_arguments,2)
|
||||||
|
|
||||||
if eventName == "friendly_fire" then
|
if eventName == "friendly_fire" then
|
||||||
--"friendly_fire", playerID, weaponName, victimPlayerID
|
--"friendly_fire", playerID, weaponName, victimPlayerID
|
||||||
if arg2 == "" then
|
if arg2 == "" then
|
||||||
@@ -763,6 +869,8 @@ Perun.onGameEvent = function (eventName,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
|||||||
_temp_event_type="kill_Infantry"
|
_temp_event_type="kill_Infantry"
|
||||||
elseif _temp_category == "Fortification" then
|
elseif _temp_category == "Fortification" then
|
||||||
_temp_event_type="kill_Fortification"
|
_temp_event_type="kill_Fortification"
|
||||||
|
elseif _temp_category == "Artillery" then
|
||||||
|
_temp_event_type="kill_Artillery"
|
||||||
else
|
else
|
||||||
_temp_event_type="kill_Other"
|
_temp_event_type="kill_Other"
|
||||||
end
|
end
|
||||||
@@ -782,8 +890,13 @@ Perun.onGameEvent = function (eventName,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
|||||||
if arg7 == "" then
|
if arg7 == "" then
|
||||||
arg7 = "Cannon"
|
arg7 = "Cannon"
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.LogEvent(eventName,Perun.SideID2Name(arg3) .. _temp_killers .. " in " .. arg2 .. " killed " .. Perun.SideID2Name(arg6) .. _temp_victims .. " in " .. arg5 .. " using " .. arg7 .. " [".. Perun.GetCategory(arg5).."]",arg7,Perun.GetCategory(arg5));
|
local victim_vehicle = arg5
|
||||||
|
if victim_vehicle == "" then
|
||||||
|
victim_vehicle = "?"
|
||||||
|
end
|
||||||
|
|
||||||
|
Perun.LogEvent(eventName,Perun.SideID2Name(arg3) .. _temp_killers .. " in " .. arg2 .. " killed " .. Perun.SideID2Name(arg6) .. _temp_victims .. " in " .. victim_vehicle .. " using " .. arg7 .. " [".. Perun.GetCategory(arg5).."]",arg7,Perun.GetCategory(arg5));
|
||||||
|
|
||||||
elseif eventName == "self_kill" then
|
elseif eventName == "self_kill" then
|
||||||
--"self_kill", playerID
|
--"self_kill", playerID
|
||||||
@@ -792,26 +905,29 @@ Perun.onGameEvent = function (eventName,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
|||||||
|
|
||||||
elseif eventName == "change_slot" then
|
elseif eventName == "change_slot" then
|
||||||
--"change_slot", playerID, slotID, prevSide
|
--"change_slot", playerID, slotID, prevSide
|
||||||
|
|
||||||
Perun.LogStatsCount(arg1,"init")
|
|
||||||
_master_type,_master_slot,_sub_slot = Perun.GetMulticrewAllParameters(arg1)
|
_master_type,_master_slot,_sub_slot = Perun.GetMulticrewAllParameters(arg1)
|
||||||
if _sub_slot == nil then
|
if _sub_slot == nil then
|
||||||
_sub_slot =""
|
_sub_slot =""
|
||||||
else
|
else
|
||||||
_sub_slot =" (" .. _sub_slot .. ") "
|
_sub_slot =" (" .. _sub_slot .. ") "
|
||||||
end
|
end
|
||||||
Perun.LogEvent(eventName,Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " changed slot to " .. _master_type .. " " .. _sub_slot,nil,nil);
|
Perun.LogEvent(eventName,Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " changed slot to " .. _master_type .. " " .. _sub_slot,nil,nil);
|
||||||
|
|
||||||
|
Perun.LogStats(arg1);
|
||||||
|
Perun.LogStatsCount(arg1,"init")
|
||||||
|
Perun.PlayersTableCache["p"..arg1]=net.get_player_info(arg1);
|
||||||
|
|
||||||
elseif eventName == "connect" then
|
elseif eventName == "connect" then
|
||||||
--"connect", playerID, name
|
--"connect", playerID, name
|
||||||
Perun.LogLogin(arg1);
|
Perun.LogLogin(arg1);
|
||||||
Perun.LogEvent(eventName,"Player "..net.get_player_info(arg1, "name") .. " connected",nil,nil);
|
Perun.LogEvent(eventName,"Player "..net.get_player_info(arg1, "name") .. " connected",nil,nil);
|
||||||
|
Perun.PlayersTableCache["p"..arg1]=net.get_player_info(arg1);
|
||||||
|
|
||||||
elseif eventName == "disconnect" then
|
elseif eventName == "disconnect" then
|
||||||
--"disconnect", playerID, name, playerSide, reason_code
|
--"disconnect", playerID, name, playerSide, reason_code
|
||||||
|
Perun.LogEvent(eventName,"Player " .. arg2 .. " disconnected (".. arg4 .. ")." ,arg4,nil);
|
||||||
Perun.LogStats(arg1);
|
Perun.LogStats(arg1);
|
||||||
Perun.LogEvent(eventName, Perun.SideID2Name(arg3) .. " player " ..net.get_player_info(arg1, "name") .. " disconnected",nil,nil);
|
|
||||||
|
|
||||||
elseif eventName == "crash" then
|
elseif eventName == "crash" then
|
||||||
--"crash", playerID, unit_missionID
|
--"crash", playerID, unit_missionID
|
||||||
@@ -831,19 +947,7 @@ Perun.onGameEvent = function (eventName,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
|||||||
_temp_airfield = "";
|
_temp_airfield = "";
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TBD below shall be moved to function and arrays of strings - see landings
|
Perun.LogStatsCountCrew (arg1,Perun.GetTakeOffLandingEvent(true,arg3))
|
||||||
_temp_type = ""
|
|
||||||
if string.find(arg3, "FARP",1,true) then
|
|
||||||
_temp_type="tookoff_FARP"
|
|
||||||
elseif string.find(arg3, "CVN-74 John C. Stennis",1,true) or string.find(arg3, "LHA-1 Tarawa",1,true) or string.find(arg3, "SHIP",1,true) then
|
|
||||||
_temp_type="tookoff_SHIP"
|
|
||||||
elseif arg3 ~= "" then
|
|
||||||
_temp_type="tookoff_AIRFIELD"
|
|
||||||
else
|
|
||||||
_temp_type="tookoff_OTHER"
|
|
||||||
end
|
|
||||||
|
|
||||||
Perun.LogStatsCountCrew (arg1,_temp_type)
|
|
||||||
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player(s) " .. Perun.GetMulticrewCrewNames(arg1) .. " took off in ".. DCS.getUnitType(arg2) .. _temp_airfield,arg3,nil);
|
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player(s) " .. Perun.GetMulticrewCrewNames(arg1) .. " took off in ".. DCS.getUnitType(arg2) .. _temp_airfield,arg3,nil);
|
||||||
|
|
||||||
elseif eventName == "landing" then
|
elseif eventName == "landing" then
|
||||||
@@ -854,19 +958,7 @@ Perun.onGameEvent = function (eventName,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
|||||||
_temp_airfield ="";
|
_temp_airfield ="";
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TBD below shall be moved to function and arrays of strings - see takeoffs
|
Perun.LogStatsCountCrew (arg1,Perun.GetTakeOffLandingEvent(false,arg3))
|
||||||
_temp_type = ""
|
|
||||||
if string.find(arg3, "FARP",1,true) then
|
|
||||||
_temp_type = "landing_FARP"
|
|
||||||
elseif string.find(arg3, "CVN-74 John C. Stennis",1,true) or string.find(arg3, "LHA-1 Tarawa",1,true) or string.find(arg3, "SHIP",1,true) then
|
|
||||||
_temp_type = "landing_SHIP"
|
|
||||||
elseif arg3 ~= "" then
|
|
||||||
_temp_type = "landing_AIRFIELD"
|
|
||||||
else
|
|
||||||
_temp_type = "landing_OTHER"
|
|
||||||
end
|
|
||||||
|
|
||||||
Perun.LogStatsCountCrew (arg1,_temp_type)
|
|
||||||
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player(s) " .. Perun.GetMulticrewCrewNames(arg1) .. " landed in " .. DCS.getUnitType(arg2).. _temp_airfield,arg3,nil);
|
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player(s) " .. Perun.GetMulticrewCrewNames(arg1) .. " landed in " .. DCS.getUnitType(arg2).. _temp_airfield,arg3,nil);
|
||||||
|
|
||||||
elseif eventName == "pilot_death" then
|
elseif eventName == "pilot_death" then
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
[]
|
|
||||||
@@ -8,13 +8,19 @@ EndProject
|
|||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x64 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{5A710507-92E9-4664-9B91-918B8B82F107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{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|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.ActiveCfg = Release|Any CPU
|
||||||
{5A710507-92E9-4664-9B91-918B8B82F107}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -48,17 +48,17 @@ public class DatabaseController
|
|||||||
{
|
{
|
||||||
// Add entry to chat log
|
// 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 = "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 += "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 += "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")
|
else if (TCPFrameType == "51")
|
||||||
{
|
{
|
||||||
// Add entry to event log
|
// 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 = "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 + ";";
|
||||||
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")
|
else if (TCPFrameType == "52")
|
||||||
{
|
{
|
||||||
@@ -69,15 +69,15 @@ public class DatabaseController
|
|||||||
SQLQueryTxt += "UPDATE `pe_DataPlayers` SET `pe_DataPlayers_updated`=" + TCPFrameTimestamp + " 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_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 += "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 `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_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")
|
else if (TCPFrameType == "53")
|
||||||
{
|
{
|
||||||
// User logged in to DCS server
|
// 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 = "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 += "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 + "'), '" + TCPFrame.payload.login_name + "', '" + TCPFrame.payload.login_ipaddr + "','" + TCPFrameInstance + "');";
|
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")
|
else if (TCPFrameType == "-1")
|
||||||
{
|
{
|
||||||
@@ -87,10 +87,10 @@ public class DatabaseController
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// General definition used for 1-10 type packets
|
// 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 = "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 + ";";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect to mysql and execute sql
|
// Connect to mysql and execute sql
|
||||||
@@ -104,7 +104,29 @@ public class DatabaseController
|
|||||||
DatabaseConnection.Open();
|
DatabaseConnection.Open();
|
||||||
DatabaseStatus = true;
|
DatabaseStatus = true;
|
||||||
MySqlCommand DatabaseCommand = new MySqlCommand(SQLQueryTxt, DatabaseConnection);
|
MySqlCommand DatabaseCommand = new MySqlCommand(SQLQueryTxt, DatabaseConnection);
|
||||||
MySqlDataReader DatabaseReader = DatabaseCommand.ExecuteReader();
|
|
||||||
|
// 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)
|
if (DatabaseReader.HasRows)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ internal class PerunHelper
|
|||||||
Globals.AppUpdateGUI = true;
|
Globals.AppUpdateGUI = true;
|
||||||
}
|
}
|
||||||
// Add the entry to log file
|
// 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)
|
public static string GetAppVersion(string strBeginning)
|
||||||
@@ -60,6 +60,7 @@ internal class PerunHelper
|
|||||||
|
|
||||||
public static int CheckVersions()
|
public static int CheckVersions()
|
||||||
{
|
{
|
||||||
|
#if !DEBUG
|
||||||
// Checks the versions of APP, DCS Hook and MySQL database
|
// Checks the versions of APP, DCS Hook and MySQL database
|
||||||
Match match = Regex.Match(Globals.VersionPerun, @"^\d+.\d+.\d+", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
Match match = Regex.Match(Globals.VersionPerun, @"^\d+.\d+.\d+", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
string VersionApp = "v" + match.Groups[0].Value;
|
string VersionApp = "v" + match.Groups[0].Value;
|
||||||
@@ -90,5 +91,8 @@ internal class PerunHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ReturnValue;
|
return ReturnValue;
|
||||||
|
#else
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,11 +157,11 @@
|
|||||||
// label6
|
// label6
|
||||||
//
|
//
|
||||||
this.label6.AutoSize = true;
|
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.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.TabIndex = 9;
|
||||||
this.label6.Text = "Server port";
|
this.label6.Text = "MySQL DB port";
|
||||||
//
|
//
|
||||||
// con_txt_mysql_port
|
// con_txt_mysql_port
|
||||||
//
|
//
|
||||||
@@ -198,20 +198,20 @@
|
|||||||
// label2
|
// label2
|
||||||
//
|
//
|
||||||
this.label2.AutoSize = true;
|
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.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.TabIndex = 4;
|
||||||
this.label2.Text = "Database";
|
this.label2.Text = "Database name";
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
this.label1.AutoSize = true;
|
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.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.TabIndex = 3;
|
||||||
this.label1.Text = "Server address";
|
this.label1.Text = "MySQL DB address";
|
||||||
//
|
//
|
||||||
// con_txt_mysql_database
|
// con_txt_mysql_database
|
||||||
//
|
//
|
||||||
@@ -359,11 +359,11 @@
|
|||||||
// label8
|
// label8
|
||||||
//
|
//
|
||||||
this.label8.AutoSize = true;
|
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.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.TabIndex = 12;
|
||||||
this.label8.Text = "Instance ID";
|
this.label8.Text = "Perun Instance ID";
|
||||||
//
|
//
|
||||||
// con_txt_dcs_instance
|
// con_txt_dcs_instance
|
||||||
//
|
//
|
||||||
@@ -375,11 +375,11 @@
|
|||||||
// label7
|
// label7
|
||||||
//
|
//
|
||||||
this.label7.AutoSize = true;
|
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.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.TabIndex = 10;
|
||||||
this.label7.Text = "Server port";
|
this.label7.Text = "Perun port";
|
||||||
//
|
//
|
||||||
// con_txt_dcs_server_port
|
// con_txt_dcs_server_port
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -506,46 +506,27 @@ namespace Perun_v1
|
|||||||
ExtSRSJson = System.IO.File.ReadAllText(con_txt_3rd_srs.Text);
|
ExtSRSJson = System.IO.File.ReadAllText(con_txt_3rd_srs.Text);
|
||||||
dynamic raw_lotatc = JsonConvert.DeserializeObject(ExtSRSJson);
|
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--)
|
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 + "'}";
|
||||||
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;
|
ExtSRSUseDefault = false;
|
||||||
PerunHelper.AddLog(ref Globals.AppLogHistory, "SRS data loaded", 3, 0, "100", true);
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "SRS data loaded", 3, 0, "100", true);
|
||||||
ExtSRSStatus = true;
|
ExtSRSStatus = true;
|
||||||
@@ -563,7 +544,10 @@ namespace Perun_v1
|
|||||||
{
|
{
|
||||||
ExtSRSJson = "{'type':'100','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':{'ignore':'true'}}";
|
ExtSRSJson = "{'type':'100','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':{'ignore':'true'}}";
|
||||||
}
|
}
|
||||||
DatabaseConnection.SendToMySql(ExtSRSJson);
|
if (ExtSRSStatus)
|
||||||
|
{
|
||||||
|
DatabaseConnection.SendToMySql(ExtSRSJson);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle LotATC
|
// Handle LotATC
|
||||||
@@ -594,7 +578,10 @@ namespace Perun_v1
|
|||||||
{
|
{
|
||||||
ExtLotATCJson = "{'type':'101','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':{'ignore':'true'}}"; // No LotATC controller connected
|
ExtLotATCJson = "{'type':'101','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':{'ignore':'true'}}"; // No LotATC controller connected
|
||||||
}
|
}
|
||||||
DatabaseConnection.SendToMySql(ExtLotATCJson);
|
if (ExtLotATCStatus)
|
||||||
|
{
|
||||||
|
DatabaseConnection.SendToMySql(ExtLotATCJson);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's do not risk int overload
|
// Let's do not risk int overload
|
||||||
|
|||||||
@@ -12,29 +12,27 @@
|
|||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
<PublishUrl>ftp://s18.mydevil.net/perun/</PublishUrl>
|
<PublishUrl>C:\Users\DCS\Desktop\Perun\</PublishUrl>
|
||||||
<Install>true</Install>
|
<Install>true</Install>
|
||||||
<InstallFrom>Web</InstallFrom>
|
<InstallFrom>Disk</InstallFrom>
|
||||||
<UpdateEnabled>true</UpdateEnabled>
|
<UpdateEnabled>false</UpdateEnabled>
|
||||||
<UpdateMode>Foreground</UpdateMode>
|
<UpdateMode>Foreground</UpdateMode>
|
||||||
<UpdateInterval>7</UpdateInterval>
|
<UpdateInterval>7</UpdateInterval>
|
||||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||||
<UpdatePeriodically>false</UpdatePeriodically>
|
<UpdatePeriodically>false</UpdatePeriodically>
|
||||||
<UpdateRequired>false</UpdateRequired>
|
<UpdateRequired>false</UpdateRequired>
|
||||||
<MapFileExtensions>true</MapFileExtensions>
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
<InstallUrl>http://share.porwolik.com/ftp/perun/</InstallUrl>
|
|
||||||
<SupportUrl>https://github.com/szporwolik/perun</SupportUrl>
|
<SupportUrl>https://github.com/szporwolik/perun</SupportUrl>
|
||||||
<ErrorReportUrl>https://github.com/szporwolik/perun</ErrorReportUrl>
|
<ErrorReportUrl>https://github.com/szporwolik/perun</ErrorReportUrl>
|
||||||
<TargetCulture>en</TargetCulture>
|
<TargetCulture>en</TargetCulture>
|
||||||
<ProductName>Perun for DCS World</ProductName>
|
<ProductName>Perun for DCS World</ProductName>
|
||||||
<PublisherName>szporwolik</PublisherName>
|
<PublisherName>szporwolik</PublisherName>
|
||||||
<SuiteName>Perun</SuiteName>
|
<SuiteName>Perun</SuiteName>
|
||||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
|
||||||
<WebPage>Perun.htm</WebPage>
|
<WebPage>Perun.htm</WebPage>
|
||||||
<ApplicationRevision>0</ApplicationRevision>
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
<ApplicationVersion>0.9.0.%2a</ApplicationVersion>
|
<ApplicationVersion>0.10.0.%2a</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||||
@@ -50,6 +48,7 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<CodeAnalysisRuleSet>SecurityRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>SecurityRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@@ -88,6 +87,28 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
|
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
|
||||||
</PropertyGroup>
|
</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>
|
<ItemGroup>
|
||||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.3.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
|
<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>
|
<HintPath>..\packages\BouncyCastle.1.8.3.1\lib\BouncyCastle.Crypto.dll</HintPath>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Szymon Porwolik")]
|
[assembly: AssemblyCompany("Szymon Porwolik")]
|
||||||
[assembly: AssemblyProduct("Perun for DCS World")]
|
[assembly: AssemblyProduct("Perun for DCS World")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
[assembly: AssemblyCopyright("Copyright © 2019-2020")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[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
|
// 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:
|
// przy użyciu symbolu „*”, tak jak pokazano poniżej:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.9.0.0")]
|
[assembly: AssemblyVersion("0.10.0.0")]
|
||||||
[assembly: AssemblyFileVersion("0.9.0.0")]
|
[assembly: AssemblyFileVersion("0.10.0.0")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ SET time_zone = "+00:00";
|
|||||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
/*!40101 SET NAMES utf8mb4 */;
|
/*!40101 SET NAMES utf8mb4 */;
|
||||||
|
|
||||||
CREATE DATABASE IF NOT EXISTS `m1081_perun` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
|
|
||||||
USE `m1081_perun`;
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `pe_Config`;
|
DROP TABLE IF EXISTS `pe_Config`;
|
||||||
CREATE TABLE IF NOT EXISTS `pe_Config` (
|
CREATE TABLE IF NOT EXISTS `pe_Config` (
|
||||||
@@ -19,7 +17,7 @@ CREATE TABLE IF NOT EXISTS `pe_Config` (
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
INSERT INTO `pe_Config` (`pe_Config_id`, `pe_Config_payload`) VALUES
|
INSERT INTO `pe_Config` (`pe_Config_id`, `pe_Config_payload`) VALUES
|
||||||
(1, 'v0.9.0');
|
(1, 'v0.10.0');
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `pe_DataMissionHashes`;
|
DROP TABLE IF EXISTS `pe_DataMissionHashes`;
|
||||||
CREATE TABLE IF NOT EXISTS `pe_DataMissionHashes` (
|
CREATE TABLE IF NOT EXISTS `pe_DataMissionHashes` (
|
||||||
@@ -30,24 +28,25 @@ CREATE TABLE IF NOT EXISTS `pe_DataMissionHashes` (
|
|||||||
PRIMARY KEY (`pe_DataMissionHashes_id`),
|
PRIMARY KEY (`pe_DataMissionHashes_id`),
|
||||||
UNIQUE KEY `UNIQUE_hash` (`pe_DataMissionHashes_hash`),
|
UNIQUE KEY `UNIQUE_hash` (`pe_DataMissionHashes_hash`),
|
||||||
KEY `pe_DataMissionHashes_instance` (`pe_DataMissionHashes_instance`)
|
KEY `pe_DataMissionHashes_instance` (`pe_DataMissionHashes_instance`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=7215 DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `pe_DataPlayers`;
|
DROP TABLE IF EXISTS `pe_DataPlayers`;
|
||||||
CREATE TABLE IF NOT EXISTS `pe_DataPlayers` (
|
CREATE TABLE IF NOT EXISTS `pe_DataPlayers` (
|
||||||
`pe_DataPlayers_id` bigint(20) NOT NULL AUTO_INCREMENT,
|
`pe_DataPlayers_id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
`pe_DataPlayers_ucid` varchar(150) NOT NULL,
|
`pe_DataPlayers_ucid` varchar(150) NOT NULL,
|
||||||
`pe_DataPlayers_lastname` varchar(150) NOT NULL,
|
`pe_DataPlayers_lastname` varchar(150) DEFAULT NULL,
|
||||||
`pe_DataPlayers_lastip` varchar(100) NOT NULL,
|
`pe_DataPlayers_lastip` varchar(100) DEFAULT NULL,
|
||||||
`pe_DataPlayers_updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`pe_DataPlayers_updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
PRIMARY KEY (`pe_DataPlayers_id`),
|
PRIMARY KEY (`pe_DataPlayers_id`),
|
||||||
UNIQUE KEY `UNIQUE_UCID` (`pe_DataPlayers_ucid`)
|
UNIQUE KEY `UNIQUE_UCID` (`pe_DataPlayers_ucid`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=226 DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `pe_DataRaw`;
|
DROP TABLE IF EXISTS `pe_DataRaw`;
|
||||||
CREATE TABLE IF NOT EXISTS `pe_DataRaw` (
|
CREATE TABLE IF NOT EXISTS `pe_DataRaw` (
|
||||||
`pe_dataraw_type` tinyint(4) NOT NULL,
|
`pe_dataraw_type` tinyint(4) NOT NULL,
|
||||||
`pe_dataraw_instance` smallint(5) UNSIGNED 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,
|
`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_type_pe_dataraw_instance` (`pe_dataraw_type`,`pe_dataraw_instance`),
|
||||||
@@ -61,7 +60,7 @@ CREATE TABLE IF NOT EXISTS `pe_DataTypes` (
|
|||||||
`pe_DataTypes_update` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`pe_DataTypes_update` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
PRIMARY KEY (`pe_DataTypes_id`),
|
PRIMARY KEY (`pe_DataTypes_id`),
|
||||||
UNIQUE KEY `UNIQUE_TYPE_NAME` (`pe_DataTypes_name`)
|
UNIQUE KEY `UNIQUE_TYPE_NAME` (`pe_DataTypes_name`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=60 DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `pe_LogChat`;
|
DROP TABLE IF EXISTS `pe_LogChat`;
|
||||||
CREATE TABLE IF NOT EXISTS `pe_LogChat` (
|
CREATE TABLE IF NOT EXISTS `pe_LogChat` (
|
||||||
@@ -76,7 +75,7 @@ CREATE TABLE IF NOT EXISTS `pe_LogChat` (
|
|||||||
KEY `pe_LogChat_playerid` (`pe_LogChat_playerid`),
|
KEY `pe_LogChat_playerid` (`pe_LogChat_playerid`),
|
||||||
KEY `pe_LogChat_datetime` (`pe_LogChat_datetime`),
|
KEY `pe_LogChat_datetime` (`pe_LogChat_datetime`),
|
||||||
KEY `pe_LogChat_all` (`pe_LogChat_all`)
|
KEY `pe_LogChat_all` (`pe_LogChat_all`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=22686 DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `pe_LogEvent`;
|
DROP TABLE IF EXISTS `pe_LogEvent`;
|
||||||
CREATE TABLE IF NOT EXISTS `pe_LogEvent` (
|
CREATE TABLE IF NOT EXISTS `pe_LogEvent` (
|
||||||
@@ -92,7 +91,7 @@ CREATE TABLE IF NOT EXISTS `pe_LogEvent` (
|
|||||||
KEY `pe_LogEvent_missionhash_id` (`pe_LogEvent_missionhash_id`),
|
KEY `pe_LogEvent_missionhash_id` (`pe_LogEvent_missionhash_id`),
|
||||||
KEY `pe_LogEvent_datetime` (`pe_LogEvent_datetime`),
|
KEY `pe_LogEvent_datetime` (`pe_LogEvent_datetime`),
|
||||||
KEY `pe_LogEvent_type_2` (`pe_LogEvent_type`)
|
KEY `pe_LogEvent_type_2` (`pe_LogEvent_type`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=99807 DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `pe_LogLogins`;
|
DROP TABLE IF EXISTS `pe_LogLogins`;
|
||||||
CREATE TABLE IF NOT EXISTS `pe_LogLogins` (
|
CREATE TABLE IF NOT EXISTS `pe_LogLogins` (
|
||||||
@@ -106,7 +105,7 @@ CREATE TABLE IF NOT EXISTS `pe_LogLogins` (
|
|||||||
KEY `pe_LogLogins_playerid` (`pe_LogLogins_playerid`),
|
KEY `pe_LogLogins_playerid` (`pe_LogLogins_playerid`),
|
||||||
KEY `pe_LogLogins_datetime` (`pe_LogLogins_datetime`),
|
KEY `pe_LogLogins_datetime` (`pe_LogLogins_datetime`),
|
||||||
KEY `pe_LogLogins_instance` (`pe_LogLogins_instance`)
|
KEY `pe_LogLogins_instance` (`pe_LogLogins_instance`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=11344 DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `pe_LogStats`;
|
DROP TABLE IF EXISTS `pe_LogStats`;
|
||||||
CREATE TABLE IF NOT EXISTS `pe_LogStats` (
|
CREATE TABLE IF NOT EXISTS `pe_LogStats` (
|
||||||
@@ -116,8 +115,7 @@ CREATE TABLE IF NOT EXISTS `pe_LogStats` (
|
|||||||
`pe_LogStats_playerid` bigint(20) DEFAULT NULL,
|
`pe_LogStats_playerid` bigint(20) DEFAULT NULL,
|
||||||
`pe_LogStats_typeid` int(11) DEFAULT NULL,
|
`pe_LogStats_typeid` int(11) DEFAULT NULL,
|
||||||
`pe_LogStats_masterslot` int(11) DEFAULT NULL,
|
`pe_LogStats_masterslot` int(11) DEFAULT NULL,
|
||||||
`pe_LogStats_seat` int(10) UNSIGNED DEFAULT NULL,
|
`pe_LogStats_seat` int(10) DEFAULT NULL,
|
||||||
`ps_kills` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
|
||||||
`ps_pvp` 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_deaths` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
`ps_ejections` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
`ps_ejections` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
@@ -131,6 +129,7 @@ CREATE TABLE IF NOT EXISTS `pe_LogStats` (
|
|||||||
`ps_kills_infantry` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
`ps_kills_infantry` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
`ps_kills_ships` 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_fortification` int(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`ps_kills_artillery` int(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
`ps_kills_other` int(11) UNSIGNED 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_takeoffs` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
`ps_airfield_landings` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
`ps_airfield_landings` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
@@ -140,6 +139,7 @@ CREATE TABLE IF NOT EXISTS `pe_LogStats` (
|
|||||||
`ps_farp_landings` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
`ps_farp_landings` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
`ps_other_landings` int(10) 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_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,
|
`pe_LogStats_mstatus` enum('?','RTB','MIA','KIA') DEFAULT NULL,
|
||||||
PRIMARY KEY (`pe_LogStats_id`),
|
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,
|
UNIQUE KEY `UNIQUE_STATS_PER_MISSION_AND_UCID_AND_TYPE` (`pe_LogStats_playerid`,`pe_LogStats_missionhash_id`,`pe_LogStats_typeid`) USING BTREE,
|
||||||
@@ -149,7 +149,8 @@ CREATE TABLE IF NOT EXISTS `pe_LogStats` (
|
|||||||
KEY `pe_LogStats_masterslot` (`pe_LogStats_masterslot`),
|
KEY `pe_LogStats_masterslot` (`pe_LogStats_masterslot`),
|
||||||
KEY `pe_LogStats_mstatus` (`pe_LogStats_mstatus`),
|
KEY `pe_LogStats_mstatus` (`pe_LogStats_mstatus`),
|
||||||
KEY `pe_LogStats_seat` (`pe_LogStats_seat`)
|
KEY `pe_LogStats_seat` (`pe_LogStats_seat`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=10220 DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `pe_LogStats_UPDATE`;
|
DROP TRIGGER IF EXISTS `pe_LogStats_UPDATE`;
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE TRIGGER `pe_LogStats_UPDATE` BEFORE UPDATE ON `pe_LogStats` FOR EACH ROW BEGIN
|
CREATE TRIGGER `pe_LogStats_UPDATE` BEFORE UPDATE ON `pe_LogStats` FOR EACH ROW BEGIN
|
||||||
|
|||||||
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.
24
README.md
24
README.md
@@ -1,24 +1,24 @@
|
|||||||
|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
# Perun for DCS World
|
# 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.
|
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
|
## Prerequisites
|
||||||
Core:
|
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)
|
* 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
|
* .NET Framework 4.8.0
|
||||||
|
|
||||||
@@ -29,13 +29,12 @@ Core:
|
|||||||
## Installing
|
## Installing
|
||||||
* Download latest [release](https://github.com/szporwolik/perun/releases)
|
* 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)
|
* 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
|
## Running
|
||||||
* Start DCS World and host multiplayer session
|
* 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 - ensure that port and instance ID in the options sections of the Lua file matches data
|
||||||
* by default the TCP port 48620 is in use as target port
|
* run the Win32 application
|
||||||
* **optionaly** run the Win32 application
|
|
||||||
* set MySQL connection data
|
* set MySQL connection data
|
||||||
* **optionaly** point LotATC json file location
|
* **optionaly** point LotATC json file location
|
||||||
* **optionaly** point DCS SRS json file location
|
* **optionaly** point DCS SRS json file location
|
||||||
@@ -68,8 +67,11 @@ Due to resource limitations, "Perun for DCS World" will focus on pulling the dat
|
|||||||
### I keep getting 1305 MySQL error
|
### 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.
|
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
|
### 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)
|
# API documentation (for expert users)
|
||||||
## MySQL database structure
|
## MySQL database structure
|
||||||
|
|||||||
Reference in New Issue
Block a user