client/addons/arsenal/functions/fnc_addArmoryItem.sqf
Jacob Schmidt 55f60dc71f feat: Revamp admin panel, store, and arsenal systems
This commit introduces significant changes to the admin panel, store, and arsenal systems, focusing on improved functionality, UI enhancements, and code optimization.

**Admin Panel:**
- Migrated to a web-based UI for improved user experience and maintainability.
- Implemented dynamic player listing with filtering and search capabilities.
- Added functionality for managing player paygrades, sending messages, and transferring funds.
- Integrated server-side events for handling admin actions.

**Store:**
- Added `handleDelivery` event handler.
- Streamlined product selection and purchase processes.
- Improved handling of organization funds and player balances.
- Refactored code for better readability and maintainability.

**Arsenal:**
- Enhanced initialization process with improved data validation.
- Optimized item unlocking logic.

These changes aim to provide a more robust, user-friendly, and efficient experience for both administrators and players.
2025-05-03 19:33:10 -05:00

56 lines
1.3 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Function: forge_client_arsenal_fnc_addArmoryItem
* Author: IDSolutions
*
* [Description]
* Adds item to player's armory unlocks and updates virtual arsenal
*
* Arguments:
* 0: Classname of item to add <STRING>
* 1: Type of item to add <STRING>
*
* Return Value:
* None
*
* Examples:
* ["B_AssaultPack_rgr", "backpack"] call forge_client_arsenal_fnc_addArmoryItem
*
* Public: Yes
*/
params [["_class", "", [""]], ["_type", "", [""]]];
private _default = [[],[],[],[]];
private _armory_unlocks = GETVAR(player,Armory_Unlocks,_default);
private _typeToNumber = switch (_type) do {
case "facewear";
case "headgear";
case "hmd";
case "item";
case "uniform";
case "vest": {0};
case "weapon": {1};
case "magazine": {2};
case "backpack": {3};
default {0};
};
private _index = (_armory_unlocks select _typeToNumber) pushBackUnique _class;
if (_index > -1) then {
SETPVAR(player,Armory_Unlocks,_armory_unlocks);
if (GVAR(armory_type) == 0) then {
[GVAR(gear_box), [_class], false, true, 1, _typeToNumber] call BFUNC(addVirtualItemCargo);
} else {
[GVAR(gear_box), [_class]] call AFUNC(arsenal,addVirtualItems);
};
TRACE_2("Item added to armory",_class,_type);
true
} else {
false
};