mirror of
https://github.com/indig0fox/Arma3-AttendanceTracker.git/
synced 2025-12-08 09:51:47 -06:00
bugfixes, track playerId (directplay id, unique per session)
This commit is contained in:
Binary file not shown.
@@ -1,24 +1,29 @@
|
||||
[
|
||||
["OnUserConnected", {
|
||||
params ["_networkId", "_clientStateNumber", "_clientState"];
|
||||
|
||||
[format ["(EventHandler) OnUserConnected fired: %1", _this], "DEBUG"] call attendanceTracker_fnc_log;
|
||||
|
||||
private _userInfo = (getUserInfo _networkId);
|
||||
_userInfo params ["_playerID", "_ownerId", "_playerUID", "_profileName", "_displayName", "_steamName", "_clientState", "_isHC", "_adminState", "_networkInfo", "_unit"];
|
||||
if (_isHC) exitWith {};
|
||||
|
||||
[
|
||||
"ConnectedServer",
|
||||
_playerID,
|
||||
_playerUID,
|
||||
_profileName,
|
||||
_steamName
|
||||
] call attendanceTracker_fnc_logServerEvent;
|
||||
|
||||
(AttendanceTracker getVariable ["allUsers", createHashMap]) set [_networkId, _userInfo];
|
||||
|
||||
[format ["(EventHandler) OnUserConnected fired: %1", _this], "DEBUG"] call attendanceTracker_fnc_log;
|
||||
}],
|
||||
["OnUserDisconnected", {
|
||||
params ["_networkId", "_clientStateNumber", "_clientState"];
|
||||
private _userInfo = (AttendanceTracker getVariable ["allUsers", createHashMap]) get [_networkId, nil];
|
||||
|
||||
[format ["(EventHandler) OnUserDisconnected fired: %1", _this], "DEBUG"] call attendanceTracker_fnc_log;
|
||||
|
||||
private _userInfo = (AttendanceTracker getVariable ["allUsers", createHashMap]) get _networkId;
|
||||
if (isNil "_userInfo") exitWith {};
|
||||
|
||||
_userInfo params ["_playerID", "_ownerId", "_playerUID", "_profileName", "_displayName", "_steamName", "_clientState", "_isHC", "_adminState", "_networkInfo", "_unit"];
|
||||
@@ -26,15 +31,17 @@
|
||||
|
||||
[
|
||||
"DisconnectedServer",
|
||||
_playerID,
|
||||
_playerUID,
|
||||
_profileName,
|
||||
_steamName
|
||||
] call attendanceTracker_fnc_logServerEvent;
|
||||
|
||||
[format ["(EventHandler) OnUserDisconnected fired: %1", _this], "DEBUG"] call attendanceTracker_fnc_log;
|
||||
}],
|
||||
["PlayerConnected", {
|
||||
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
|
||||
|
||||
[format ["(EventHandler) PlayerConnected fired: %1", _this], "DEBUG"] call attendanceTracker_fnc_log;
|
||||
|
||||
private _userInfo = (getUserInfo _idstr);
|
||||
if (isNil "_userInfo") exitWith {};
|
||||
|
||||
@@ -46,19 +53,23 @@
|
||||
|
||||
[
|
||||
"ConnectedMission",
|
||||
_playerID,
|
||||
_playerUID,
|
||||
_profileName,
|
||||
_steamName,
|
||||
_jip,
|
||||
roleDescription _unit
|
||||
] call attendanceTracker_fnc_logMissionEvent;
|
||||
|
||||
[format ["(EventHandler) PlayerConnected fired: %1", _this], "DEBUG"] call attendanceTracker_fnc_log;
|
||||
}],
|
||||
["HandleDisconnect", {
|
||||
params ["_unit", "_id", "_uid", "_name"];
|
||||
private _userInfo = (AttendanceTracker getVariable ["allUsers", createHashMap]) get [_id toFixed 0, nil];
|
||||
if (isNil "_userInfo") exitWith {};
|
||||
["PlayerDisconnected", {
|
||||
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
|
||||
|
||||
[format ["(EventHandler) HandleDisconnect fired: %1", _this], "DEBUG"] call attendanceTracker_fnc_log;
|
||||
|
||||
private _userInfo = (AttendanceTracker getVariable ["allUsers", createHashMap]) get _idstr;
|
||||
if (isNil "_userInfo") exitWith {
|
||||
[format ["(EventHandler) HandleDisconnect: No user info found for %1", _idstr], "DEBUG"] call attendanceTracker_fnc_log;
|
||||
};
|
||||
|
||||
_userInfo params ["_playerID", "_ownerId", "_playerUID", "_profileName", "_displayName", "_steamName", "_clientState", "_isHC", "_adminState", "_networkInfo", "_unit"];
|
||||
|
||||
@@ -66,13 +77,14 @@
|
||||
|
||||
[
|
||||
"DisconnectedMission",
|
||||
_playerID,
|
||||
_playerUID,
|
||||
_profileName,
|
||||
_steamName,
|
||||
_jip
|
||||
] call attendanceTracker_fnc_logMissionEvent;
|
||||
|
||||
[format ["(EventHandler) HandleDisconnect fired: %1", _this], "DEBUG"] call attendanceTracker_fnc_log;
|
||||
|
||||
false;
|
||||
}]
|
||||
];
|
||||
@@ -5,6 +5,10 @@ params [
|
||||
];
|
||||
|
||||
if (isNil "_message") exitWith {false};
|
||||
if (
|
||||
missionNamespace getVariable ["AttendanceTracker_debug", false] &&
|
||||
_level == "DEBUG"
|
||||
) exitWith {};
|
||||
|
||||
"AttendanceTracker" callExtension ["log", [_level, _message]];
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
params [
|
||||
["_eventType", ""],
|
||||
["_playerId", ""],
|
||||
["_playerUID", ""],
|
||||
["_profileName", ""],
|
||||
["_steamName", ""],
|
||||
@@ -9,6 +10,7 @@ params [
|
||||
|
||||
private _hash = + (AttendanceTracker getVariable ["missionContext", createHashMap]);
|
||||
_hash set ["eventType", _eventType];
|
||||
_hash set ["playerId", _playerId];
|
||||
_hash set ["playerUID", _playerUID];
|
||||
_hash set ["profileName", _profileName];
|
||||
_hash set ["steamName", _steamName];
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
params [
|
||||
["_eventType", ""],
|
||||
["_playerId", ""],
|
||||
["_playerUID", ""],
|
||||
["_profileName", ""],
|
||||
["_steamName", ""]
|
||||
@@ -8,6 +9,7 @@ params [
|
||||
|
||||
private _hash = + (AttendanceTracker getVariable ["missionContext", createHashMap]);
|
||||
_hash set ["eventType", _eventType];
|
||||
_hash set ["playerId", _playerId];
|
||||
_hash set ["playerUID", _playerUID];
|
||||
_hash set ["profileName", _profileName];
|
||||
_hash set ["steamName", _steamName];
|
||||
|
||||
@@ -14,9 +14,10 @@ AttendanceTracker setVariable ["missionContext", createHashMapFromArray [
|
||||
|
||||
// store all user details in a hash when they connect so we can reference it in disconnect events
|
||||
AttendanceTracker setVariable ["allUsers", createHashMap];
|
||||
missionNamespace getVariable ["AttendanceTracker_debug", false];
|
||||
|
||||
private _database = "AttendanceTracker" callExtension "connectDB";
|
||||
systemChat "AttendanceTracker: Connecting to database...";
|
||||
// systemChat "AttendanceTracker: Connecting to database...";
|
||||
["Connecting to database...", "INFO"] call attendanceTracker_fnc_log;
|
||||
|
||||
{
|
||||
|
||||
Binary file not shown.
@@ -143,6 +143,7 @@ type AttendanceLogItem struct {
|
||||
MissionStart string `json:"missionStart"`
|
||||
// situational
|
||||
EventType string `json:"eventType"`
|
||||
PlayerId string `json:"playerId"`
|
||||
PlayerUID string `json:"playerUID"`
|
||||
ProfileName string `json:"profileName"`
|
||||
SteamName string `json:"steamName"`
|
||||
@@ -180,7 +181,7 @@ func writeAttendance(data string) {
|
||||
|
||||
// send to DB
|
||||
|
||||
result, err := db.ExecContext(context.Background(), `INSERT INTO AttendanceLog (timestamp, mission_name, briefing_name, mission_name_source, on_load_name, author, server_name, server_profile, mission_start, event_type, player_uid, profile_name, steam_name, is_jip, role_description) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`,
|
||||
result, err := db.ExecContext(context.Background(), `INSERT INTO AttendanceLog (timestamp, mission_name, briefing_name, mission_name_source, on_load_name, author, server_name, server_profile, mission_start, event_type, player_id, player_uid, profile_name, steam_name, is_jip, role_description) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`,
|
||||
now,
|
||||
event.MissionName,
|
||||
event.BriefingName,
|
||||
@@ -191,6 +192,7 @@ func writeAttendance(data string) {
|
||||
event.ServerProfile,
|
||||
t,
|
||||
event.EventType,
|
||||
event.PlayerId,
|
||||
event.PlayerUID,
|
||||
event.ProfileName,
|
||||
event.SteamName,
|
||||
|
||||
Reference in New Issue
Block a user