client/addons/arsenal/functions/fnc_saveUnlocks.sqf
Jacob Schmidt d474b3676a
All checks were successful
Build / Build (push) Successful in 28s
Refactor: Standardize function descriptions and variable handling
This commit refactors several client-side functions to improve code consistency and readability.

- Standardizes function descriptions by removing redundant "Function: forge_client..." prefixes and "[Description]" sections, focusing on concise descriptions of the function's purpose.
- Updates variable handling in arsenal functions to use GVAR and EGVARS for default values, improving consistency and reducing code duplication.
- Removes the bank init function as it is no longer needed.
- Adds a done variable to the preinit file.
2025-05-25 11:30:26 -05:00

57 lines
1.6 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Saves arsenal/garage unlocks to appropriate storage based on persistence mode
*
* Arguments:
* 0: Type <STRING> ("armory" or "garage")
*
* Return Value:
* None
*
* Examples:
* ["armory"] call forge_client_arsenal_fnc_saveUnlocks
*
* Public: Yes
*/
params [["_type", "", [""]]];
switch (_type) do {
case "armory": {
private _armory_data = GETVAR(player,Armory_Unlocks,GVAR(default_armory));
switch (GVAR(pdb_mode)) do {
case 0: {
SETVAR(profileNamespace,Armory_Unlocks,_armory_data);
};
case 1: {
["hsetid", getPlayerUID player, "armory_unlocks", -1, _armory_data, "", false] remoteExec ["dragonfly_db_fnc_addTask", 2, false];
};
default {
SETVAR(profileNamespace,Armory_Unlocks,_armory_data);
};
};
[_type, _armory_data] call FUNC(updateUnlocks);
};
case "garage": {
private _garage_data = GETVAR(player,Garage_Unlocks,GVAR(default_garage));
switch (GVAR(pdb_mode)) do {
case 0: {
SETVAR(profileNamespace,Garage_Unlocks,_garage_data);
};
case 1: {
["hsetid", getPlayerUID player, "garage_unlocks", -1, _garage_data, "", false] remoteExec ["dragonfly_db_fnc_addTask", 2, false];
};
default {
SETVAR(profileNamespace,Garage_Unlocks,_garage_data);
};
};
[_type, _garage_data] call FUNC(updateUnlocks);
};
};