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>
110 lines
3.6 KiB
Plaintext
110 lines
3.6 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* File: fnc_initGarageStore.sqf
|
|
* Author: IDSolutions
|
|
* Date: 2025-12-17
|
|
* Last Update: 2026-01-03
|
|
* Public: No
|
|
*
|
|
* Description:
|
|
* Initializes the Garage store for managing player vehicles.
|
|
* Provides methods for syncing, saving, and applying vehicles to the player's garage.
|
|
*
|
|
* Parameter(s):
|
|
* N/A
|
|
*
|
|
* Returns:
|
|
* Something [BOOL]
|
|
*
|
|
* Example(s):
|
|
* [parameter] call forge_x_component_fnc_myFunction
|
|
*/
|
|
|
|
#pragma hemtt ignore_variables ["_self"]
|
|
GVAR(GarageStore) = createHashMapObject [[
|
|
["#base", EGVAR(common,BaseStore)],
|
|
["#type", "IGarageStore"],
|
|
["#create", {
|
|
GVAR(GarageRegistry) = createHashMap;
|
|
|
|
_self set ["_registry", GVAR(GarageRegistry)];
|
|
_self set ["_extCallPrefix", "garage"];
|
|
_self set ["_readMethod", "get"];
|
|
_self set ["_storeName", "Garage"];
|
|
_self set ["_syncEventName", CRPC(garage,responseSyncGarage)];
|
|
|
|
["INFO", "Garage Store Initialized!", nil, nil] call EFUNC(common,log);
|
|
}],
|
|
["init", {
|
|
params [["_uid", "", [""]], ["_defaultGarage", createHashMap, [createHashMap]]];
|
|
|
|
private _finalGarage = createHashMap;
|
|
|
|
["garage:exists", [_uid]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
|
private _exists = _result == "true";
|
|
|
|
if !(_exists) then {
|
|
_finalGarage = _defaultGarage;
|
|
|
|
["garage:create", [_uid]] call EFUNC(extension,extCall);
|
|
["INFO", format ["Created new garage for %1", _uid], nil, nil] call EFUNC(common,log);
|
|
} else {
|
|
_finalGarage = _self call ["fetch", [_uid]];
|
|
["INFO", format ["Found garage for %1", _uid], nil, nil] call EFUNC(common,log);
|
|
};
|
|
|
|
GVAR(GarageRegistry) set [_uid, _finalGarage];
|
|
|
|
private _player = [_uid] call EFUNC(common,getPlayer);
|
|
[CRPC(garage,responseInitGarage), [_finalGarage], _player] call CFUNC(targetEvent);
|
|
|
|
_finalGarage
|
|
}],
|
|
["set", {
|
|
params [["_uid", "", [""]], ["_field", "", [""]], ["_value", nil], ["_sync", false, [false]]];
|
|
|
|
private _existingData = GVAR(GarageRegistry) get _uid;
|
|
private _finalData = +_existingData;
|
|
private _hashMap = createHashMap;
|
|
|
|
_finalData set [_field, _value];
|
|
_hashMap set [_field, _value];
|
|
GVAR(GarageRegistry) set [_uid, _finalData];
|
|
|
|
if (_sync) then {
|
|
private _json = _self call ["toJSON", [_finalData]];
|
|
["garage:update", [_uid, _json]] call EFUNC(extension,extCall);
|
|
};
|
|
|
|
private _player = [_uid] call EFUNC(common,getPlayer);
|
|
[CRPC(garage,responseSyncGarage), [_hashMap], _player] call CFUNC(targetEvent);
|
|
|
|
_hashMap
|
|
}],
|
|
["mset", {
|
|
params [["_uid", "", [""]], ["_fieldValuePairs", createHashMap, [createHashMap]], ["_sync", false, [false]]];
|
|
|
|
private _existingData = GVAR(GarageRegistry) get _uid;
|
|
private _finalData = +_existingData;
|
|
private _hashMap = createHashMap;
|
|
|
|
{ _finalData set [_x, _y]; } forEach _fieldValuePairs;
|
|
{ _hashMap set [_x, _y]; } forEach _fieldValuePairs;
|
|
GVAR(GarageRegistry) set [_uid, _finalData];
|
|
|
|
if (_sync) then {
|
|
private _json = _self call ["toJSON", [_finalData]];
|
|
["garage:update", [_uid, _json]] call EFUNC(extension,extCall);
|
|
};
|
|
|
|
private _player = [_uid] call EFUNC(common,getPlayer);
|
|
[CRPC(garage,responseSyncGarage), [_hashMap], _player] call CFUNC(targetEvent);
|
|
|
|
_hashMap
|
|
}]
|
|
]];
|
|
|
|
SETMVAR(FORGE_GarageStore,GVAR(GarageStore));
|
|
GVAR(GarageStore)
|