From 7a1d0be6d6bdeae224067a85526023955a2395d7 Mon Sep 17 00:00:00 2001 From: EagleTrooper Date: Mon, 15 Jan 2024 21:44:40 -0600 Subject: [PATCH 1/8] Update 'functions/server/fn_logPlayerInventory.sqf' Updated the fn_logPlayerInventory.sqf to do a check against a list of items that are "approved / rejected / restricted / and meme items in a players inventory --- functions/server/fn_logPlayerInventory.sqf | 249 ++++++++++++++++++++- 1 file changed, 242 insertions(+), 7 deletions(-) diff --git a/functions/server/fn_logPlayerInventory.sqf b/functions/server/fn_logPlayerInventory.sqf index c63f769..3cd2388 100644 --- a/functions/server/fn_logPlayerInventory.sqf +++ b/functions/server/fn_logPlayerInventory.sqf @@ -13,10 +13,222 @@ _items pushback hmd _player; _items pushback binocular _player; _items append primaryWeaponItems _player; -_noncompliant = []; _unlisted = []; +_restricted = []; +_blacklist = []; +_tabbed = []; +_meme = []; + { + + + _blackListItems = [ // Items that NO member is allowed to use. + "17BN_ANPVS14", // NVG AN/PVS-14 + "USP_PVS_14", // NVG AN/PVS-14 + "USP_PVS_15", // NVG AN/PVS-15 + "rhsusf_ANPVS_14", // NVG AN/PVS-14 + "ej_VPS15", // NVG AN/PVS-15 + "rhsusf_ANPVS_15", // NVG AN/PVS-15 + "ej_PVS15D", // NVG AN/PVS-15 + "UK3CB_M16_Carbine", // M16 Series + "UK3CB_M16A1", // M16 Series + "UK3CB_M16A1_LSW", // M16 Series + "UK3CB_M16A2", // M16 Series + "UK3CB_M16A2_UGL", // M16 Series + "UK3CB_M16A3", // M16 Series + "rhs_weap_m16a4", // M16 Series + "rhs_weap_m16a4_carryhandle", // M16 Series + "rhs_weap_m16a4_carryhandle_M203", // M16 Series + "rhs_weap_m16a4_imod", // M16 Series + "rhs_weap_m16a4_imod_M203", // M16 Series + "rhs_weap_m27iar", // M27 Series + "rhs_weap_m27iar_grip", // M27 Series + "UK3CB_G36_MLIC", // G36 Series + "UK3CB_G36_MLIC_K", // G36 Series + "UK3CB_G36_MLIC_C", // G36 Series + "UK3CB_G36_KSK_K", // G36 Series + "UK3CB_G36_KSK", // G36 Series + "UK3CB_G36A1", // G36 Series + "UK3CB_AG36A1", // G36 Series + "UK3CB_G36A1_K", // G36 Series + "UK3CB_G36A1_C", // G36 Series + "UK3CB_G36E1", // G36 Series + "UK3CB_AG36E1", // G36 Series + "UK3CB_G36E1_K", // G36 Series + "UK3CB_G36E1_C", // G36 Series + "UK3CB_AG36_MLIC", // G36 Series + "UK3CB_G36V", // G36 Series + "UK3CB_AG36V", // G36 Series + "UK3CB_G36_TAC", // G36 Series + "UK3CB_G36V_K", // G36 Series + "UK3CB_AG36_TAC_K", // G36 Series + "UK3CB_G36V_C", // G36 Series + "UK3CB_G36_TAC_C", // G36 Series + "UK3CB_G36_LSW", // G36 Series + "rhs_weap_g36kv", // G36 Series + "rhs_weap_g36kv_ag36", // G36 Series + "rhs_weap_g36c", // G36 Series + "Tier1_SIG_CMX_115_Virtus_300BLK", // MCX 300 Blackout + "Tier1_SIG_CMX_115_Virtus_300BLK_Black", // MCX 300 Blackout + "Tier1_SIG_CMX_115_Virtus_300BLK_Desert", // MCX 300 Blackout + "Tier1_SIG_CMX_115_Virtus_300BLK_FDE", // MCX 300 Blackout + "UK3CB_M14", // M14 Series + "UK3CB_M14_Railed", // M14 Series + "UK3CB_M14DMR", // M14 Series + "UK3CB_M14DMR_BLK", // M14 Series + "UK3CB_M14DMR_Railed", // M14 Series + "UK3CB_M14DMR_Railed_BLK", // M14 Series + "srifle_DMR_06_hunter_F", // M14 Series + "srifle_DMR_06_camo_F", // M14 Series + "srifle_DMR_06_olive_F", // M14 Series + "rhs_weap_m14", // M14 Series + "rhs_weap_m14_d", // M14 Series + "rhs_weap_m14_fiberglass", // M14 Series + "rhs_weap_m14_rail", // M14 Series + "rhs_weap_m14_rail_d", // M14 Series + "rhs_weap_m14_rail_fiberglass", // M14 Series + "rhs_weap_m14_rail_wd", // M14 Series + "rhs_weap_m14_ris", // M14 Series + "rhs_weap_m14_ris_d", // M14 Series + "rhs_weap_m14_ris_fiberglass", // M14 Series + "rhs_weap_m14_ris_wd", // M14 Series + "rhs_weap_m14_wd", // M14 Series + "rhs_weap_m14_weap_m14ebrri", // M14 Series + "rhs_weap_m14_socom", // M14 Series + "rhs_weap_m14_socom_rail", // M14 Series + "srifle_EBR_F", // Mk14 Series + "UK3CB_FNFAL_OSW", // FN_FAL Series + "UK3CB_FNFAL_OSW_GL", // FN_FAL Series + "UK3CB_FNFAL_FULL", // FN_FAL Series + "UK3CB_FNFAL_FULL_RAILS", // FN_FAL Series + "UK3CB_FNFAL_FOREGRIP", // FN_FAL Series + "UK3CB_FNFAL_PARA", // FN_FAL Series + "UK3CB_FNFAL_PARA_RAILS", // FN_FAL Series + "UK3CB_FNFAL_STG58", // FN_FAL Series + "SMA_ACRREM", //Remington ACR 556+6.5 + "SMA_ACRREMAFGCQB", //Remington ACR 556+6.5 + "SMA_ACRREMAFG", //Remington ACR 556+6.5 + "SMA_ACRREMMOECQB", //Remington ACR 556+6.5 + "SMA_ACRREMMOE", //Remington ACR 556+6.5 + "SMA_ACRREMblk", //Remington ACR 556+6.5 + "SMA_ACRREMAFGCQBblk", //Remington ACR 556+6.5 + "SMA_ACRREMAFGblk", //Remington ACR 556+6.5 + "SMA_ACRREMMOECQBblk", //Remington ACR 556+6.5 + "SMA_ACRREMMOEblk", //Remington ACR 556+6.5 + "SMA_ACRREMGL_B", //Remington ACR 556+6.5 + "SMA_ACRREMCQBGL", //Remington ACR 556+6.5 + "SMA_ACRREMGL", //Remington ACR 556+6.5 + "LMG_Mk200_F", //Mk200 Series + "LMG_Mk200_black_F" //Mk200 Series + ] + + _restrictedItems = [ // Items that are allowed for Specific USE Case (RRC / Marksman / etc.) + "A3_GPNVG18b_REC_TI", // Thermal Quad + "A3_GPNVG18_REC_TI", // Thermal Quad + "A3_GPNVG18b_TI", // Thermal Quad + "A3_GPNVG18_TI", // Thermal Quad + "A3_GPNVG18b_REC_BLK_TI", // Thermal Quad + "A3_GPNVG18_REC_BLK_TI", // Thermal Quad + "A3_GPNVG18b_BLK_TI", // Thermal Quad + "A3_GPNVG18_BLK_TI", // Thermal Quad + "NVGogglesB_gry_F", // ENVG + "NVGogglesB_grn_F", // ENVG + "NVGogglesB_blk_F", // ENVG + "optic_Nightstalker", // Thermal Optic + "rhsusf_acc_anpas13gv1", // Thermal Optic + "Tier1_ANPVS10_Tan", // Thermal Optic + "rhsusf_acc_anpvs27", // Thermal Optic + "optic_tws_mg", // Thermal Optic + "optic_tws", // Thermal Optic + "Tier1_ATACR18_ADM_Black", //Nightforce Series Optic + "Tier1_ATACR18_ADM_Desert", //Nightforce Series Optic + "Tier1_ATACR18_ADM_Desert_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_ADM_Black_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_ADM_T1_Black", //Nightforce Series Optic + "Tier1_ATACR18_ADM_T1_Desert", //Nightforce Series Optic + "Tier1_ATACR18_ADM_T1_Black_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_ADM_T1_Desert_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Black", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Desert", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Black_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Desert_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Docter_Black", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Docter_Desert", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Docter_Black_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Docter_Desert_Vanilla", //Nightforce Series Optic + "optic_lrps", //Nightforce Series Optic + "optic_lrps_ghex_F", //Nightforce Series Optic + "optic_lrps_tna_F", //Nightforce Series Optic + "ACE_optic_LRPS_2D", //Nightforce Series Optic + "ACE_optic_LRPS_PIP" //Nightforce Series Optic + ]; + + _tabbedItems = [ // Items that are allowed for individuals with Ranger Tab + "arifle_SPAR_03_snd_F", // HK417 Series + "arifle_SPAR_03_blk_F", // HK417 Series + "arifle_SPAR_03_khk_F", // HK417 Series + "SMA_HK417", // HK417 Series + "SMA_HK417vfg", // HK417 Series + "SMA_HK417_16in", // HK417 Series + "rhs_weap_SCARH_CQC", // Scar H Series + "rhs_weap_SCARH_FDE_CQC", // Scar H Series + "rhs_weap_SCARH_FDE_LB", // Scar H Series + "rhs_weap_SCARH_LB", // Scar H Series + "rhs_weap_SCARH_FDE_STD", // Scar H Series + "rhs_weap_SCARH_STD", // Scar H Series + "rhs_weap_SCARH_USA_CQC", // Scar H Series + "rhs_weap_SCARH_USA_LB", // Scar H Series + "rhs_weap_SCARH_USA_STD", // Scar H Series + "SMA_Mk17", // Scar H Series + "SMA_Mk17_black", // Scar H Series + "SMA_Mk17_green", // Scar H Series + "SMA_Mk17_EGML", // Scar H Series + "SMA_Mk17_EGML_black", // Scar H Series + "SMA_Mk17_EGML_green", // Scar H Series + "SMA_Mk17_16", // Scar H Series + "SMA_Mk17_16_black", // Scar H Series + "SMA_Mk17_16_green", // Scar H Series + "Tier1_SR25", // SR-25 Series + "Tier1_SR25_tan", // SR-25 Series + "Tier1_SR25_ec", // SR-25 Series + "Tier1_SR25_ec_tan", // SR-25 Series + "arifle_MXC_F", // MXC Series + "arifle_MXC_black_F", // MXC Series + "arifle_MXC_khk_F", // MXC Series + "arifle_MXM_F", // MXM Series + "arifle_MXM_black_F", // MXM Series + "arifle_MXM_khk_F", // MXM Series + "arifle_MX_F", // MX Series + "arifle_MX_black_F", // MX Series + "arifle_MX_khk_F", // MX Series + "arifle_MX_GL_F", // MX 3GL Series + "arifle_MX_GL_black_F", // MX 3GL Series + "arifle_MX_GL_khk_F", // MX 3GL Series + "arifle_MX_SW_F", // MX LSW Series + "arifle_MX_SW_black_F", // MX LSW Series + "arifle_MX_SW_khk_F", // MX LSW Series + "Tier1_MK48_Mod0", // Mk48 Series + "Tier1_MK48_Mod0_Desert", // Mk48 Series + "Tier1_MK48_Mod0_Para", // Mk48 Series + "Tier1_MK48_Mod0_Para_Desert", // Mk48 Series + "Tier1_MK48_Mod1", // Mk48 Series + "Tier1_MK48_Mod1_Desert" // Mk48 Series + ] + + _memeItems = [ // Items that serve no purpose other than to MEME + "UK3CB_Cocaine_Brick", + "ACE_Banana" + ] + + + + + + + + + _item = _x; _modes = getArray(configfile >> "CfgWeapons" >> _item >> "visionMode"); @@ -26,10 +238,21 @@ _unlisted = []; _modes append getArray( _x >> "visionMode" ); } forEach _subModes; - _restrictedItemList = ["A3_GPNVG18b_REC_TI","A3_GPNVG18_REC_TI","A3_GPNVG18b_TI","A3_GPNVG18_TI","A3_GPNVG18b_REC_BLK_TI","A3_GPNVG18_REC_BLK_TI","A3_GPNVG18b_BLK_TI","A3_GPNVG18_BLK_TI","NVGogglesB_gry_F","NVGogglesB_grn_F","NVGogglesB_blk_F","optic_Nightstalker","rhsusf_acc_anpas13gv1","Tier1_ANPVS10_Tan","rhsusf_acc_anpvs27","optic_tws_mg","optic_tws"]; - if ( _x in _restrictedItemList ) then { - _noncompliant pushBackUnique _item; + if ( _item in _blackListItems ) then { + _blacklist pushBackUnique _item; + }; + + if ( _item in _restrictedItems ) then { + _restrcited pushBackUnique _item; + }; + + if ( _item in _tabbedItems ) then { + _tabbed pushBackUnique _item; + }; + + if ( _item in _memeItems ) then { + _meme pushBackUnique _item; }; if ((count _modes) isNotEqualTo 0) then { @@ -41,16 +264,28 @@ _unlisted = []; } forEach _items; +{ + diag_log text format["[MILSIM] (logPlayerInventory): %1 has a blacklisted inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; +} forEach _blacklist; + { diag_log text format["[MILSIM] (logPlayerInventory): %1 has a restricted inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; -} forEach _noncompliant; +} forEach _restrcited; + +{ + diag_log text format["[MILSIM] (logPlayerInventory): %1 has a tabbed inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; +} forEach _tabbed; + +{ + diag_log text format["[MILSIM] (logPlayerInventory): %1 has a meme inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; +} forEach _meme; { diag_log text format["[MILSIM] (logPlayerInventory): %1 has an unlisted thermal item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; } forEach _unlisted; -if (((count _noncompliant) isEqualTo 0) && ((count _unlisted) isEqualTo 0)) then { - diag_log text format["[MILSIM] (logPlayerInventory): %1 inventory in compliance", name _player]; +if (((count _blacklist) isEqualTo 0) && ((count _restrcited) isEqualTo 0) && ((count _tabbed) isEqualTo 0) && ((count _meme) isEqualTo 0) && ((count _unlisted) isEqualTo 0)) then { + diag_log text format["[MILSIM] (logPlayerInventory): %1 inventory in fully base inventory compliant.", name _player]; }; nil \ No newline at end of file From 6eb598b6604db9178529c0c98dd2cae412a8b007 Mon Sep 17 00:00:00 2001 From: EagleTrooper Date: Tue, 16 Jan 2024 22:48:36 -0600 Subject: [PATCH 2/8] Update fn_logPlayerInventory.sqf Expanded the items arrays to check not only internal inventory items but primary slot inventory items. --- functions/server/fn_logPlayerInventory.sqf | 110 +++++++++++---------- 1 file changed, 60 insertions(+), 50 deletions(-) diff --git a/functions/server/fn_logPlayerInventory.sqf b/functions/server/fn_logPlayerInventory.sqf index 3cd2388..38d4d03 100644 --- a/functions/server/fn_logPlayerInventory.sqf +++ b/functions/server/fn_logPlayerInventory.sqf @@ -5,13 +5,22 @@ params [ if (!isPlayer _player) exitWith { diag_log("exitWith logPlayerInventory")}; -_items = []; +_items = []; +_ietms pushback headgear _player; +_items pushback uniform _player; _items append uniformItems _player; -_items append vestItems _player; -_items append backpackItems _player; -_items pushback hmd _player; -_items pushback binocular _player; -_items append primaryWeaponItems _player; +_items pushback vest _player; +_items append vestItems _player; +_items pushback backpack _player; +_items append backpackItems _player; +_items pushback hmd _player; +_items pushback binocular _player; +_items pushback primaryWeapon _player; +_items append primaryWeaponItems _player; +_items pushback secondaryWeapon _player; +_items append secondaryWeaponItems _player; + + _unlisted = []; @@ -20,8 +29,9 @@ _blacklist = []; _tabbed = []; _meme = []; -{ +diag_log text format["[MILSIM] (logPlayerInventory): Checking %1 inventory.", name _player]; +{ _blackListItems = [ // Items that NO member is allowed to use. "17BN_ANPVS14", // NVG AN/PVS-14 @@ -229,63 +239,63 @@ _meme = []; - _item = _x; - _modes = getArray(configfile >> "CfgWeapons" >> _item >> "visionMode"); + _item = _x; + _modes = getArray(configfile >> "CfgWeapons" >> _item >> "visionMode"); - _subModes = [configfile >> "CfgWeapons" >> _item >> "ItemInfo" >> "OpticsModes", 1] call BIS_fnc_returnChildren; - - { - _modes append getArray( _x >> "visionMode" ); - } forEach _subModes; + _subModes = [configfile >> "CfgWeapons" >> _item >> "ItemInfo" >> "OpticsModes", 1] call BIS_fnc_returnChildren; + + { + _modes append getArray( _x >> "visionMode" ); + } forEach _subModes; - if ( _item in _blackListItems ) then { - _blacklist pushBackUnique _item; - }; + if ( _item in _blackListItems ) then { + _blacklist pushBackUnique _item; + }; - if ( _item in _restrictedItems ) then { - _restrcited pushBackUnique _item; - }; + if ( _item in _restrictedItems ) then { + _restrcited pushBackUnique _item; + }; - if ( _item in _tabbedItems ) then { - _tabbed pushBackUnique _item; - }; + if ( _item in _tabbedItems ) then { + _tabbed pushBackUnique _item; + }; - if ( _item in _memeItems ) then { - _meme pushBackUnique _item; - }; - - if ((count _modes) isNotEqualTo 0) then { - _modes = _modes apply { toLower _x }; - if ( "ti" in _modes ) then { - _unlisted pushBackUnique _item; - }; - }; + if ( _item in _memeItems ) then { + _meme pushBackUnique _item; + }; + + if ((count _modes) isNotEqualTo 0) then { + _modes = _modes apply { toLower _x }; + if ( "ti" in _modes ) then { + _unlisted pushBackUnique _item; + }; + }; } forEach _items; -{ - diag_log text format["[MILSIM] (logPlayerInventory): %1 has a blacklisted inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; -} forEach _blacklist; +{ + diag_log text format["[MILSIM] (logPlayerInventory): %1 has a blacklisted inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; +} forEach _blacklist; -{ - diag_log text format["[MILSIM] (logPlayerInventory): %1 has a restricted inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; -} forEach _restrcited; +{ + diag_log text format["[MILSIM] (logPlayerInventory): %1 has a restricted inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; +} forEach _restrcited; -{ - diag_log text format["[MILSIM] (logPlayerInventory): %1 has a tabbed inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; -} forEach _tabbed; +{ + diag_log text format["[MILSIM] (logPlayerInventory): %1 has a tabbed inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; +} forEach _tabbed; -{ - diag_log text format["[MILSIM] (logPlayerInventory): %1 has a meme inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; -} forEach _meme; +{ + diag_log text format["[MILSIM] (logPlayerInventory): %1 has a meme inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; +} forEach _meme; -{ - diag_log text format["[MILSIM] (logPlayerInventory): %1 has an unlisted thermal item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; -} forEach _unlisted; +{ + diag_log text format["[MILSIM] (logPlayerInventory): %1 has an unlisted thermal item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; +} forEach _unlisted; -if (((count _blacklist) isEqualTo 0) && ((count _restrcited) isEqualTo 0) && ((count _tabbed) isEqualTo 0) && ((count _meme) isEqualTo 0) && ((count _unlisted) isEqualTo 0)) then { +if (((count _blacklist) isEqualTo 0) && ((count _restrcited) isEqualTo 0) && ((count _tabbed) isEqualTo 0) && ((count _meme) isEqualTo 0) && ((count _unlisted) isEqualTo 0)) then { diag_log text format["[MILSIM] (logPlayerInventory): %1 inventory in fully base inventory compliant.", name _player]; -}; +} nil \ No newline at end of file From 49fb1bb7fa91f34f30a5c79171aaf91f04031ab8 Mon Sep 17 00:00:00 2001 From: IndigoFox Date: Sun, 28 Jan 2024 22:44:49 -0800 Subject: [PATCH 3/8] fixes '_restricted' var references, uses find to identify if any non0 --- functions/server/fn_logPlayerInventory.sqf | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/functions/server/fn_logPlayerInventory.sqf b/functions/server/fn_logPlayerInventory.sqf index 38d4d03..31e874d 100644 --- a/functions/server/fn_logPlayerInventory.sqf +++ b/functions/server/fn_logPlayerInventory.sqf @@ -131,7 +131,7 @@ diag_log text format["[MILSIM] (logPlayerInventory): Checking %1 inventory.", na "SMA_ACRREMGL", //Remington ACR 556+6.5 "LMG_Mk200_F", //Mk200 Series "LMG_Mk200_black_F" //Mk200 Series - ] + ]; _restrictedItems = [ // Items that are allowed for Specific USE Case (RRC / Marksman / etc.) "A3_GPNVG18b_REC_TI", // Thermal Quad @@ -224,12 +224,12 @@ diag_log text format["[MILSIM] (logPlayerInventory): Checking %1 inventory.", na "Tier1_MK48_Mod0_Para_Desert", // Mk48 Series "Tier1_MK48_Mod1", // Mk48 Series "Tier1_MK48_Mod1_Desert" // Mk48 Series - ] + ]; _memeItems = [ // Items that serve no purpose other than to MEME "UK3CB_Cocaine_Brick", "ACE_Banana" - ] + ]; @@ -254,7 +254,7 @@ diag_log text format["[MILSIM] (logPlayerInventory): Checking %1 inventory.", na }; if ( _item in _restrictedItems ) then { - _restrcited pushBackUnique _item; + _restricted pushBackUnique _item; }; if ( _item in _tabbedItems ) then { @@ -280,7 +280,7 @@ diag_log text format["[MILSIM] (logPlayerInventory): Checking %1 inventory.", na { diag_log text format["[MILSIM] (logPlayerInventory): %1 has a restricted inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; -} forEach _restrcited; +} forEach _restricted; { diag_log text format["[MILSIM] (logPlayerInventory): %1 has a tabbed inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; @@ -294,8 +294,12 @@ diag_log text format["[MILSIM] (logPlayerInventory): Checking %1 inventory.", na diag_log text format["[MILSIM] (logPlayerInventory): %1 has an unlisted thermal item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; } forEach _unlisted; -if (((count _blacklist) isEqualTo 0) && ((count _restrcited) isEqualTo 0) && ((count _tabbed) isEqualTo 0) && ((count _meme) isEqualTo 0) && ((count _unlisted) isEqualTo 0)) then { +if ( + [_blacklist, _restricted, _tabbed, _meme, _unlisted] find { + count _x > 0 + } isEqualTo -1 +) then { diag_log text format["[MILSIM] (logPlayerInventory): %1 inventory in fully base inventory compliant.", name _player]; -} +}; nil \ No newline at end of file From 93204f7d36d9273a7ca0e76de2417ec3653f0573 Mon Sep 17 00:00:00 2001 From: IndigoFox Date: Mon, 29 Jan 2024 10:18:01 -0800 Subject: [PATCH 4/8] rework for structured logging and improvements --- functions/server/fn_logPlayerInventory.sqf | 575 +++++++++++---------- 1 file changed, 307 insertions(+), 268 deletions(-) diff --git a/functions/server/fn_logPlayerInventory.sqf b/functions/server/fn_logPlayerInventory.sqf index 31e874d..dbbb114 100644 --- a/functions/server/fn_logPlayerInventory.sqf +++ b/functions/server/fn_logPlayerInventory.sqf @@ -5,23 +5,207 @@ params [ if (!isPlayer _player) exitWith { diag_log("exitWith logPlayerInventory")}; -_items = []; -_ietms pushback headgear _player; -_items pushback uniform _player; -_items append uniformItems _player; -_items pushback vest _player; -_items append vestItems _player; -_items pushback backpack _player; -_items append backpackItems _player; -_items pushback hmd _player; -_items pushback binocular _player; -_items pushback primaryWeapon _player; -_items append primaryWeaponItems _player; -_items pushback secondaryWeapon _player; -_items append secondaryWeaponItems _player; - +// DEFINITIONS +_blackListItems = [ // Items that NO member is allowed to use. + "17BN_ANPVS14", // NVG AN/PVS-14 + "USP_PVS_14", // NVG AN/PVS-14 + "USP_PVS_15", // NVG AN/PVS-15 + "rhsusf_ANPVS_14", // NVG AN/PVS-14 + "ej_VPS15", // NVG AN/PVS-15 + "rhsusf_ANPVS_15", // NVG AN/PVS-15 + "ej_PVS15D", // NVG AN/PVS-15 + "UK3CB_M16_Carbine", // M16 Series + "UK3CB_M16A1", // M16 Series + "UK3CB_M16A1_LSW", // M16 Series + "UK3CB_M16A2", // M16 Series + "UK3CB_M16A2_UGL", // M16 Series + "UK3CB_M16A3", // M16 Series + "rhs_weap_m16a4", // M16 Series + "rhs_weap_m16a4_carryhandle", // M16 Series + "rhs_weap_m16a4_carryhandle_M203", // M16 Series + "rhs_weap_m16a4_imod", // M16 Series + "rhs_weap_m16a4_imod_M203", // M16 Series + "rhs_weap_m27iar", // M27 Series + "rhs_weap_m27iar_grip", // M27 Series + "UK3CB_G36_MLIC", // G36 Series + "UK3CB_G36_MLIC_K", // G36 Series + "UK3CB_G36_MLIC_C", // G36 Series + "UK3CB_G36_KSK_K", // G36 Series + "UK3CB_G36_KSK", // G36 Series + "UK3CB_G36A1", // G36 Series + "UK3CB_AG36A1", // G36 Series + "UK3CB_G36A1_K", // G36 Series + "UK3CB_G36A1_C", // G36 Series + "UK3CB_G36E1", // G36 Series + "UK3CB_AG36E1", // G36 Series + "UK3CB_G36E1_K", // G36 Series + "UK3CB_G36E1_C", // G36 Series + "UK3CB_AG36_MLIC", // G36 Series + "UK3CB_G36V", // G36 Series + "UK3CB_AG36V", // G36 Series + "UK3CB_G36_TAC", // G36 Series + "UK3CB_G36V_K", // G36 Series + "UK3CB_AG36_TAC_K", // G36 Series + "UK3CB_G36V_C", // G36 Series + "UK3CB_G36_TAC_C", // G36 Series + "UK3CB_G36_LSW", // G36 Series + "rhs_weap_g36kv", // G36 Series + "rhs_weap_g36kv_ag36", // G36 Series + "rhs_weap_g36c", // G36 Series + "Tier1_SIG_CMX_115_Virtus_300BLK", // MCX 300 Blackout + "Tier1_SIG_CMX_115_Virtus_300BLK_Black", // MCX 300 Blackout + "Tier1_SIG_CMX_115_Virtus_300BLK_Desert", // MCX 300 Blackout + "Tier1_SIG_CMX_115_Virtus_300BLK_FDE", // MCX 300 Blackout + "UK3CB_M14", // M14 Series + "UK3CB_M14_Railed", // M14 Series + "UK3CB_M14DMR", // M14 Series + "UK3CB_M14DMR_BLK", // M14 Series + "UK3CB_M14DMR_Railed", // M14 Series + "UK3CB_M14DMR_Railed_BLK", // M14 Series + "srifle_DMR_06_hunter_F", // M14 Series + "srifle_DMR_06_camo_F", // M14 Series + "srifle_DMR_06_olive_F", // M14 Series + "rhs_weap_m14", // M14 Series + "rhs_weap_m14_d", // M14 Series + "rhs_weap_m14_fiberglass", // M14 Series + "rhs_weap_m14_rail", // M14 Series + "rhs_weap_m14_rail_d", // M14 Series + "rhs_weap_m14_rail_fiberglass", // M14 Series + "rhs_weap_m14_rail_wd", // M14 Series + "rhs_weap_m14_ris", // M14 Series + "rhs_weap_m14_ris_d", // M14 Series + "rhs_weap_m14_ris_fiberglass", // M14 Series + "rhs_weap_m14_ris_wd", // M14 Series + "rhs_weap_m14_wd", // M14 Series + "rhs_weap_m14_weap_m14ebrri", // M14 Series + "rhs_weap_m14_socom", // M14 Series + "rhs_weap_m14_socom_rail", // M14 Series + "srifle_EBR_F", // Mk14 Series + "UK3CB_FNFAL_OSW", // FN_FAL Series + "UK3CB_FNFAL_OSW_GL", // FN_FAL Series + "UK3CB_FNFAL_FULL", // FN_FAL Series + "UK3CB_FNFAL_FULL_RAILS", // FN_FAL Series + "UK3CB_FNFAL_FOREGRIP", // FN_FAL Series + "UK3CB_FNFAL_PARA", // FN_FAL Series + "UK3CB_FNFAL_PARA_RAILS", // FN_FAL Series + "UK3CB_FNFAL_STG58", // FN_FAL Series + "SMA_ACRREM", //Remington ACR 556+6.5 + "SMA_ACRREMAFGCQB", //Remington ACR 556+6.5 + "SMA_ACRREMAFG", //Remington ACR 556+6.5 + "SMA_ACRREMMOECQB", //Remington ACR 556+6.5 + "SMA_ACRREMMOE", //Remington ACR 556+6.5 + "SMA_ACRREMblk", //Remington ACR 556+6.5 + "SMA_ACRREMAFGCQBblk", //Remington ACR 556+6.5 + "SMA_ACRREMAFGblk", //Remington ACR 556+6.5 + "SMA_ACRREMMOECQBblk", //Remington ACR 556+6.5 + "SMA_ACRREMMOEblk", //Remington ACR 556+6.5 + "SMA_ACRREMGL_B", //Remington ACR 556+6.5 + "SMA_ACRREMCQBGL", //Remington ACR 556+6.5 + "SMA_ACRREMGL", //Remington ACR 556+6.5 + "LMG_Mk200_F", //Mk200 Series + "LMG_Mk200_black_F" //Mk200 Series +]; + +_restrictedItems = [ // Items that are allowed for Specific USE Case (RRC / Marksman / etc.) + "A3_GPNVG18b_REC_TI", // Thermal Quad + "A3_GPNVG18_REC_TI", // Thermal Quad + "A3_GPNVG18b_TI", // Thermal Quad + "A3_GPNVG18_TI", // Thermal Quad + "A3_GPNVG18b_REC_BLK_TI", // Thermal Quad + "A3_GPNVG18_REC_BLK_TI", // Thermal Quad + "A3_GPNVG18b_BLK_TI", // Thermal Quad + "A3_GPNVG18_BLK_TI", // Thermal Quad + "NVGogglesB_gry_F", // ENVG + "NVGogglesB_grn_F", // ENVG + "NVGogglesB_blk_F", // ENVG + "optic_Nightstalker", // Thermal Optic + "rhsusf_acc_anpas13gv1", // Thermal Optic + "Tier1_ANPVS10_Tan", // Thermal Optic + "rhsusf_acc_anpvs27", // Thermal Optic + "optic_tws_mg", // Thermal Optic + "optic_tws", // Thermal Optic + "Tier1_ATACR18_ADM_Black", //Nightforce Series Optic + "Tier1_ATACR18_ADM_Desert", //Nightforce Series Optic + "Tier1_ATACR18_ADM_Desert_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_ADM_Black_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_ADM_T1_Black", //Nightforce Series Optic + "Tier1_ATACR18_ADM_T1_Desert", //Nightforce Series Optic + "Tier1_ATACR18_ADM_T1_Black_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_ADM_T1_Desert_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Black", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Desert", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Black_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Desert_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Docter_Black", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Docter_Desert", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Docter_Black_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Docter_Desert_Vanilla", //Nightforce Series Optic + "optic_lrps", //Nightforce Series Optic + "optic_lrps_ghex_F", //Nightforce Series Optic + "optic_lrps_tna_F", //Nightforce Series Optic + "ACE_optic_LRPS_2D", //Nightforce Series Optic + "ACE_optic_LRPS_PIP" //Nightforce Series Optic +]; + +_tabbedItems = [ // Items that are allowed for individuals with Ranger Tab + "arifle_SPAR_03_snd_F", // HK417 Series + "arifle_SPAR_03_blk_F", // HK417 Series + "arifle_SPAR_03_khk_F", // HK417 Series + "SMA_HK417", // HK417 Series + "SMA_HK417vfg", // HK417 Series + "SMA_HK417_16in", // HK417 Series + "rhs_weap_SCARH_CQC", // Scar H Series + "rhs_weap_SCARH_FDE_CQC", // Scar H Series + "rhs_weap_SCARH_FDE_LB", // Scar H Series + "rhs_weap_SCARH_LB", // Scar H Series + "rhs_weap_SCARH_FDE_STD", // Scar H Series + "rhs_weap_SCARH_STD", // Scar H Series + "rhs_weap_SCARH_USA_CQC", // Scar H Series + "rhs_weap_SCARH_USA_LB", // Scar H Series + "rhs_weap_SCARH_USA_STD", // Scar H Series + "SMA_Mk17", // Scar H Series + "SMA_Mk17_black", // Scar H Series + "SMA_Mk17_green", // Scar H Series + "SMA_Mk17_EGML", // Scar H Series + "SMA_Mk17_EGML_black", // Scar H Series + "SMA_Mk17_EGML_green", // Scar H Series + "SMA_Mk17_16", // Scar H Series + "SMA_Mk17_16_black", // Scar H Series + "SMA_Mk17_16_green", // Scar H Series + "Tier1_SR25", // SR-25 Series + "Tier1_SR25_tan", // SR-25 Series + "Tier1_SR25_ec", // SR-25 Series + "Tier1_SR25_ec_tan", // SR-25 Series + "arifle_MXC_F", // MXC Series + "arifle_MXC_black_F", // MXC Series + "arifle_MXC_khk_F", // MXC Series + "arifle_MXM_F", // MXM Series + "arifle_MXM_black_F", // MXM Series + "arifle_MXM_khk_F", // MXM Series + "arifle_MX_F", // MX Series + "arifle_MX_black_F", // MX Series + "arifle_MX_khk_F", // MX Series + "arifle_MX_GL_F", // MX 3GL Series + "arifle_MX_GL_black_F", // MX 3GL Series + "arifle_MX_GL_khk_F", // MX 3GL Series + "arifle_MX_SW_F", // MX LSW Series + "arifle_MX_SW_black_F", // MX LSW Series + "arifle_MX_SW_khk_F", // MX LSW Series + "Tier1_MK48_Mod0", // Mk48 Series + "Tier1_MK48_Mod0_Desert", // Mk48 Series + "Tier1_MK48_Mod0_Para", // Mk48 Series + "Tier1_MK48_Mod0_Para_Desert", // Mk48 Series + "Tier1_MK48_Mod1", // Mk48 Series + "Tier1_MK48_Mod1_Desert" // Mk48 Series +]; + +_memeItems = [ // Items that serve no purpose other than to MEME + "UK3CB_Cocaine_Brick", + "ACE_Banana" +]; +// INSTANTIATE VARS _unlisted = []; _restricted = []; @@ -29,277 +213,132 @@ _blacklist = []; _tabbed = []; _meme = []; -diag_log text format["[MILSIM] (logPlayerInventory): Checking %1 inventory.", name _player]; +private _nonCompliantItemsCount = 0; + +// PRIVATE FUNCTIONS +private _logItem = { + params ["_playerObj", "_categoryText", "_itemClassName"]; + private _cfg = _itemClassName call CBA_fnc_getItemConfig; + diag_log text format[ + "[MILSIM] (logPlayerInventory): Found %1 :: className=""%2"" displayName=""%3"" %4", + _categoryText, + _itemClassName, + [_cfg] call BIS_fnc_displayName, + [_playerObj] call _playerInfoString + ]; +}; + +private _playerInfoString = { + params ["_playerObj"]; + format["playerName=""%1"" playerUID=""%2"" playerGroup=""%3""", name _playerObj, getPlayerUID _playerObj, groupId (group _playerObj)]; +}; + + +// GATHER INVENTORY +// _items = []; +// _items pushback headgear _player; +// _items pushback uniform _player; +// _items append uniformItems _player; +// _items pushback vest _player; +// _items append vestItems _player; +// _items pushback backpack _player; +// _items append backpackItems _player; +// _items pushback hmd _player; +// _items pushback binocular _player; +// _items pushback primaryWeapon _player; +// _items append primaryWeaponItems _player; +// _items pushback secondaryWeapon _player; +// _items append secondaryWeaponItems _player; + +_items = [ + _player, // Unit + true, // Include weapons, attachments, loaded magazines + true, // Include items in backpack + true, // Include items in vest + true, // Include items in uniform + true, // Include assigned items + true // Include not loaded magazines +] call CBA_fnc_uniqueUnitItems; + +_items pushBack (headgear _player); +_items pushBack (uniform _player); + +// CHECK INVENTORY +diag_log text format[ + "[MILSIM] (logPlayerInventory): Checking inventory :: %1", + [_player] call _playerInfoString +]; { + _item = _x; + _modes = getArray(configfile >> "CfgWeapons" >> _item >> "visionMode"); - _blackListItems = [ // Items that NO member is allowed to use. - "17BN_ANPVS14", // NVG AN/PVS-14 - "USP_PVS_14", // NVG AN/PVS-14 - "USP_PVS_15", // NVG AN/PVS-15 - "rhsusf_ANPVS_14", // NVG AN/PVS-14 - "ej_VPS15", // NVG AN/PVS-15 - "rhsusf_ANPVS_15", // NVG AN/PVS-15 - "ej_PVS15D", // NVG AN/PVS-15 - "UK3CB_M16_Carbine", // M16 Series - "UK3CB_M16A1", // M16 Series - "UK3CB_M16A1_LSW", // M16 Series - "UK3CB_M16A2", // M16 Series - "UK3CB_M16A2_UGL", // M16 Series - "UK3CB_M16A3", // M16 Series - "rhs_weap_m16a4", // M16 Series - "rhs_weap_m16a4_carryhandle", // M16 Series - "rhs_weap_m16a4_carryhandle_M203", // M16 Series - "rhs_weap_m16a4_imod", // M16 Series - "rhs_weap_m16a4_imod_M203", // M16 Series - "rhs_weap_m27iar", // M27 Series - "rhs_weap_m27iar_grip", // M27 Series - "UK3CB_G36_MLIC", // G36 Series - "UK3CB_G36_MLIC_K", // G36 Series - "UK3CB_G36_MLIC_C", // G36 Series - "UK3CB_G36_KSK_K", // G36 Series - "UK3CB_G36_KSK", // G36 Series - "UK3CB_G36A1", // G36 Series - "UK3CB_AG36A1", // G36 Series - "UK3CB_G36A1_K", // G36 Series - "UK3CB_G36A1_C", // G36 Series - "UK3CB_G36E1", // G36 Series - "UK3CB_AG36E1", // G36 Series - "UK3CB_G36E1_K", // G36 Series - "UK3CB_G36E1_C", // G36 Series - "UK3CB_AG36_MLIC", // G36 Series - "UK3CB_G36V", // G36 Series - "UK3CB_AG36V", // G36 Series - "UK3CB_G36_TAC", // G36 Series - "UK3CB_G36V_K", // G36 Series - "UK3CB_AG36_TAC_K", // G36 Series - "UK3CB_G36V_C", // G36 Series - "UK3CB_G36_TAC_C", // G36 Series - "UK3CB_G36_LSW", // G36 Series - "rhs_weap_g36kv", // G36 Series - "rhs_weap_g36kv_ag36", // G36 Series - "rhs_weap_g36c", // G36 Series - "Tier1_SIG_CMX_115_Virtus_300BLK", // MCX 300 Blackout - "Tier1_SIG_CMX_115_Virtus_300BLK_Black", // MCX 300 Blackout - "Tier1_SIG_CMX_115_Virtus_300BLK_Desert", // MCX 300 Blackout - "Tier1_SIG_CMX_115_Virtus_300BLK_FDE", // MCX 300 Blackout - "UK3CB_M14", // M14 Series - "UK3CB_M14_Railed", // M14 Series - "UK3CB_M14DMR", // M14 Series - "UK3CB_M14DMR_BLK", // M14 Series - "UK3CB_M14DMR_Railed", // M14 Series - "UK3CB_M14DMR_Railed_BLK", // M14 Series - "srifle_DMR_06_hunter_F", // M14 Series - "srifle_DMR_06_camo_F", // M14 Series - "srifle_DMR_06_olive_F", // M14 Series - "rhs_weap_m14", // M14 Series - "rhs_weap_m14_d", // M14 Series - "rhs_weap_m14_fiberglass", // M14 Series - "rhs_weap_m14_rail", // M14 Series - "rhs_weap_m14_rail_d", // M14 Series - "rhs_weap_m14_rail_fiberglass", // M14 Series - "rhs_weap_m14_rail_wd", // M14 Series - "rhs_weap_m14_ris", // M14 Series - "rhs_weap_m14_ris_d", // M14 Series - "rhs_weap_m14_ris_fiberglass", // M14 Series - "rhs_weap_m14_ris_wd", // M14 Series - "rhs_weap_m14_wd", // M14 Series - "rhs_weap_m14_weap_m14ebrri", // M14 Series - "rhs_weap_m14_socom", // M14 Series - "rhs_weap_m14_socom_rail", // M14 Series - "srifle_EBR_F", // Mk14 Series - "UK3CB_FNFAL_OSW", // FN_FAL Series - "UK3CB_FNFAL_OSW_GL", // FN_FAL Series - "UK3CB_FNFAL_FULL", // FN_FAL Series - "UK3CB_FNFAL_FULL_RAILS", // FN_FAL Series - "UK3CB_FNFAL_FOREGRIP", // FN_FAL Series - "UK3CB_FNFAL_PARA", // FN_FAL Series - "UK3CB_FNFAL_PARA_RAILS", // FN_FAL Series - "UK3CB_FNFAL_STG58", // FN_FAL Series - "SMA_ACRREM", //Remington ACR 556+6.5 - "SMA_ACRREMAFGCQB", //Remington ACR 556+6.5 - "SMA_ACRREMAFG", //Remington ACR 556+6.5 - "SMA_ACRREMMOECQB", //Remington ACR 556+6.5 - "SMA_ACRREMMOE", //Remington ACR 556+6.5 - "SMA_ACRREMblk", //Remington ACR 556+6.5 - "SMA_ACRREMAFGCQBblk", //Remington ACR 556+6.5 - "SMA_ACRREMAFGblk", //Remington ACR 556+6.5 - "SMA_ACRREMMOECQBblk", //Remington ACR 556+6.5 - "SMA_ACRREMMOEblk", //Remington ACR 556+6.5 - "SMA_ACRREMGL_B", //Remington ACR 556+6.5 - "SMA_ACRREMCQBGL", //Remington ACR 556+6.5 - "SMA_ACRREMGL", //Remington ACR 556+6.5 - "LMG_Mk200_F", //Mk200 Series - "LMG_Mk200_black_F" //Mk200 Series - ]; + _subModes = [configfile >> "CfgWeapons" >> _item >> "ItemInfo" >> "OpticsModes", 1] call BIS_fnc_returnChildren; - _restrictedItems = [ // Items that are allowed for Specific USE Case (RRC / Marksman / etc.) - "A3_GPNVG18b_REC_TI", // Thermal Quad - "A3_GPNVG18_REC_TI", // Thermal Quad - "A3_GPNVG18b_TI", // Thermal Quad - "A3_GPNVG18_TI", // Thermal Quad - "A3_GPNVG18b_REC_BLK_TI", // Thermal Quad - "A3_GPNVG18_REC_BLK_TI", // Thermal Quad - "A3_GPNVG18b_BLK_TI", // Thermal Quad - "A3_GPNVG18_BLK_TI", // Thermal Quad - "NVGogglesB_gry_F", // ENVG - "NVGogglesB_grn_F", // ENVG - "NVGogglesB_blk_F", // ENVG - "optic_Nightstalker", // Thermal Optic - "rhsusf_acc_anpas13gv1", // Thermal Optic - "Tier1_ANPVS10_Tan", // Thermal Optic - "rhsusf_acc_anpvs27", // Thermal Optic - "optic_tws_mg", // Thermal Optic - "optic_tws", // Thermal Optic - "Tier1_ATACR18_ADM_Black", //Nightforce Series Optic - "Tier1_ATACR18_ADM_Desert", //Nightforce Series Optic - "Tier1_ATACR18_ADM_Desert_Vanilla", //Nightforce Series Optic - "Tier1_ATACR18_ADM_Black_Vanilla", //Nightforce Series Optic - "Tier1_ATACR18_ADM_T1_Black", //Nightforce Series Optic - "Tier1_ATACR18_ADM_T1_Desert", //Nightforce Series Optic - "Tier1_ATACR18_ADM_T1_Black_Vanilla", //Nightforce Series Optic - "Tier1_ATACR18_ADM_T1_Desert_Vanilla", //Nightforce Series Optic - "Tier1_ATACR18_Geissele_Black", //Nightforce Series Optic - "Tier1_ATACR18_Geissele_Desert", //Nightforce Series Optic - "Tier1_ATACR18_Geissele_Black_Vanilla", //Nightforce Series Optic - "Tier1_ATACR18_Geissele_Desert_Vanilla", //Nightforce Series Optic - "Tier1_ATACR18_Geissele_Docter_Black", //Nightforce Series Optic - "Tier1_ATACR18_Geissele_Docter_Desert", //Nightforce Series Optic - "Tier1_ATACR18_Geissele_Docter_Black_Vanilla", //Nightforce Series Optic - "Tier1_ATACR18_Geissele_Docter_Desert_Vanilla", //Nightforce Series Optic - "optic_lrps", //Nightforce Series Optic - "optic_lrps_ghex_F", //Nightforce Series Optic - "optic_lrps_tna_F", //Nightforce Series Optic - "ACE_optic_LRPS_2D", //Nightforce Series Optic - "ACE_optic_LRPS_PIP" //Nightforce Series Optic - ]; - - _tabbedItems = [ // Items that are allowed for individuals with Ranger Tab - "arifle_SPAR_03_snd_F", // HK417 Series - "arifle_SPAR_03_blk_F", // HK417 Series - "arifle_SPAR_03_khk_F", // HK417 Series - "SMA_HK417", // HK417 Series - "SMA_HK417vfg", // HK417 Series - "SMA_HK417_16in", // HK417 Series - "rhs_weap_SCARH_CQC", // Scar H Series - "rhs_weap_SCARH_FDE_CQC", // Scar H Series - "rhs_weap_SCARH_FDE_LB", // Scar H Series - "rhs_weap_SCARH_LB", // Scar H Series - "rhs_weap_SCARH_FDE_STD", // Scar H Series - "rhs_weap_SCARH_STD", // Scar H Series - "rhs_weap_SCARH_USA_CQC", // Scar H Series - "rhs_weap_SCARH_USA_LB", // Scar H Series - "rhs_weap_SCARH_USA_STD", // Scar H Series - "SMA_Mk17", // Scar H Series - "SMA_Mk17_black", // Scar H Series - "SMA_Mk17_green", // Scar H Series - "SMA_Mk17_EGML", // Scar H Series - "SMA_Mk17_EGML_black", // Scar H Series - "SMA_Mk17_EGML_green", // Scar H Series - "SMA_Mk17_16", // Scar H Series - "SMA_Mk17_16_black", // Scar H Series - "SMA_Mk17_16_green", // Scar H Series - "Tier1_SR25", // SR-25 Series - "Tier1_SR25_tan", // SR-25 Series - "Tier1_SR25_ec", // SR-25 Series - "Tier1_SR25_ec_tan", // SR-25 Series - "arifle_MXC_F", // MXC Series - "arifle_MXC_black_F", // MXC Series - "arifle_MXC_khk_F", // MXC Series - "arifle_MXM_F", // MXM Series - "arifle_MXM_black_F", // MXM Series - "arifle_MXM_khk_F", // MXM Series - "arifle_MX_F", // MX Series - "arifle_MX_black_F", // MX Series - "arifle_MX_khk_F", // MX Series - "arifle_MX_GL_F", // MX 3GL Series - "arifle_MX_GL_black_F", // MX 3GL Series - "arifle_MX_GL_khk_F", // MX 3GL Series - "arifle_MX_SW_F", // MX LSW Series - "arifle_MX_SW_black_F", // MX LSW Series - "arifle_MX_SW_khk_F", // MX LSW Series - "Tier1_MK48_Mod0", // Mk48 Series - "Tier1_MK48_Mod0_Desert", // Mk48 Series - "Tier1_MK48_Mod0_Para", // Mk48 Series - "Tier1_MK48_Mod0_Para_Desert", // Mk48 Series - "Tier1_MK48_Mod1", // Mk48 Series - "Tier1_MK48_Mod1_Desert" // Mk48 Series - ]; - - _memeItems = [ // Items that serve no purpose other than to MEME - "UK3CB_Cocaine_Brick", - "ACE_Banana" - ]; + { + _modes append getArray( _x >> "visionMode" ); + } forEach _subModes; + if ( _item in _blackListItems ) then { + _blacklist pushBackUnique _item; + }; + if ( _item in _restrictedItems ) then { + _restricted pushBackUnique _item; + }; + if ( _item in _tabbedItems ) then { + _tabbed pushBackUnique _item; + }; + if ( _item in _memeItems ) then { + _meme pushBackUnique _item; + }; - - - - _item = _x; - _modes = getArray(configfile >> "CfgWeapons" >> _item >> "visionMode"); - - _subModes = [configfile >> "CfgWeapons" >> _item >> "ItemInfo" >> "OpticsModes", 1] call BIS_fnc_returnChildren; - - { - _modes append getArray( _x >> "visionMode" ); - } forEach _subModes; - - - if ( _item in _blackListItems ) then { - _blacklist pushBackUnique _item; - }; - - if ( _item in _restrictedItems ) then { - _restricted pushBackUnique _item; - }; - - if ( _item in _tabbedItems ) then { - _tabbed pushBackUnique _item; - }; - - if ( _item in _memeItems ) then { - _meme pushBackUnique _item; - }; - - if ((count _modes) isNotEqualTo 0) then { - _modes = _modes apply { toLower _x }; - if ( "ti" in _modes ) then { - _unlisted pushBackUnique _item; - }; - }; + if ((count _modes) isNotEqualTo 0) then { + _modes = _modes apply { toLower _x }; + if ( "ti" in _modes ) then { + _unlisted pushBackUnique _item; + }; + }; } forEach _items; -{ - diag_log text format["[MILSIM] (logPlayerInventory): %1 has a blacklisted inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; -} forEach _blacklist; -{ - diag_log text format["[MILSIM] (logPlayerInventory): %1 has a restricted inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; -} forEach _restricted; -{ - diag_log text format["[MILSIM] (logPlayerInventory): %1 has a tabbed inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; -} forEach _tabbed; -{ - diag_log text format["[MILSIM] (logPlayerInventory): %1 has a meme inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; -} forEach _meme; +{ + _nonCompliantItemsCount = _nonCompliantItemsCount + 1; + [_player, "a blacklisted inventory item", _x] call _logItem; +} forEach _blacklist; -{ - diag_log text format["[MILSIM] (logPlayerInventory): %1 has an unlisted thermal item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; -} forEach _unlisted; +{ + _nonCompliantItemsCount = _nonCompliantItemsCount + 1; + [_player, "a restricted inventory item", _x] call _logItem; +} forEach _restricted; -if ( - [_blacklist, _restricted, _tabbed, _meme, _unlisted] find { - count _x > 0 - } isEqualTo -1 -) then { - diag_log text format["[MILSIM] (logPlayerInventory): %1 inventory in fully base inventory compliant.", name _player]; +{ + _nonCompliantItemsCount = _nonCompliantItemsCount + 1; + [_player, "a tabbed inventory item", _x] call _logItem; +} forEach _tabbed; + +{ + _nonCompliantItemsCount = _nonCompliantItemsCount + 1; + [_player, "a meme inventory item", _x] call _logItem; +} forEach _meme; + +{ + if ( + _x in _blackListItems || + _x in _restrictedItems + ) then {continue}; // Skip items that are already checked + _nonCompliantItemsCount = _nonCompliantItemsCount + 1; + [_player, "an unlisted thermal item", _x] call _logItem; +} forEach _unlisted; + +if (_nonCompliantItemsCount isEqualTo 0) then { + diag_log text format["[MILSIM] (logPlayerInventory): %1's inventory is compliant :: playerName=""%1"" playerUID=""%2""", name _player, getPlayerUID _player]; }; nil \ No newline at end of file From f77e418ac810891c839df777c08dc65afb6eca21 Mon Sep 17 00:00:00 2001 From: IndigoFox Date: Mon, 29 Jan 2024 10:35:24 -0800 Subject: [PATCH 5/8] simplifies log types --- functions/server/fn_logPlayerInventory.sqf | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/functions/server/fn_logPlayerInventory.sqf b/functions/server/fn_logPlayerInventory.sqf index dbbb114..5ea5997 100644 --- a/functions/server/fn_logPlayerInventory.sqf +++ b/functions/server/fn_logPlayerInventory.sqf @@ -220,7 +220,7 @@ private _logItem = { params ["_playerObj", "_categoryText", "_itemClassName"]; private _cfg = _itemClassName call CBA_fnc_getItemConfig; diag_log text format[ - "[MILSIM] (logPlayerInventory): Found %1 :: className=""%2"" displayName=""%3"" %4", + "[MILSIM] (logPlayerInventory): %1 :: className=""%2"" displayName=""%3"" %4", _categoryText, _itemClassName, [_cfg] call BIS_fnc_displayName, @@ -265,7 +265,7 @@ _items pushBack (uniform _player); // CHECK INVENTORY diag_log text format[ - "[MILSIM] (logPlayerInventory): Checking inventory :: %1", + "[MILSIM] (logPlayerInventory): CHECKING :: %1", [_player] call _playerInfoString ]; @@ -310,22 +310,22 @@ diag_log text format[ { _nonCompliantItemsCount = _nonCompliantItemsCount + 1; - [_player, "a blacklisted inventory item", _x] call _logItem; + [_player, "BLACKLISTED", _x] call _logItem; } forEach _blacklist; { _nonCompliantItemsCount = _nonCompliantItemsCount + 1; - [_player, "a restricted inventory item", _x] call _logItem; + [_player, "RESTRICTED", _x] call _logItem; } forEach _restricted; { _nonCompliantItemsCount = _nonCompliantItemsCount + 1; - [_player, "a tabbed inventory item", _x] call _logItem; + [_player, "TABBED", _x] call _logItem; } forEach _tabbed; { _nonCompliantItemsCount = _nonCompliantItemsCount + 1; - [_player, "a meme inventory item", _x] call _logItem; + [_player, "MEME", _x] call _logItem; } forEach _meme; { @@ -334,11 +334,14 @@ diag_log text format[ _x in _restrictedItems ) then {continue}; // Skip items that are already checked _nonCompliantItemsCount = _nonCompliantItemsCount + 1; - [_player, "an unlisted thermal item", _x] call _logItem; + [_player, "UNLISTED THERMAL", _x] call _logItem; } forEach _unlisted; if (_nonCompliantItemsCount isEqualTo 0) then { - diag_log text format["[MILSIM] (logPlayerInventory): %1's inventory is compliant :: playerName=""%1"" playerUID=""%2""", name _player, getPlayerUID _player]; + diag_log text format[ + "[MILSIM] (logPlayerInventory): COMPLIANT :: %1", + [_player] call _playerInfoString + ]; }; nil \ No newline at end of file From cada98e15a5f7d52675d4932cd89437789611b92 Mon Sep 17 00:00:00 2001 From: IndigoFox Date: Mon, 29 Jan 2024 13:48:35 -0800 Subject: [PATCH 6/8] change logPlayerInventory to return lines, which handlers send to CBA ev --- functions/client/fn_bindEventHandlers.sqf | 6 ++-- functions/init/fn_initPlayerLocal.sqf | 9 ++++++ functions/init/fn_initServer.sqf | 7 ++++- functions/server/fn_logPlayerInventory.sqf | 35 +++++++++++++++++----- 4 files changed, 46 insertions(+), 11 deletions(-) diff --git a/functions/client/fn_bindEventHandlers.sqf b/functions/client/fn_bindEventHandlers.sqf index 08a8cdf..f04d505 100644 --- a/functions/client/fn_bindEventHandlers.sqf +++ b/functions/client/fn_bindEventHandlers.sqf @@ -39,11 +39,13 @@ addMissionEventHandler ["HandleChatMessage", ["ace_arsenal_displayClosed", { - player remoteExec["milsim_fnc_logPlayerInventory", 0]; + private _lines = [player] call milsim_fnc_logPlayerInventory; + ["milsim_logText", [_lines]] call CBA_fnc_globalEvent; }] call CBA_fnc_addEventHandler; [missionNamespace, "arsenalClosed", { - player remoteExec["milsim_fnc_logPlayerInventory", 0]; + private _lines = [player] call milsim_fnc_logPlayerInventory; + ["milsim_logText", [_lines]] call CBA_fnc_globalEvent; }] call BIS_fnc_addScriptedEventHandler; diag_log text "[MILSIM] (client) event handlers bound"; diff --git a/functions/init/fn_initPlayerLocal.sqf b/functions/init/fn_initPlayerLocal.sqf index 3a1a2a3..d72495f 100644 --- a/functions/init/fn_initPlayerLocal.sqf +++ b/functions/init/fn_initPlayerLocal.sqf @@ -1,5 +1,14 @@ if ( !hasInterface ) exitWith {}; +if (!isServer) then { + ["milsim_logText", { + params [["_strArray", [""], [[]]]]; + { + diag_log text _x; + } forEach _strArray; + }] call CBA_fnc_addEventHandler; +}; + ["InitializePlayer", [player, true]] call BIS_fnc_dynamicGroups; nil; \ No newline at end of file diff --git a/functions/init/fn_initServer.sqf b/functions/init/fn_initServer.sqf index 15784ef..c2c335e 100644 --- a/functions/init/fn_initServer.sqf +++ b/functions/init/fn_initServer.sqf @@ -53,7 +53,12 @@ publicVariable "milsim_var_rotaryAssets"; // Initializes the Dynamic Groups framework and groups ["Initialize", [true]] call BIS_fnc_dynamicGroups; - +["milsim_logText", { + params [["_strArray", [""], [[]]]]; + { + diag_log text _x; + } forEach _strArray; +}] call CBA_fnc_addEventHandler; missionNamespace setVariable ["milsim_complete", true]; diag_log text "[MILSIM] (initServer) milsim_complete: version 2.3"; diff --git a/functions/server/fn_logPlayerInventory.sqf b/functions/server/fn_logPlayerInventory.sqf index 5ea5997..b85f0f5 100644 --- a/functions/server/fn_logPlayerInventory.sqf +++ b/functions/server/fn_logPlayerInventory.sqf @@ -1,9 +1,25 @@ +/* + Function: milsim_fnc_logPlayerInventory + Description: + Checks a player's inventory for non-compliant items and logs results to all machines. + + Author: Hizumi, EagleTrooper, IndigoFox + + Parameters: + 0: _player - - Player to check inventory of. + + Returns: + - Array of strings to be logged. + +*/ params [ ["_player", objNull, [objNull]] ]; -if (!isPlayer _player) exitWith { diag_log("exitWith logPlayerInventory")}; +if (!isPlayer _player) exitWith { + ["[MILSIM] (logPlayerInventory): ERROR :: _player is not a player"] +}; // DEFINITIONS _blackListItems = [ // Items that NO member is allowed to use. @@ -206,6 +222,8 @@ _memeItems = [ // Items that serve no purpose other than to MEME // INSTANTIATE VARS +private _returnLines = []; + _unlisted = []; _restricted = []; @@ -219,13 +237,13 @@ private _nonCompliantItemsCount = 0; private _logItem = { params ["_playerObj", "_categoryText", "_itemClassName"]; private _cfg = _itemClassName call CBA_fnc_getItemConfig; - diag_log text format[ + _returnLines pushBack (format[ "[MILSIM] (logPlayerInventory): %1 :: className=""%2"" displayName=""%3"" %4", _categoryText, _itemClassName, [_cfg] call BIS_fnc_displayName, [_playerObj] call _playerInfoString - ]; + ]); }; private _playerInfoString = { @@ -264,10 +282,10 @@ _items pushBack (headgear _player); _items pushBack (uniform _player); // CHECK INVENTORY -diag_log text format[ +_returnLines pushBack (format[ "[MILSIM] (logPlayerInventory): CHECKING :: %1", [_player] call _playerInfoString -]; +]); { _item = _x; @@ -338,10 +356,11 @@ diag_log text format[ } forEach _unlisted; if (_nonCompliantItemsCount isEqualTo 0) then { - diag_log text format[ + _returnLines pushBack (format[ "[MILSIM] (logPlayerInventory): COMPLIANT :: %1", [_player] call _playerInfoString - ]; + ]); }; -nil \ No newline at end of file +// returns array of strings +_returnLines; \ No newline at end of file From dc3382975189c6272a0a989118f955c161b1b863 Mon Sep 17 00:00:00 2001 From: IndigoFox Date: Tue, 30 Jan 2024 18:22:45 -0800 Subject: [PATCH 7/8] changes logging, and eval inv on server only --- functions/client/fn_bindEventHandlers.sqf | 6 +-- functions/server/fn_logPlayerInventory.sqf | 54 +++++++++++----------- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/functions/client/fn_bindEventHandlers.sqf b/functions/client/fn_bindEventHandlers.sqf index 075a86d..1a0132b 100644 --- a/functions/client/fn_bindEventHandlers.sqf +++ b/functions/client/fn_bindEventHandlers.sqf @@ -42,13 +42,11 @@ addMissionEventHandler ["HandleChatMessage", ["ace_arsenal_displayClosed", { - private _lines = [player] call milsim_fnc_logPlayerInventory; - ["milsim_logText", [_lines]] call CBA_fnc_globalEvent; + [player] remoteExec ["milsim_fnc_logPlayerInventory", 2]; }] call CBA_fnc_addEventHandler; [missionNamespace, "arsenalClosed", { - private _lines = [player] call milsim_fnc_logPlayerInventory; - ["milsim_logText", [_lines]] call CBA_fnc_globalEvent; + [player] remoteExec ["milsim_fnc_logPlayerInventory", 2]; }] call BIS_fnc_addScriptedEventHandler; diag_log text "[MILSIM] (client) event handlers bound"; diff --git a/functions/server/fn_logPlayerInventory.sqf b/functions/server/fn_logPlayerInventory.sqf index b85f0f5..2534f58 100644 --- a/functions/server/fn_logPlayerInventory.sqf +++ b/functions/server/fn_logPlayerInventory.sqf @@ -18,7 +18,11 @@ params [ ]; if (!isPlayer _player) exitWith { - ["[MILSIM] (logPlayerInventory): ERROR :: _player is not a player"] + [ + "logPlayerInventory", + "PARAM PLAYER IS NOT A PLAYER", + [["player", _player]] + ] call milsim_fnc_log; }; // DEFINITIONS @@ -236,22 +240,19 @@ private _nonCompliantItemsCount = 0; // PRIVATE FUNCTIONS private _logItem = { params ["_playerObj", "_categoryText", "_itemClassName"]; - private _cfg = _itemClassName call CBA_fnc_getItemConfig; - _returnLines pushBack (format[ - "[MILSIM] (logPlayerInventory): %1 :: className=""%2"" displayName=""%3"" %4", - _categoryText, - _itemClassName, - [_cfg] call BIS_fnc_displayName, - [_playerObj] call _playerInfoString - ]); + private _itemConfig = _itemClassName call CBA_fnc_getItemConfig; + // Log to RPT + [ + "logPlayerInventory", + "NON-COMPLIANT ITEM", + [_playerObj, [ + ["category", _categoryText], + ["className", _itemClassName], + ["displayName", [_itemConfig] call BIS_fnc_displayName] + ]] call milsim_fnc_addPlayerInfoToArray + ] call milsim_fnc_log; }; -private _playerInfoString = { - params ["_playerObj"]; - format["playerName=""%1"" playerUID=""%2"" playerGroup=""%3""", name _playerObj, getPlayerUID _playerObj, groupId (group _playerObj)]; -}; - - // GATHER INVENTORY // _items = []; // _items pushback headgear _player; @@ -282,10 +283,11 @@ _items pushBack (headgear _player); _items pushBack (uniform _player); // CHECK INVENTORY -_returnLines pushBack (format[ - "[MILSIM] (logPlayerInventory): CHECKING :: %1", - [_player] call _playerInfoString -]); +[ + "logPlayerInventory", + "CHECKING PLAYER INVENTORY", + [_player] call milsim_fnc_addPlayerInfoToArray +] call milsim_fnc_log; { _item = _x; @@ -356,11 +358,9 @@ _returnLines pushBack (format[ } forEach _unlisted; if (_nonCompliantItemsCount isEqualTo 0) then { - _returnLines pushBack (format[ - "[MILSIM] (logPlayerInventory): COMPLIANT :: %1", - [_player] call _playerInfoString - ]); -}; - -// returns array of strings -_returnLines; \ No newline at end of file + [ + "logPlayerInventory", + "PLAYER INVENTORY IS COMPLIANT", + [_player] call milsim_fnc_addPlayerInfoToArray + ] call milsim_fnc_log; +}; \ No newline at end of file From 4677d54689be77d61e67d713cc3d75f6ef40b999 Mon Sep 17 00:00:00 2001 From: IndigoFox Date: Wed, 31 Jan 2024 19:43:30 -0800 Subject: [PATCH 8/8] tested. moves defs to cfg where they should be, plus refactor of gather --- description.ext | 1 + functions/definitions/DisallowedEquipment.hpp | 223 ++++++++++ functions/server/fn_logPlayerInventory.sqf | 386 ++++-------------- 3 files changed, 306 insertions(+), 304 deletions(-) create mode 100644 functions/definitions/DisallowedEquipment.hpp diff --git a/description.ext b/description.ext index 5bc6cb1..340a0a0 100644 --- a/description.ext +++ b/description.ext @@ -17,6 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include "mission_settings.hpp" +#include "functions\definitions\DisallowedEquipment.hpp" //-------------------------------------------MISSION INFO-------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/functions/definitions/DisallowedEquipment.hpp b/functions/definitions/DisallowedEquipment.hpp new file mode 100644 index 0000000..d10c79b --- /dev/null +++ b/functions/definitions/DisallowedEquipment.hpp @@ -0,0 +1,223 @@ +// To access these from SQF: +// to get an array of STRING with each subclass name: +// (missionConfigFile >> "DisallowedEquipment") call BIS_fnc_getCfgSubClasses +// To access a specific class' properties: +// (missionConfigFile >> "DisallowedEquipment" >> "blacklisted" >> "label") call BIS_fnc_getCfgData; +// (missionConfigFile >> "DisallowedEquipment" >> "blacklisted" >> "description") call BIS_fnc_getCfgData; +// (missionConfigFile >> "DisallowedEquipment" >> "blacklisted" >> "items") call BIS_fnc_getCfgDataArray; + +class DisallowedEquipment { + class blacklisted { + label = "BLACKLISTED WEAPON OR ITEM"; + description = "Items that NO member is allowed to use."; + items[] = { + "17BN_ANPVS14", // NVG AN/PVS-14 + "ej_PVS15D", // NVG AN/PVS-15 + "ej_VPS15", // NVG AN/PVS-15 + "LMG_Mk200_black_F", //Mk200 Series + "LMG_Mk200_F", //Mk200 Series + "rhs_weap_g36c", // G36 Series + "rhs_weap_g36kv_ag36", // G36 Series + "rhs_weap_g36kv", // G36 Series + "rhs_weap_m14_d", // M14 Series + "rhs_weap_m14_fiberglass", // M14 Series + "rhs_weap_m14_rail_d", // M14 Series + "rhs_weap_m14_rail_fiberglass", // M14 Series + "rhs_weap_m14_rail_wd", // M14 Series + "rhs_weap_m14_rail", // M14 Series + "rhs_weap_m14_ris_d", // M14 Series + "rhs_weap_m14_ris_fiberglass", // M14 Series + "rhs_weap_m14_ris_wd", // M14 Series + "rhs_weap_m14_ris", // M14 Series + "rhs_weap_m14_socom_rail", // M14 Series + "rhs_weap_m14_socom", // M14 Series + "rhs_weap_m14_wd", // M14 Series + "rhs_weap_m14_weap_m14ebrri", // M14 Series + "rhs_weap_m14", // M14 Series + "rhs_weap_m16a4_carryhandle_M203", // M16 Series + "rhs_weap_m16a4_carryhandle", // M16 Series + "rhs_weap_m16a4_imod_M203", // M16 Series + "rhs_weap_m16a4_imod", // M16 Series + "rhs_weap_m16a4", // M16 Series + "rhs_weap_m27iar_grip", // M27 Series + "rhs_weap_m27iar", // M27 Series + "rhsusf_ANPVS_14", // NVG AN/PVS-14 + "rhsusf_ANPVS_15", // NVG AN/PVS-15 + "SMA_ACRREM", //Remington ACR 556+6.5 + "SMA_ACRREMAFG", //Remington ACR 556+6.5 + "SMA_ACRREMAFGblk", //Remington ACR 556+6.5 + "SMA_ACRREMAFGCQB", //Remington ACR 556+6.5 + "SMA_ACRREMAFGCQBblk", //Remington ACR 556+6.5 + "SMA_ACRREMblk", //Remington ACR 556+6.5 + "SMA_ACRREMCQBGL", //Remington ACR 556+6.5 + "SMA_ACRREMGL_B", //Remington ACR 556+6.5 + "SMA_ACRREMGL", //Remington ACR 556+6.5 + "SMA_ACRREMMOE", //Remington ACR 556+6.5 + "SMA_ACRREMMOEblk", //Remington ACR 556+6.5 + "SMA_ACRREMMOECQB", //Remington ACR 556+6.5 + "SMA_ACRREMMOECQBblk", //Remington ACR 556+6.5 + "srifle_DMR_06_camo_F", // M14 Series + "srifle_DMR_06_hunter_F", // M14 Series + "srifle_DMR_06_olive_F", // M14 Series + "srifle_EBR_F", // Mk14 Series + "Tier1_SIG_CMX_115_Virtus_300BLK_Black", // MCX 300 Blackout + "Tier1_SIG_CMX_115_Virtus_300BLK_Desert", // MCX 300 Blackout + "Tier1_SIG_CMX_115_Virtus_300BLK_FDE", // MCX 300 Blackout + "Tier1_SIG_CMX_115_Virtus_300BLK", // MCX 300 Blackout + "UK3CB_AG36_MLIC", // G36 Series + "UK3CB_AG36_TAC_K", // G36 Series + "UK3CB_AG36A1", // G36 Series + "UK3CB_AG36E1", // G36 Series + "UK3CB_AG36V", // G36 Series + "UK3CB_FNFAL_FOREGRIP", // FN_FAL Series + "UK3CB_FNFAL_FULL_RAILS", // FN_FAL Series + "UK3CB_FNFAL_FULL", // FN_FAL Series + "UK3CB_FNFAL_OSW_GL", // FN_FAL Series + "UK3CB_FNFAL_OSW", // FN_FAL Series + "UK3CB_FNFAL_PARA_RAILS", // FN_FAL Series + "UK3CB_FNFAL_PARA", // FN_FAL Series + "UK3CB_FNFAL_STG58", // FN_FAL Series + "UK3CB_G36_KSK_K", // G36 Series + "UK3CB_G36_KSK", // G36 Series + "UK3CB_G36_LSW", // G36 Series + "UK3CB_G36_MLIC_C", // G36 Series + "UK3CB_G36_MLIC_K", // G36 Series + "UK3CB_G36_MLIC", // G36 Series + "UK3CB_G36_TAC_C", // G36 Series + "UK3CB_G36_TAC", // G36 Series + "UK3CB_G36A1_C", // G36 Series + "UK3CB_G36A1_K", // G36 Series + "UK3CB_G36A1", // G36 Series + "UK3CB_G36E1_C", // G36 Series + "UK3CB_G36E1_K", // G36 Series + "UK3CB_G36E1", // G36 Series + "UK3CB_G36V_C", // G36 Series + "UK3CB_G36V_K", // G36 Series + "UK3CB_G36V", // G36 Series + "UK3CB_M14_Railed", // M14 Series + "UK3CB_M14", // M14 Series + "UK3CB_M14DMR_BLK", // M14 Series + "UK3CB_M14DMR_Railed_BLK", // M14 Series + "UK3CB_M14DMR_Railed", // M14 Series + "UK3CB_M14DMR", // M14 Series + "UK3CB_M16_Carbine", // M16 Series + "UK3CB_M16A1_LSW", // M16 Series + "UK3CB_M16A1", // M16 Series + "UK3CB_M16A2_UGL", // M16 Series + "UK3CB_M16A2", // M16 Series + "UK3CB_M16A3", // M16 Series + "USP_PVS_14", // NVG AN/PVS-14 + "USP_PVS_15" // NVG AN/PVS-15 + }; + }; + + class restrictedItems { + label = "RESTRICTED ITEM"; + description = "Items that are allowed for specific USE Case (RRC / Marksman / etc.)"; + items[] = { + "A3_GPNVG18_BLK_TI", // Thermal Quad + "A3_GPNVG18_REC_BLK_TI", // Thermal Quad + "A3_GPNVG18_REC_TI", // Thermal Quad + "A3_GPNVG18_TI", // Thermal Quad + "A3_GPNVG18b_BLK_TI", // Thermal Quad + "A3_GPNVG18b_REC_BLK_TI", // Thermal Quad + "A3_GPNVG18b_REC_TI", // Thermal Quad + "A3_GPNVG18b_TI", // Thermal Quad + "ACE_optic_LRPS_2D", //Nightforce Series Optic + "ACE_optic_LRPS_PIP", //Nightforce Series Optic + "NVGogglesB_blk_F", // ENVG + "NVGogglesB_grn_F", // ENVG + "NVGogglesB_gry_F", // ENVG + "optic_lrps_ghex_F", //Nightforce Series Optic + "optic_lrps_tna_F", //Nightforce Series Optic + "optic_lrps", //Nightforce Series Optic + "optic_Nightstalker", // Thermal Optic + "optic_tws_mg", // Thermal Optic + "optic_tws", // Thermal Optic + "rhsusf_acc_anpas13gv1", // Thermal Optic + "rhsusf_acc_anpvs27", // Thermal Optic + "Tier1_ANPVS10_Tan", // Thermal Optic + "Tier1_ATACR18_ADM_Black_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_ADM_Black", //Nightforce Series Optic + "Tier1_ATACR18_ADM_Desert_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_ADM_Desert", //Nightforce Series Optic + "Tier1_ATACR18_ADM_T1_Black_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_ADM_T1_Black", //Nightforce Series Optic + "Tier1_ATACR18_ADM_T1_Desert_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_ADM_T1_Desert", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Black_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Black", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Desert_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Desert", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Docter_Black_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Docter_Black", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Docter_Desert_Vanilla", //Nightforce Series Optic + "Tier1_ATACR18_Geissele_Docter_Desert" //Nightforce Series Optic + }; + }; + + class tabbedItems { // Items that are allowed for individuals with Ranger Tab + label = "TABBED WEAPON"; + description = "Items that are allowed for individuals with Ranger Tab."; + items[] = { + "arifle_MX_black_F", // MX Series + "arifle_MX_F", // MX Series + "arifle_MX_GL_black_F", // MX 3GL Series + "arifle_MX_GL_F", // MX 3GL Series + "arifle_MX_GL_khk_F", // MX 3GL Series + "arifle_MX_khk_F", // MX Series + "arifle_MX_SW_black_F", // MX LSW Series + "arifle_MX_SW_F", // MX LSW Series + "arifle_MX_SW_khk_F", // MX LSW Series + "arifle_MXC_black_F", // MXC Series + "arifle_MXC_F", // MXC Series + "arifle_MXC_khk_F", // MXC Series + "arifle_MXM_black_F", // MXM Series + "arifle_MXM_F", // MXM Series + "arifle_MXM_khk_F", // MXM Series + "arifle_SPAR_03_blk_F", // HK417 Series + "arifle_SPAR_03_khk_F", // HK417 Series + "arifle_SPAR_03_snd_F", // HK417 Series + "rhs_weap_SCARH_CQC", // Scar H Series + "rhs_weap_SCARH_FDE_CQC", // Scar H Series + "rhs_weap_SCARH_FDE_LB", // Scar H Series + "rhs_weap_SCARH_FDE_STD", // Scar H Series + "rhs_weap_SCARH_LB", // Scar H Series + "rhs_weap_SCARH_STD", // Scar H Series + "rhs_weap_SCARH_USA_CQC", // Scar H Series + "rhs_weap_SCARH_USA_LB", // Scar H Series + "rhs_weap_SCARH_USA_STD", // Scar H Series + "SMA_HK417_16in", // HK417 Series + "SMA_HK417", // HK417 Series + "SMA_HK417vfg", // HK417 Series + "SMA_Mk17_16_black", // Scar H Series + "SMA_Mk17_16_green", // Scar H Series + "SMA_Mk17_16", // Scar H Series + "SMA_Mk17_black", // Scar H Series + "SMA_Mk17_EGML_black", // Scar H Series + "SMA_Mk17_EGML_green", // Scar H Series + "SMA_Mk17_EGML", // Scar H Series + "SMA_Mk17_green", // Scar H Series + "SMA_Mk17", // Scar H Series + "Tier1_MK48_Mod0_Desert", // Mk48 Series + "Tier1_MK48_Mod0_Para_Desert", // Mk48 Series + "Tier1_MK48_Mod0_Para", // Mk48 Series + "Tier1_MK48_Mod0", // Mk48 Series + "Tier1_MK48_Mod1_Desert", // Mk48 Series + "Tier1_MK48_Mod1", // Mk48 Series + "Tier1_SR25_ec_tan", // SR-25 Series + "Tier1_SR25_ec", // SR-25 Series + "Tier1_SR25_tan", // SR-25 Series + "Tier1_SR25" // SR-25 Series + }; + }; + + class memeItems { + label = "MEME ITEM"; + description = "Items that serve no purpose other than to MEME."; + items[] = { + "ACE_Banana", + "UK3CB_Cocaine_Brick" + }; + }; +}; \ No newline at end of file diff --git a/functions/server/fn_logPlayerInventory.sqf b/functions/server/fn_logPlayerInventory.sqf index 2534f58..835d529 100644 --- a/functions/server/fn_logPlayerInventory.sqf +++ b/functions/server/fn_logPlayerInventory.sqf @@ -25,251 +25,20 @@ if (!isPlayer _player) exitWith { ] call milsim_fnc_log; }; -// DEFINITIONS -_blackListItems = [ // Items that NO member is allowed to use. - "17BN_ANPVS14", // NVG AN/PVS-14 - "USP_PVS_14", // NVG AN/PVS-14 - "USP_PVS_15", // NVG AN/PVS-15 - "rhsusf_ANPVS_14", // NVG AN/PVS-14 - "ej_VPS15", // NVG AN/PVS-15 - "rhsusf_ANPVS_15", // NVG AN/PVS-15 - "ej_PVS15D", // NVG AN/PVS-15 - "UK3CB_M16_Carbine", // M16 Series - "UK3CB_M16A1", // M16 Series - "UK3CB_M16A1_LSW", // M16 Series - "UK3CB_M16A2", // M16 Series - "UK3CB_M16A2_UGL", // M16 Series - "UK3CB_M16A3", // M16 Series - "rhs_weap_m16a4", // M16 Series - "rhs_weap_m16a4_carryhandle", // M16 Series - "rhs_weap_m16a4_carryhandle_M203", // M16 Series - "rhs_weap_m16a4_imod", // M16 Series - "rhs_weap_m16a4_imod_M203", // M16 Series - "rhs_weap_m27iar", // M27 Series - "rhs_weap_m27iar_grip", // M27 Series - "UK3CB_G36_MLIC", // G36 Series - "UK3CB_G36_MLIC_K", // G36 Series - "UK3CB_G36_MLIC_C", // G36 Series - "UK3CB_G36_KSK_K", // G36 Series - "UK3CB_G36_KSK", // G36 Series - "UK3CB_G36A1", // G36 Series - "UK3CB_AG36A1", // G36 Series - "UK3CB_G36A1_K", // G36 Series - "UK3CB_G36A1_C", // G36 Series - "UK3CB_G36E1", // G36 Series - "UK3CB_AG36E1", // G36 Series - "UK3CB_G36E1_K", // G36 Series - "UK3CB_G36E1_C", // G36 Series - "UK3CB_AG36_MLIC", // G36 Series - "UK3CB_G36V", // G36 Series - "UK3CB_AG36V", // G36 Series - "UK3CB_G36_TAC", // G36 Series - "UK3CB_G36V_K", // G36 Series - "UK3CB_AG36_TAC_K", // G36 Series - "UK3CB_G36V_C", // G36 Series - "UK3CB_G36_TAC_C", // G36 Series - "UK3CB_G36_LSW", // G36 Series - "rhs_weap_g36kv", // G36 Series - "rhs_weap_g36kv_ag36", // G36 Series - "rhs_weap_g36c", // G36 Series - "Tier1_SIG_CMX_115_Virtus_300BLK", // MCX 300 Blackout - "Tier1_SIG_CMX_115_Virtus_300BLK_Black", // MCX 300 Blackout - "Tier1_SIG_CMX_115_Virtus_300BLK_Desert", // MCX 300 Blackout - "Tier1_SIG_CMX_115_Virtus_300BLK_FDE", // MCX 300 Blackout - "UK3CB_M14", // M14 Series - "UK3CB_M14_Railed", // M14 Series - "UK3CB_M14DMR", // M14 Series - "UK3CB_M14DMR_BLK", // M14 Series - "UK3CB_M14DMR_Railed", // M14 Series - "UK3CB_M14DMR_Railed_BLK", // M14 Series - "srifle_DMR_06_hunter_F", // M14 Series - "srifle_DMR_06_camo_F", // M14 Series - "srifle_DMR_06_olive_F", // M14 Series - "rhs_weap_m14", // M14 Series - "rhs_weap_m14_d", // M14 Series - "rhs_weap_m14_fiberglass", // M14 Series - "rhs_weap_m14_rail", // M14 Series - "rhs_weap_m14_rail_d", // M14 Series - "rhs_weap_m14_rail_fiberglass", // M14 Series - "rhs_weap_m14_rail_wd", // M14 Series - "rhs_weap_m14_ris", // M14 Series - "rhs_weap_m14_ris_d", // M14 Series - "rhs_weap_m14_ris_fiberglass", // M14 Series - "rhs_weap_m14_ris_wd", // M14 Series - "rhs_weap_m14_wd", // M14 Series - "rhs_weap_m14_weap_m14ebrri", // M14 Series - "rhs_weap_m14_socom", // M14 Series - "rhs_weap_m14_socom_rail", // M14 Series - "srifle_EBR_F", // Mk14 Series - "UK3CB_FNFAL_OSW", // FN_FAL Series - "UK3CB_FNFAL_OSW_GL", // FN_FAL Series - "UK3CB_FNFAL_FULL", // FN_FAL Series - "UK3CB_FNFAL_FULL_RAILS", // FN_FAL Series - "UK3CB_FNFAL_FOREGRIP", // FN_FAL Series - "UK3CB_FNFAL_PARA", // FN_FAL Series - "UK3CB_FNFAL_PARA_RAILS", // FN_FAL Series - "UK3CB_FNFAL_STG58", // FN_FAL Series - "SMA_ACRREM", //Remington ACR 556+6.5 - "SMA_ACRREMAFGCQB", //Remington ACR 556+6.5 - "SMA_ACRREMAFG", //Remington ACR 556+6.5 - "SMA_ACRREMMOECQB", //Remington ACR 556+6.5 - "SMA_ACRREMMOE", //Remington ACR 556+6.5 - "SMA_ACRREMblk", //Remington ACR 556+6.5 - "SMA_ACRREMAFGCQBblk", //Remington ACR 556+6.5 - "SMA_ACRREMAFGblk", //Remington ACR 556+6.5 - "SMA_ACRREMMOECQBblk", //Remington ACR 556+6.5 - "SMA_ACRREMMOEblk", //Remington ACR 556+6.5 - "SMA_ACRREMGL_B", //Remington ACR 556+6.5 - "SMA_ACRREMCQBGL", //Remington ACR 556+6.5 - "SMA_ACRREMGL", //Remington ACR 556+6.5 - "LMG_Mk200_F", //Mk200 Series - "LMG_Mk200_black_F" //Mk200 Series -]; - -_restrictedItems = [ // Items that are allowed for Specific USE Case (RRC / Marksman / etc.) - "A3_GPNVG18b_REC_TI", // Thermal Quad - "A3_GPNVG18_REC_TI", // Thermal Quad - "A3_GPNVG18b_TI", // Thermal Quad - "A3_GPNVG18_TI", // Thermal Quad - "A3_GPNVG18b_REC_BLK_TI", // Thermal Quad - "A3_GPNVG18_REC_BLK_TI", // Thermal Quad - "A3_GPNVG18b_BLK_TI", // Thermal Quad - "A3_GPNVG18_BLK_TI", // Thermal Quad - "NVGogglesB_gry_F", // ENVG - "NVGogglesB_grn_F", // ENVG - "NVGogglesB_blk_F", // ENVG - "optic_Nightstalker", // Thermal Optic - "rhsusf_acc_anpas13gv1", // Thermal Optic - "Tier1_ANPVS10_Tan", // Thermal Optic - "rhsusf_acc_anpvs27", // Thermal Optic - "optic_tws_mg", // Thermal Optic - "optic_tws", // Thermal Optic - "Tier1_ATACR18_ADM_Black", //Nightforce Series Optic - "Tier1_ATACR18_ADM_Desert", //Nightforce Series Optic - "Tier1_ATACR18_ADM_Desert_Vanilla", //Nightforce Series Optic - "Tier1_ATACR18_ADM_Black_Vanilla", //Nightforce Series Optic - "Tier1_ATACR18_ADM_T1_Black", //Nightforce Series Optic - "Tier1_ATACR18_ADM_T1_Desert", //Nightforce Series Optic - "Tier1_ATACR18_ADM_T1_Black_Vanilla", //Nightforce Series Optic - "Tier1_ATACR18_ADM_T1_Desert_Vanilla", //Nightforce Series Optic - "Tier1_ATACR18_Geissele_Black", //Nightforce Series Optic - "Tier1_ATACR18_Geissele_Desert", //Nightforce Series Optic - "Tier1_ATACR18_Geissele_Black_Vanilla", //Nightforce Series Optic - "Tier1_ATACR18_Geissele_Desert_Vanilla", //Nightforce Series Optic - "Tier1_ATACR18_Geissele_Docter_Black", //Nightforce Series Optic - "Tier1_ATACR18_Geissele_Docter_Desert", //Nightforce Series Optic - "Tier1_ATACR18_Geissele_Docter_Black_Vanilla", //Nightforce Series Optic - "Tier1_ATACR18_Geissele_Docter_Desert_Vanilla", //Nightforce Series Optic - "optic_lrps", //Nightforce Series Optic - "optic_lrps_ghex_F", //Nightforce Series Optic - "optic_lrps_tna_F", //Nightforce Series Optic - "ACE_optic_LRPS_2D", //Nightforce Series Optic - "ACE_optic_LRPS_PIP" //Nightforce Series Optic -]; - -_tabbedItems = [ // Items that are allowed for individuals with Ranger Tab - "arifle_SPAR_03_snd_F", // HK417 Series - "arifle_SPAR_03_blk_F", // HK417 Series - "arifle_SPAR_03_khk_F", // HK417 Series - "SMA_HK417", // HK417 Series - "SMA_HK417vfg", // HK417 Series - "SMA_HK417_16in", // HK417 Series - "rhs_weap_SCARH_CQC", // Scar H Series - "rhs_weap_SCARH_FDE_CQC", // Scar H Series - "rhs_weap_SCARH_FDE_LB", // Scar H Series - "rhs_weap_SCARH_LB", // Scar H Series - "rhs_weap_SCARH_FDE_STD", // Scar H Series - "rhs_weap_SCARH_STD", // Scar H Series - "rhs_weap_SCARH_USA_CQC", // Scar H Series - "rhs_weap_SCARH_USA_LB", // Scar H Series - "rhs_weap_SCARH_USA_STD", // Scar H Series - "SMA_Mk17", // Scar H Series - "SMA_Mk17_black", // Scar H Series - "SMA_Mk17_green", // Scar H Series - "SMA_Mk17_EGML", // Scar H Series - "SMA_Mk17_EGML_black", // Scar H Series - "SMA_Mk17_EGML_green", // Scar H Series - "SMA_Mk17_16", // Scar H Series - "SMA_Mk17_16_black", // Scar H Series - "SMA_Mk17_16_green", // Scar H Series - "Tier1_SR25", // SR-25 Series - "Tier1_SR25_tan", // SR-25 Series - "Tier1_SR25_ec", // SR-25 Series - "Tier1_SR25_ec_tan", // SR-25 Series - "arifle_MXC_F", // MXC Series - "arifle_MXC_black_F", // MXC Series - "arifle_MXC_khk_F", // MXC Series - "arifle_MXM_F", // MXM Series - "arifle_MXM_black_F", // MXM Series - "arifle_MXM_khk_F", // MXM Series - "arifle_MX_F", // MX Series - "arifle_MX_black_F", // MX Series - "arifle_MX_khk_F", // MX Series - "arifle_MX_GL_F", // MX 3GL Series - "arifle_MX_GL_black_F", // MX 3GL Series - "arifle_MX_GL_khk_F", // MX 3GL Series - "arifle_MX_SW_F", // MX LSW Series - "arifle_MX_SW_black_F", // MX LSW Series - "arifle_MX_SW_khk_F", // MX LSW Series - "Tier1_MK48_Mod0", // Mk48 Series - "Tier1_MK48_Mod0_Desert", // Mk48 Series - "Tier1_MK48_Mod0_Para", // Mk48 Series - "Tier1_MK48_Mod0_Para_Desert", // Mk48 Series - "Tier1_MK48_Mod1", // Mk48 Series - "Tier1_MK48_Mod1_Desert" // Mk48 Series -]; - -_memeItems = [ // Items that serve no purpose other than to MEME - "UK3CB_Cocaine_Brick", - "ACE_Banana" -]; - +// testing +// test_old = compile preprocessFileLineNumbers "testold.sqf"; +// test_new = compile preprocessFileLineNumbers "testnew.sqf"; +// player addItem "A3_GPNVG18_BLK_TI"; +// player addWeapon "SMA_HK417_16in"; +// player addItem "ej_VPS15"; +// player addItem "ACE_Banana"; // INSTANTIATE VARS -private _returnLines = []; +private _foundItemsKeyValue = []; +private _allFoundItemsSoFar = []; -_unlisted = []; - -_restricted = []; -_blacklist = []; -_tabbed = []; -_meme = []; - -private _nonCompliantItemsCount = 0; - -// PRIVATE FUNCTIONS -private _logItem = { - params ["_playerObj", "_categoryText", "_itemClassName"]; - private _itemConfig = _itemClassName call CBA_fnc_getItemConfig; - // Log to RPT - [ - "logPlayerInventory", - "NON-COMPLIANT ITEM", - [_playerObj, [ - ["category", _categoryText], - ["className", _itemClassName], - ["displayName", [_itemConfig] call BIS_fnc_displayName] - ]] call milsim_fnc_addPlayerInfoToArray - ] call milsim_fnc_log; -}; - -// GATHER INVENTORY -// _items = []; -// _items pushback headgear _player; -// _items pushback uniform _player; -// _items append uniformItems _player; -// _items pushback vest _player; -// _items append vestItems _player; -// _items pushback backpack _player; -// _items append backpackItems _player; -// _items pushback hmd _player; -// _items pushback binocular _player; -// _items pushback primaryWeapon _player; -// _items append primaryWeaponItems _player; -// _items pushback secondaryWeapon _player; -// _items append secondaryWeaponItems _player; - -_items = [ +// GET PLAYER ITEMS +private _playerItems = [ _player, // Unit true, // Include weapons, attachments, loaded magazines true, // Include items in backpack @@ -279,88 +48,97 @@ _items = [ true // Include not loaded magazines ] call CBA_fnc_uniqueUnitItems; -_items pushBack (headgear _player); -_items pushBack (uniform _player); +_playerItems pushBack (headgear _player); +_playerItems pushBack (uniform _player); + -// CHECK INVENTORY [ "logPlayerInventory", "CHECKING PLAYER INVENTORY", [_player] call milsim_fnc_addPlayerInfoToArray ] call milsim_fnc_log; -{ - _item = _x; - _modes = getArray(configfile >> "CfgWeapons" >> _item >> "visionMode"); +//////////////////////////////////////// +// HARDCODED DISALLOWED ITEMS - see functions/definitions/DisallowedEquipment.hpp - _subModes = [configfile >> "CfgWeapons" >> _item >> "ItemInfo" >> "OpticsModes", 1] call BIS_fnc_returnChildren; +// Get parent class +private _disallowedEquipmentCfg = (missionConfigFile >> "DisallowedEquipment"); +// Get all subclasses +private _definitionCfgs = (_disallowedEquipmentCfg call BIS_fnc_getCfgSubClasses) apply { + (_disallowedEquipmentCfg >> _x) +}; + +// diag_log text format["DEFINITION CFGS: %1", _definitionCfgs]; +// Check all items +{ // forEach _subclassesCfgs + private _definitionCfg = _x; + private _definitionLabel = (_definitionCfg >> "label") call BIS_fnc_getCfgData; + private _definitionItems = (_definitionCfg >> "items") call BIS_fnc_getCfgDataArray; + // diag_log text format["DEF ITEMS: %1", _definitionItems]; + { // forEach _playerItems + private _playerItem = _x; + // diag_log text format["PLAYER ITEM: %1", _playerItem]; + if (_playerItem in _definitionItems && not (_playerItem in _allFoundItemsSoFar)) then { + // add under def label + [_foundItemsKeyValue, _definitionLabel, _playerItem] call BIS_fnc_addToPairs; + // add to all found items + _allFoundItemsSoFar pushBackUnique _playerItem; + }; + } forEach _playerItems; +} forEach _definitionCfgs; + +//////////////////////////////////////// +// UNLISTED THERMAL - Any item with thermal capabilities that is not already in the list + +// Identify thermal items in the player list +private _thermalItems = _playerItems select { + private _playerItem = _x; + private _modes = getArray(configfile >> "CfgWeapons" >> _playerItem >> "visionMode"); + private _subModes = [configfile >> "CfgWeapons" >> _playerItem >> "ItemInfo" >> "OpticsModes", 1] call BIS_fnc_returnChildren; { _modes append getArray( _x >> "visionMode" ); } forEach _subModes; - - - if ( _item in _blackListItems ) then { - _blacklist pushBackUnique _item; - }; - - if ( _item in _restrictedItems ) then { - _restricted pushBackUnique _item; - }; - - if ( _item in _tabbedItems ) then { - _tabbed pushBackUnique _item; - }; - - if ( _item in _memeItems ) then { - _meme pushBackUnique _item; - }; - if ((count _modes) isNotEqualTo 0) then { - _modes = _modes apply { toLower _x }; - if ( "ti" in _modes ) then { - _unlisted pushBackUnique _item; - }; + // if the item has thermal capabilities and is not in the list anywhere else, include it + "ti" in (_modes apply { toLower _x }) && not (_playerItem in _allFoundItemsSoFar); + } else { + false; }; - -} forEach _items; - - - +}; { - _nonCompliantItemsCount = _nonCompliantItemsCount + 1; - [_player, "BLACKLISTED", _x] call _logItem; -} forEach _blacklist; + [_foundItemsKeyValue, "UNLISTED THERMAL", _x] call BIS_fnc_addToPairs; +} forEach _thermalItems; -{ - _nonCompliantItemsCount = _nonCompliantItemsCount + 1; - [_player, "RESTRICTED", _x] call _logItem; -} forEach _restricted; -{ - _nonCompliantItemsCount = _nonCompliantItemsCount + 1; - [_player, "TABBED", _x] call _logItem; -} forEach _tabbed; - -{ - _nonCompliantItemsCount = _nonCompliantItemsCount + 1; - [_player, "MEME", _x] call _logItem; -} forEach _meme; - -{ - if ( - _x in _blackListItems || - _x in _restrictedItems - ) then {continue}; // Skip items that are already checked - _nonCompliantItemsCount = _nonCompliantItemsCount + 1; - [_player, "UNLISTED THERMAL", _x] call _logItem; -} forEach _unlisted; - -if (_nonCompliantItemsCount isEqualTo 0) then { +// Only log compliance message if no non-compliant items were found +if (count _allFoundItemsSoFar isEqualTo 0) exitWith { [ "logPlayerInventory", "PLAYER INVENTORY IS COMPLIANT", [_player] call milsim_fnc_addPlayerInfoToArray ] call milsim_fnc_log; -}; \ No newline at end of file +}; + +// Log all non-compliant items +{ + _x params ["_categoryLabel", "_items"]; + if (typeName _items isEqualTo "STRING") then { + _items = [_items]; + }; + { + private _itemClassName = _x; + private _itemConfig = _itemClassName call CBA_fnc_getItemConfig; + // Log to RPT + [ + "logPlayerInventory", + "NON-COMPLIANT ITEM", + [_player, [ + ["category", _categoryLabel], + ["className", _itemClassName], + ["displayName", [_itemConfig] call BIS_fnc_displayName] + ]] call milsim_fnc_addPlayerInfoToArray + ] call milsim_fnc_log; + } forEach _items; +} forEach _foundItemsKeyValue; \ No newline at end of file