Refactor event listener registration and update logging settings for task events
This commit is contained in:
parent
27c3c5e502
commit
b1959ee06d
@ -5,4 +5,4 @@ PREP(initGroupRepository);
|
|||||||
PREP(initPermissionService);
|
PREP(initPermissionService);
|
||||||
PREP(initPersistenceService);
|
PREP(initPersistenceService);
|
||||||
PREP(initRequestRepository);
|
PREP(initRequestRepository);
|
||||||
PREP(registerTaskEventListeners);
|
PREP(registerEventListeners);
|
||||||
|
|||||||
@ -5,7 +5,7 @@ PREP_RECOMPILE_START;
|
|||||||
PREP_RECOMPILE_END;
|
PREP_RECOMPILE_END;
|
||||||
|
|
||||||
call FUNC(initCadStore);
|
call FUNC(initCadStore);
|
||||||
call FUNC(registerTaskEventListeners);
|
call FUNC(registerEventListeners);
|
||||||
|
|
||||||
[QGVAR(requestHydrateCad), {
|
[QGVAR(requestHydrateCad), {
|
||||||
params [["_uid", "", [""]]];
|
params [["_uid", "", [""]]];
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* File: fnc_registerTaskEventListeners.sqf
|
* File: fnc_registerEventListeners.sqf
|
||||||
* Author: IDSolutions
|
* Author: IDSolutions
|
||||||
* Date: 2026-05-14
|
* Date: 2026-05-14
|
||||||
* Public: No
|
* Public: No
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Registers CAD listeners for framework task lifecycle events.
|
* Registers CAD listeners for framework events that should refresh CAD state.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* None
|
* None
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* Listener tokens [ARRAY]
|
* Listener tokens [ARRAY]
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call forge_server_cad_fnc_registerTaskEventListeners
|
* call forge_server_cad_fnc_registerEventListeners
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); };
|
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); };
|
||||||
@ -43,6 +43,41 @@ Payloads should be hash maps and should include stable identifiers first:
|
|||||||
`taskID`, `requestID`, `groupID`, `uid`, `orgID`, or `accountID` as appropriate.
|
`taskID`, `requestID`, `groupID`, `uid`, `orgID`, or `accountID` as appropriate.
|
||||||
The event bus adds `event`, `source`, and `timestamp` when the event is emitted.
|
The event bus adds `event`, `source`, and `timestamp` when the event is emitted.
|
||||||
|
|
||||||
|
### Current Events
|
||||||
|
Task lifecycle:
|
||||||
|
- `task.created`
|
||||||
|
- `task.started`
|
||||||
|
- `task.completed`
|
||||||
|
- `task.failed`
|
||||||
|
- `task.cleared`
|
||||||
|
|
||||||
|
Task rewards and notifications:
|
||||||
|
- `task.reward.requested`
|
||||||
|
- `task.reward.applied`
|
||||||
|
- `task.reward.failed`
|
||||||
|
- `task.rating.applied`
|
||||||
|
- `task.rating.failed`
|
||||||
|
- `task.notification.requested`
|
||||||
|
- `task.reward.notification.requested`
|
||||||
|
|
||||||
|
CAD state:
|
||||||
|
- `cad.assignment.assigned`
|
||||||
|
- `cad.assignment.created`
|
||||||
|
- `cad.assignment.acknowledged`
|
||||||
|
- `cad.assignment.declined`
|
||||||
|
- `cad.assignment.closed`
|
||||||
|
- `cad.request.submitted`
|
||||||
|
- `cad.request.closed`
|
||||||
|
- `cad.group.updated`
|
||||||
|
|
||||||
|
Client sync and notification requests:
|
||||||
|
- `notification.requested`
|
||||||
|
- `bank.account.sync.requested`
|
||||||
|
- `org.sync.requested`
|
||||||
|
- `locker.sync.requested`
|
||||||
|
- `locker.va.sync.requested`
|
||||||
|
- `garage.vgarage.sync.requested`
|
||||||
|
|
||||||
```sqf
|
```sqf
|
||||||
private _token = EGVAR(common,EventBus) call ["on", [
|
private _token = EGVAR(common,EventBus) call ["on", [
|
||||||
"task.completed",
|
"task.completed",
|
||||||
|
|||||||
@ -5,7 +5,7 @@ if (isNil QGVAR(TaskLifecycleEventLogTokens)) then {
|
|||||||
private _logTaskLifecycleEvent = {
|
private _logTaskLifecycleEvent = {
|
||||||
params ["_event"];
|
params ["_event"];
|
||||||
|
|
||||||
if !(missionNamespace getVariable [QGVAR(enableEventLogs), true]) exitWith {};
|
if !(missionNamespace getVariable [QGVAR(enableEventLogs), false]) exitWith {};
|
||||||
|
|
||||||
["INFO", format [
|
["INFO", format [
|
||||||
"Task lifecycle event: %1 taskID=%2 taskType=%3 status=%4 participants=%5",
|
"Task lifecycle event: %1 taskID=%2 taskType=%3 status=%4 participants=%5",
|
||||||
@ -20,7 +20,7 @@ if (isNil QGVAR(TaskLifecycleEventLogTokens)) then {
|
|||||||
private _logTaskRewardEvent = {
|
private _logTaskRewardEvent = {
|
||||||
params ["_event"];
|
params ["_event"];
|
||||||
|
|
||||||
if !(missionNamespace getVariable [QGVAR(enableEventLogs), true]) exitWith {};
|
if !(missionNamespace getVariable [QGVAR(enableEventLogs), false]) exitWith {};
|
||||||
|
|
||||||
["INFO", format [
|
["INFO", format [
|
||||||
"Task reward event: %1 taskID=%2 success=%3 message=%4",
|
"Task reward event: %1 taskID=%2 success=%3 message=%4",
|
||||||
@ -62,7 +62,7 @@ if (isNil QGVAR(TaskNotificationEventTokens)) then {
|
|||||||
[CRPC(notifications,recieveNotification), [_type, _title, _message], _player] call CFUNC(targetEvent);
|
[CRPC(notifications,recieveNotification), [_type, _title, _message], _player] call CFUNC(targetEvent);
|
||||||
} forEach _participantUids;
|
} forEach _participantUids;
|
||||||
|
|
||||||
if (missionNamespace getVariable [QGVAR(enableEventLogs), true]) then {
|
if (missionNamespace getVariable [QGVAR(enableEventLogs), false]) then {
|
||||||
["INFO", format [
|
["INFO", format [
|
||||||
"Task notification event: taskID=%1 type=%2 recipients=%3 message=%4",
|
"Task notification event: taskID=%1 type=%2 recipients=%3 message=%4",
|
||||||
_event getOrDefault ["taskID", ""],
|
_event getOrDefault ["taskID", ""],
|
||||||
@ -89,7 +89,7 @@ if (isNil QGVAR(TaskNotificationEventTokens)) then {
|
|||||||
[CRPC(notifications,recieveNotification), [_type, _title, _message], _player] call CFUNC(targetEvent);
|
[CRPC(notifications,recieveNotification), [_type, _title, _message], _player] call CFUNC(targetEvent);
|
||||||
} forEach _memberUids;
|
} forEach _memberUids;
|
||||||
|
|
||||||
if (missionNamespace getVariable [QGVAR(enableEventLogs), true]) then {
|
if (missionNamespace getVariable [QGVAR(enableEventLogs), false]) then {
|
||||||
["INFO", format [
|
["INFO", format [
|
||||||
"Task reward notification event: taskID=%1 type=%2 recipients=%3 message=%4",
|
"Task reward notification event: taskID=%1 type=%2 recipients=%3 message=%4",
|
||||||
_event getOrDefault ["taskID", ""],
|
_event getOrDefault ["taskID", ""],
|
||||||
|
|||||||
@ -7,5 +7,5 @@
|
|||||||
[
|
[
|
||||||
QGVAR(enableEventLogs), "CHECKBOX",
|
QGVAR(enableEventLogs), "CHECKBOX",
|
||||||
[LSTRING(enableEventLogs), LSTRING(enableEventLogsTooltip)],
|
[LSTRING(enableEventLogs), LSTRING(enableEventLogsTooltip)],
|
||||||
_category, true, true
|
_category, false, true
|
||||||
] call CBA_fnc_addSetting;
|
] call CBA_fnc_addSetting;
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
<English>Enable Event Logs</English>
|
<English>Enable Event Logs</English>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_forge_server_task_enableEventLogsTooltip">
|
<Key ID="STR_forge_server_task_enableEventLogsTooltip">
|
||||||
<English>Log task event bus lifecycle, reward, rating, and notification events.</English>
|
<English>Log task event bus lifecycle, reward, rating, and notification events for debugging.</English>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_forge_server_task_enableGenerator">
|
<Key ID="STR_forge_server_task_enableGenerator">
|
||||||
<English>Enable Generator</English>
|
<English>Enable Generator</English>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user