151 lines
6.9 KiB
Plaintext
151 lines
6.9 KiB
Plaintext
#include "script_component.hpp"
|
|
|
|
PREP_RECOMPILE_START;
|
|
#include "XEH_PREP.hpp"
|
|
PREP_RECOMPILE_END;
|
|
|
|
// private _category = [QUOTE(MOD_NAME), LLSTRING(displayName)];
|
|
|
|
[QGVAR(requestInitGarage), {
|
|
params [["_uid", "", [""]], ["_garage", createHashMap, [createHashMap]]];
|
|
|
|
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid UID!" };
|
|
GVAR(GarageStore) call ["init", [_uid, _garage]];
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(requestGetGarage), {
|
|
params [["_uid", "", [""]], ["_sync", false, [false]]];
|
|
|
|
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid UID!" };
|
|
|
|
private _session = EGVAR(actor,PlayerSessions) getOrDefault [_uid, nil];
|
|
if (isNil "_session") exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid Session!" };
|
|
|
|
GVAR(GarageStore) call ["get", [GVAR(GarageRegistry), "garage:get", _uid, _sync]];
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(requestSetGarage), {
|
|
params [["_uid", "", [""]], ["_key", "", [""]], ["_value", nil, [[], "", 0, false, createHashMap]], ["_sync", false, [false]]];
|
|
|
|
if (_uid isEqualTo "" || _key isEqualTo "") exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid UID or Key!" };
|
|
|
|
private _session = EGVAR(actor,PlayerSessions) getOrDefault [_uid, nil];
|
|
if (isNil "_session") exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid Session!" };
|
|
|
|
private _hashMap = GVAR(GarageStore) call ["set", [GVAR(GarageRegistry), "garage:update", _uid, _key, _value, _sync]];
|
|
private _player = [_uid] call EFUNC(common,getPlayer);
|
|
|
|
[CRPC(garage,responseSyncGarage), [_hashMap], _player] call CFUNC(targetEvent);
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(requestMSetGarage), {
|
|
params [["_uid", "", [""]], ["_fieldValuePairs", createHashMap, [createHashMap]], ["_sync", false, [false]]];
|
|
|
|
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid UID!" };
|
|
if ((_fieldValuePairs isEqualTo createHashMap) || !(_fieldValuePairs isEqualType createHashMap)) exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid field pairs!" };
|
|
|
|
private _session = EGVAR(actor,PlayerSessions) getOrDefault [_uid, nil];
|
|
if (isNil "_session") exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid Session!" };
|
|
|
|
private _hashMap = GVAR(GarageStore) call ["mset", [GVAR(GarageRegistry), "garage:update", _uid, _fieldValuePairs, _sync]];
|
|
private _player = [_uid] call EFUNC(common,getPlayer);
|
|
|
|
[CRPC(garage,responseSyncGarage), [_hashMap], _player] call CFUNC(targetEvent);
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(requestSaveGarage), {
|
|
params [["_uid", "", [""]], ["_sync", false, [false]]];
|
|
|
|
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid UID!" };
|
|
|
|
private _session = EGVAR(actor,PlayerSessions) getOrDefault [_uid, nil];
|
|
if (isNil "_session") exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid Session!" };
|
|
|
|
private _finalData = GVAR(GarageStore) call ["save", [GVAR(GarageRegistry), "garage:update", _uid, _sync]];
|
|
private _player = [_uid] call EFUNC(common,getPlayer);
|
|
|
|
[CRPC(garage,responseSyncGarage), [_finalData], _player] call CFUNC(targetEvent);
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(requestRemoveGarage), {
|
|
params [["_uid", "", [""]]];
|
|
|
|
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid UID!" };
|
|
|
|
GVAR(GarageStore) call ["remove", [GVAR(GarageRegistry), _uid]];
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(requestInitVG), {
|
|
params [["_uid", "", [""]], ["_vGarage", createHashMap, [createHashMap]]];
|
|
|
|
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid UID!" };
|
|
if (_vGarage isEqualTo createHashMap) exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid VGarage data!" };
|
|
|
|
GVAR(VGarageStore) call ["init", [_uid, _vGarage]];
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(requestGetVG), {
|
|
params [["_uid", "", [""]], ["_sync", false, [false]]];
|
|
|
|
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid UID!" };
|
|
|
|
private _session = EGVAR(actor,PlayerSessions) getOrDefault [_uid, nil];
|
|
if (isNil "_session") exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid Session!" };
|
|
|
|
private _hashMap = GVAR(VGarageStore) call ["get", [GVAR(VGarageRegistry), "owned:garage:fetch", _uid, _sync]];
|
|
private _player = [_uid] call EFUNC(common,getPlayer);
|
|
|
|
[CRPC(garage,responseSyncVG), [_hashMap], _player] call CFUNC(targetEvent);
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(requestSetVG), {
|
|
params [["_uid", "", [""]], ["_key", "", [""]], ["_value", nil, [[], "", 0, false, createHashMap]], ["_sync", false, [false]]];
|
|
|
|
if (_uid isEqualTo "" || _key isEqualTo "") exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid UID or Key!" };
|
|
|
|
private _session = EGVAR(actor,PlayerSessions) getOrDefault [_uid, nil];
|
|
if (isNil "_session") exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid Session!" };
|
|
|
|
private _hashMap = GVAR(VGarageStore) call ["set", [GVAR(VGarageRegistry), "", _uid, _key, _value, _sync]];
|
|
private _player = [_uid] call EFUNC(common,getPlayer);
|
|
|
|
[CRPC(garage,responseSyncVG), [_hashMap], _player] call CFUNC(targetEvent);
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(requestMSetVG), {
|
|
params [["_uid", "", [""]], ["_fieldValuePairs", createHashMap, [createHashMap]], ["_sync", false, [false]]];
|
|
|
|
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid UID!" };
|
|
if ((_fieldValuePairs isEqualTo createHashMap) || !(_fieldValuePairs isEqualType createHashMap)) exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid field pairs!" };
|
|
|
|
private _session = EGVAR(actor,PlayerSessions) getOrDefault [_uid, nil];
|
|
if (isNil "_session") exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid Session!" };
|
|
|
|
private _hashMap = GVAR(VGarageStore) call ["mset", [GVAR(VGarageRegistry), "", _uid, _fieldValuePairs, _sync]];
|
|
private _player = [_uid] call EFUNC(common,getPlayer);
|
|
|
|
[CRPC(garage,responseSyncVG), [_hashMap], _player] call CFUNC(targetEvent);
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(requestSaveVG), {
|
|
params [["_uid", "", [""]], ["_sync", false, [false]]];
|
|
|
|
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid UID!" };
|
|
|
|
private _session = EGVAR(actor,PlayerSessions) getOrDefault [_uid, nil];
|
|
if (isNil "_session") exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid Session!" };
|
|
|
|
private _finalData = GVAR(VGarageStore) call ["save", [GVAR(VGarageRegistry), "", _uid, _sync]];
|
|
private _player = [_uid] call EFUNC(common,getPlayer);
|
|
|
|
[CRPC(garage,responseSyncVG), [_finalData], _player] call CFUNC(targetEvent);
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(requestRemoveVG), {
|
|
params [["_uid", "", [""]]];
|
|
|
|
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid UID!" };
|
|
|
|
GVAR(VGarageStore) call ["remove", [GVAR(VGarageRegistry), _uid]];
|
|
}] call CFUNC(addEventHandler);
|