- Introduce `OrgUIBridge` to centralize UI event/request/response handling - Add leave and disband org requests with server handlers and client bridge events - Enforce portal permissions for leaving/disbanding and protect owner/self from member removal
45 lines
1.3 KiB
Plaintext
45 lines
1.3 KiB
Plaintext
#include "script_component.hpp"
|
|
|
|
if (isNil QGVAR(OrgClass)) then { call FUNC(initOrgClass); };
|
|
if (isNil QGVAR(OrgUIBridge)) then { call FUNC(initOrgUIBridge); };
|
|
|
|
[QGVAR(initOrg), {
|
|
GVAR(OrgClass) call ["init", []];
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(responseInitOrg), {
|
|
params [["_data", createHashMap, [createHashMap]]];
|
|
|
|
GVAR(OrgClass) call ["sync", [_data, true]];
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(responseSyncOrg), {
|
|
params [["_data", createHashMap, [createHashMap]], ["_jip", false, [false]]];
|
|
|
|
GVAR(OrgClass) call ["sync", [_data, _jip]];
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(responseCreateOrg), {
|
|
params [["_payload", createHashMap, [createHashMap]]];
|
|
|
|
GVAR(OrgUIBridge) call ["handleCreateResponse", [_payload]];
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(responseDisbandOrg), {
|
|
params [["_payload", createHashMap, [createHashMap]]];
|
|
|
|
GVAR(OrgUIBridge) call ["handleDisbandResponse", [_payload]];
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(responseLeaveOrg), {
|
|
params [["_payload", createHashMap, [createHashMap]]];
|
|
|
|
GVAR(OrgUIBridge) call ["handleLeaveResponse", [_payload]];
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[{
|
|
EGVAR(actor,ActorClass) get "isLoaded";
|
|
}, {
|
|
[QGVAR(initOrg), []] call CFUNC(localEvent);
|
|
}] call CFUNC(waitUntilAndExecute);
|