mirror of
https://github.com/DaKerboul/perun.git
synced 2026-08-09 17:55:38 +02:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad299b227b | ||
|
|
7d3b99c1fd | ||
|
|
57771d94b7 | ||
|
|
d1bedf3e1c | ||
|
|
c4eb824c32 | ||
|
|
ab1e19b340 | ||
|
|
ba646a6c22 | ||
|
|
7e8b01c2aa | ||
|
|
7b907190f9 | ||
|
|
7f484bc1a1 | ||
|
|
c053d5d461 | ||
|
|
5b3d19e134 | ||
|
|
d885d2cd90 | ||
|
|
9f50bb1397 | ||
|
|
f7f688d1a5 | ||
|
|
81ff34014a | ||
|
|
9e0c515af0 | ||
|
|
9391d8778f | ||
|
|
1cfe5a1ea9 | ||
|
|
8d1835f6f5 |
@@ -14,17 +14,19 @@ Perun.UDPSourcePort = 48621 -- (int) UDP port to send data from
|
|||||||
Perun.Instance = 1 -- (int) Id number of instance (if multiple DCS instances are to run at the same PC)
|
Perun.Instance = 1 -- (int) Id number of instance (if multiple DCS instances are to run at the same PC)
|
||||||
Perun.JsonStatusLocation = "Scripts\\Json\\" -- (string) folder relative do user's SaveGames DCS folder -> status file updated each RefreshMission
|
Perun.JsonStatusLocation = "Scripts\\Json\\" -- (string) folder relative do user's SaveGames DCS folder -> status file updated each RefreshMission
|
||||||
Perun.MOTD_L1 = "Witamy na serwerze Gildia.org !" -- (string) Message send to players connecting the server - Line 1
|
Perun.MOTD_L1 = "Witamy na serwerze Gildia.org !" -- (string) Message send to players connecting the server - Line 1
|
||||||
Perun.MOTD_L2 = "Wymagamy obecnosci na 255Mhz (DCS SRS)" -- (string) Message send to players connecting the server - Line 2
|
Perun.MOTD_L2 = "Wymagamy obecnosci DCS SRS - szczegoly na forum" -- (string) Message send to players connecting the server - Line 2
|
||||||
|
|
||||||
-- ###################### 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.4.1"
|
Perun.Version = "v0.6.0"
|
||||||
Perun.StatusData = {}
|
Perun.StatusData = {}
|
||||||
Perun.SlotsData = {}
|
Perun.SlotsData = {}
|
||||||
Perun.MissionData = {}
|
Perun.MissionData = {}
|
||||||
Perun.ServerData = {}
|
Perun.ServerData = {}
|
||||||
|
Perun.StatData = {}
|
||||||
|
Perun.StatDataLastType = {}
|
||||||
Perun.MissionHash=""
|
Perun.MissionHash=""
|
||||||
Perun.lastSentStatus =0
|
Perun.lastSentStatus =0
|
||||||
Perun.lastSentMission =0
|
Perun.lastSentMission =0
|
||||||
@@ -169,7 +171,6 @@ Perun.UpdateJsonStatus = function()
|
|||||||
perun_export = io.open(Perun.JsonStatusLocation .. "perun_status_data.json", "w")
|
perun_export = io.open(Perun.JsonStatusLocation .. "perun_status_data.json", "w")
|
||||||
perun_export:write(_temp .. "\n")
|
perun_export:write(_temp .. "\n")
|
||||||
perun_export:close()
|
perun_export:close()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.Send = function(data_id, data_package)
|
Perun.Send = function(data_id, data_package)
|
||||||
@@ -184,7 +185,7 @@ Perun.Send = function(data_id, data_package)
|
|||||||
temp=stripChars(temp)
|
temp=stripChars(temp)
|
||||||
|
|
||||||
Perun.UDP:send(temp)
|
Perun.UDP:send(temp)
|
||||||
Perun.AddLog("Packet send")
|
Perun.AddLog("Packet send "..data_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.UpdateStatusPart = function(part_id, data_package)
|
Perun.UpdateStatusPart = function(part_id, data_package)
|
||||||
@@ -237,6 +238,18 @@ Perun.UpdateStatus = function()
|
|||||||
|
|
||||||
for j, i in pairs(Perun.SlotsData['coalitions']) do
|
for j, i in pairs(Perun.SlotsData['coalitions']) do
|
||||||
Perun.SlotsData['slots'][j]=DCS.getAvailableSlots(j)
|
Perun.SlotsData['slots'][j]=DCS.getAvailableSlots(j)
|
||||||
|
|
||||||
|
for sj, si in pairs(Perun.SlotsData['slots'][j]) do
|
||||||
|
Perun.SlotsData['slots'][j][sj]['countryName']= nil
|
||||||
|
Perun.SlotsData['slots'][j][sj]['onboard_num']= nil
|
||||||
|
Perun.SlotsData['slots'][j][sj]['groupSize']= nil
|
||||||
|
Perun.SlotsData['slots'][j][sj]['groupName']= nil
|
||||||
|
Perun.SlotsData['slots'][j][sj]['callsign']= nil
|
||||||
|
Perun.SlotsData['slots'][j][sj]['task']= nil
|
||||||
|
Perun.SlotsData['slots'][j][sj]['airdromeId']= nil
|
||||||
|
Perun.SlotsData['slots'][j][sj]['helipadName']= nil
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
-- Send
|
-- Send
|
||||||
Perun.Send(3,Perun.SlotsData)
|
Perun.Send(3,Perun.SlotsData)
|
||||||
@@ -262,11 +275,13 @@ Perun.LogChat = function(playerID,msg,all)
|
|||||||
Perun.Send(50,data)
|
Perun.Send(50,data)
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.LogEvent = function(log_type,log_content)
|
Perun.LogEvent = function(log_type,log_content,log_arg_1,log_arg_2)
|
||||||
-- Log chat messages
|
-- Log chat messages
|
||||||
|
|
||||||
data={}
|
data={}
|
||||||
data['log_type']= log_type
|
data['log_type']= log_type
|
||||||
|
data['log_arg_1']= log_arg_1
|
||||||
|
data['log_arg_2']= log_arg_2
|
||||||
data['log_content']=log_content
|
data['log_content']=log_content
|
||||||
data['log_datetime']=os.date('%Y-%m-%d %H:%M:%S')
|
data['log_datetime']=os.date('%Y-%m-%d %H:%M:%S')
|
||||||
data['log_missionhash']=Perun.MissionHash
|
data['log_missionhash']=Perun.MissionHash
|
||||||
@@ -274,23 +289,140 @@ Perun.LogEvent = function(log_type,log_content)
|
|||||||
Perun.Send(51,data)
|
Perun.Send(51,data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Perun.LogStatsCount = function(argPlayerID,argAction,argType)
|
||||||
|
-- Creates or updates Perun statistics array
|
||||||
|
_ucid=net.get_player_info(argPlayerID, 'ucid')..argType
|
||||||
|
|
||||||
|
if Perun.StatData[_ucid] == nil then
|
||||||
|
-- Create empty element
|
||||||
|
_temp={}
|
||||||
|
_temp['ps_type'] = argType
|
||||||
|
_temp['ps_pvp'] = 0
|
||||||
|
_temp['ps_deaths'] = 0
|
||||||
|
_temp['ps_ejections'] = 0
|
||||||
|
_temp['ps_crashes'] = 0
|
||||||
|
_temp['ps_teamkills'] = 0
|
||||||
|
_temp['ps_kills_planes'] = 0
|
||||||
|
_temp['ps_kills_helicopters'] = 0
|
||||||
|
_temp['ps_kills_air_defense'] = 0
|
||||||
|
_temp['ps_kills_armor'] = 0
|
||||||
|
_temp['ps_kills_unarmed'] = 0
|
||||||
|
_temp['ps_kills_infantry'] = 0
|
||||||
|
_temp['ps_kills_ships'] = 0
|
||||||
|
_temp['ps_kills_fortification'] = 0
|
||||||
|
_temp['ps_kills_other'] = 0
|
||||||
|
_temp['ps_airfield_takeoffs'] = 0
|
||||||
|
_temp['ps_airfield_landings'] = 0
|
||||||
|
_temp['ps_ship_takeoffs'] = 0
|
||||||
|
_temp['ps_ship_landings'] = 0
|
||||||
|
_temp['ps_farp_takeoffs'] = 0
|
||||||
|
_temp['ps_farp_landings'] = 0
|
||||||
|
_temp['ps_other_takeoffs'] = 0
|
||||||
|
_temp['ps_other_landings'] = 0
|
||||||
|
|
||||||
|
Perun.StatData[_ucid]=_temp
|
||||||
|
end
|
||||||
|
|
||||||
|
if argType ~= nil then
|
||||||
|
Perun.StatData[_ucid]['ps_type']=argType;
|
||||||
|
Perun.StatDataLastType[net.get_player_info(argPlayerID, 'ucid')]=_ucid
|
||||||
|
else
|
||||||
|
-- Do nothing
|
||||||
|
end
|
||||||
|
|
||||||
|
if argAction == "eject" then
|
||||||
|
Perun.StatData[_ucid]['ps_ejections']=Perun.StatData[_ucid]['ps_ejections']+1
|
||||||
|
elseif argAction == "pilot_death" then
|
||||||
|
Perun.StatData[_ucid]['ps_deaths']=Perun.StatData[_ucid]['ps_deaths']+1
|
||||||
|
elseif argAction == "friendly_fire" then
|
||||||
|
Perun.StatData[_ucid]['ps_teamkills']=Perun.StatData[_ucid]['ps_teamkills']+1
|
||||||
|
elseif argAction == "crash" then
|
||||||
|
Perun.StatData[_ucid]['ps_crashes']=Perun.StatData[_ucid]['ps_crashes']+1
|
||||||
|
elseif argAction == "landing_FARP" then
|
||||||
|
Perun.StatData[_ucid]['ps_farp_landings']=Perun.StatData[_ucid]['ps_farp_landings']+1
|
||||||
|
elseif argAction == "landing_SHIP" then
|
||||||
|
Perun.StatData[_ucid]['ps_ship_landings']=Perun.StatData[_ucid]['ps_ship_landings']+1
|
||||||
|
elseif argAction == "landing_AIRFIELD" then
|
||||||
|
Perun.StatData[_ucid]['ps_airfield_landings']=Perun.StatData[_ucid]['ps_airfield_landings']+1
|
||||||
|
elseif argAction == "tookoff_FARP" then
|
||||||
|
Perun.StatData[_ucid]['ps_farp_takeoffs']=Perun.StatData[_ucid]['ps_farp_takeoffs']+1
|
||||||
|
elseif argAction == "tookoff_SHIP" then
|
||||||
|
Perun.StatData[_ucid]['ps_ship_takeoffs']=Perun.StatData[_ucid]['ps_ship_takeoffs']+1
|
||||||
|
elseif argAction == "tookoff_AIRFIELD" then
|
||||||
|
Perun.StatData[_ucid]['ps_airfield_takeoffs']=Perun.StatData[_ucid]['ps_airfield_takeoffs']+1
|
||||||
|
elseif argAction == "kill_Planes" then
|
||||||
|
Perun.StatData[_ucid]['ps_kills_planes']=Perun.StatData[_ucid]['ps_kills_planes']+1
|
||||||
|
elseif argAction == "kill_Helicopters" then
|
||||||
|
Perun.StatData[_ucid]['ps_kills_helicopters']=Perun.StatData[_ucid]['ps_kills_helicopters']+1
|
||||||
|
elseif argAction == "kill_Ships" then
|
||||||
|
Perun.StatData[_ucid]['ps_kills_ships']=Perun.StatData[_ucid]['ps_kills_ships']+1
|
||||||
|
elseif argAction == "kill_Air_Defence" then
|
||||||
|
Perun.StatData[_ucid]['ps_kills_air_defense']=Perun.StatData[_ucid]['ps_kills_air_defense']+1
|
||||||
|
elseif argAction == "kill_Unarmed" then
|
||||||
|
Perun.StatData[_ucid]['ps_kills_unarmed']=Perun.StatData[_ucid]['ps_kills_unarmed']+1
|
||||||
|
elseif argAction == "kill_Armor" then
|
||||||
|
Perun.StatData[_ucid]['ps_kills_armor']=Perun.StatData[_ucid]['ps_kills_armor']+1
|
||||||
|
elseif argAction == "kill_Infantry" then
|
||||||
|
Perun.StatData[_ucid]['ps_kills_infantry']=Perun.StatData[_ucid]['ps_kills_infantry']+1
|
||||||
|
elseif argAction == "kill_Fortification" then
|
||||||
|
Perun.StatData[_ucid]['ps_kills_fortification']=Perun.StatData[_ucid]['ps_kills_fortification']+1
|
||||||
|
elseif argAction == "kill_Other" then
|
||||||
|
Perun.StatData[_ucid]['ps_kills_other']=Perun.StatData[_ucid]['ps_kills_other']+1
|
||||||
|
elseif argAction == "kill_PvP" then
|
||||||
|
Perun.StatData[_ucid]['ps_pvp']=Perun.StatData[_ucid]['ps_pvp']+1
|
||||||
|
elseif argAction == "landing_OTHER" then
|
||||||
|
Perun.StatData[_ucid]['ps_other_landings']=Perun.StatData[_ucid]['ps_other_landings']+1
|
||||||
|
elseif argAction == "tookoff_OTHER" then
|
||||||
|
Perun.StatData[_ucid]['ps_other_takeoffs']=Perun.StatData[_ucid]['ps_other_takeoffs']+1
|
||||||
|
end
|
||||||
|
|
||||||
|
Perun.LogStats(argPlayerID);
|
||||||
|
end
|
||||||
|
|
||||||
|
Perun.LogStatsGet = function(playerID)
|
||||||
|
-- Gets Perun statistics array per player
|
||||||
|
|
||||||
|
local next = next
|
||||||
|
if next(Perun.StatDataLastType) == nil then
|
||||||
|
_ucid=net.get_player_info(playerID, 'ucid')..DCS.getUnitType(playerID)
|
||||||
|
elseif Perun.StatDataLastType[net.get_player_info(playerID, 'ucid')]== nil then
|
||||||
|
_ucid=net.get_player_info(playerID, 'ucid')..DCS.getUnitType(playerID)
|
||||||
|
else
|
||||||
|
_ucid=Perun.StatDataLastType[net.get_player_info(playerID, 'ucid')]
|
||||||
|
end
|
||||||
|
|
||||||
|
local next = next
|
||||||
|
if next(Perun.StatData) == nil then
|
||||||
|
Perun.LogStatsCount(playerID,'init')
|
||||||
|
|
||||||
|
end
|
||||||
|
if Perun.StatData[_ucid]== nil then
|
||||||
|
Perun.LogStatsCount(playerID,'init')
|
||||||
|
end
|
||||||
|
return Perun.StatData[_ucid];
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Perun.LogStats = function(playerID)
|
Perun.LogStats = function(playerID)
|
||||||
-- Log player status
|
-- Log player status
|
||||||
|
|
||||||
-- TBD : not working at the moment WIP
|
-- TBD : DCS stats not working at the moment WIP
|
||||||
p_stats={}
|
p_stats_dcs={}
|
||||||
p_stats['PS_CAR']=net.get_stat(playerID,2)
|
p_stats_dcs['PS_CAR']=net.get_stat(playerID,2)
|
||||||
p_stats['PS_PLANE']=net.get_stat(playerID,3)
|
p_stats_dcs['PS_PLANE']=net.get_stat(playerID,3)
|
||||||
p_stats['PS_SHIP']=net.get_stat(playerID,4)
|
p_stats_dcs['PS_SHIP']=net.get_stat(playerID,4)
|
||||||
p_stats['PS_SCORE']=net.get_stat(playerID,5)
|
p_stats_dcs['PS_SCORE']=net.get_stat(playerID,5)
|
||||||
p_stats['PS_LAND']=net.get_stat(playerID,6)
|
p_stats_dcs['PS_LAND']=net.get_stat(playerID,6)
|
||||||
p_stats['PS_PING']=net.get_stat(playerID,0)
|
p_stats_dcs['PS_PING']=net.get_stat(playerID,0)
|
||||||
p_stats['PS_CRASH']=net.get_stat(playerID,1)
|
p_stats_dcs['PS_CRASH']=net.get_stat(playerID,1)
|
||||||
p_stats['PS_EJECT']=net.get_stat(playerID,7)
|
p_stats_dcs['PS_EJECT']=net.get_stat(playerID,7)
|
||||||
p_stats['debug']="ok"
|
|
||||||
|
_temp=Perun.LogStatsGet(playerID)
|
||||||
data={}
|
data={}
|
||||||
data['stat_data']=p_stats
|
data['stat_data_dcs']=p_stats_dcs
|
||||||
|
data['stat_data_perun']=_temp
|
||||||
|
data['stat_data_type']=_temp['ps_type'];
|
||||||
data['stat_ucid']=net.get_player_info(playerID, 'ucid')
|
data['stat_ucid']=net.get_player_info(playerID, 'ucid')
|
||||||
data['stat_datetime']=os.date('%Y-%m-%d %H:%M:%S')
|
data['stat_datetime']=os.date('%Y-%m-%d %H:%M:%S')
|
||||||
data['stat_missionhash']=Perun.MissionHash
|
data['stat_missionhash']=Perun.MissionHash
|
||||||
@@ -314,15 +446,20 @@ end
|
|||||||
|
|
||||||
Perun.onSimulationStart = function()
|
Perun.onSimulationStart = function()
|
||||||
Perun.MissionHash=DCS.getMissionName( ).."@".. Perun.Instance .. "@"..os.date('%Y%m%d_%H%M%S');
|
Perun.MissionHash=DCS.getMissionName( ).."@".. Perun.Instance .. "@"..os.date('%Y%m%d_%H%M%S');
|
||||||
Perun.LogEvent("SimStart","Mission " .. Perun.MissionHash .. " started");
|
Perun.LogEvent("SimStart","Mission " .. Perun.MissionHash .. " started",nil,nil);
|
||||||
|
Perun.StatData = {}
|
||||||
|
Perun.StatDataLastType = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.onSimulationStop = function()
|
Perun.onSimulationStop = function()
|
||||||
Perun.LogEvent("SimStop","Mission " .. Perun.MissionHash .. " finished");
|
Perun.LogEvent("SimStop","Mission " .. Perun.MissionHash .. " finished",nil,nil);
|
||||||
|
Perun.MissionHash="";
|
||||||
|
Perun.StatData = {}
|
||||||
|
Perun.StatDataLastType = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.onPlayerDisconnect= function(id, err_code)
|
Perun.onPlayerDisconnect = function(id, err_code)
|
||||||
Perun.LogEvent("disconnect", "Player " .. net.get_player_info(id, "name") .. " disconnected; " .. err_code);
|
Perun.LogEvent("disconnect", "Player " .. net.get_player_info(id, "name") .. " disconnected; " .. err_code,net.get_player_info(id, "name"),err_code);
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.onSimulationFrame = function()
|
Perun.onSimulationFrame = function()
|
||||||
@@ -347,15 +484,11 @@ Perun.onSimulationFrame = function()
|
|||||||
|
|
||||||
Perun.UpdateStatus()
|
Perun.UpdateStatus()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
Perun.onPlayerStart = function (id)
|
Perun.onPlayerStart = function (id)
|
||||||
net.send_chat(Perun.MOTD_L1, id);
|
net.send_chat_to(Perun.MOTD_L1, id);
|
||||||
net.send_chat(Perun.MOTD_L2, id);
|
net.send_chat_to(Perun.MOTD_L2, id);
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.onPlayerTrySendChat = function (playerID, msg, all)
|
Perun.onPlayerTrySendChat = function (playerID, msg, all)
|
||||||
@@ -367,47 +500,74 @@ Perun.onPlayerTrySendChat = function (playerID, msg, all)
|
|||||||
end
|
end
|
||||||
|
|
||||||
Perun.onGameEvent = function (eventName,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
Perun.onGameEvent = function (eventName,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
||||||
|
|
||||||
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 == nil then
|
arg2 = "Cannon"
|
||||||
arg2 = Gun
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.LogEvent(eventName,Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name").." killed friendy " .. net.get_player_info(arg3, "name") .. " using " .. arg2);
|
Perun.LogEvent(eventName,Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name").." killed friendy " .. net.get_player_info(arg3, "name") .. " using " .. arg2,nil,nil);
|
||||||
Perun.LogStats(arg1);
|
|
||||||
|
if arg1 ~= arg3 then
|
||||||
|
-- Perun.LogStatsCount(arg1,"friendly_fire",DCS.getUnitType(net.get_player_info(arg1 , 'slot')))
|
||||||
|
end
|
||||||
|
|
||||||
elseif eventName == "mission_end" then
|
elseif eventName == "mission_end" then
|
||||||
--"mission_end", winner, msg
|
--"mission_end", winner, msg
|
||||||
Perun.LogEvent(eventName,"Mission finished, winner " .. arg1 .. " message: " .. arg2);
|
Perun.LogEvent(eventName,"Mission finished, winner " .. arg1 .. " message: " .. arg2,nil,nil);
|
||||||
|
|
||||||
elseif eventName == "kill" then
|
elseif eventName == "kill" then
|
||||||
--"kill", killerPlayerID, killerUnitType, killerSide, victimPlayerID, victimUnitType, victimSide, weaponName
|
--"kill", killerPlayerID, killerUnitType, killerSide, victimPlayerID, victimUnitType, victimSide, weaponName
|
||||||
if net.get_player_info(arg4, "name") ~= nil then
|
_tempX=""
|
||||||
_temp = " player ".. net.get_player_info(arg4, "name") .." ";
|
if net.get_player_info(arg4, "name") ~= nil then
|
||||||
Perun.LogStats(arg4);
|
_tempX = " player ".. net.get_player_info(arg4, "name") .." ";
|
||||||
|
|
||||||
|
Perun.LogStats(arg4);
|
||||||
else
|
else
|
||||||
_temp = " AI ";
|
_tempX = " AI ";
|
||||||
end
|
end
|
||||||
|
|
||||||
if net.get_player_info(arg1, "name") ~= nil then
|
if net.get_player_info(arg1, "name") ~= nil then
|
||||||
_temp2 = " player ".. net.get_player_info(arg1, "name") .." ";
|
_temp2 = " player ".. net.get_player_info(arg1, "name") .." ";
|
||||||
Perun.LogStats(arg1);
|
if Perun.GetCategory(arg5) == "Planes" then
|
||||||
|
Perun.LogStatsCount(arg1,"kill_Planes",arg2)
|
||||||
|
elseif Perun.GetCategory(arg5) == "Helicopters" then
|
||||||
|
Perun.LogStatsCount(arg1,"kill_Helicopters",arg2)
|
||||||
|
elseif Perun.GetCategory(arg5) == "Ships" then
|
||||||
|
Perun.LogStatsCount(arg1,"kill_Ships",arg2)
|
||||||
|
elseif Perun.GetCategory(arg5) == "Air Defence" then
|
||||||
|
Perun.LogStatsCount(arg1,"kill_Air_Defence",arg2)
|
||||||
|
elseif Perun.GetCategory(arg5) == "Unarmed" then
|
||||||
|
Perun.LogStatsCount(arg1,"kill_Unarmed",arg2)
|
||||||
|
elseif Perun.GetCategory(arg5) == "Armor" then
|
||||||
|
Perun.LogStatsCount(arg1,"kill_Armor",arg2)
|
||||||
|
elseif Perun.GetCategory(arg5) == "Infantry" then
|
||||||
|
Perun.LogStatsCount(arg1,"kill_Infantry",arg2)
|
||||||
|
elseif Perun.GetCategory(arg5) == "Fortification" then
|
||||||
|
Perun.LogStatsCount(arg1,"kill_Fortification",arg2)
|
||||||
|
else
|
||||||
|
Perun.LogStatsCount(arg1,"kill_Other",arg2)
|
||||||
|
end
|
||||||
|
if net.get_player_info(arg4, "name") ~= nil and arg3 ~= arg6 then
|
||||||
|
Perun.LogStatsCount(arg1,"kill_PvP",arg2)
|
||||||
|
end
|
||||||
|
|
||||||
|
if arg3 == arg6 then
|
||||||
|
Perun.LogStatsCount(arg1,"friendly_fire",arg2)
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
_temp2 = " AI ";
|
_temp2 = " AI ";
|
||||||
end
|
end
|
||||||
|
|
||||||
if arg7 == nil then
|
if arg7 == "" then
|
||||||
arg7 = Gun
|
arg7 = "Cannon"
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.LogEvent(eventName,Perun.SideID2Name(arg3) .. _temp2 .. " in " .. arg2 .. " killed " .. Perun.SideID2Name(arg6) .. _temp .. " in " .. arg5 .. " using " .. arg7 .. " [".. Perun.GetCategory(arg5).."]");
|
|
||||||
|
|
||||||
|
|
||||||
|
Perun.LogEvent(eventName,Perun.SideID2Name(arg3) .. _temp2 .. " in " .. arg2 .. " killed " .. Perun.SideID2Name(arg6) .. _tempX .. " in " .. arg5 .. " 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
|
||||||
Perun.LogEvent(eventName,net.get_player_info(arg1, "name") .. " killed himself");
|
Perun.LogEvent(eventName,net.get_player_info(arg1, "name") .. " killed himself",nil,nil);
|
||||||
Perun.LogStats(arg1);
|
Perun.LogStats(arg1);
|
||||||
|
|
||||||
elseif eventName == "change_slot" then
|
elseif eventName == "change_slot" then
|
||||||
@@ -419,56 +579,74 @@ Perun.onGameEvent = function (eventName,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
|||||||
_temp = "SPECTATOR";
|
_temp = "SPECTATOR";
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.LogEvent(eventName,Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " changed slot to " .. _temp);
|
Perun.LogEvent(eventName,Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " changed slot to " .. _temp,nil,nil);
|
||||||
Perun.LogStats(arg1);
|
Perun.LogStatsCount(arg1,"init",_temp)
|
||||||
|
|
||||||
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");
|
Perun.LogEvent(eventName,"Player "..net.get_player_info(arg1, "name") .. " connected",nil,nil);
|
||||||
|
|
||||||
elseif eventName == "disconnect" then
|
elseif eventName == "disconnect" then
|
||||||
--"disconnect", playerID, name, playerSide, reason_code
|
--"disconnect", playerID, name, playerSide, reason_code
|
||||||
Perun.LogEvent(eventName, Perun.SideID2Name(arg3) .. " player " ..net.get_player_info(arg1, "name") .. " disconnected");
|
Perun.LogEvent(eventName, Perun.SideID2Name(arg3) .. " player " ..net.get_player_info(arg1, "name") .. " disconnected",nil,nil);
|
||||||
Perun.LogStats(arg1);
|
Perun.LogStats(arg1);
|
||||||
|
|
||||||
elseif eventName == "crash" then
|
elseif eventName == "crash" then
|
||||||
--"crash", playerID, unit_missionID
|
--"crash", playerID, unit_missionID
|
||||||
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " crashed in " .. DCS.getUnitType(arg2));
|
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " crashed in " .. DCS.getUnitType(arg2),nil,nil);
|
||||||
Perun.LogStats(arg1);
|
Perun.LogStatsCount(arg1,"crash",DCS.getUnitType(arg2))
|
||||||
|
|
||||||
elseif eventName == "eject" then
|
elseif eventName == "eject" then
|
||||||
--"eject", playerID, unit_missionID
|
--"eject", playerID, unit_missionID
|
||||||
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " ejected " .. DCS.getUnitType(arg2));
|
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " ejected " .. DCS.getUnitType(arg2),nil,nil);
|
||||||
Perun.LogStats(arg1);
|
Perun.LogStatsCount(arg1,"eject",DCS.getUnitType(arg2));
|
||||||
|
|
||||||
elseif eventName == "takeoff" then
|
elseif eventName == "takeoff" then
|
||||||
--"takeoff", playerID, unit_missionID, airdromeName
|
--"takeoff", playerID, unit_missionID, airdromeName
|
||||||
if arg3 then
|
if arg3 ~= "" then
|
||||||
_temp = " from " .. arg3;
|
_temp = " from " .. arg3;
|
||||||
else
|
else
|
||||||
_temp = "";
|
_temp = "";
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " took off in ".. DCS.getUnitType(arg2) .. _temp);
|
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " took off in ".. DCS.getUnitType(arg2) .. _temp,arg3,nil);
|
||||||
Perun.LogStats(arg1);
|
|
||||||
|
if string.find(arg3, "FARP",1,true) then
|
||||||
|
Perun.LogStatsCount(arg1,"tookoff_FARP",DCS.getUnitType(arg2))
|
||||||
|
elseif string.find(arg3, "CVN-74 John C. Stennis",1,true) or string.find(arg3, "LHA-1 Tarawa",1,true) then
|
||||||
|
Perun.LogStatsCount(arg1,"tookoff_SHIP",DCS.getUnitType(arg2))
|
||||||
|
elseif arg3 ~= "" then
|
||||||
|
Perun.LogStatsCount(arg1,"tookoff_AIRFIELD",DCS.getUnitType(arg2))
|
||||||
|
else
|
||||||
|
Perun.LogStatsCount(arg1,"tookoff_OTHER",DCS.getUnitType(arg2))
|
||||||
|
end
|
||||||
|
|
||||||
elseif eventName == "landing" then
|
elseif eventName == "landing" then
|
||||||
--"landing", playerID, unit_missionID, airdromeName
|
--"landing", playerID, unit_missionID, airdromeName
|
||||||
if arg3 then
|
if arg3 ~= "" then
|
||||||
_temp = " at " .. arg3;
|
_temp = " at " .. arg3;
|
||||||
else
|
else
|
||||||
_temp ="";
|
_temp ="";
|
||||||
end
|
end
|
||||||
|
|
||||||
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " landed in " .. DCS.getUnitType(arg2).. _temp);
|
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " landed in " .. DCS.getUnitType(arg2).. _temp,arg3,nil);
|
||||||
Perun.LogStats(arg1);
|
|
||||||
|
if string.find(arg3, "FARP",1,true) then
|
||||||
|
Perun.LogStatsCount(arg1,"landing_FARP",DCS.getUnitType(arg2))
|
||||||
|
elseif string.find(arg3, "CVN-74 John C. Stennis",1,true) or string.find(arg3, "LHA-1 Tarawa",1,true) then
|
||||||
|
Perun.LogStatsCount(arg1,"landing_SHIP",DCS.getUnitType(arg2))
|
||||||
|
elseif arg3 ~= "" then
|
||||||
|
Perun.LogStatsCount(arg1,"landing_AIRFIELD",DCS.getUnitType(arg2))
|
||||||
|
else
|
||||||
|
Perun.LogStatsCount(arg1,"landing_OTHER",DCS.getUnitType(arg2))
|
||||||
|
end
|
||||||
|
|
||||||
elseif eventName == "pilot_death" then
|
elseif eventName == "pilot_death" then
|
||||||
--"pilot_death", playerID, unit_missionID
|
--"pilot_death", playerID, unit_missionID
|
||||||
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " in " .. DCS.getUnitType(arg2) .. " died");
|
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " in " .. DCS.getUnitType(arg2) .. " died",nil,nil);
|
||||||
Perun.LogStats(arg1);
|
Perun.LogStatsCount(arg1,"pilot_death",DCS.getUnitType(arg2))
|
||||||
|
|
||||||
else
|
else
|
||||||
Perun.LogEvent(eventName,"Unknown event type");
|
Perun.LogEvent(eventName,"Unknown event type",nil,nil);
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ internal class DatabaseController
|
|||||||
string strUDPFrameTimestamp = strUDPFrame.timestamp;
|
string strUDPFrameTimestamp = strUDPFrame.timestamp;
|
||||||
string strUDPFrameInstance = strUDPFrame.instance;
|
string strUDPFrameInstance = strUDPFrame.instance;
|
||||||
string strUDPFramePayload = "";
|
string strUDPFramePayload = "";
|
||||||
|
string strUDPFramePayload_Perun = "";
|
||||||
string strSQLQueryTxt = "";
|
string strSQLQueryTxt = "";
|
||||||
|
|
||||||
|
|
||||||
@@ -49,19 +50,21 @@ internal class DatabaseController
|
|||||||
// Add entry to event log
|
// Add entry to event log
|
||||||
strSQLQueryTxt = "INSERT INTO `pe_DataMissionHashes` (`pe_DataMissionHashes_hash`,`pe_DataMissionHashes_instance`) SELECT '" + strUDPFrame.payload.log_missionhash + "','" + strUDPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataMissionHashes` where `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.log_missionhash + "' AND `pe_DataMissionHashes_instance`=" + strUDPFrameInstance + ");";
|
strSQLQueryTxt = "INSERT INTO `pe_DataMissionHashes` (`pe_DataMissionHashes_hash`,`pe_DataMissionHashes_instance`) SELECT '" + strUDPFrame.payload.log_missionhash + "','" + strUDPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataMissionHashes` where `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.log_missionhash + "' AND `pe_DataMissionHashes_instance`=" + strUDPFrameInstance + ");";
|
||||||
strSQLQueryTxt += "UPDATE `pe_DataMissionHashes` SET `pe_DataMissionHashes_datetime` = " + strUDPFrameTimestamp + " WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.log_missionhash + "' AND `pe_DataMissionHashes_instance`=" + strUDPFrameInstance + ";";
|
strSQLQueryTxt += "UPDATE `pe_DataMissionHashes` SET `pe_DataMissionHashes_datetime` = " + strUDPFrameTimestamp + " WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.log_missionhash + "' AND `pe_DataMissionHashes_instance`=" + strUDPFrameInstance + ";";
|
||||||
strSQLQueryTxt += "INSERT INTO `pe_LogEvent` (`pe_LogEvent_id`, `pe_LogEvent_datetime`, `pe_LogEvent_type`, `pe_LogEvent_content`,`pe_LogEvent_missionhash_id`) VALUES ( NULL, '" + strUDPFrame.payload.log_datetime + "', '" + strUDPFrame.payload.log_type + "', '" + strUDPFrame.payload.log_content + "', (SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.log_missionhash + "'));";
|
strSQLQueryTxt += "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 ('"+ strUDPFrame.payload.log_arg_1 + "','"+ strUDPFrame.payload.log_arg_2 + "', NULL, '" + strUDPFrame.payload.log_datetime + "', '" + strUDPFrame.payload.log_type + "', '" + strUDPFrame.payload.log_content + "', (SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.log_missionhash + "'));";
|
||||||
}
|
}
|
||||||
else if (strUDPFrameType == "52")
|
else if (strUDPFrameType == "52")
|
||||||
{
|
{
|
||||||
// Update user stats
|
// Update user stats
|
||||||
strUDPFramePayload = JsonConvert.SerializeObject(strUDPFrame.payload.stat_data); // Deserialize payload
|
strUDPFramePayload = JsonConvert.SerializeObject(strUDPFrame.payload.stat_data_dcs); // Deserialize payload
|
||||||
|
strUDPFramePayload_Perun = JsonConvert.SerializeObject(strUDPFrame.payload.stat_data_perun); // Deserialize payload
|
||||||
|
|
||||||
strSQLQueryTxt = "INSERT INTO `pe_DataMissionHashes` (`pe_DataMissionHashes_hash`,`pe_DataMissionHashes_instance`) SELECT '" + strUDPFrame.payload.stat_missionhash + "','" + strUDPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataMissionHashes` where `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.stat_missionhash + "' AND `pe_DataMissionHashes_instance`=" + strUDPFrameInstance + ");";
|
strSQLQueryTxt = "INSERT INTO `pe_DataMissionHashes` (`pe_DataMissionHashes_hash`,`pe_DataMissionHashes_instance`) SELECT '" + strUDPFrame.payload.stat_missionhash + "','" + strUDPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataMissionHashes` where `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.stat_missionhash + "' AND `pe_DataMissionHashes_instance`=" + strUDPFrameInstance + ");";
|
||||||
strSQLQueryTxt += "UPDATE `pe_DataMissionHashes` SET `pe_DataMissionHashes_datetime` = " + strUDPFrameTimestamp + " WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.stat_missionhash + "' AND `pe_DataMissionHashes_instance`=" + strUDPFrameInstance + " ;";
|
strSQLQueryTxt += "UPDATE `pe_DataMissionHashes` SET `pe_DataMissionHashes_datetime` = " + strUDPFrameTimestamp + " WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.stat_missionhash + "' AND `pe_DataMissionHashes_instance`=" + strUDPFrameInstance + " ;";
|
||||||
strSQLQueryTxt += "INSERT INTO `pe_DataPlayers` (`pe_DataPlayers_ucid`) SELECT '" + strUDPFrame.payload.stat_ucid + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataPlayers` where `pe_DataPlayers_ucid` = '" + strUDPFrame.payload.stat_ucid + "');";
|
strSQLQueryTxt += "INSERT INTO `pe_DataPlayers` (`pe_DataPlayers_ucid`) SELECT '" + strUDPFrame.payload.stat_ucid + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataPlayers` where `pe_DataPlayers_ucid` = '" + strUDPFrame.payload.stat_ucid + "');";
|
||||||
strSQLQueryTxt += "UPDATE `pe_DataPlayers` SET `pe_DataPlayers_updated`=" + strUDPFrameTimestamp + " WHERE `pe_DataPlayers_ucid`='" + strUDPFrame.payload.stat_ucid + "';";
|
strSQLQueryTxt += "UPDATE `pe_DataPlayers` SET `pe_DataPlayers_updated`=" + strUDPFrameTimestamp + " WHERE `pe_DataPlayers_ucid`='" + strUDPFrame.payload.stat_ucid + "';";
|
||||||
strSQLQueryTxt += "INSERT INTO `pe_LogStats` (`pe_LogStats_playerid`,`pe_LogStats_missionhash_id`) SELECT (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + strUDPFrame.payload.stat_ucid + "'), (SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.stat_missionhash + "') 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` = '" + strUDPFrame.payload.stat_missionhash + "') AND `pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + strUDPFrame.payload.stat_ucid + "') );";
|
strSQLQueryTxt += "INSERT INTO `pe_DataTypes` (`pe_DataTypes_name`) SELECT '" + strUDPFrame.payload.stat_data_type + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + strUDPFrame.payload.stat_data_type + "');";
|
||||||
strSQLQueryTxt += "UPDATE `pe_LogStats` SET `pe_LogStats_datetime`='" + strUDPFrame.payload.stat_datetime + "',`pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + strUDPFrame.payload.stat_ucid + "'),`pe_LogStats_debug`=JSON_QUOTE('" + strUDPFramePayload + "'),`pe_LogStats_missionhash_id`=(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.stat_missionhash + "') WHERE `pe_LogStats_missionhash_id`=(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.stat_missionhash + "') AND `pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + strUDPFrame.payload.stat_ucid + "');";
|
strSQLQueryTxt += "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` = '" + strUDPFrame.payload.stat_ucid + "'), (SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.stat_missionhash + "'), (SELECT pe_DataTypes_id FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + strUDPFrame.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` = '" + strUDPFrame.payload.stat_missionhash + "') AND `pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + strUDPFrame.payload.stat_ucid + "') AND `pe_LogStats_typeid`= (SELECT pe_DataTypes_id FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + strUDPFrame.payload.stat_data_type + "'));";
|
||||||
|
strSQLQueryTxt += "UPDATE `pe_LogStats` SET `ps_kills_fortification`=" + strUDPFrame.payload.stat_data_perun.ps_kills_fortification + ",`ps_other_landings`=" + strUDPFrame.payload.stat_data_perun.ps_other_landings + ",`ps_other_takeoffs`=" + strUDPFrame.payload.stat_data_perun.ps_other_takeoffs + ",`ps_pvp`=" + strUDPFrame.payload.stat_data_perun.ps_pvp + ",`ps_deaths`=" + strUDPFrame.payload.stat_data_perun.ps_deaths + ",`ps_ejections`=" + strUDPFrame.payload.stat_data_perun.ps_ejections + ",`ps_crashes`=" + strUDPFrame.payload.stat_data_perun.ps_crashes + ",`ps_teamkills`=" + strUDPFrame.payload.stat_data_perun.ps_teamkills + ",`ps_kills_planes`=" + strUDPFrame.payload.stat_data_perun.ps_kills_planes + ",`ps_kills_helicopters`=" + strUDPFrame.payload.stat_data_perun.ps_kills_helicopters + ",`ps_kills_air_defense`=" + strUDPFrame.payload.stat_data_perun.ps_kills_air_defense + ",`ps_kills_armor`=" + strUDPFrame.payload.stat_data_perun.ps_kills_armor + ",`ps_kills_unarmed`=" + strUDPFrame.payload.stat_data_perun.ps_kills_unarmed + ",`ps_kills_infantry`=" + strUDPFrame.payload.stat_data_perun.ps_kills_infantry + ",`ps_kills_ships`=" + strUDPFrame.payload.stat_data_perun.ps_kills_ships + ",`ps_kills_other`=" + strUDPFrame.payload.stat_data_perun.ps_kills_other + ",`ps_airfield_takeoffs`=" + strUDPFrame.payload.stat_data_perun.ps_airfield_takeoffs + ",`ps_airfield_landings`=" + strUDPFrame.payload.stat_data_perun.ps_airfield_landings + ",`ps_ship_takeoffs`=" + strUDPFrame.payload.stat_data_perun.ps_ship_takeoffs + ",`ps_ship_landings`=" + strUDPFrame.payload.stat_data_perun.ps_ship_landings + ",`ps_farp_takeoffs`=" + strUDPFrame.payload.stat_data_perun.ps_farp_takeoffs + ",`ps_farp_landings`=" + strUDPFrame.payload.stat_data_perun.ps_farp_landings + ", `pe_LogStats_datetime`='" + strUDPFrame.payload.stat_datetime + "',`pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + strUDPFrame.payload.stat_ucid + "'),`pe_LogStats_missionhash_id`=(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.stat_missionhash + "') WHERE `pe_LogStats_missionhash_id`=(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.stat_missionhash + "') AND `pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + strUDPFrame.payload.stat_ucid + "') AND `pe_LogStats_typeid`=(SELECT pe_DataTypes_id FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + strUDPFrame.payload.stat_data_type + "');";
|
||||||
}
|
}
|
||||||
else if (strUDPFrameType == "53")
|
else if (strUDPFrameType == "53")
|
||||||
{
|
{
|
||||||
@@ -123,4 +126,4 @@ internal class DatabaseController
|
|||||||
connMySQL.Close();
|
connMySQL.Close();
|
||||||
Console.WriteLine("Sending data to MySQL - Done");
|
Console.WriteLine("Sending data to MySQL - Done");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||||
<WebPage>Perun.htm</WebPage>
|
<WebPage>Perun.htm</WebPage>
|
||||||
<ApplicationRevision>0</ApplicationRevision>
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
<ApplicationVersion>0.4.1.%2a</ApplicationVersion>
|
<ApplicationVersion>0.6.0.%2a</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||||
|
|||||||
@@ -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.4.0.0")]
|
[assembly: AssemblyVersion("0.6.0.0")]
|
||||||
[assembly: AssemblyFileVersion("0.4.0.0")]
|
[assembly: AssemblyFileVersion("0.6.0.0")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ CREATE TABLE IF NOT EXISTS `pe_DataMissionHashes` (
|
|||||||
`pe_DataMissionHashes_hash` varchar(150) NOT NULL,
|
`pe_DataMissionHashes_hash` varchar(150) NOT NULL,
|
||||||
`pe_DataMissionHashes_datetime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`pe_DataMissionHashes_datetime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
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`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
@@ -42,8 +43,8 @@ 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_lastip` varchar(100) NOT NULL,
|
|
||||||
`pe_DataPlayers_lastname` varchar(150) NOT NULL,
|
`pe_DataPlayers_lastname` varchar(150) NOT NULL,
|
||||||
|
`pe_DataPlayers_lastip` varchar(100) NOT 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`)
|
||||||
@@ -66,6 +67,21 @@ CREATE TABLE IF NOT EXISTS `pe_DataRaw` (
|
|||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Struktura tabeli dla tabeli `pe_DataTypes`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `pe_DataTypes`;
|
||||||
|
CREATE TABLE IF NOT EXISTS `pe_DataTypes` (
|
||||||
|
`pe_DataTypes_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`pe_DataTypes_name` varchar(100) NOT NULL,
|
||||||
|
`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 DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Struktura tabeli dla tabeli `pe_LogChat`
|
-- Struktura tabeli dla tabeli `pe_LogChat`
|
||||||
--
|
--
|
||||||
@@ -78,7 +94,9 @@ CREATE TABLE IF NOT EXISTS `pe_LogChat` (
|
|||||||
`pe_LogChat_playerid` varchar(100) NOT NULL,
|
`pe_LogChat_playerid` varchar(100) NOT NULL,
|
||||||
`pe_LogChat_msg` text NOT NULL,
|
`pe_LogChat_msg` text NOT NULL,
|
||||||
`pe_LogChat_all` varchar(10) NOT NULL,
|
`pe_LogChat_all` varchar(10) NOT NULL,
|
||||||
PRIMARY KEY (`pe_LogChat_id`)
|
PRIMARY KEY (`pe_LogChat_id`),
|
||||||
|
KEY `pe_LogChat_missionhash_id` (`pe_LogChat_missionhash_id`),
|
||||||
|
KEY `pe_LogChat_playerid` (`pe_LogChat_playerid`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
@@ -90,11 +108,14 @@ CREATE TABLE IF NOT EXISTS `pe_LogChat` (
|
|||||||
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` (
|
||||||
`pe_LogEvent_id` bigint(20) NOT NULL AUTO_INCREMENT,
|
`pe_LogEvent_id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
`pe_LogEvent_missionhash_id` bigint(20) DEFAULT NULL,
|
|
||||||
`pe_LogEvent_datetime` datetime DEFAULT CURRENT_TIMESTAMP,
|
`pe_LogEvent_datetime` datetime DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`pe_LogEvent_missionhash_id` bigint(20) DEFAULT NULL,
|
||||||
`pe_LogEvent_type` varchar(100) NOT NULL,
|
`pe_LogEvent_type` varchar(100) NOT NULL,
|
||||||
`pe_LogEvent_content` text NOT NULL,
|
`pe_LogEvent_content` text NOT NULL,
|
||||||
PRIMARY KEY (`pe_LogEvent_id`)
|
`pe_LogEvent_arg1` varchar(150) DEFAULT NULL,
|
||||||
|
`pe_LogEvent_arg2` varchar(150) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`pe_LogEvent_id`),
|
||||||
|
KEY `pe_LogEvent_missionhash_id` (`pe_LogEvent_missionhash_id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
@@ -111,7 +132,8 @@ CREATE TABLE IF NOT EXISTS `pe_LogLogins` (
|
|||||||
`pe_LogLogins_playerid` bigint(20) DEFAULT NULL,
|
`pe_LogLogins_playerid` bigint(20) DEFAULT NULL,
|
||||||
`pe_LogLogins_name` varchar(150) NOT NULL,
|
`pe_LogLogins_name` varchar(150) NOT NULL,
|
||||||
`pe_LogLogins_ip` varchar(100) NOT NULL,
|
`pe_LogLogins_ip` varchar(100) NOT NULL,
|
||||||
PRIMARY KEY (`pe_LogLogins_id`)
|
PRIMARY KEY (`pe_LogLogins_id`),
|
||||||
|
KEY `pe_LogLogins_playerid` (`pe_LogLogins_playerid`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
@@ -123,12 +145,35 @@ CREATE TABLE IF NOT EXISTS `pe_LogLogins` (
|
|||||||
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` (
|
||||||
`pe_LogStats_id` bigint(20) NOT NULL AUTO_INCREMENT,
|
`pe_LogStats_id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
`pe_LogStats_missionhash_id` bigint(20) DEFAULT NULL,
|
|
||||||
`pe_LogStats_datetime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`pe_LogStats_datetime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`pe_LogStats_missionhash_id` bigint(20) DEFAULT NULL,
|
||||||
`pe_LogStats_playerid` bigint(20) DEFAULT NULL,
|
`pe_LogStats_playerid` bigint(20) DEFAULT NULL,
|
||||||
`pe_LogStats_debug` text,
|
`pe_LogStats_typeid` int(11) DEFAULT NULL,
|
||||||
|
`ps_kills` 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',
|
||||||
|
`ps_crashes` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`ps_teamkills` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`ps_kills_planes` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`ps_kills_helicopters` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`ps_kills_air_defense` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`ps_kills_armor` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`ps_kills_unarmed` 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_fortification` int(10) 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_landings` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`ps_ship_takeoffs` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`ps_ship_landings` int(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`ps_farp_takeoffs` 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_takeoffs` int(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
PRIMARY KEY (`pe_LogStats_id`),
|
PRIMARY KEY (`pe_LogStats_id`),
|
||||||
UNIQUE KEY `UNIQUE_STATS_PER_MISSION_AND_UCID` (`pe_LogStats_playerid`,`pe_LogStats_missionhash_id`) USING BTREE
|
UNIQUE KEY `UNIQUE_STATS_PER_MISSION_AND_UCID_AND_TYPE` (`pe_LogStats_playerid`,`pe_LogStats_missionhash_id`,`pe_LogStats_typeid`) USING BTREE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user