forge/arma/server/addons/locker/XEH_preInit.sqf
Jacob Schmidt ebfe77a340 feat: implement complete Forge framework with Rust/Redis backend and Arma 3 integration
Implemented features:
- High-performance Rust extension with Redis persistence
- Actor/player management with loadout, position, and state tracking
- Banking system with deposit, withdraw, and transfer operations
- Physical and virtual garage/locker systems for vehicle and equipment storage
- Organization management with member tracking and permissions
- Client-side UI with React-like state management
- Server-side event-driven architecture with CBA Events
- Security: Self-transfer prevention at multiple layers
- Logging system with per-module log files
- ICOM module for inter-server communication

Co-Authored-By: Warp <agent@warp.dev>
2026-01-04 12:52:15 -06:00

130 lines
5.5 KiB
Plaintext

#include "script_component.hpp"
PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
// private _category = [QUOTE(MOD_NAME), LLSTRING(displayName)];
[QGVAR(requestInitLocker), {
params [["_uid", "", [""]], ["_locker", createHashMap, [createHashMap]]];
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid UID!" };
GVAR(LockerStore) call ["init", [_uid, _locker]];
}] call CFUNC(addEventHandler);
[QGVAR(requestGetLocker), {
params [["_uid", "", [""]], ["_sync", false, [false]]];
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid UID!" };
private _session = EGVAR(actor,PlayerSessions) getOrDefault [_uid, nil];
if (isNil "_session") exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid Session!" };
GVAR(LockerStore) call ["get", [_uid, _sync]];
}] call CFUNC(addEventHandler);
[QGVAR(requestSetLocker), {
params [["_uid", "", [""]], ["_key", "", [""]], ["_value", nil, [[], "", 0, false, createHashMap]], ["_sync", false, [false]]];
if (_uid isEqualTo "" || _key isEqualTo "") exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid UID or Key!" };
private _session = EGVAR(actor,PlayerSessions) getOrDefault [_uid, nil];
if (isNil "_session") exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid Session!" };
GVAR(LockerStore) call ["set", [_uid, _key, _value, _sync]];
}] call CFUNC(addEventHandler);
[QGVAR(requestMSetLocker), {
params [["_uid", "", [""]], ["_fieldValuePairs", createHashMap, [createHashMap]], ["_sync", false, [false]]];
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid UID!" };
if ((_fieldValuePairs isEqualTo createHashMap) || !(_fieldValuePairs isEqualType createHashMap)) exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid field pairs!" };
private _session = EGVAR(actor,PlayerSessions) getOrDefault [_uid, nil];
if (isNil "_session") exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid Session!" };
GVAR(LockerStore) call ["mset", [_uid, _fieldValuePairs, _sync]];
}] call CFUNC(addEventHandler);
[QGVAR(requestSaveLocker), {
params [["_uid", "", [""]], ["_sync", false, [false]]];
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid UID!" };
private _session = EGVAR(actor,PlayerSessions) getOrDefault [_uid, nil];
if (isNil "_session") exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid Session!" };
GVAR(LockerStore) call ["save", [_uid, _sync]];
}] call CFUNC(addEventHandler);
[QGVAR(requestRemoveLocker), {
params [["_uid", "", [""]]];
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid UID!" };
GVAR(LockerStore) call ["remove", [_uid]];
}] call CFUNC(addEventHandler);
[QGVAR(requestInitVA), {
params [["_uid", "", [""]], ["_vArsenal", createHashMap, [createHashMap]]];
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid UID!" };
if (_vArsenal isEqualTo createHashMap) exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid VArsenal data!" };
GVAR(VArsenalStore) call ["init", [_uid, _vArsenal]];
}] call CFUNC(addEventHandler);
[QGVAR(requestGetVA), {
params [["_uid", "", [""]], ["_sync", false, [false]]];
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid UID!" };
private _session = EGVAR(actor,PlayerSessions) getOrDefault [_uid, nil];
if (isNil "_session") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid Session!" };
GVAR(VArsenalStore) call ["get", [_uid, _sync]];
}] call CFUNC(addEventHandler);
[QGVAR(requestSetVA), {
params [["_uid", "", [""]], ["_key", "", [""]], ["_value", nil, [[], "", 0, false, createHashMap]], ["_sync", false, [false]]];
if (_uid isEqualTo "" || _key isEqualTo "") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid UID or Key!" };
private _session = EGVAR(actor,PlayerSessions) getOrDefault [_uid, nil];
if (isNil "_session") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid Session!" };
GVAR(VArsenalStore) call ["set", [_uid, _key, _value, _sync]];
}] call CFUNC(addEventHandler);
[QGVAR(requestMSetVA), {
params [["_uid", "", [""]], ["_fieldValuePairs", createHashMap, [createHashMap]], ["_sync", false, [false]]];
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid UID!" };
if ((_fieldValuePairs isEqualTo createHashMap) || !(_fieldValuePairs isEqualType createHashMap)) exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid field pairs!" };
private _session = EGVAR(actor,PlayerSessions) getOrDefault [_uid, nil];
if (isNil "_session") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid Session!" };
GVAR(VArsenalStore) call ["mset", [_uid, _fieldValuePairs, _sync]];
}] call CFUNC(addEventHandler);
[QGVAR(requestSaveVA), {
params [["_uid", "", [""]], ["_sync", false, [false]]];
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid UID!" };
private _session = EGVAR(actor,PlayerSessions) getOrDefault [_uid, nil];
if (isNil "_session") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid Session!" };
GVAR(VArsenalStore) call ["save", [_uid, _sync]];
}] call CFUNC(addEventHandler);
[QGVAR(requestRemoveVA), {
params [["_uid", "", [""]]];
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid UID!" };
GVAR(VArsenalStore) call ["remove", [_uid]];
}] call CFUNC(addEventHandler);