forge/arma/server/addons/org/XEH_preInit.sqf

71 lines
2.7 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", "", [""]]];
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID!" };
GVAR(OrgStore) call ["init", [_uid]];
}] call CFUNC(addEventHandler);
[QGVAR(requestGetOrg), {
params [["_uid", "", [""]], ["_field", "", [""]]];
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID!" };
private _index = GVAR(IndexRegistry) get _uid;
private _key = _index get "orgID";
private _finalData = GVAR(OrgStore) call ["get", [GVAR(Registry), _key, _field]];
private _player = [_uid] call EFUNC(common,getPlayer);
[CRPC(org,responseSyncOrg), [_finalData], _player] call CFUNC(targetEvent);
}] call CFUNC(addEventHandler);
[QGVAR(requestSetOrg), {
params [["_uid", "", [""]], ["_field", "", [""]], ["_value", nil, [[], "", 0, false, createHashMap]], ["_sync", false, [false]]];
if (_uid isEqualTo "" || _field isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID or Field!" };
private _index = GVAR(IndexRegistry) get _uid;
private _key = _index get "orgID";
GVAR(OrgStore) call ["set", [GVAR(Registry), "org:update", _key, _field, _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!" };
private _index = GVAR(IndexRegistry) get _uid;
private _key = _index get "orgID";
GVAR(OrgStore) call ["mset", [GVAR(Registry), "org:update", _key, _fieldValuePairs, _sync]];
}] call CFUNC(addEventHandler);
[QGVAR(requestSaveOrg), {
params [["_uid", "", [""]]];
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID!" };
private _index = GVAR(IndexRegistry) get _uid;
private _key = _index get "orgID";
GVAR(OrgStore) call ["save", [GVAR(Registry), "org:update", _key]];
}] call CFUNC(addEventHandler);
[QGVAR(requestRemoveOrg), {
params [["_uid", "", [""]]];
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID!" };
private _index = GVAR(IndexRegistry) get _uid;
private _key = _index get "orgID";
GVAR(OrgStore) call ["remove", [GVAR(Registry), "org:update", _key]];
}] call CFUNC(addEventHandler);