consolidate functionality to streamline
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -4,10 +4,9 @@
|
||||
|
||||
*.so
|
||||
|
||||
extension/RangerMetrics.h
|
||||
RangerMetrics.h
|
||||
RangerMetrics_x64.h
|
||||
|
||||
extension/RangerMetrics_x64.h
|
||||
|
||||
\@RangerMetrics/settings.json
|
||||
settings.json
|
||||
|
||||
*.log
|
||||
|
||||
@@ -17,23 +17,6 @@ class CfgFunctions {
|
||||
class loadSettings {};
|
||||
};
|
||||
};
|
||||
class RangerMetrics_event {
|
||||
class server {
|
||||
file = "\RangerMetrics\functions\capture\serverEH";
|
||||
class ace_unconscious {};
|
||||
class EntityKilled {};
|
||||
class Explosion {};
|
||||
class FiredMan {};
|
||||
class HandleChatMessage {};
|
||||
class MarkerCreated {};
|
||||
class MarkerDeleted {};
|
||||
class MarkerUpdated {};
|
||||
class milsim_serverEfficiency {};
|
||||
};
|
||||
class client {
|
||||
file = "\RangerMetrics\functions\capture\clientEH";
|
||||
};
|
||||
};
|
||||
class RangerMetrics_cDefinitions {
|
||||
class functions {
|
||||
file = "\RangerMetrics\functions\captureDefinitions";
|
||||
@@ -51,17 +34,14 @@ class CfgFunctions {
|
||||
file = "\RangerMetrics\functions\capture";
|
||||
class entity_count {};
|
||||
class mission_config_file {};
|
||||
class player_identity {};
|
||||
class player_performance {};
|
||||
class player_status {};
|
||||
class running_mission {};
|
||||
class running_scripts {};
|
||||
class server_performance {};
|
||||
class server_time {};
|
||||
class unit_inventory {};
|
||||
class unit_state {};
|
||||
class view_distance {};
|
||||
class weather {};
|
||||
class soldier_ammo {};
|
||||
};
|
||||
};
|
||||
class RangerMetrics {
|
||||
@@ -71,7 +51,6 @@ class CfgFunctions {
|
||||
class captureLoop {};
|
||||
class log {};
|
||||
class send {};
|
||||
class sendClientPoll {};
|
||||
class startServerPoll {};
|
||||
class initCapture {};
|
||||
};
|
||||
@@ -81,6 +60,7 @@ class CfgFunctions {
|
||||
class encodeJSON {};
|
||||
class stringReplace {};
|
||||
class unixTimestamp {};
|
||||
class getMagsAmmo {};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -16,11 +16,7 @@ if (_data isEqualTo "") exitWith {
|
||||
private "_response";
|
||||
try {
|
||||
// diag_log format ["Raw callback: %1: %2", _function, _data];
|
||||
if (_function find "JSON" > -1) then {
|
||||
_response = [_data, 2] call CBA_fnc_parseJSON;
|
||||
} else {
|
||||
_response = parseSimpleArray _data;
|
||||
};
|
||||
} catch {
|
||||
[
|
||||
format ["Callback invalid data: %1: %2", _function, _data],
|
||||
|
||||
@@ -2,16 +2,18 @@ params ["_function", "_data"];
|
||||
|
||||
|
||||
if (_function isEqualTo "loadSettingsJSON") exitWith {
|
||||
RangerMetrics_settings = _data;
|
||||
RangerMetrics_recordingSettings = _data get "recordingSettings";
|
||||
diag_log "RangerMetrics: loadSettingsJSON";
|
||||
// diag_log text format["%1", _data#0];
|
||||
RangerMetrics_settings = [_data#0] call CBA_fnc_parseJSON;
|
||||
// diag_log text format["%1", RangerMetrics_settings];
|
||||
|
||||
RangerMetrics_debug = RangerMetrics_settings get "arma3" get "debug";
|
||||
|
||||
RangerMetrics_recordingSettings = RangerMetrics_settings getVariable "recordingSettings";
|
||||
|
||||
RangerMetrics_debug = (RangerMetrics_settings getVariable "arma3") getVariable "debug";
|
||||
|
||||
[
|
||||
format [
|
||||
"Settings loaded: %1",
|
||||
_data
|
||||
],
|
||||
"INFO"
|
||||
] call RangerMetrics_fnc_log;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
private _settings = RangerMetrics_recordingSettings get "entityCount";
|
||||
private _settings = RangerMetrics_recordingSettings getVariable "entityCount";
|
||||
|
||||
|
||||
private _allUnits = allUnits;
|
||||
@@ -13,7 +13,7 @@ private _allPlayers = call BIS_fnc_listPlayers;
|
||||
private _thisSideStr = _thisSide call BIS_fnc_sideNameUnlocalized;
|
||||
// Number of remote units
|
||||
[
|
||||
_settings get "bucket",
|
||||
_settings getVariable "bucket",
|
||||
"entities_remote",
|
||||
[
|
||||
["string", "side", _thisSideStr]
|
||||
@@ -45,7 +45,7 @@ private _allPlayers = call BIS_fnc_listPlayers;
|
||||
|
||||
// Number of local units
|
||||
[
|
||||
_settings get "bucket",
|
||||
_settings getVariable "bucket",
|
||||
"entities_local",
|
||||
[
|
||||
["string", "side", _thisSideStr]
|
||||
@@ -78,7 +78,7 @@ private _allPlayers = call BIS_fnc_listPlayers;
|
||||
// Number of global units - only track on server
|
||||
if (isServer) then {
|
||||
[
|
||||
_settings get "bucket",
|
||||
_settings getVariable "bucket",
|
||||
"entities_global",
|
||||
[
|
||||
["string", "side", _thisSideStr]
|
||||
@@ -118,7 +118,7 @@ private _allPlayers = call BIS_fnc_listPlayers;
|
||||
|
||||
if (isServer) then {
|
||||
[
|
||||
_settings get "bucket",
|
||||
_settings getVariable "bucket",
|
||||
"player_count",
|
||||
nil,
|
||||
[
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
params ["_playerID", "_ownerId", "_playerUID", "_profileName", "_displayName", "_steamName", "_clientState", "_isHC", "_adminState", "_networkInfo", "_unit", ["_jip", false]];
|
||||
// _networkInfo params ["_avgPing", "_avgBandwidth", "_desync"];
|
||||
|
||||
private _settings = RangerMetrics_recordingSettings get "playerIdentity";
|
||||
|
||||
|
||||
private _fields = [
|
||||
["string", "playerID", _playerID],
|
||||
["int", "ownerId", _ownerId],
|
||||
["string", "playerUID", _playerUID],
|
||||
["string", "profileName", _profileName],
|
||||
["string", "displayName", _displayName],
|
||||
["string", "steamName", _steamName],
|
||||
["bool", "isHC", _isHC],
|
||||
["bool", "isJip", _jip]
|
||||
];
|
||||
|
||||
try {
|
||||
// Get Squad Info of Player
|
||||
(squadParams _unit) params [
|
||||
"_squadInfo",
|
||||
"_unitInfo",
|
||||
"_squadId",
|
||||
"_a3unitsId"
|
||||
];
|
||||
|
||||
// For each section, we'll define the format and save to fields
|
||||
_squadInfoDataFormat = [
|
||||
"squadNick",
|
||||
"squadName",
|
||||
"squadEmail",
|
||||
"squadWeb",
|
||||
"squadLogo",
|
||||
"squadTitle"
|
||||
];
|
||||
|
||||
{
|
||||
_fields pushBack [
|
||||
"string",
|
||||
_squadInfoDataFormat select _forEachIndex,
|
||||
_squadInfo select _forEachIndex
|
||||
];
|
||||
} forEach _squadInfoDataFormat;
|
||||
|
||||
_unitInfoDataFormat = [
|
||||
"unitUid",
|
||||
"unitName",
|
||||
"unitFullName",
|
||||
"unitICQ",
|
||||
"unitRemark"
|
||||
];
|
||||
|
||||
{
|
||||
_fields pushBack [
|
||||
"string",
|
||||
_unitInfoDataFormat select _forEachIndex,
|
||||
_unitInfo select _forEachIndex
|
||||
];
|
||||
} forEach _unitInfoDataFormat;
|
||||
} catch {
|
||||
// If we fail to get squad info, we'll just skip it
|
||||
[format["Failed to get squad info for %1", _playerUID]] call RangerMetrics_fnc_log;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Role description
|
||||
private _roleDescription = roleDescription _unit;
|
||||
if (_roleDescription isNotEqualTo "") then {
|
||||
_fields pushBack ["string", "roleDescription", _roleDescription];
|
||||
};
|
||||
|
||||
[
|
||||
_settings get "bucket",
|
||||
_settings get "measurement",
|
||||
[
|
||||
["string", "playerUID", _playerUID]
|
||||
],
|
||||
_fields,
|
||||
["server"]
|
||||
] call RangerMetrics_fnc_send;
|
||||
@@ -1,6 +1,6 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
private _settings = RangerMetrics_recordingSettings get "playerPerformance";
|
||||
private _settings = RangerMetrics_recordingSettings getVariable "playerPerformance";
|
||||
|
||||
{
|
||||
_x params ["_playerID", "_ownerId", "_playerUID", "_profileName", "_displayName", "_steamName", "_clientState", "_isHC", "_adminState", "_networkInfo", "_unit"];
|
||||
@@ -11,8 +11,8 @@ private _settings = RangerMetrics_recordingSettings get "playerPerformance";
|
||||
};
|
||||
|
||||
[
|
||||
_settings get "bucket",
|
||||
_settings get "measurement",
|
||||
_settings getVariable "bucket",
|
||||
_settings getVariable "measurement",
|
||||
[["string", "playerUID", _playerUID]],
|
||||
[
|
||||
["float", "avgPing", _avgPing],
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
params ["_playerID", "_ownerId", "_playerUID", "_profileName", "_displayName", "_steamName", "_clientState", "_isHC", "_adminState", "_networkInfo", "_unit"];
|
||||
// _networkInfo params ["_avgPing", "_avgBandwidth", "_desync"];
|
||||
|
||||
private _settings = RangerMetrics_recordingSettings get "playerStatus";
|
||||
|
||||
[
|
||||
_settings get "bucket",
|
||||
_settings get "measurement",
|
||||
[["string", "playerUID", _playerUID]],
|
||||
[
|
||||
["int", "clientStateNumber", _clientState],
|
||||
["int", "adminState", _adminState],
|
||||
["string", "profileName", _profileName]
|
||||
],
|
||||
["server"]
|
||||
] call RangerMetrics_fnc_send;
|
||||
@@ -1,10 +1,10 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
private _settings = RangerMetrics_recordingSettings get "runningMission";
|
||||
private _settings = RangerMetrics_recordingSettings getVariable "runningMission";
|
||||
|
||||
[
|
||||
_settings get "bucket",
|
||||
_settings get "measurement",
|
||||
_settings getVariable "bucket",
|
||||
_settings getVariable "measurement",
|
||||
nil, // tags
|
||||
[ // fields
|
||||
["string","briefing_name", briefingName],
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
private _settings = RangerMetrics_recordingSettings get "runningScripts";
|
||||
private _settings = RangerMetrics_recordingSettings getVariable "runningScripts";
|
||||
|
||||
[
|
||||
_settings get "bucket",
|
||||
_settings get "measurement",
|
||||
_settings getVariable "bucket",
|
||||
_settings getVariable "measurement",
|
||||
nil,
|
||||
[
|
||||
["int", "spawn", diag_activeScripts select 0],
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
private _settings = RangerMetrics_recordingSettings get "serverPerformance";
|
||||
private _settings = RangerMetrics_recordingSettings getVariable "serverPerformance";
|
||||
|
||||
[
|
||||
_settings get "bucket",
|
||||
_settings get "measurement",
|
||||
_settings getVariable "bucket",
|
||||
_settings getVariable "measurement",
|
||||
nil, [
|
||||
["float", "fps_avg", diag_fps toFixed 2],
|
||||
["float", "fps_min", diag_fpsMin toFixed 2]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
private _settings = RangerMetrics_recordingSettings get "serverTime";
|
||||
private _settings = RangerMetrics_recordingSettings getVariable "serverTime";
|
||||
|
||||
[
|
||||
_settings get "bucket",
|
||||
_settings get "measurement",
|
||||
_settings getVariable "bucket",
|
||||
_settings getVariable "measurement",
|
||||
nil,
|
||||
[
|
||||
["float", "diag_tickTime", diag_tickTime toFixed 2],
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
private _settings = RangerMetrics_recordingSettings getVariable "soldierAmmo";
|
||||
|
||||
// run for each side
|
||||
{
|
||||
private _side = _x;
|
||||
private _allHash = createHashMap;
|
||||
|
||||
// run function and increment hash for each player
|
||||
// the hash will wind up containing all mags and ammo count present for each soldier on this side
|
||||
{
|
||||
[_x, _allHash] call RangerMetrics_fnc_getMagsAmmo;
|
||||
} forEach (allUnits select {side _x == _side && alive _x && !isNull _x});
|
||||
|
||||
{
|
||||
private _class = _x;
|
||||
_y params ["_displayName", "_magType", "_ammoCount"];
|
||||
|
||||
[
|
||||
_settings getVariable "bucket",
|
||||
_settings getVariable "measurement",
|
||||
[ // tags
|
||||
["string", "class", _class],
|
||||
["string", "display_name", _displayName],
|
||||
["string", "mag_type", _magType],
|
||||
["string", "side", str _side]
|
||||
],
|
||||
[ // fields
|
||||
["int" ,"ammo_count", round(_ammoCount)]
|
||||
],
|
||||
["profile", "server", "world"] // context
|
||||
] call RangerMetrics_fnc_send;
|
||||
} forEach _allHash;
|
||||
|
||||
// diag_log text format["RangerMetrics: %1 side complete, mags ammo: %2", _side, _allHash];
|
||||
} forEach [west, east, independent, civilian];
|
||||
@@ -1,200 +0,0 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
params [
|
||||
["_unit", objNull, [objNull]]
|
||||
];
|
||||
|
||||
if (isNull _unit) exitWith {false};
|
||||
if (!isPlayer _unit) exitWith {};
|
||||
|
||||
// do not check more than once every 15 seconds
|
||||
_checkDelay = 15;
|
||||
_lastCheck = _unit getVariable [
|
||||
"RangerMetrics_lastInventoryCheck",
|
||||
0
|
||||
];
|
||||
if (
|
||||
(_lastCheck + _checkDelay) > diag_tickTime
|
||||
) exitWith {false};
|
||||
_unit setVariable ["RangerMetrics_lastInventoryCheck", diag_tickTime];
|
||||
|
||||
private _lastLoadout = _unit getVariable "RangerMetrics_unitLoadout";
|
||||
if (isNil "_lastLoadout") then {
|
||||
_lastLoadout = [];
|
||||
};
|
||||
|
||||
private _uniqueUnitItems = uniqueUnitItems [_unit, 2, 2, 2, 2, true];
|
||||
// if (_lastLoadout isEqualTo _uniqueUnitItems) exitWith {false};
|
||||
// _unit setVariable ["RangerMetrics_unitLoadout", _uniqueUnitItems];
|
||||
|
||||
private _uniqueUnitItems = _uniqueUnitItems toArray false;
|
||||
_classItemCounts = [];
|
||||
{
|
||||
_x params ["_item", "_count"];
|
||||
if (_item isEqualTo "") exitWith {};
|
||||
_classItemCounts pushBack ["int", _item, _count];
|
||||
} forEach _uniqueUnitItems;
|
||||
|
||||
_playerUID = getPlayerUID _unit;
|
||||
_unitId = _unit getVariable ["RangerMetrics_Id", -1];
|
||||
if (_unitId isEqualTo -1) exitWith {false};
|
||||
|
||||
|
||||
// this section uses uniqueUnitItems to get a list of all items and their counts
|
||||
|
||||
[
|
||||
"player_state",
|
||||
"unit_loadout",
|
||||
[
|
||||
["string", "playerUID", _playerUID],
|
||||
["string", "format", "className"]
|
||||
],
|
||||
_classItemCounts,
|
||||
["server"]
|
||||
] call RangerMetrics_fnc_send;
|
||||
|
||||
// prep displayName by fetching from configs
|
||||
_displayItemCounts = [];
|
||||
{
|
||||
_x params ["_valueType", "_item", "_count"];
|
||||
|
||||
// from CBA_fnc_getItemConfig, author: commy2
|
||||
private "_itemConfig";
|
||||
{
|
||||
private _config = configFile >> _x >> _item;
|
||||
|
||||
if (isClass _config) exitWith {
|
||||
_itemConfig = _config;
|
||||
};
|
||||
} forEach ["CfgWeapons", "CfgMagazines", "CfgGlasses"];
|
||||
|
||||
if (isNil "_itemConfig") then {
|
||||
private _config = configFile >> "CfgVehicles" >> _item;
|
||||
|
||||
if (getNumber (_config >> "isBackpack") isEqualTo 1) then {
|
||||
_itemConfig = _config;
|
||||
};
|
||||
};
|
||||
|
||||
_itemDisplayName = getText(_itemConfig >> "displayName");
|
||||
_displayItemCounts pushBack ["int", _itemDisplayName, _count];
|
||||
} forEach _classItemCounts;
|
||||
|
||||
|
||||
[
|
||||
"player_state",
|
||||
"unit_loadout",
|
||||
[
|
||||
["string", "playerUID", _playerUID],
|
||||
["string", "unitId", str _unitId],
|
||||
["string", "format", "displayName"]
|
||||
],
|
||||
_displayItemCounts,
|
||||
["server"]
|
||||
] call RangerMetrics_fnc_send;
|
||||
|
||||
true;
|
||||
|
||||
|
||||
|
||||
// get current loadout
|
||||
// ! this section breaks everything down individually, see above for uniqueUnitItems implementation
|
||||
// private _primaryWeapon = primaryWeapon _unit;
|
||||
// (primaryWeaponItems _unit) params [
|
||||
// "_primaryWeaponSilencer",
|
||||
// "_primaryWeaponLaser",
|
||||
// "_primaryWeaponOptics",
|
||||
// "_primaryWeaponBipod"
|
||||
// ];
|
||||
// _primaryWeapon = [
|
||||
// ["string", "weapon", _primaryWeapon],
|
||||
// ["string", "silencer", _primaryWeaponSilencer],
|
||||
// ["string", "laser", _primaryWeaponLaser],
|
||||
// ["string", "optic", _primaryWeaponOptics],
|
||||
// ["string", "bipod", _primaryWeaponBipod]
|
||||
// ];
|
||||
|
||||
// private _secondaryWeapon = secondaryWeapon _unit;
|
||||
// (secondaryWeaponItems _unit) params [
|
||||
// "_secondaryWeaponSilencer",
|
||||
// "_secondaryWeaponLaser",
|
||||
// "_secondaryWeaponOptics",
|
||||
// "_secondaryWeaponBipod"
|
||||
// ];
|
||||
// _secondaryWeapon = [
|
||||
// ["string", "weapon", _secondaryWeapon],
|
||||
// ["string", "silencer", _secondaryWeaponSilencer],
|
||||
// ["string", "laser", _secondaryWeaponLaser],
|
||||
// ["string", "optic", _secondaryWeaponOptics],
|
||||
// ["string", "bipod", _secondaryWeaponBipod]
|
||||
// ];
|
||||
|
||||
// private _handgun = handgunWeapon _unit;
|
||||
// (handgunItems _unit) params [
|
||||
// "_handgunSilencer",
|
||||
// "_handgunLaser",
|
||||
// "_handgunOptics",
|
||||
// "_handgunBipod"
|
||||
// ];
|
||||
// _handgun = [
|
||||
// ["string", "weapon", _handgun],
|
||||
// ["string", "silencer", _handgunSilencer],
|
||||
// ["string", "laser", _handgunLaser],
|
||||
// ["string", "optic", _handgunOptics],
|
||||
// ["string", "bipod", _handgunBipod]
|
||||
// ];
|
||||
|
||||
// private _magazinesFields = [];
|
||||
// private _magazines = (magazines _unit) call BIS_fnc_consolidateArray;
|
||||
// _magazines = _magazines apply {
|
||||
// _x params ["_magazine", "_count"];
|
||||
// _magazinesFields pushBack ["int", _magazine, _count];
|
||||
// _magazinesFields pushBack ["int", getText(configFile >> "CfgMagazines" >> _magazine >> "displayName"), _count];
|
||||
// };
|
||||
|
||||
// private _itemsFields = [];
|
||||
// private _items = (items _unit) call BIS_fnc_consolidateArray;
|
||||
// _items = _items apply {
|
||||
// _x params ["_item", "_count"];
|
||||
// _itemsFields pushBack ["int", _item, _count];
|
||||
// _itemsFields pushBack ["int", getText(configFile >> "CfgWeapons" >> _item >> "displayName"), _count];
|
||||
// };
|
||||
|
||||
// private _slotItems = [
|
||||
// ["string", "goggles", goggles _unit],
|
||||
// ["string", "gogglesClass", getText(configFile >> "CfgWeapons" >> (goggles _unit) >> "displayName")],
|
||||
// ["string", "headgear", headgear _unit],
|
||||
// ["string", "headgearClass", getText(configFile >> "CfgWeapons" >> (headgear _unit) >> "displayName")],
|
||||
// ["string", "binocular", binocular _unit],
|
||||
// ["string", "binocularClass", getText(configFile >> "CfgWeapons" >> (binocular _unit) >> "displayName")],
|
||||
// ["string", "uniform", uniform _unit],
|
||||
// ["string", "uniformClass", getText(configFile >> "CfgWeapons" >> (uniform _unit) >> "displayName")],
|
||||
// ["string", "vest", vest _unit],
|
||||
// ["string", "vestClass", getText(configFile >> "CfgWeapons" >> (vest _unit) >> "displayName")],
|
||||
// ["string", "backpack", backpack _unit],
|
||||
// ["string", "backpackClass", getText(configFile >> "CfgWeapons" >> (backpack _unit) >> "displayName")]
|
||||
// ];
|
||||
|
||||
|
||||
// send loadout data
|
||||
// {
|
||||
// [
|
||||
// "player_state",
|
||||
// "unit_loadout",
|
||||
// [
|
||||
// ["string", "playerUID", _playerUID]
|
||||
// ],
|
||||
// _x,
|
||||
// ["server"]
|
||||
// ] call RangerMetrics_fnc_send;
|
||||
// } forEach [
|
||||
// _primaryWeapon,
|
||||
// _secondaryWeapon,
|
||||
// _handgun,
|
||||
// _magazinesFields,
|
||||
// _itemsFields,
|
||||
// _slotItems
|
||||
// ];
|
||||
|
||||
|
||||
// true;
|
||||
@@ -1,81 +0,0 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
params [[
|
||||
"_unit", objNull, [objNull]
|
||||
]];
|
||||
|
||||
if (isNull _unit || !(isPlayer _unit)) exitWith {};
|
||||
|
||||
// Used in Dammaged EH, so add a 1s delay to prevent spamming
|
||||
_checkDelay = 1;
|
||||
_lastCheck = _unit getVariable [
|
||||
"RangerMetrics_lastUnitStateCheck",
|
||||
diag_tickTime
|
||||
];
|
||||
if (
|
||||
(_lastCheck + _checkDelay) > diag_tickTime
|
||||
) exitWith {};
|
||||
_unit setVariable ["RangerMetrics_lastUnitStateCheck", diag_tickTime];
|
||||
|
||||
// Get owner playerUID
|
||||
private _unitUID = getPlayerUID _unit;
|
||||
if (_unitUID isEqualTo "") exitWith {};
|
||||
|
||||
// Medical info
|
||||
private _isUnconscious = false;
|
||||
private _isInCardiacArrest = false;
|
||||
if (RangerMetrics_aceMedicalPresent) then {
|
||||
_isUnconscious = _unit getVariable ["ace_medical_isUnconscious", false];
|
||||
_isInCardiacArrest = _unit getVariable ["ace_medical_isInCardiacArrest", false];
|
||||
} else {
|
||||
_isUnconscious = (lifeState _unit) isEqualTo "INCAPACITATED";
|
||||
};
|
||||
|
||||
// Vehicle info
|
||||
private _inVehicle = !isNull (objectParent _unit);
|
||||
if (_inVehicle) then {
|
||||
_crew = fullCrew (objectParent _unit);
|
||||
_pos = _crew find {(_x select 0) isEqualTo _unit};
|
||||
_vehicleRole = toLower _crew select _pos select 1;
|
||||
} else {
|
||||
_vehicleRole = "";
|
||||
};
|
||||
|
||||
// Declare fields
|
||||
private _fields = [
|
||||
["float", "health", 1 - (damage _unit)],
|
||||
["bool", "is_unconscious", _isUnconscious],
|
||||
["bool", "is_cardiac_arrest", _isInCardiacArrest],
|
||||
["bool", "is_captive", captive _unit],
|
||||
["bool", "in_vehicle", _inVehicle],
|
||||
["string", "vehicle_role", _vehicleRole],
|
||||
["float", "speed_kmh", speed _unit]
|
||||
];
|
||||
|
||||
// Traits
|
||||
private _playerTraits = getAllUnitTraits _unit;
|
||||
{
|
||||
private _valueType = typeNAME (_x select 1);
|
||||
switch (_valueType) do {
|
||||
case "BOOL": {
|
||||
_fields pushBack ["bool", (_x select 0), (_x select 1)];
|
||||
};
|
||||
case "SCALAR": {
|
||||
_fields pushBack ["float", (_x select 0), (_x select 1)];
|
||||
};
|
||||
case "STRING": {
|
||||
_fields pushBack ["string", (_x select 0), (_x select 1)];
|
||||
};
|
||||
};
|
||||
} forEach _playerTraits;
|
||||
|
||||
|
||||
[
|
||||
"player_state",
|
||||
"unit_status",
|
||||
[
|
||||
["string", "playerUID", _unitUID]
|
||||
],
|
||||
_fields,
|
||||
["server"]
|
||||
] call RangerMetrics_fnc_send;
|
||||
@@ -1,10 +1,10 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
private _settings = RangerMetrics_recordingSettings get "viewDistance";
|
||||
private _settings = RangerMetrics_recordingSettings getVariable "viewDistance";
|
||||
|
||||
[
|
||||
_settings get "bucket",
|
||||
_settings get "measurement",
|
||||
_settings getVariable "bucket",
|
||||
_settings getVariable "measurement",
|
||||
nil,
|
||||
[
|
||||
["float", "objectViewDistance", getObjectViewDistance # 0],
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
private _settings = RangerMetrics_recordingSettings get "weather";
|
||||
private _settings = RangerMetrics_recordingSettings getVariable "weather";
|
||||
|
||||
[
|
||||
_settings get "bucket",
|
||||
_settings get "measurement",
|
||||
_settings getVariable "bucket",
|
||||
_settings getVariable "measurement",
|
||||
nil, // tags
|
||||
[ // fields
|
||||
["float", "fog", fog],
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
params ["_killed", "_killer", "_instigator"];
|
||||
|
||||
if (!isPlayer _killed) exitWith {}; // only track player deaths
|
||||
|
||||
// check in case ACE is active and lastDamageSource has been broadcast via addLocalSoldierEH
|
||||
_instigator = _unit getVariable [
|
||||
"ace_medical_lastDamageSource",
|
||||
_instigator
|
||||
];
|
||||
|
||||
|
||||
if (isNull _instigator) then { _instigator = UAVControl vehicle _killer select 0 }; // UAV/UGV player operated road kill
|
||||
if (isNull _instigator) then { _instigator = _killer }; // player driven vehicle road kill
|
||||
if (isNull _instigator) then { _instigator = _killed };
|
||||
// hint format ["Killed By %1", name _instigator];
|
||||
|
||||
if (!isPlayer _killed && !isPlayer _instigator) exitWith {}; // only track player kills
|
||||
|
||||
private _tags = [];
|
||||
private _fields = [];
|
||||
|
||||
if (getPlayerUID _instigator != "") then {
|
||||
_tags pushBack ["string", "killerPlayerUID", getPlayerUID _instigator];
|
||||
};
|
||||
if (name _instigator != "") then {
|
||||
_fields pushBack ["string", "killerName", name _instigator];
|
||||
};
|
||||
|
||||
if (getPlayerUID _killed != "") then {
|
||||
_tags pushBack ["string", "killedPlayerUID", getPlayerUID _killed];
|
||||
};
|
||||
if (name _killed != "") then {
|
||||
_fields pushBack ["string", "killedName", name _killed];
|
||||
};
|
||||
|
||||
[
|
||||
"server_events",
|
||||
"EntityKilled",
|
||||
_tags,
|
||||
_fields,
|
||||
["server"]
|
||||
] call RangerMetrics_fnc_send;
|
||||
@@ -1,33 +0,0 @@
|
||||
params ["_vehicle", "_damage", "_source"];
|
||||
|
||||
if (isNull _vehicle) exitWith {};
|
||||
private _sourceClass = "";
|
||||
private _sourceDisplayName = "";
|
||||
private _sourcePlayerUID = "";
|
||||
if !(isNull _source) then {
|
||||
private _sourceClass = typeOf _source;
|
||||
private _sourceDisplayName = [configOf _source] call BIS_fnc_displayName;
|
||||
if (isPlayer _source) then {
|
||||
private _sourcePlayerId = getPlayerId _source;
|
||||
private _sourceUserInfo = getUserInfo _sourcePlayerId;
|
||||
private _sourcePlayerUID = _sourceUserInfo select 2;
|
||||
} else {
|
||||
private _sourcePlayerUID = "";
|
||||
};
|
||||
};
|
||||
private _unitPlayerId = getPlayerId _vehicle;
|
||||
private _userInfo = getUserInfo _unitPlayerId;
|
||||
private _unitPlayerUID = _userInfo select 2;
|
||||
|
||||
[
|
||||
"player_events",
|
||||
"Explosion",
|
||||
[["string", "playerUID", _unitPlayerUID]],
|
||||
[
|
||||
["string", "sourceClass", _sourceClass],
|
||||
["string", "sourceDisplayName", _sourceDisplayName],
|
||||
["string", "sourcePlayerUID", _sourcePlayerUID],
|
||||
["float", "damage", _damage]
|
||||
],
|
||||
["server"]
|
||||
] call RangerMetrics_fnc_send;
|
||||
@@ -1,27 +0,0 @@
|
||||
params [
|
||||
["_unit", objNull],
|
||||
"_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"
|
||||
];
|
||||
|
||||
if (isNull _unit) exitWith {};
|
||||
private _unitPlayerId = getPlayerId _unit;
|
||||
private _userInfo = getUserInfo _unitPlayerId;
|
||||
|
||||
[
|
||||
"player_events",
|
||||
"FiredMan",
|
||||
[
|
||||
["string", "playerUID", _userInfo select 2]
|
||||
],
|
||||
[
|
||||
["string", "weapon", _weapon],
|
||||
["string", "muzzle", _muzzle],
|
||||
["string", "mode", _mode],
|
||||
["string", "ammo", _ammo],
|
||||
["string", "magazine", _magazine],
|
||||
// ["object", "projectile", _projectile],
|
||||
["string", "vehicle", [configOf _vehicle] call displayName],
|
||||
["string", "vehicleClass", typeOf _vehicle]
|
||||
],
|
||||
["server"]
|
||||
] call RangerMetrics_fnc_send;
|
||||
@@ -1,40 +0,0 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
params ["_channel", "_owner", "_from", "_text", "_person", "_name", "_strID", "_forcedDisplay", "_isPlayerMessage", "_sentenceType", "_chatMessageType"];
|
||||
|
||||
// if (!_isPlayerMessage) exitWith {};
|
||||
|
||||
private _fields = [
|
||||
["int", "channel", _channel],
|
||||
["int", "owner", _owner],
|
||||
["string", "from", _from],
|
||||
["string", "text", _text],
|
||||
// ["object", "person", _person],
|
||||
["string", "name", _name],
|
||||
["string", "strID", _strID],
|
||||
["bool", "forcedDisplay", _forcedDisplay],
|
||||
["bool", "isPlayerMessage", _isPlayerMessage],
|
||||
["int", "sentenceType", _sentenceType],
|
||||
["int", "chatMessageType", _chatMessageType toFixed 0]
|
||||
];
|
||||
|
||||
// we need special processing to ensure the object is valid and we have a playerUid. Line protocol doesn't support empty string
|
||||
private "_playerUID";
|
||||
|
||||
if (parseNumber _strID > 1) then {
|
||||
_playerUID = (getUserInfo _strID)#2;
|
||||
} else {
|
||||
_playerUID = "";
|
||||
};
|
||||
|
||||
if (_playerUID isNotEqualTo "") then {
|
||||
_fields pushBack ["string", "playerUID", _playerUid];
|
||||
};
|
||||
|
||||
[
|
||||
"server_events",
|
||||
"HandleChatMessage",
|
||||
nil,
|
||||
_fields,
|
||||
["server"]
|
||||
] call RangerMetrics_fnc_send;
|
||||
@@ -1,30 +0,0 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
params ["_marker", "_channelNumber", "_owner", "_local"];
|
||||
|
||||
// Log marker
|
||||
if (_marker isEqualTo "") exitWith {};
|
||||
if (_channelNumber isEqualTo "") exitWith {};
|
||||
if (_owner isEqualTo "") exitWith {};
|
||||
|
||||
// Get marker
|
||||
private _markerData = _marker call BIS_fnc_markerToString;
|
||||
if (_markerData isEqualTo "") exitWith {};
|
||||
|
||||
// Get owner playerUID
|
||||
private _ownerUID = getPlayerUID _owner;
|
||||
if (_ownerUID isEqualTo "") exitWith {};
|
||||
|
||||
[
|
||||
"server_events",
|
||||
"MarkerCreated",
|
||||
[
|
||||
["string", "actorPlayerUID", _ownerUID]
|
||||
],
|
||||
[
|
||||
["string", "marker", _markerData],
|
||||
["number", "channelNumber", _channelNumber],
|
||||
["string", "owner", _ownerUID]
|
||||
],
|
||||
["server"]
|
||||
] call RangerMetrics_fnc_send;
|
||||
@@ -1,31 +0,0 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
params ["_marker", "_channelNumber", "_owner", "_local"];
|
||||
|
||||
// Log marker
|
||||
if (_marker isEqualTo "") exitWith {};
|
||||
if (_channelNumber isEqualTo "") exitWith {};
|
||||
if (_owner isEqualTo "") exitWith {};
|
||||
|
||||
// Get marker
|
||||
private _markerData = _marker call BIS_fnc_markerToString;
|
||||
|
||||
// Get owner playerUID
|
||||
private _ownerUID = getPlayerUID _owner;
|
||||
if (_ownerUID isEqualTo "") then {
|
||||
_ownerUID = "-1";
|
||||
};
|
||||
|
||||
[
|
||||
"server_events",
|
||||
"MarkerDeleted",
|
||||
[
|
||||
["string", "actorPlayerUID", _ownerUID]
|
||||
],
|
||||
[
|
||||
["string", "marker", _markerData],
|
||||
["number", "channelNumber", _channelNumber],
|
||||
["string", "owner", _ownerUID]
|
||||
],
|
||||
["server"]
|
||||
] call RangerMetrics_fnc_send;
|
||||
@@ -1,20 +0,0 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
params ["_marker", "_local"];
|
||||
|
||||
// Log marker
|
||||
if (_marker isEqualTo "") exitWith {};
|
||||
|
||||
// Get marker
|
||||
private _markerData = _marker call BIS_fnc_markerToString;
|
||||
|
||||
[
|
||||
"server_events",
|
||||
"MarkerUpdated",
|
||||
nil,
|
||||
[
|
||||
["string", "marker", _markerData]
|
||||
],
|
||||
["server"]
|
||||
] call RangerMetrics_fnc_send;
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
if (!RangerMetrics_run) exitWith {};
|
||||
|
||||
params [["_unit", objNull], "_unconscious"];
|
||||
if (isNull _unit) exitWith {};
|
||||
if (!isPlayer _unit) exitWith {};
|
||||
// Get owner playerUID
|
||||
private _unitUID = getPlayerUID _unitUID;
|
||||
if (_unitUID isEqualTo "") exitWith {false};
|
||||
|
||||
[
|
||||
"player_state",
|
||||
"player_health",
|
||||
[
|
||||
["string", "playerUID", _unitUID]
|
||||
],
|
||||
[
|
||||
["float", "health", 1 - (damage _unit)],
|
||||
["bool", "state", _unconscious]
|
||||
]
|
||||
] call RangerMetrics_fnc_send;
|
||||
|
||||
true;
|
||||
@@ -1,17 +0,0 @@
|
||||
params [["_fields", []]];
|
||||
|
||||
// Example:
|
||||
// ["milsim_serverEfficiency", [[
|
||||
// ["float", "milsim_raw_cps", "3207.98"],
|
||||
// ["float", "milsim_cps", "1"]
|
||||
// ]]] call CBA_fnc_serverEvent;
|
||||
|
||||
private _settings = RangerMetrics_recordingSettings get "CBAEventHandlers" get "milsimServerEfficiency";
|
||||
|
||||
[
|
||||
_settings get "bucket",
|
||||
_settings get "measurement",
|
||||
nil,
|
||||
_fields,
|
||||
["server"]
|
||||
] call RangerMetrics_fnc_send;
|
||||
@@ -5,8 +5,6 @@
|
||||
private _tags = [];
|
||||
if (!isNil "_userInfo") then {
|
||||
_tags pushBack ["string", "playerUID", _userInfo#2];
|
||||
_userInfo call RangerMetrics_capture_fnc_player_identity;
|
||||
_userInfo call RangerMetrics_capture_fnc_player_status;
|
||||
};
|
||||
["server_events", "OnUserConnected",
|
||||
_tags, [
|
||||
@@ -22,8 +20,6 @@
|
||||
private _tags = [];
|
||||
if (!isNil "_userInfo") then {
|
||||
_tags pushBack ["string", "playerUID", _userInfo#2];
|
||||
_userInfo call RangerMetrics_capture_fnc_player_identity;
|
||||
_userInfo call RangerMetrics_capture_fnc_player_status;
|
||||
};
|
||||
["server_events", "OnUserDisconnected",
|
||||
_tags, [
|
||||
@@ -54,10 +50,6 @@
|
||||
["HandleDisconnect", {
|
||||
params ["_unit", "_id", "_uid", "_name"];
|
||||
private _userInfo = (getUserInfo (_id toFixed 0));
|
||||
if (!isNil "_userInfo") then {
|
||||
_userInfo call RangerMetrics_capture_fnc_player_identity;
|
||||
_userInfo call RangerMetrics_capture_fnc_player_status;
|
||||
};
|
||||
["server_events", "HandleDisconnect", [
|
||||
["string", "playerUID", _uid]
|
||||
], [
|
||||
@@ -71,7 +63,6 @@
|
||||
["OnUserClientStateChanged", {
|
||||
params ["_networkId", "_clientStateNumber", "_clientState"];
|
||||
private _userInfo = (getUserInfo _networkId);
|
||||
_userInfo call RangerMetrics_capture_fnc_player_status;
|
||||
["server_events", "OnUserClientStateChanged", [
|
||||
["string", "playerUID", _userInfo#2]
|
||||
], [
|
||||
@@ -85,7 +76,6 @@
|
||||
params ["_networkId", "_loggedIn", "_votedIn"];
|
||||
private _userInfo = (getUserInfo _networkId);
|
||||
if (isNil "_userInfo") exitWith {};
|
||||
_userInfo call RangerMetrics_capture_fnc_player_status;
|
||||
["server_events", "OnUserAdminStateChanged", [
|
||||
["string", "playerUID", _userInfo#2]
|
||||
], [
|
||||
@@ -99,8 +89,6 @@
|
||||
params ["_networkId", "_kickTypeNumber", "_kickType", "_kickReason", "_kickMessageIncReason"];
|
||||
private _userInfo = (getUserInfo _networkId);
|
||||
if (isNil "_userInfo") exitWith {};
|
||||
_userInfo call RangerMetrics_capture_fnc_player_identity;
|
||||
_userInfo call RangerMetrics_capture_fnc_player_status;
|
||||
["server_events", "OnUserKicked", [
|
||||
["string", "playerUID", _userInfo#2]
|
||||
], [
|
||||
@@ -142,18 +130,14 @@
|
||||
if (
|
||||
!(_entity isKindOf "AllVehicles")
|
||||
) exitWith {};
|
||||
_this call RangerMetrics_event_fnc_EntityKilled;
|
||||
call RangerMetrics_capture_fnc_entity_count;
|
||||
// [_entity] call RangerMetrics_capture_fnc_unit_inventory;
|
||||
// [_entity] call RangerMetrics_capture_fnc_unit_state;
|
||||
|
||||
[format["(EventHandler) EntityKilled fired: %1", _this], "DEBUG"] call RangerMetrics_fnc_log;
|
||||
}],
|
||||
["EntityRespawned", {
|
||||
params ["_newEntity", "_oldEntity"];
|
||||
call RangerMetrics_capture_fnc_entity_count;
|
||||
// [_entity] call RangerMetrics_capture_fnc_unit_inventory;
|
||||
// [_entity] call RangerMetrics_capture_fnc_unit_state;
|
||||
|
||||
[format["(EventHandler) EntityRespawned fired: %1", _this], "DEBUG"] call RangerMetrics_fnc_log;
|
||||
}],
|
||||
["GroupCreated", {
|
||||
@@ -166,37 +150,4 @@
|
||||
call RangerMetrics_capture_fnc_entity_count;
|
||||
[format["(EventHandler) GroupDeleted fired: %1", _this], "DEBUG"] call RangerMetrics_fnc_log;
|
||||
}]
|
||||
// ["MarkerCreated", {
|
||||
// params ["_marker", "_channelNumber", "_owner", "_local"];
|
||||
// if (markerType _marker isEqualTo "") exitWith {};
|
||||
// _this call RangerMetrics_event_fnc_MarkerCreated;
|
||||
// [format["(EventHandler) MarkerCreated fired: %1", _this], "DEBUG"] call RangerMetrics_fnc_log;
|
||||
// }],
|
||||
// ["MarkerDeleted", {
|
||||
// params ["_marker", "_channelNumber", "_owner", "_local"];
|
||||
// if (markerType _marker isEqualTo "") exitWith {};
|
||||
// _this call RangerMetrics_event_fnc_MarkerDeleted;
|
||||
// [format["(EventHandler) MarkerDeleted fired: %1", _this], "DEBUG"] call RangerMetrics_fnc_log;
|
||||
// }],
|
||||
// ["MarkerUpdated", {
|
||||
// params ["_marker", "_local"];
|
||||
// if (markerType _marker isEqualTo "") exitWith {};
|
||||
// _this call RangerMetrics_event_fnc_MarkerUpdated;
|
||||
// }],
|
||||
// ["Service", {
|
||||
// params ["_serviceVehicle", "_servicedVehicle", "_serviceType", "_needsService", "_autoSupply"];
|
||||
// [
|
||||
// "server_events",
|
||||
// "Service",
|
||||
// [
|
||||
// ["string", "serviceVehicle", typeOf _serviceVehicle],
|
||||
// ["string", "servicedVehicle", typeOf _servicedVehicle],
|
||||
// ["int", "serviceType", _serviceType],
|
||||
// ["bool", "needsService", _needsService],
|
||||
// ["bool", "autoSupply", _autoSupply]
|
||||
// ],
|
||||
// nil
|
||||
// ] call RangerMetrics_fnc_send;
|
||||
// [format["(EventHandler) Service fired: %1", _this], "DEBUG"] call RangerMetrics_fnc_log;
|
||||
// }]
|
||||
]
|
||||
];
|
||||
@@ -30,6 +30,10 @@
|
||||
[
|
||||
"viewDistance",
|
||||
RangerMetrics_capture_fnc_view_distance
|
||||
],
|
||||
[
|
||||
"soldierAmmo",
|
||||
RangerMetrics_capture_fnc_soldier_ammo
|
||||
]
|
||||
// [
|
||||
// "playerInventory",
|
||||
|
||||
@@ -25,15 +25,15 @@
|
||||
_x params ["_name", "_code"];
|
||||
|
||||
// get the settings
|
||||
private _settings = RangerMetrics_recordingSettings get _name;
|
||||
private _settings = RangerMetrics_recordingSettings getVariable _name;
|
||||
if (isNil "_settings") exitWith {};
|
||||
if (count (keys _settings) == 0) exitWith {};
|
||||
if (count (allVariables _settings) == 0) exitWith {};
|
||||
|
||||
if (
|
||||
(_settings get "enabled") isNotEqualTo true ||
|
||||
(_settings getVariable "enabled") isNotEqualTo true ||
|
||||
(
|
||||
!isServer &&
|
||||
(_settings get "serverOnly") isNotEqualTo false
|
||||
(_settings getVariable "serverOnly") isNotEqualTo false
|
||||
) ||
|
||||
(hasInterface && !isServer)
|
||||
) exitWith {};
|
||||
@@ -49,15 +49,15 @@
|
||||
private "_handle";
|
||||
_x params ["_settingName", "_handleName", "_code"];
|
||||
|
||||
private _settings = RangerMetrics_recordingSettings get "CBAEventHandlers" get _settingName;
|
||||
private _settings = (RangerMetrics_recordingSettings getVariable "CBAEventHandlers") getVariable _settingName;
|
||||
if (isNil "_settings") exitWith {};
|
||||
if (count (keys _settings) == 0) exitWith {};
|
||||
|
||||
if (
|
||||
(_settings get "enabled") isNotEqualTo true ||
|
||||
(_settings getVariable "enabled") isNotEqualTo true ||
|
||||
(
|
||||
!isServer &&
|
||||
(_settings get "serverOnly") isNotEqualTo false
|
||||
(_settings getVariable "serverOnly") isNotEqualTo false
|
||||
) ||
|
||||
(hasInterface && !isServer)
|
||||
) exitWith {};
|
||||
|
||||
@@ -8,9 +8,9 @@ RangerMetrics = false call CBA_fnc_createNamespace;
|
||||
|
||||
RangerMetrics_cbaPresent = isClass(configFile >> "CfgPatches" >> "cba_main");
|
||||
RangerMetrics_logPrefix = "RangerMetrics";
|
||||
RangerMetrics_debug = false;
|
||||
RangerMetrics_debug = true;
|
||||
RangerMetrics_initialized = false;
|
||||
RangerMetrics_run = true;
|
||||
RangerMetrics_run = false;
|
||||
|
||||
RangerMetrics_settings = createHashMap;
|
||||
RangerMetrics_recordingSettings = createHashMap;
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
// format [interval, [[handleName, code], [handleName, code], ...]]
|
||||
[_this, {
|
||||
if (!hasInterface || isDedicated) exitWith {};
|
||||
params [
|
||||
["_interval", 5, [5]],
|
||||
["_pollItems", []]
|
||||
];
|
||||
{
|
||||
_x params [
|
||||
"_handleName",
|
||||
["_code", {}, [{}]]
|
||||
];
|
||||
|
||||
private _runningCBA = (isClass(configFile >> "CfgPatches" >> "cba_main"));
|
||||
if (_runningCBA) then {
|
||||
missionNamespace setVariable [
|
||||
_handleName,
|
||||
[_code, _interval, _handleName] call CBA_fnc_addPerFrameHandler
|
||||
];
|
||||
} else {
|
||||
missionNamespace setVariable [
|
||||
_handleName,
|
||||
[_handleName, _interval] spawn {
|
||||
params [
|
||||
"_handleName",
|
||||
"_interval"
|
||||
];
|
||||
while {true} do {
|
||||
[_handleName] call _code;
|
||||
sleep _interval;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
} forEach _pollItems;
|
||||
}] remoteExec ["call", [0, -2] select isDedicated, true];
|
||||
@@ -1,6 +1,6 @@
|
||||
params ["_refName", "_code"];
|
||||
|
||||
private _intervalMs = RangerMetrics_recordingSettings get _refName get "intervalMs";
|
||||
private _intervalMs = (RangerMetrics_recordingSettings getVariable _refName) getVariable ["intervalMs", 1000];
|
||||
if (isNil "_intervalMs") exitWith {
|
||||
[format["No intervalMs found for serverPoll %1", _name]] call RangerMetrics_fnc_log;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
params [
|
||||
["_unit", objNull, [objNull]],
|
||||
["_hash", createHashMap, [createHashMap]]
|
||||
];
|
||||
|
||||
_magazines = magazinesAmmoFull _unit;
|
||||
|
||||
{
|
||||
_x params [
|
||||
"_class",
|
||||
"_ammoCount",
|
||||
"_isLoaded",
|
||||
"_magTypeBit"
|
||||
];
|
||||
|
||||
private _magType = switch (_magTypeBit) do {
|
||||
case -1: {""};
|
||||
case 0: {"grenade"};
|
||||
case 1: {"primaryMagazine"};
|
||||
case 2: {"handgunMagazine"};
|
||||
case 4: {"secondaryMagainze"};
|
||||
case 4096: {"binocularMagazine"};
|
||||
case 65536: {"vehicleMagazine"};
|
||||
};
|
||||
|
||||
_config = (configFile >> "CfgMagazines" >> _class);
|
||||
_dname = getText(_config >> "displayName");
|
||||
private _existing = _hash getOrDefault [_class, [_dname, _magType, 0]];
|
||||
_hash set [_class, [
|
||||
_dname,
|
||||
_magType,
|
||||
(_existing#2) + _ammoCount
|
||||
]];
|
||||
} forEach _magazines;
|
||||
|
||||
|
||||
|
||||
@@ -1,435 +0,0 @@
|
||||
classDiagram
|
||||
class server_state {
|
||||
BUCKET
|
||||
}
|
||||
|
||||
class server_events {
|
||||
Measurement OnUserConnected
|
||||
Measurement OnUserDisconnected
|
||||
Measurement PlayerConnected
|
||||
Measurement PlayerDisconnected
|
||||
Measurement OnUserClientStateChanged
|
||||
Measurement OnUserAdminStateChanged
|
||||
Measurement OnUserKicked
|
||||
Meausrement HandleChatMessage
|
||||
Measurement MPEnded
|
||||
Measurement EntityCreated
|
||||
Measurement EntityKilled
|
||||
Measurement GroupCreated
|
||||
Measurement GroupDeleted
|
||||
Measurement MarkerCreated
|
||||
Measurement MarkerDeleted
|
||||
Measurement MarkerUpdated
|
||||
Measurement Service
|
||||
}
|
||||
|
||||
server_state --> running_mission
|
||||
class running_mission {
|
||||
capture: ServerPoll, 60s
|
||||
capture: MissionEH, MPEnded
|
||||
tag string profileName
|
||||
tag string connectedServer
|
||||
field string onLoadName
|
||||
field string missionName
|
||||
field string missionNameSource
|
||||
field string briefingName
|
||||
}
|
||||
|
||||
server_state --> view_distance
|
||||
class view_distance {
|
||||
capture: ServerPoll, 60s
|
||||
tag string profileName
|
||||
tag string connectedServer
|
||||
field string viewDistance
|
||||
field string objectViewDistance
|
||||
}
|
||||
|
||||
server_state --> server_time
|
||||
class server_time {
|
||||
capture: ServerPoll, 3s
|
||||
tag string profileName
|
||||
tag string connectedServer
|
||||
field float diag_tickTime
|
||||
field int serverTime
|
||||
field float timeMultiplier
|
||||
field int accTime
|
||||
}
|
||||
|
||||
server_state --> running_scripts
|
||||
class running_scripts {
|
||||
capture: ServerPoll, 3s
|
||||
tag string profileName
|
||||
tag string connectedServer
|
||||
field int spawn_total
|
||||
field int execVM_total
|
||||
field int exec_total
|
||||
field int execFSM_total
|
||||
field int pfh_total
|
||||
}
|
||||
|
||||
server_state --> entities_local
|
||||
class entities_local {
|
||||
capture: ServerPoll, 30s
|
||||
capture: MissionEH, EntityKilled
|
||||
capture: MissionEH, EntityCreated
|
||||
capture: MissionEH, GroupCreated
|
||||
capture: MissionEH, GroupDeleted
|
||||
tag string profileName
|
||||
tag string connectedServer
|
||||
field int units_alive
|
||||
field int units_dead
|
||||
field int vehicles_total
|
||||
field int groups_total
|
||||
}
|
||||
server_state --> entities_global
|
||||
class entities_global {
|
||||
capture: ServerPoll, 30s
|
||||
capture: MissionEH, EntityKilled
|
||||
capture: MissionEH, EntityCreated
|
||||
capture: MissionEH, GroupCreated
|
||||
capture: MissionEH, GroupDeleted
|
||||
tag string profileName
|
||||
tag string connectedServer
|
||||
field int units_alive
|
||||
field int units_dead
|
||||
field int vehicles_total
|
||||
field int groups_total
|
||||
}
|
||||
server_state --> entities_remote
|
||||
class entities_remote {
|
||||
capture: ServerPoll, 30s
|
||||
capture: MissionEH, EntityKilled
|
||||
capture: MissionEH, EntityCreated
|
||||
capture: MissionEH, GroupCreated
|
||||
capture: MissionEH, GroupDeleted
|
||||
tag string profileName
|
||||
tag string connectedServer
|
||||
field int units_alive
|
||||
field int units_dead
|
||||
field int vehicles_total
|
||||
field int groups_total
|
||||
}
|
||||
|
||||
server_state --> server_performance
|
||||
class server_performance {
|
||||
capture: ServerPoll, 1s
|
||||
tag string profileName
|
||||
tag string connectedServer
|
||||
field string fps_avg
|
||||
field string fps_min
|
||||
|
||||
}
|
||||
|
||||
server_state --> weather
|
||||
class weather {
|
||||
capture: ServerPoll, 60s
|
||||
tag string profileName
|
||||
tag string connectedServer
|
||||
field string fog
|
||||
field string overcast
|
||||
field string rain
|
||||
field string humidity
|
||||
field string waves
|
||||
field string windDir
|
||||
field string windStr
|
||||
field string gusts
|
||||
field string lightnings
|
||||
field string moonIntensity
|
||||
field string moonPhase
|
||||
field string sunOrMoon
|
||||
}
|
||||
|
||||
class config_state {
|
||||
tag string profileName
|
||||
tag string connectedServer
|
||||
Measurement mission_config_file
|
||||
Measurement addon_options
|
||||
Measurement mission_parameters
|
||||
}
|
||||
|
||||
config_state --> mission_config_file
|
||||
class mission_config_file {
|
||||
tag string profileName
|
||||
tag string connectedServer
|
||||
tag string category [
|
||||
mission_info
|
||||
respawn
|
||||
player_ui
|
||||
corpse_and_wreck
|
||||
mission_settings
|
||||
]
|
||||
|
||||
}
|
||||
%% ' link fields in each category
|
||||
mission_config_file --> mission_info
|
||||
class mission_info {
|
||||
tag string profileName
|
||||
tag string connectedServer
|
||||
field string author
|
||||
field string onLoadName
|
||||
field string onLoadMission
|
||||
field string loadScreen
|
||||
%% field string header
|
||||
field string gameType
|
||||
field int minPlayers
|
||||
field int maxPlayers
|
||||
field int onLoadIntro
|
||||
field int onLoadMissionTime
|
||||
field int onLoadIntroTime
|
||||
field string briefingName
|
||||
field string overviewPicture
|
||||
field string overviewText
|
||||
field string overviewTextLocked
|
||||
}
|
||||
|
||||
mission_config_file --> respawn
|
||||
class respawn {
|
||||
tag string profileName
|
||||
tag string connectedServer
|
||||
field string respawn
|
||||
field string respawnButton
|
||||
field string respawnDelay
|
||||
field string respawnVehicleDelay
|
||||
field string respawnDialog
|
||||
field string respawnOnStart
|
||||
field string respawnTemplates
|
||||
field string respawnTemplatesWest
|
||||
field string respawnTemplatesEast
|
||||
field string respawnTemplatesGuer
|
||||
field string respawnTemplatesCiv
|
||||
field string respawnWeapons
|
||||
field string respawnMagazines
|
||||
field int reviveMode
|
||||
field int reviveUnconsciousStateMode
|
||||
field int reviveRequiredTrait
|
||||
field int reviveRequiredItems
|
||||
field int reviveRequiredItemsFakConsumed
|
||||
field int reviveMedicSpeedMultiplier
|
||||
field int reviveDelay
|
||||
field int reviveForceRespawnDelay
|
||||
field int reviveBleedOutDelay
|
||||
field int enablePlayerAddRespawn
|
||||
}
|
||||
|
||||
mission_config_file --> player_ui
|
||||
class player_ui {
|
||||
tag string profileName
|
||||
tag string connectedServer
|
||||
field int overrideFeedback
|
||||
field int showHUD
|
||||
field int showCompass
|
||||
field int showGPS
|
||||
field int showGroupIndicator
|
||||
field int showMap
|
||||
field int showNotePad
|
||||
field int showPad
|
||||
field int showWatch
|
||||
field int showUAVFeed
|
||||
field int showSquadRadar
|
||||
}
|
||||
|
||||
mission_config_file --> corpse_and_wreck
|
||||
class corpse_and_wreck {
|
||||
tag string profileName
|
||||
tag string connectedServer
|
||||
field int corpseManagerMode
|
||||
field int corpseLimit
|
||||
field int corpseRemovalMinTime
|
||||
field int corpseRemovalMaxTime
|
||||
field int wreckManagerMode
|
||||
field int wreckLimit
|
||||
field int wreckRemovalMinTime
|
||||
field int wreckRemovalMaxTime
|
||||
field int minPlayerDistance
|
||||
}
|
||||
|
||||
mission_config_file --> mission_settings
|
||||
class mission_settings {
|
||||
tag string profileName
|
||||
tag string connectedServer
|
||||
field int aiKills
|
||||
field int briefing
|
||||
field int debriefing
|
||||
field string disableChannels
|
||||
field int disabledAI
|
||||
field string disableRandomization
|
||||
field List~string~ enableDebugConsole
|
||||
field int enableItemsDropping
|
||||
field int enableTeamSwitch
|
||||
field int forceRotorLibSimulation
|
||||
field int joinUnassigned
|
||||
field int minScore
|
||||
field int avgScore
|
||||
field int maxScore
|
||||
field string onCheat
|
||||
field string onPauseScript
|
||||
field int saving
|
||||
field int scriptedPlayer
|
||||
field int skipLobby
|
||||
field int HostDoesNotSkipLobby
|
||||
field string missionGroup
|
||||
}
|
||||
|
||||
class player_state
|
||||
|
||||
|
||||
player_state --> player_identity
|
||||
class player_identity {
|
||||
capture: MissionEH, OnUserConnected
|
||||
capture: MissionEH, OnUserDisconnected
|
||||
capture: MissionEH, PlayerConnected
|
||||
capture: MissionEH, PlayerDisconnected
|
||||
capture: MissionEH, OnUserKicked
|
||||
tag string connectedServer
|
||||
tag string playerUID
|
||||
field string playerID
|
||||
field string ownerId
|
||||
field string playerUID
|
||||
field string profileName
|
||||
field string displayName
|
||||
field string steamName
|
||||
field bool isHC
|
||||
field bool isJip
|
||||
field string roleDescription
|
||||
}
|
||||
|
||||
player_state --> player_status
|
||||
class player_status {
|
||||
capture: MissionEH, OnUserConnected
|
||||
capture: MissionEH, OnUserDisconnected
|
||||
capture: MissionEH, PlayerConnected
|
||||
capture: MissionEH, PlayerDisconnected
|
||||
capture: MissionEH, OnUserClientStateChanged
|
||||
capture: MissionEH, OnUserAdminStateChanged
|
||||
capture: MissionEH, OnUserKicked
|
||||
tag string connectedServer
|
||||
tag string playerUID
|
||||
field int clientStateNumber
|
||||
field int adminState
|
||||
}
|
||||
|
||||
player_state --> player_performance
|
||||
class player_performance {
|
||||
capture: ServerPoll
|
||||
tag string connectedServer
|
||||
tag string playerUID
|
||||
field float avgPing
|
||||
field float avgBandwidth
|
||||
field float desync
|
||||
}
|
||||
|
||||
player_state --> unit_inventory
|
||||
class unit_inventory {
|
||||
capture: InventoryClosedEH
|
||||
tag string connectedServer
|
||||
tag string playerUID
|
||||
field string currentWeapon
|
||||
field string uniform
|
||||
field string vest
|
||||
field string backpack
|
||||
field string headgear
|
||||
field string goggles
|
||||
field string hmd
|
||||
field string primaryWeapon
|
||||
field string primaryWeaponMagazine
|
||||
field string secondaryWeapon
|
||||
field string secondaryWeaponMagazine
|
||||
field string handgunWeapon
|
||||
field string handgunMagazine
|
||||
}
|
||||
|
||||
player_state --> unit_state
|
||||
class unit_state {
|
||||
capture: UnitEH, GetInMan
|
||||
capture: UnitEH, GetOutMan
|
||||
tag string connectedServer
|
||||
tag string playerUID
|
||||
field float health
|
||||
field bool is_unconscious
|
||||
field bool is_cardiac_arrest
|
||||
field bool is_captive
|
||||
field bool in_vehicle
|
||||
field string vehicle_role
|
||||
field float speed_kmh
|
||||
field string unitTraitX
|
||||
field bool unitTraitY
|
||||
field int unitTraitZ
|
||||
}
|
||||
|
||||
class player_events
|
||||
|
||||
player_events --> Dammaged
|
||||
class Dammaged {
|
||||
capture: UnitEH, Dammaged
|
||||
tag string connectedServer
|
||||
tag string playerUID
|
||||
field string selection
|
||||
field string damage
|
||||
field string hitIndex
|
||||
field string hitPoint
|
||||
field string shooter
|
||||
field string projectile
|
||||
}
|
||||
|
||||
player_events --> FiredMan
|
||||
class FiredMan {
|
||||
capture: UnitEH, FiredMan
|
||||
tag string connectedServer
|
||||
tag string playerUID
|
||||
field string weapon
|
||||
field string muzzle
|
||||
field string mode
|
||||
field string ammo
|
||||
field string magazine
|
||||
field string vehicle
|
||||
field string vehicleClass
|
||||
}
|
||||
|
||||
player_events --> GetInMan
|
||||
class GetInMan {
|
||||
capture: UnitEH, GetInMan
|
||||
tag string connectedServer
|
||||
tag string playerUID
|
||||
field string role
|
||||
field string vehicle
|
||||
field string turret
|
||||
}
|
||||
player_events --> GetOutMan
|
||||
class GetOutMan {
|
||||
capture: UnitEH, GetOutMan
|
||||
tag string connectedServer
|
||||
tag string playerUID
|
||||
field string role
|
||||
field string vehicle
|
||||
field string turret
|
||||
}
|
||||
|
||||
player_events --> HandleScore
|
||||
class HandleScore {
|
||||
capture: UnitEH, HandleScore
|
||||
tag string connectedServer
|
||||
tag string playerUID
|
||||
field int score
|
||||
field string object
|
||||
field string objectclass
|
||||
}
|
||||
|
||||
player_events --> InventoryClosed
|
||||
class InventoryClosed {
|
||||
capture: UnitEH, InventoryClosed
|
||||
tag string connectedServer
|
||||
tag string playerUID
|
||||
field string currentWeaponClass
|
||||
field string uniformClass
|
||||
field string vestClass
|
||||
field string backpackClass
|
||||
field string headgearClass
|
||||
field string gogglesClass
|
||||
field string hmdClass
|
||||
field string primaryWeaponClass
|
||||
field string primaryWeaponMagazineClass
|
||||
field string secondaryWeaponClass
|
||||
field string secondaryWeaponMagazineClass
|
||||
field string handgunWeaponClass
|
||||
field string handgunMagazineClass
|
||||
}
|
||||
@@ -59,7 +59,7 @@
|
||||
"name": "weather",
|
||||
"enabled": true,
|
||||
"serverOnly": true,
|
||||
"intervalMs": 300000,
|
||||
"intervalMs": 30000,
|
||||
"bucket": "mission_data",
|
||||
"measurement": "weather",
|
||||
"description": "SERVER POLL. Tracks the weather on the server. Always server-only. Runs at specified interval."
|
||||
@@ -82,23 +82,14 @@
|
||||
"measurement": "running_mission",
|
||||
"description": "SERVER POSTINIT, MPEnded. Tracks the name of the mission running on the server. Always server-only. Runs at the start (and tries at end) of the mission."
|
||||
},
|
||||
"playerStatus": {
|
||||
"name": "playerStatus",
|
||||
"soldierAmmo": {
|
||||
"name": "soldierAmmo",
|
||||
"enabled": true,
|
||||
"serverOnly": true,
|
||||
"intervalMs": 0,
|
||||
"bucket": "player_data",
|
||||
"measurement": "client_state",
|
||||
"description": "EH. Tracks players' clientstateNumber, adminState, and profileName on connect/disconnect to server and to mission, as well as when these values change."
|
||||
},
|
||||
"playerIdentity": {
|
||||
"name": "playerIdentity",
|
||||
"enabled": true,
|
||||
"serverOnly": true,
|
||||
"intervalMs": 0,
|
||||
"bucket": "player_data",
|
||||
"measurement": "player_identity",
|
||||
"description": "EH. Tracks players' identity on connect/disconnect to server and to mission, as well as when these values change."
|
||||
"intervalMs": 10000,
|
||||
"bucket": "soldier_ammo",
|
||||
"measurement": "soldier_ammo",
|
||||
"description": "SERVER POLL. Tracks the ammo count of all units by side. Polled on server at specified interval."
|
||||
},
|
||||
"CBAEventHandlers": {
|
||||
"milsimServerEfficiency": {
|
||||
|
||||
@@ -9,7 +9,6 @@ package main
|
||||
import "C" // This is required to import the C code
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
@@ -74,7 +73,7 @@ var CBAEventHandlerProperties []string = []string{
|
||||
"Description",
|
||||
}
|
||||
|
||||
type settingsJson struct {
|
||||
type SettingsJson struct {
|
||||
Influx struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
Host string `json:"host"`
|
||||
@@ -85,10 +84,10 @@ type settingsJson struct {
|
||||
RefreshRateMs int `json:"refreshRateMs"`
|
||||
Debug bool `json:"debug"`
|
||||
} `json:"arma3"`
|
||||
RecordingSettings map[string]interface{} `json:"recordingSettings"`
|
||||
RecordingSettings map[string]ServerPollSetting `json:"recordingSettings"`
|
||||
}
|
||||
|
||||
var activeSettings settingsJson
|
||||
var activeSettings SettingsJson
|
||||
|
||||
// InfluxDB variables
|
||||
var InfluxClient influxdb2.Client
|
||||
@@ -118,7 +117,7 @@ func init() {
|
||||
|
||||
func deinitExtension() {
|
||||
functionName := "deinitExtension"
|
||||
writeLog(functionName, `Deinitializing RangerMetrics extension"`, "INFO")
|
||||
writeLog(functionName, `Deinitializing RangerMetrics extension`, "INFO")
|
||||
|
||||
if InfluxClient != nil {
|
||||
InfluxClient.Close()
|
||||
@@ -161,21 +160,27 @@ func version() {
|
||||
// return db client and error
|
||||
func connectToInflux() (influxdb2.Client, error) {
|
||||
|
||||
loadSettings()
|
||||
|
||||
// create backup writer
|
||||
if BACKUP_WRITER == nil {
|
||||
writeLog("connectToInflux", `Creating backup file`, "INFO")
|
||||
file, err := os.Open(BACKUP_FILE_PATH)
|
||||
writeLog("connectToInflux", fmt.Sprintf(`Creating backup file: %s`, BACKUP_FILE_PATH), "INFO")
|
||||
// create if not exists
|
||||
file, err := os.OpenFile(BACKUP_FILE_PATH, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
||||
if err != nil {
|
||||
writeLog("connectToInflux", `Error opening backup file`, "ERROR")
|
||||
writeLog("connectToInflux", fmt.Sprintf(`Error opening backup file: %s`, err), "ERROR")
|
||||
}
|
||||
BACKUP_WRITER = gzip.NewWriter(file)
|
||||
if err != nil {
|
||||
writeLog("connectToInflux", `Error creating gzip writer`, "ERROR")
|
||||
writeLog("connectToInflux", fmt.Sprintf(`Error creating gzip writer: %s`, err), "ERROR")
|
||||
}
|
||||
}
|
||||
|
||||
if activeSettings.Influx.Host == "" ||
|
||||
activeSettings.Influx.Host == "http://host:8086" {
|
||||
activeSettings.Influx.Host == "http://INFLUX_URL:8086" {
|
||||
|
||||
writeLog("connectToInflux", `Influx connection settings not configured. Using local backup`, "INFO")
|
||||
writeLog("connectToInflux", fmt.Sprintf(`Influx connection settings: %v`, activeSettings), "DEBUG")
|
||||
|
||||
return nil, errors.New("influxConnectionSettings.Host is empty")
|
||||
// writeLog("connectToInflux", `["Creating backup file", "INFO"]`)
|
||||
@@ -192,8 +197,8 @@ func connectToInflux() (influxdb2.Client, error) {
|
||||
// return "Error connecting to Influx. Using local backup"
|
||||
}
|
||||
|
||||
if activeSettings.Influx.Enabled == false {
|
||||
return nil, errors.New("influxConnectionSettings.Enabled is false")
|
||||
if !activeSettings.Influx.Enabled {
|
||||
return nil, errors.New("influxdb.Enabled is false")
|
||||
}
|
||||
|
||||
InfluxClient := influxdb2.NewClientWithOptions(activeSettings.Influx.Host, activeSettings.Influx.Token, influxdb2.DefaultOptions().SetBatchSize(2500).SetFlushInterval(1000))
|
||||
@@ -220,7 +225,8 @@ func writeToInflux(a3DataRaw *[]string) string {
|
||||
InfluxClient, err = connectToInflux()
|
||||
if err != nil {
|
||||
InfluxClient = nil
|
||||
return fmt.Sprintf(`Error connecting to InfluxDB: %v`, err)
|
||||
// return fmt.Sprintf(`Error connecting to InfluxDB: %v`, err)
|
||||
// we dont want to return, because we have the backup log being written as a fallback
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,14 +307,13 @@ func getDir() string {
|
||||
return dir
|
||||
}
|
||||
|
||||
// return true if the program should continue
|
||||
func loadSettings() (settingsJson, error) {
|
||||
func loadSettings() (SettingsJson, error) {
|
||||
functionName := "loadSettings"
|
||||
writeLog(functionName, fmt.Sprintf(`ADDON_FOLDER: %s`, ADDON_FOLDER), "DEBUG")
|
||||
writeLog(functionName, fmt.Sprintf(`LOG_FILE: %s`, LOG_FILE), "DEBUG")
|
||||
writeLog(functionName, fmt.Sprintf(`SETTINGS_FILE: %s`, SETTINGS_FILE), "DEBUG")
|
||||
|
||||
settings := settingsJson{}
|
||||
settings := SettingsJson{}
|
||||
|
||||
// print the current working directory
|
||||
var file *os.File
|
||||
@@ -343,7 +348,7 @@ func loadSettings() (settingsJson, error) {
|
||||
// file exists
|
||||
writeLog(functionName, `settings.json found`, "DEBUG")
|
||||
// read the file
|
||||
file, err = os.Open(SETTINGS_FILE)
|
||||
file, err = os.OpenFile(SETTINGS_FILE, os.O_RDONLY, 0644)
|
||||
if err != nil {
|
||||
return settings, err
|
||||
}
|
||||
@@ -361,16 +366,28 @@ func loadSettings() (settingsJson, error) {
|
||||
return settings, err
|
||||
}
|
||||
|
||||
// compact the json
|
||||
var jsonStr bytes.Buffer
|
||||
err = json.Compact(&jsonStr, fileContents)
|
||||
// unmarshal the json to activeSettings
|
||||
err = json.Unmarshal(fileContents, &activeSettings)
|
||||
if err != nil {
|
||||
writeLog(functionName, fmt.Sprintf(`Error unmarshalling settings json: %s`, err), "ERROR")
|
||||
return settings, err
|
||||
}
|
||||
|
||||
// marshal the json
|
||||
var jsonStr []byte
|
||||
jsonStr, err = json.Marshal(activeSettings)
|
||||
if err != nil {
|
||||
writeLog(functionName, fmt.Sprintf(`Error marshalling settings json: %s`, err), "ERROR")
|
||||
return activeSettings, err
|
||||
}
|
||||
|
||||
// convert to string
|
||||
var jsonStrString string = string(jsonStr)
|
||||
|
||||
// send the contents to the log
|
||||
writeLog(
|
||||
"loadSettingsJSON",
|
||||
jsonStr.String(),
|
||||
jsonStrString,
|
||||
"DEBUG",
|
||||
)
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
build:
|
||||
export GOARCH="amd64"
|
||||
export CGO_ENABLED=1
|
||||
go build -o RangerMetrics_x64.so -buildmode=c-shared .
|
||||
|
||||
export GOARCH = "386"
|
||||
export CGO_ENABLED = 1
|
||||
go build -o RangerMetrics.dll -buildmode=c-shared .
|
||||
|
||||
export GOARCH = "amd64"
|
||||
export CGO_ENABLED = 1
|
||||
go build -o RangerMetrics_x64.dll -buildmode=c-shared .
|
||||
Reference in New Issue
Block a user