#include "..\script_component.hpp"

/*
 * Author: IDSolutions
 * Updates the arsenal system variables when unlocks change
 *
 * Arguments:
 * 0: Type <STRING> ("armory" or "garage")
 * 1: Data <ARRAY> (Array of unlocks)
 *
 * Example:
 * ["armory", _armory_unlocks] call forge_client_arsenal_fnc_updateUnlocks
 */

params [["_type", "", [""]], ["_data", [], [[]]]];

switch (_type) do {
    case "armory": {
        GVAR(armory_unlocks) = _data;

        GVAR(item_unlocks) = _data select 0;
        GVAR(weapon_unlocks) = _data select 1;
        GVAR(magazine_unlocks) = _data select 2;
        GVAR(backpack_unlocks) = _data select 3;
        
        TRACE_1("Armory unlocks updated",count GVAR(armory_unlocks));
    };
    
    case "garage": {
        GVAR(garage_unlocks) = _data;

        GVAR(car_unlocks) = _data select 0;
        GVAR(armor_unlocks) = _data select 1;
        GVAR(heli_unlocks) = _data select 2;
        GVAR(plane_unlocks) = _data select 3;
        GVAR(naval_unlocks) = _data select 4;
        GVAR(static_unlocks) = _data select 5;
        
        TRACE_1("Garage unlocks updated",count GVAR(garage_unlocks));
    };
};