improve inventory check performance and logging #10

Merged
hizumi merged 5 commits from #7-inventory-compliance-message into inv_expan 2024-01-29 23:37:08 -06:00
Owner

fixes #7

fixes #7
IndigoFox added 1 commit 2024-01-29 00:46:31 -06:00
Author
Owner

(please test LOL)

(please test LOL)
IndigoFox added 1 commit 2024-01-29 12:18:12 -06:00
Author
Owner
  • moves flagged item definitions out of the _items forEach loop
  • creates two private functions for logging data & getting player info key=value pairs
  • changes to use CBA_fnc_uniqueUnitItems for gathering
  • changes format of logging to support structured RPT parsing
  • no longer logs items in unlisted thermal category if they were defined in another list

EXAMPLE LOG

10:11:45 [MILSIM] (logPlayerInventory): Checking inventory :: playerName="SPC IndigoFox" playerUID="_SP_PLAYER_" playerGroup="Alpha 1-1"
10:11:45 [MILSIM] (logPlayerInventory): Found a blacklisted inventory item :: className="rhs_weap_m16a4" displayName="M16A4" playerName="SPC IndigoFox" playerUID="_SP_PLAYER_" playerGroup="Alpha 1-1"
10:11:45 [MILSIM] (logPlayerInventory): Found a restricted inventory item :: className="A3_GPNVG18_BLK_TI" displayName="GPNVG-18 BLK TI" playerName="SPC IndigoFox" playerUID="_SP_PLAYER_" playerGroup="Alpha 1-1"

PARSED OUTPUT

[
    {
        "time": "10:11:45",
        "type": "Checking inventory",
        "playerName": "SPC IndigoFox",
        "playerUID": "_SP_PLAYER_",
        "playerGroup": "Alpha 1-1"
    },
    {
        "time": "10:11:45",
        "type": "Found a blacklisted inventory item",
        "className": "rhs_weap_m16a4",
        "displayName": "M16A4",
        "playerName": "SPC IndigoFox",
        "playerUID": "_SP_PLAYER_",
        "playerGroup": "Alpha 1-1"
    },
    {
        "time": "10:11:45",
        "type": "Found a restricted inventory item",
        "className": "A3_GPNVG18_BLK_TI",
        "displayName": "GPNVG-18 BLK TI",
        "playerName": "SPC IndigoFox",
        "playerUID": "_SP_PLAYER_",
        "playerGroup": "Alpha 1-1"
    }
]
- moves flagged item definitions out of the \_items forEach loop - creates two private functions for logging data & getting player info key=value pairs - changes to use CBA_fnc_uniqueUnitItems for gathering - changes format of logging to support structured RPT parsing - no longer logs items in unlisted thermal category if they were defined in another list EXAMPLE LOG ```log 10:11:45 [MILSIM] (logPlayerInventory): Checking inventory :: playerName="SPC IndigoFox" playerUID="_SP_PLAYER_" playerGroup="Alpha 1-1" 10:11:45 [MILSIM] (logPlayerInventory): Found a blacklisted inventory item :: className="rhs_weap_m16a4" displayName="M16A4" playerName="SPC IndigoFox" playerUID="_SP_PLAYER_" playerGroup="Alpha 1-1" 10:11:45 [MILSIM] (logPlayerInventory): Found a restricted inventory item :: className="A3_GPNVG18_BLK_TI" displayName="GPNVG-18 BLK TI" playerName="SPC IndigoFox" playerUID="_SP_PLAYER_" playerGroup="Alpha 1-1" ``` PARSED OUTPUT ```json [ { "time": "10:11:45", "type": "Checking inventory", "playerName": "SPC IndigoFox", "playerUID": "_SP_PLAYER_", "playerGroup": "Alpha 1-1" }, { "time": "10:11:45", "type": "Found a blacklisted inventory item", "className": "rhs_weap_m16a4", "displayName": "M16A4", "playerName": "SPC IndigoFox", "playerUID": "_SP_PLAYER_", "playerGroup": "Alpha 1-1" }, { "time": "10:11:45", "type": "Found a restricted inventory item", "className": "A3_GPNVG18_BLK_TI", "displayName": "GPNVG-18 BLK TI", "playerName": "SPC IndigoFox", "playerUID": "_SP_PLAYER_", "playerGroup": "Alpha 1-1" } ] ```
IndigoFox added 1 commit 2024-01-29 12:35:30 -06:00
Author
Owner

further simplified

10:33:29 [MILSIM] (logPlayerInventory): CHECKING :: playerName="SPC IndigoFox" playerUID="_SP_PLAYER_" playerGroup="Alpha 1-1"
10:33:29 [MILSIM] (logPlayerInventory): COMPLIANT :: playerName="SPC IndigoFox" playerUID="_SP_PLAYER_" playerGroup="Alpha 1-1"
10:33:40 [MILSIM] (logPlayerInventory): CHECKING :: playerName="SPC IndigoFox" playerUID="_SP_PLAYER_" playerGroup="Alpha 1-1"
10:33:40 [MILSIM] (logPlayerInventory): BLACKLISTED :: className="rhs_weap_m16a4" displayName="M16A4" playerName="SPC IndigoFox" playerUID="_SP_PLAYER_" playerGroup="Alpha 1-1"
10:33:40 [MILSIM] (logPlayerInventory): RESTRICTED :: className="A3_GPNVG18_BLK_TI" displayName="GPNVG-18 BLK TI" playerName="SPC IndigoFox" playerUID="_SP_PLAYER_" playerGroup="Alpha 1-1"

Example SQLite3 result attached.

further simplified ``` 10:33:29 [MILSIM] (logPlayerInventory): CHECKING :: playerName="SPC IndigoFox" playerUID="_SP_PLAYER_" playerGroup="Alpha 1-1" 10:33:29 [MILSIM] (logPlayerInventory): COMPLIANT :: playerName="SPC IndigoFox" playerUID="_SP_PLAYER_" playerGroup="Alpha 1-1" 10:33:40 [MILSIM] (logPlayerInventory): CHECKING :: playerName="SPC IndigoFox" playerUID="_SP_PLAYER_" playerGroup="Alpha 1-1" 10:33:40 [MILSIM] (logPlayerInventory): BLACKLISTED :: className="rhs_weap_m16a4" displayName="M16A4" playerName="SPC IndigoFox" playerUID="_SP_PLAYER_" playerGroup="Alpha 1-1" 10:33:40 [MILSIM] (logPlayerInventory): RESTRICTED :: className="A3_GPNVG18_BLK_TI" displayName="GPNVG-18 BLK TI" playerName="SPC IndigoFox" playerUID="_SP_PLAYER_" playerGroup="Alpha 1-1" ``` Example SQLite3 result attached.
IndigoFox changed title from fixes '_restricted' var references, uses find to identify if any non0 to improve inventory check performance and logging 2024-01-29 15:18:20 -06:00
hizumi merged commit 3e4b0c76b9 into inv_expan 2024-01-29 23:37:08 -06:00
hizumi deleted branch #7-inventory-compliance-message 2024-04-10 01:07:02 -05:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: 17th-Ranger-Battalion-ORG/MissionTemplate#10