mirror of
https://github.com/indig0fox/Arma3-AttendanceTracker.git/
synced 2025-12-08 09:51:47 -06:00
change to 1 row per session (networkId)
This commit is contained in:
@@ -55,6 +55,12 @@ addMissionEventHandler ["ExtensionCallback", {
|
||||
]];
|
||||
};
|
||||
};
|
||||
case "writeAttendance": {
|
||||
if (_response#0 == "ATT_LOG") then {
|
||||
_response params ["_netId", "_rowId"];
|
||||
((AttendanceTracker getVariable ["allUsers", createHashMap]) get _netId) set ["_rowID", _rowID];
|
||||
};
|
||||
};
|
||||
default {
|
||||
_response call attendanceTracker_fnc_log;
|
||||
};
|
||||
|
||||
@@ -8,15 +8,16 @@
|
||||
_userInfo params ["_playerID", "_ownerId", "_playerUID", "_profileName", "_displayName", "_steamName", "_clientState", "_isHC", "_adminState", "_networkInfo", "_unit"];
|
||||
if (_isHC) exitWith {};
|
||||
|
||||
(AttendanceTracker getVariable ["allUsers", createHashMap]) set [_networkId, _userInfo];
|
||||
[
|
||||
"ConnectedServer",
|
||||
"Server",
|
||||
_playerID,
|
||||
_playerUID,
|
||||
_profileName,
|
||||
_steamName
|
||||
] call attendanceTracker_fnc_logServerEvent;
|
||||
_steamName,
|
||||
nil // send rowId on d/c only
|
||||
] call attendanceTracker_fnc_writeAttendance;
|
||||
|
||||
(AttendanceTracker getVariable ["allUsers", createHashMap]) set [_networkId, _userInfo];
|
||||
}],
|
||||
["OnUserDisconnected", {
|
||||
params ["_networkId", "_clientStateNumber", "_clientState"];
|
||||
@@ -26,16 +27,17 @@
|
||||
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"];
|
||||
_userInfo params ["_playerID", "_ownerId", "_playerUID", "_profileName", "_displayName", "_steamName", "_clientState", "_isHC", "_adminState", "_networkInfo", "_unit", "_rowId"];
|
||||
if (_isHC) exitWith {};
|
||||
|
||||
[
|
||||
"DisconnectedServer",
|
||||
"Server",
|
||||
_playerID,
|
||||
_playerUID,
|
||||
_profileName,
|
||||
_steamName
|
||||
] call attendanceTracker_fnc_logServerEvent;
|
||||
_steamName,
|
||||
(if (!isNil "_rowId") then {_rowId} else {nil}) // send rowId on d/c only
|
||||
] call attendanceTracker_fnc_writeAttendance;
|
||||
}],
|
||||
["PlayerConnected", {
|
||||
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
|
||||
@@ -46,19 +48,18 @@
|
||||
if (isNil "_userInfo") exitWith {};
|
||||
|
||||
_userInfo params ["_playerID", "_ownerId", "_playerUID", "_profileName", "_displayName", "_steamName", "_clientState", "_isHC", "_adminState", "_networkInfo", "_unit"];
|
||||
if (_isHC) exitWith {};
|
||||
|
||||
(AttendanceTracker getVariable ["allUsers", createHashMap]) set [_playerID, _userInfo];
|
||||
|
||||
if (_isHC) exitWith {};
|
||||
|
||||
[
|
||||
"ConnectedMission",
|
||||
"Mission",
|
||||
_playerID,
|
||||
_playerUID,
|
||||
_profileName,
|
||||
_steamName,
|
||||
_jip,
|
||||
roleDescription _unit
|
||||
roleDescription _unit,
|
||||
nil // send rowId on d/c only
|
||||
] call attendanceTracker_fnc_logMissionEvent;
|
||||
}],
|
||||
["PlayerDisconnected", {
|
||||
@@ -72,17 +73,18 @@
|
||||
[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"];
|
||||
|
||||
_userInfo params ["_playerID", "_ownerId", "_playerUID", "_profileName", "_displayName", "_steamName", "_clientState", "_isHC", "_adminState", "_networkInfo", "_unit", "_rowId"];
|
||||
if (_isHC) exitWith {};
|
||||
|
||||
[
|
||||
"DisconnectedMission",
|
||||
"Mission",
|
||||
_playerID,
|
||||
_playerUID,
|
||||
_profileName,
|
||||
_steamName,
|
||||
_jip
|
||||
_jip,
|
||||
nil,
|
||||
(if (!isNil "_rowId") then {_rowId} else {nil}) // send rowId on d/c only
|
||||
] call attendanceTracker_fnc_logMissionEvent;
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@ params [
|
||||
["_profileName", ""],
|
||||
["_steamName", ""],
|
||||
["_isJIP", false, [true, false]],
|
||||
["_roleDescription", ""]
|
||||
["_roleDescription", ""],
|
||||
["_rowID", nil]
|
||||
];
|
||||
|
||||
private _hash = + (AttendanceTracker getVariable ["missionContext", createHashMap]);
|
||||
@@ -18,6 +19,11 @@ _hash set ["isJIP", _isJIP];
|
||||
_hash set ["roleDescription", _roleDescription];
|
||||
_hash set ["missionHash", missionNamespace getVariable ["AttendanceTracker_missionHash", ""]];
|
||||
|
||||
"AttendanceTracker" callExtension ["logAttendance", [[_hash] call CBA_fnc_encodeJSON]];
|
||||
if (!isNil "_rowID") then {
|
||||
_hash set ["rowID", _rowID];
|
||||
"AttendanceTracker" callExtension ["writeDisconnectEvent", [[_hash] call CBA_fnc_encodeJSON]];
|
||||
} else {
|
||||
"AttendanceTracker" callExtension ["writeAttendance", [[_hash] call CBA_fnc_encodeJSON]];
|
||||
};
|
||||
|
||||
true;
|
||||
@@ -3,11 +3,13 @@ params [
|
||||
["_playerId", ""],
|
||||
["_playerUID", ""],
|
||||
["_profileName", ""],
|
||||
["_steamName", ""]
|
||||
["_steamName", ""],
|
||||
["_rowID", nil]
|
||||
];
|
||||
|
||||
|
||||
private _hash = + (AttendanceTracker getVariable ["missionContext", createHashMap]);
|
||||
_hash set ["networkId", netID player]
|
||||
_hash set ["eventType", _eventType];
|
||||
_hash set ["playerId", _playerId];
|
||||
_hash set ["playerUID", _playerUID];
|
||||
@@ -17,6 +19,11 @@ _hash set ["isJIP", false];
|
||||
_hash set ["roleDescription", ""];
|
||||
_hash set ["missionHash", missionNamespace getVariable ["AttendanceTracker_missionHash", ""]];
|
||||
|
||||
"AttendanceTracker" callExtension ["logAttendance", [[_hash] call CBA_fnc_encodeJSON]];
|
||||
if (!isNil "_rowID") then {
|
||||
_hash set ["rowID", _rowID];
|
||||
"AttendanceTracker" callExtension ["writeDisconnectEvent", [[_hash] call CBA_fnc_encodeJSON]];
|
||||
} else {
|
||||
"AttendanceTracker" callExtension ["writeAttendance", [[_hash] call CBA_fnc_encodeJSON]];
|
||||
};
|
||||
|
||||
true;
|
||||
Reference in New Issue
Block a user