43 lines
1.2 KiB
Plaintext
43 lines
1.2 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* Author: IDSolutions
|
|
* Adds item to player's armory unlocks and updates virtual arsenal
|
|
*/
|
|
|
|
params [["_class", "", [""]], ["_type", "", [""]]];
|
|
|
|
private _default = [[],[],[],[]];
|
|
// private _armory_unlocks = player getVariable ["Armory_Unlocks", _default];
|
|
private _armory_unlocks = GETVAR(player,Armory_Unlocks,_default);
|
|
|
|
private _typeToNumber = switch (_type) do {
|
|
case "backpack": {3};
|
|
case "facewear": {0};
|
|
case "headgear": {0};
|
|
case "hmd": {0};
|
|
case "item": {0};
|
|
case "magazine": {2};
|
|
case "uniform": {0};
|
|
case "vest": {0};
|
|
case "weapon": {1};
|
|
default {0};
|
|
};
|
|
|
|
private _index = (_armory_unlocks select _typeToNumber) pushBackUnique _class;
|
|
|
|
if (_index > -1) then {
|
|
// player setVariable ["Armory_Unlocks", _armory_unlocks, true];
|
|
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
|
|
}; |