54 lines
2.1 KiB
Plaintext
54 lines
2.1 KiB
Plaintext
#include "script_component.hpp"
|
|
|
|
PREP_RECOMPILE_START;
|
|
#include "XEH_PREP.hpp"
|
|
PREP_RECOMPILE_END;
|
|
|
|
// private _category = [QUOTE(MOD_NAME), LLSTRING(displayName)];
|
|
|
|
[QGVAR(requestInitOrg), {
|
|
params [["_uid", "", [""]], ["_org", createHashMap, [createHashMap]]];
|
|
|
|
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID!" };
|
|
if (_org isEqualTo createHashMap) exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid Org data!" };
|
|
|
|
GVAR(OrgStore) call ["init", [_uid, _org]];
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(requestGetOrg), {
|
|
params [["_uid", "", [""]], ["_sync", false, [false]]];
|
|
|
|
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID!" };
|
|
GVAR(OrgStore) call ["get", [_uid, _sync]];
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(requestSetOrg), {
|
|
params [["_uid", "", [""]], ["_key", "", [""]], ["_value", nil, [[], "", 0, false, createHashMap]], ["_sync", false, [false]]];
|
|
|
|
if (_uid isEqualTo "" || _key isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID or Key!" };
|
|
GVAR(OrgStore) call ["set", [_uid, _key, _value, _sync]];
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(requestMSetOrg), {
|
|
params [["_uid", "", [""]], ["_fieldValuePairs", createHashMap, [createHashMap]], ["_sync", false, [false]]];
|
|
|
|
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID!" };
|
|
if ((_fieldValuePairs isEqualTo createHashMap) || !(_fieldValuePairs isEqualType createHashMap)) exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid field pairs!" };
|
|
|
|
GVAR(OrgStore) call ["mset", [_uid, _fieldValuePairs, _sync]];
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(requestSaveOrg), {
|
|
params [["_uid", "", [""]], ["_sync", false, [false]]];
|
|
|
|
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID!" };
|
|
GVAR(OrgStore) call ["save", [_uid, _sync]];
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(requestRemoveOrg), {
|
|
params [["_uid", "", [""]]];
|
|
|
|
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID!" };
|
|
GVAR(OrgStore) call ["remove", [_uid]];
|
|
}] call CFUNC(addEventHandler);
|