67 lines
1.9 KiB
Plaintext
67 lines
1.9 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* File: fnc_initLockerStore.sqf
|
|
* Author: IDSolutions
|
|
* Date: 2025-12-17
|
|
* Last Update: 2026-01-10
|
|
* Public: No
|
|
*
|
|
* Description:
|
|
* Initializes the Locker store for managing player locker items.
|
|
* Provides methods for syncing, saving, and applying locker items to the player's locker.
|
|
*
|
|
* Parameter(s):
|
|
* N/A
|
|
*
|
|
* Returns:
|
|
* vArsenal class object [HASHMAP OBJECT]
|
|
*
|
|
* Example(s):
|
|
* [parameter] call forge_client_locker_fnc_initVAStore;
|
|
*/
|
|
|
|
#pragma hemtt ignore_variables ["_self"]
|
|
private _typeLocker = compileFinal createHashMapFromArray [
|
|
["#base", EGVAR(common,BaseStore)],
|
|
["#type", "ILockerBase"],
|
|
["init", {
|
|
params [["_uid", "", [""]], ["_defaultLocker", createHashMap, [createHashMap]]];
|
|
|
|
private _finalLocker = createHashMap;
|
|
|
|
["locker:exists", [_uid]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
|
private _exists = _result == "true";
|
|
|
|
if !(_exists) then {
|
|
_finalLocker = _defaultLocker;
|
|
|
|
["locker:create", [_uid]] call EFUNC(extension,extCall);
|
|
["INFO", format ["Created new locker for %1", _uid], nil, nil] call EFUNC(common,log);
|
|
} else {
|
|
_finalLocker = _self call ["fetch", [_uid]];
|
|
["INFO", format ["Found locker for %1", _uid], nil, nil] call EFUNC(common,log);
|
|
};
|
|
|
|
GVAR(LockerRegistry) set [_uid, _finalLocker];
|
|
|
|
private _player = [_uid] call EFUNC(common,getPlayer);
|
|
[CRPC(locker,responseInitLocker), [_finalLocker], _player] call CFUNC(targetEvent);
|
|
|
|
_finalLocker
|
|
}]
|
|
];
|
|
|
|
GVAR(LockerStore) = createHashMapObject [[
|
|
["#base", _typeLocker],
|
|
["#type", "ILockerStore"],
|
|
["#create", {
|
|
GVAR(LockerRegistry) = createHashMap;
|
|
|
|
["INFO", "Locker Store Initialized!", nil, nil] call EFUNC(common,log);
|
|
}]
|
|
]];
|
|
|
|
SETMVAR(FORGE_LockerStore,GVAR(LockerStore));
|
|
GVAR(LockerStore)
|