2015-12-11 00:02:15 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
ADDON = false;
|
|
|
|
|
|
|
|
PREP(addCustomFilter);
|
|
|
|
PREP(currentItemListBox);
|
|
|
|
PREP(forceItemListUpdate);
|
|
|
|
PREP(inventoryDisplayLoaded);
|
|
|
|
PREP(onLBSelChanged);
|
|
|
|
|
|
|
|
// cache config
|
2015-12-11 12:14:58 +00:00
|
|
|
// items in the inventory display can only be distinguished by their lb names and pictures
|
|
|
|
// this can cause collisions (mainly weapons with attachments),
|
|
|
|
// but if the item has the same name and picture it at least shouldn't change the filter anyway
|
|
|
|
// luckily we don't need private items, so dummy and parent classes are out of the picture
|
2015-12-11 00:02:15 +00:00
|
|
|
|
2015-12-11 12:14:58 +00:00
|
|
|
if !(uiNamespace getVariable [QGVAR(configCached), false]) then {
|
|
|
|
private _fnc_addToCache = {
|
2015-12-11 13:18:11 +00:00
|
|
|
private _displayName = getText (_this >> "displayName");
|
|
|
|
private _picture = getText (_this >> "picture");
|
2015-12-11 00:02:15 +00:00
|
|
|
|
2015-12-11 12:14:58 +00:00
|
|
|
// list box seems to delete the leading backslash
|
|
|
|
if (_picture select [0,1] == "\") then {
|
|
|
|
_picture = _picture select [1];
|
2015-12-11 00:02:15 +00:00
|
|
|
};
|
2015-12-11 12:14:58 +00:00
|
|
|
|
2015-12-11 13:18:11 +00:00
|
|
|
uiNamespace setVariable [format [QGVAR(ItemKey:%1:%2), _displayName, _picture], _this];
|
2015-12-11 12:14:58 +00:00
|
|
|
};
|
|
|
|
|
2015-12-11 13:18:11 +00:00
|
|
|
// weapons and items
|
2015-12-11 12:14:58 +00:00
|
|
|
{
|
2015-12-11 13:18:11 +00:00
|
|
|
if (getNumber (_x >> "scope") > 0) then {_x call _fnc_addToCache};
|
2015-12-11 00:02:15 +00:00
|
|
|
false
|
|
|
|
} count (
|
|
|
|
("true" configClasses (configFile >> "CfgWeapons")) +
|
|
|
|
("true" configClasses (configFile >> "CfgGlasses"))
|
|
|
|
);
|
|
|
|
|
2015-12-11 13:18:11 +00:00
|
|
|
// magazines
|
|
|
|
{
|
|
|
|
if (getNumber (_x >> "scope") == 2) then {_x call _fnc_addToCache};
|
|
|
|
false
|
|
|
|
} count ("true" configClasses (configFile >> "CfgMagazines"));
|
|
|
|
|
2015-12-11 00:02:15 +00:00
|
|
|
// backpacks
|
|
|
|
{
|
2015-12-11 13:18:11 +00:00
|
|
|
if (getNumber (_x >> "scope") > 0 && {getNumber (_x >> "isBackpack") == 1}) then {_x call _fnc_addToCache};
|
2015-12-11 00:02:15 +00:00
|
|
|
false
|
|
|
|
} count ("true" configClasses (configFile >> "CfgVehicles"));
|
|
|
|
|
|
|
|
uiNamespace setVariable [QGVAR(configCached), true];
|
|
|
|
};
|
|
|
|
|
2015-12-11 13:18:11 +00:00
|
|
|
PREP(filterWeapons);
|
|
|
|
PREP(filterMagazines);
|
|
|
|
PREP(filterItems);
|
2015-12-11 12:14:58 +00:00
|
|
|
PREP(filterHeadgear);
|
|
|
|
PREP(filterUniforms);
|
|
|
|
PREP(filterVests);
|
|
|
|
PREP(filterBackpacks);
|
|
|
|
PREP(filterGrenades);
|
|
|
|
PREP(filterMedical);
|
|
|
|
|
2015-12-11 00:02:15 +00:00
|
|
|
ADDON = true;
|