71 lines
2.1 KiB
Plaintext
71 lines
2.1 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* File: fnc_initVAStore.sqf
|
|
* Author: IDSolutions
|
|
* Date: 2025-12-17
|
|
* Last Update: 2026-01-10
|
|
* Public: No
|
|
*
|
|
* Description:
|
|
* Initializes the Virtual Arsenal store for managing player arsenal unlocks.
|
|
* Provides methods for syncing, saving, and applying virtual items to BIS Arsenal.
|
|
*
|
|
* 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 _typeVArsenal = compileFinal createHashMapFromArray [
|
|
["#base", EGVAR(common,BaseStore)],
|
|
["#type", "IVArsenalBase"],
|
|
["init", {
|
|
params [["_uid", "", [""]], ["_defaultVArsenal", createHashMap, [createHashMap]]];
|
|
|
|
private _finalVArsenal = createHashMap;
|
|
|
|
["owned:locker:exists", [_uid]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
|
private _exists = _result == "true";
|
|
|
|
if !(_exists) then {
|
|
_finalVArsenal = _defaultVArsenal;
|
|
|
|
["owned:locker:create", [_uid]] call EFUNC(extension,extCall);
|
|
["INFO", format ["Created new VArsenal for %1", _uid], nil, nil] call EFUNC(common,log);
|
|
} else {
|
|
private _existingVArsenal = _self call ["fetch", [_uid]];
|
|
_finalVArsenal = _existingVArsenal;
|
|
|
|
{
|
|
if !(_x in _finalVArsenal) then { _finalVArsenal set [_x, _y]; };
|
|
} forEach _defaultVArsenal;
|
|
};
|
|
|
|
GVAR(VArsenalRegistry) set [_uid, _finalVArsenal];
|
|
|
|
private _player = [_uid] call EFUNC(common,getPlayer);
|
|
[CRPC(locker,responseInitVA), [_finalVArsenal], _player] call CFUNC(targetEvent);
|
|
|
|
_finalVArsenal
|
|
}]
|
|
];
|
|
|
|
GVAR(VArsenalStore) = createHashMapObject [[
|
|
["#base", _typeVArsenal],
|
|
["#type", "IVArsenalStore"],
|
|
["#create", {
|
|
GVAR(VArsenalRegistry) = createHashMap;
|
|
|
|
["INFO", "VArsenal Store Initialized!", nil, nil] call EFUNC(common,log);
|
|
}]
|
|
]];
|
|
|
|
SETMVAR(FORGE_VArsenalStore,GVAR(VArsenalStore));
|
|
GVAR(VArsenalStore)
|