mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Arsenal - Add Sorting Algorithms (#7719)
* support per tab sorting, and external algorithms * improved sub sorting * improve alphabetical search * update mod sorting * sort by accuracy * sort right panel * more sorts * sort right tab * fix empty * stringtables * Apply suggestions from code review Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com> * more suggestions * suggestions * remember last sort * Fix missing throw and put names * bad copy paste in stringtable * Update addons/arsenal/functions/fnc_sortPanel.sqf Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
parent
4d769e4b8f
commit
d72555ab0c
64
addons/arsenal/ACE_Arsenal_Sorts.hpp
Normal file
64
addons/arsenal/ACE_Arsenal_Sorts.hpp
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
class GVAR(sorts) {
|
||||||
|
class sortBase {
|
||||||
|
scope = 1;
|
||||||
|
displayName = "";
|
||||||
|
tabs[] = {{}, {}};
|
||||||
|
statement = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
class ACE_alphabetically: sortBase {
|
||||||
|
scope = 2;
|
||||||
|
displayName = "$STR_a3_rscdisplayarsenal_sort_alphabet";
|
||||||
|
tabs[] = {{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}, {0,1,2,3,4,5,6,7}};
|
||||||
|
statement = QUOTE({});
|
||||||
|
};
|
||||||
|
|
||||||
|
class ACE_mod: sortBase {
|
||||||
|
scope = 2;
|
||||||
|
displayName = "$STR_a3_rscdisplayarsenal_sort_mod";
|
||||||
|
tabs[] = {{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}, {0,1,2,3,4,5,6,7}};
|
||||||
|
statement = QUOTE(_this call FUNC(sortStatement_mod));
|
||||||
|
};
|
||||||
|
|
||||||
|
class ACE_mass: sortBase {
|
||||||
|
scope = 2;
|
||||||
|
displayName = CSTRING(sortByWeightText);
|
||||||
|
tabs[] = {{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}, {0,1,2,3,4,5,6,7}};
|
||||||
|
statement = QUOTE(_this call FUNC(sortStatement_mass));
|
||||||
|
};
|
||||||
|
|
||||||
|
class ACE_load: sortBase {
|
||||||
|
scope = 2;
|
||||||
|
displayName = CSTRING(sortByLoadText);
|
||||||
|
tabs[] = {{3,4,5}, {}};
|
||||||
|
statement = QUOTE(getContainerMaxLoad configName _this);
|
||||||
|
};
|
||||||
|
|
||||||
|
class ACE_accuracy: sortBase {
|
||||||
|
scope = 2;
|
||||||
|
displayName = CSTRING(sortByAccuracyText);
|
||||||
|
tabs[] = {{0,1,2}, {}};
|
||||||
|
statement = QUOTE(_this call FUNC(sortStatement_accuracy));
|
||||||
|
};
|
||||||
|
|
||||||
|
class ACE_rateOfFire: sortBase {
|
||||||
|
scope = 2;
|
||||||
|
displayName = CSTRING(sortByRateOfFireText);
|
||||||
|
tabs[] = {{0,1,2}, {}};
|
||||||
|
statement = QUOTE(_this call FUNC(sortStatement_rateOfFire));
|
||||||
|
};
|
||||||
|
|
||||||
|
class ACE_scopeMag: sortBase {
|
||||||
|
scope = 2;
|
||||||
|
displayName = CSTRING(sortByMagnificationText);
|
||||||
|
tabs[] = {{}, {0}};
|
||||||
|
statement = QUOTE(_this call FUNC(sortStatement_scopeMag));
|
||||||
|
};
|
||||||
|
|
||||||
|
class ACE_magCount: sortBase {
|
||||||
|
scope = 2;
|
||||||
|
displayName = CSTRING(sortByMagCountText);
|
||||||
|
tabs[] = {{}, {4}};
|
||||||
|
statement = QUOTE(_this call FUNC(sortStatement_magCount));
|
||||||
|
};
|
||||||
|
};
|
@ -1,5 +1,6 @@
|
|||||||
PREP(addDefaultLoadout);
|
PREP(addDefaultLoadout);
|
||||||
PREP(addListBoxItem);
|
PREP(addListBoxItem);
|
||||||
|
PREP(addSort);
|
||||||
PREP(addRightPanelButton);
|
PREP(addRightPanelButton);
|
||||||
PREP(addStat);
|
PREP(addStat);
|
||||||
PREP(addVirtualItems);
|
PREP(addVirtualItems);
|
||||||
@ -27,10 +28,12 @@ PREP(buttonLoadoutsShare);
|
|||||||
PREP(buttonStats);
|
PREP(buttonStats);
|
||||||
PREP(buttonStatsPage);
|
PREP(buttonStatsPage);
|
||||||
PREP(clearSearchbar);
|
PREP(clearSearchbar);
|
||||||
|
PREP(compileSorts);
|
||||||
PREP(compileStats);
|
PREP(compileStats);
|
||||||
PREP(fillLeftPanel);
|
PREP(fillLeftPanel);
|
||||||
PREP(fillLoadoutsList);
|
PREP(fillLoadoutsList);
|
||||||
PREP(fillRightPanel);
|
PREP(fillRightPanel);
|
||||||
|
PREP(fillSort);
|
||||||
PREP(handleLoadoutsSearchbar);
|
PREP(handleLoadoutsSearchbar);
|
||||||
PREP(handleMouse);
|
PREP(handleMouse);
|
||||||
PREP(handleScrollWheel);
|
PREP(handleScrollWheel);
|
||||||
@ -60,6 +63,12 @@ PREP(removeVirtualItems);
|
|||||||
PREP(scanConfig);
|
PREP(scanConfig);
|
||||||
PREP(showItem);
|
PREP(showItem);
|
||||||
PREP(sortPanel);
|
PREP(sortPanel);
|
||||||
|
PREP(sortStatement_accuracy);
|
||||||
|
PREP(sortStatement_magCount);
|
||||||
|
PREP(sortStatement_mass);
|
||||||
|
PREP(sortStatement_mod);
|
||||||
|
PREP(sortStatement_rateOfFire);
|
||||||
|
PREP(sortStatement_scopeMag);
|
||||||
PREP(statBarStatement_accuracy);
|
PREP(statBarStatement_accuracy);
|
||||||
PREP(statBarStatement_default);
|
PREP(statBarStatement_default);
|
||||||
PREP(statBarStatement_impact);
|
PREP(statBarStatement_impact);
|
||||||
|
@ -5,6 +5,8 @@ GVAR(EH_ID) = 0;
|
|||||||
GVAR(lastSearchTextLeft) = "";
|
GVAR(lastSearchTextLeft) = "";
|
||||||
GVAR(lastSearchTextRight) = "";
|
GVAR(lastSearchTextRight) = "";
|
||||||
GVAR(lastSearchTextLoadouts) = "";
|
GVAR(lastSearchTextLoadouts) = "";
|
||||||
|
GVAR(lastSortLeft) = "";
|
||||||
|
GVAR(lastSortRight) = "";
|
||||||
|
|
||||||
[QGVAR(initBox), {_this call FUNC(initBox)}] call CBA_fnc_addEventHandler;
|
[QGVAR(initBox), {_this call FUNC(initBox)}] call CBA_fnc_addEventHandler;
|
||||||
[QGVAR(removeBox), {_this call FUNC(removeBox)}] call CBA_fnc_addEventHandler;
|
[QGVAR(removeBox), {_this call FUNC(removeBox)}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -8,8 +8,6 @@ PREP_RECOMPILE_START;
|
|||||||
PREP_RECOMPILE_END;
|
PREP_RECOMPILE_END;
|
||||||
|
|
||||||
// Arsenal
|
// Arsenal
|
||||||
GVAR(modList) = ["", "curator", "kart", "heli", "mark", "expansion", "expansionpremium"];
|
|
||||||
|
|
||||||
[QGVAR(camInverted), "CHECKBOX", localize LSTRING(invertCameraSetting), localize LSTRING(settingCategory), false] call CBA_Settings_fnc_init;
|
[QGVAR(camInverted), "CHECKBOX", localize LSTRING(invertCameraSetting), localize LSTRING(settingCategory), false] call CBA_Settings_fnc_init;
|
||||||
[QGVAR(enableModIcons), "CHECKBOX", [LSTRING(modIconsSetting), LSTRING(modIconsTooltip)], localize LSTRING(settingCategory), true] call CBA_Settings_fnc_init;
|
[QGVAR(enableModIcons), "CHECKBOX", [LSTRING(modIconsSetting), LSTRING(modIconsTooltip)], localize LSTRING(settingCategory), true] call CBA_Settings_fnc_init;
|
||||||
[QGVAR(fontHeight), "SLIDER", [LSTRING(fontHeightSetting), LSTRING(fontHeightTooltip)], localize LSTRING(settingCategory), [1, 10, 4.5, 1]] call CBA_Settings_fnc_init;
|
[QGVAR(fontHeight), "SLIDER", [LSTRING(fontHeightSetting), LSTRING(fontHeightTooltip)], localize LSTRING(settingCategory), [1, 10, 4.5, 1]] call CBA_Settings_fnc_init;
|
||||||
@ -58,6 +56,7 @@ GVAR(modList) = ["", "curator", "kart", "heli", "mark", "expansion", "expansionp
|
|||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
call FUNC(compileStats);
|
call FUNC(compileStats);
|
||||||
|
call FUNC(compileSorts);
|
||||||
|
|
||||||
[QUOTE(ADDON), {!isNil QGVAR(camera)}] call CBA_fnc_registerFeatureCamera;
|
[QUOTE(ADDON), {!isNil QGVAR(camera)}] call CBA_fnc_registerFeatureCamera;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ class CfgPatches {
|
|||||||
requiredVersion = REQUIRED_VERSION;
|
requiredVersion = REQUIRED_VERSION;
|
||||||
requiredAddons[] = {"ace_common"};
|
requiredAddons[] = {"ace_common"};
|
||||||
author = ECSTRING(common,ACETeam);
|
author = ECSTRING(common,ACETeam);
|
||||||
authors[] = {"alganthe", "mharis001"};
|
authors[] = {"alganthe", "mharis001", "SynixeBrett"};
|
||||||
url = ECSTRING(main,URL);
|
url = ECSTRING(main,URL);
|
||||||
VERSION_CONFIG;
|
VERSION_CONFIG;
|
||||||
};
|
};
|
||||||
@ -20,4 +20,5 @@ class CfgPatches {
|
|||||||
#include "Cfg3DEN.hpp"
|
#include "Cfg3DEN.hpp"
|
||||||
#include "CfgEventHandlers.hpp"
|
#include "CfgEventHandlers.hpp"
|
||||||
#include "RscDisplayMain.hpp"
|
#include "RscDisplayMain.hpp"
|
||||||
|
#include "ACE_Arsenal_Sorts.hpp"
|
||||||
#include "ACE_Arsenal_Stats.hpp"
|
#include "ACE_Arsenal_Stats.hpp"
|
||||||
|
@ -198,9 +198,6 @@
|
|||||||
private _dlcName = _this call GETDLC;\
|
private _dlcName = _this call GETDLC;\
|
||||||
if (_dlcName != "") then {\
|
if (_dlcName != "") then {\
|
||||||
_ctrlPanel lbsetpictureright [_lbAdd,(modParams [_dlcName,["logo"]]) param [0,""]];\
|
_ctrlPanel lbsetpictureright [_lbAdd,(modParams [_dlcName,["logo"]]) param [0,""]];\
|
||||||
_modID = GVAR(modList) find _dlcName;\
|
|
||||||
if (_modID < 0) then {_modID = GVAR(modList) pushback _dlcName;};\
|
|
||||||
_ctrlPanel lbsetvalue [_lbAdd,_modID];\
|
|
||||||
};\
|
};\
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ private _cacheNamespace = _ctrlPanel; //For better readability.
|
|||||||
|
|
||||||
private _cachedItemInfo = _cacheNamespace getVariable [_configCategory+_className, []];
|
private _cachedItemInfo = _cacheNamespace getVariable [_configCategory+_className, []];
|
||||||
|
|
||||||
//_cachedItemInfo == [_displayName, _itemPicture, _modPicture, _modID]
|
//_cachedItemInfo == [_displayName, _itemPicture, _modPicture]
|
||||||
if (_cachedItemInfo isEqualTo []) then {//Not in cache. So get info and put into cache.
|
if (_cachedItemInfo isEqualTo []) then {//Not in cache. So get info and put into cache.
|
||||||
|
|
||||||
private _configPath = configFile >> _configCategory >> _className;
|
private _configPath = configFile >> _configCategory >> _className;
|
||||||
@ -41,9 +41,6 @@ if (_cachedItemInfo isEqualTo []) then {//Not in cache. So get info and put into
|
|||||||
|
|
||||||
if (_dlcName != "") then {
|
if (_dlcName != "") then {
|
||||||
_cachedItemInfo set [2, (modParams [_dlcName,["logo"]]) param [0,""]];//mod picture
|
_cachedItemInfo set [2, (modParams [_dlcName,["logo"]]) param [0,""]];//mod picture
|
||||||
_modID = GVAR(modList) find _dlcName;
|
|
||||||
if (_modID < 0) then {_modID = GVAR(modList) pushback _dlcName;};//We keep a ordered list of all mods for sorting later.
|
|
||||||
_cachedItemInfo set [3, _modID];//mod ID
|
|
||||||
} else {
|
} else {
|
||||||
_cachedItemInfo set [2, ""];//mod picture
|
_cachedItemInfo set [2, ""];//mod picture
|
||||||
_cachedItemInfo set [3, 0];//mod ID
|
_cachedItemInfo set [3, 0];//mod ID
|
||||||
@ -51,12 +48,11 @@ if (_cachedItemInfo isEqualTo []) then {//Not in cache. So get info and put into
|
|||||||
_cacheNamespace setVariable [_configCategory+_className, _cachedItemInfo];
|
_cacheNamespace setVariable [_configCategory+_className, _cachedItemInfo];
|
||||||
};
|
};
|
||||||
|
|
||||||
_cachedItemInfo params ["_displayName", "_itemPicture", "_modPicture", "_modID"];
|
_cachedItemInfo params ["_displayName", "_itemPicture", "_modPicture"];
|
||||||
|
|
||||||
private _lbAdd = _ctrlPanel lbAdd _displayName;
|
private _lbAdd = _ctrlPanel lbAdd _displayName;
|
||||||
|
|
||||||
_ctrlPanel lbSetData [_lbAdd, _className];
|
_ctrlPanel lbSetData [_lbAdd, _className];
|
||||||
_ctrlPanel lbSetPicture [_lbAdd, _itemPicture];
|
_ctrlPanel lbSetPicture [_lbAdd, _itemPicture];
|
||||||
_ctrlPanel lbSetPictureRight [_lbAdd,["",_modPicture] select (GVAR(enableModIcons))];
|
_ctrlPanel lbSetPictureRight [_lbAdd,["",_modPicture] select (GVAR(enableModIcons))];
|
||||||
_ctrlPanel lbSetValue [_lbAdd,_modID];
|
|
||||||
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _className]];
|
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _className]];
|
||||||
|
70
addons/arsenal/functions/fnc_addSort.sqf
Normal file
70
addons/arsenal/functions/fnc_addSort.sqf
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: SynixeBrett
|
||||||
|
* Add a custom sorting method.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Tabs to add stat to <ARRAY>
|
||||||
|
* 0: Left Tab Indexes <ARRAY>
|
||||||
|
* 1: Right Tab Indexes <ARRAY>
|
||||||
|
* 1: Sort Class (a unique string for each algorithm) <STRING>
|
||||||
|
* 2: Display Name <STRING>
|
||||||
|
* 3: Algorithm <CODE>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* 0: Array of IDs (ARRAY of STRINGS)
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [[[0, 1]], "fireRateSort", "Sort by fire rate", {
|
||||||
|
* params ["_itemCfg"];
|
||||||
|
* private _fireModes = getArray (_itemCfg >> "modes");
|
||||||
|
* private _fireRate = [];
|
||||||
|
*
|
||||||
|
* {
|
||||||
|
* _fireRate pushBackUnique (getNumber (_itemCfg >> _x >> "reloadTime"));
|
||||||
|
* } foreach _fireModes;
|
||||||
|
*
|
||||||
|
* _fireRate sort true;
|
||||||
|
* _fireRate param [0, 0]
|
||||||
|
* }] call ACE_arsenal_fnc_addSort;
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_tabs", [[], []], [[]], 2],
|
||||||
|
["_class", "", [""]],
|
||||||
|
["_displayName", "", [""]],
|
||||||
|
["_statement", {}, [{}]]
|
||||||
|
];
|
||||||
|
|
||||||
|
_tabs params [
|
||||||
|
["_leftTabs", [], [[]]],
|
||||||
|
["_rightTabs", [], [[]]]
|
||||||
|
];
|
||||||
|
|
||||||
|
call FUNC(compileSorts);
|
||||||
|
|
||||||
|
private _returnArray = [];
|
||||||
|
|
||||||
|
private _fnc_addToTabs = {
|
||||||
|
params ["_tabsList", "_tabsToAddTo", "_sideString"];
|
||||||
|
{
|
||||||
|
private _arrayToSave = +_finalArray;
|
||||||
|
_arrayToSave set [0, [_class, _sideString, [str _x, format ["0%1", _x]] select (_x < 10)] joinString ""];
|
||||||
|
_returnArray pushBack (_arrayToSave select 0);
|
||||||
|
(_tabsList select _x) pushBack _arrayToSave;
|
||||||
|
} forEach _tabsToAddTo;
|
||||||
|
};
|
||||||
|
|
||||||
|
_finalArray = ["", _displayName, _statement];
|
||||||
|
|
||||||
|
if !(_leftTabs isEqualTo []) then {
|
||||||
|
[GVAR(sortListLeftPanel), _leftTabs, "L", 0] call _fnc_addToTabs;
|
||||||
|
};
|
||||||
|
|
||||||
|
if !(_rightTabs isEqualTo []) then {
|
||||||
|
[GVAR(sortListRightPanel), _rightTabs, "R", 1] call _fnc_addToTabs;
|
||||||
|
};
|
||||||
|
|
||||||
|
_returnArray
|
@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Tabs to add the stat to (ARRAY of ARRAYS)
|
* 0: Tabs to add the stat to (ARRAY of ARRAYS)
|
||||||
* 0.1: Left tab indexes (ARRAY of NUMBERS)
|
* 0.1 Left tab indexes (ARRAY of NUMBERS)
|
||||||
* 0.2 Right tab indexes (ARRAY of NUMBERS)
|
* 0.2 Right tab indexes (ARRAY of NUMBERS)
|
||||||
* 1: Stat class (STRING) (A unique string for each stat)
|
* 1: Stat class (STRING) (A unique string for each stat)
|
||||||
* 2: Config entries to pass (ARRAY of STRINGS)
|
* 2: Config entries to pass (ARRAY of STRINGS)
|
||||||
@ -14,7 +14,7 @@
|
|||||||
* 4.1 Show bar (BOOL)
|
* 4.1 Show bar (BOOL)
|
||||||
* 4.2 Show text (BOOL)
|
* 4.2 Show text (BOOL)
|
||||||
* 5: Array of statements (ARRAY of ARRAYS)
|
* 5: Array of statements (ARRAY of ARRAYS)
|
||||||
* 5.1: Bar code (CODE)
|
* 5.1 Bar code (CODE)
|
||||||
* 5.2 Text code (CODE)
|
* 5.2 Text code (CODE)
|
||||||
* 5.3 Condition code (CODE)
|
* 5.3 Condition code (CODE)
|
||||||
* 6: Priority (NUMBER) (Optional)
|
* 6: Priority (NUMBER) (Optional)
|
||||||
|
82
addons/arsenal/functions/fnc_compileSorts.sqf
Normal file
82
addons/arsenal/functions/fnc_compileSorts.sqf
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: SynixeBrett
|
||||||
|
* Create the internal stats arrays when needed for the first time
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!isNil QGVAR(sortListLeftPanel)) exitWith {};
|
||||||
|
|
||||||
|
private _fnc_addToTabs = {
|
||||||
|
params ["_tabsList", "_tabsToAddTo", "_sideString"];
|
||||||
|
{
|
||||||
|
private _arrayToSave = +_finalArray;
|
||||||
|
_arrayToSave set [0, [_class, _sideString, [str _x, format ["0%1", _x]] select (_x < 10)] joinString ""];
|
||||||
|
(_tabsList select _x) pushBack _arrayToSave;
|
||||||
|
} forEach _tabsToAddTo;
|
||||||
|
};
|
||||||
|
|
||||||
|
private _sortListLeftPanel = [
|
||||||
|
[], // Primary 0
|
||||||
|
[], // Handgun 1
|
||||||
|
[], // Launcher 2
|
||||||
|
[], // Uniform 3
|
||||||
|
[], // Vests 4
|
||||||
|
[], // Backpacks 5
|
||||||
|
[], // Headgear 6
|
||||||
|
[], // Goggles 7
|
||||||
|
[], // NVGs 8
|
||||||
|
[], // Binoculars 9
|
||||||
|
[], // Map 10
|
||||||
|
[], // GPS 11
|
||||||
|
[], // Radio 12
|
||||||
|
[], // Compass 13
|
||||||
|
[] // Watch 14
|
||||||
|
];
|
||||||
|
|
||||||
|
private _sortListRightPanel = [
|
||||||
|
[], // Optics 0
|
||||||
|
[], // Side accs 1
|
||||||
|
[], // Muzzle 2
|
||||||
|
[], // Bipod 3
|
||||||
|
[], // Mag 4
|
||||||
|
[], // Throw 5
|
||||||
|
[], // Put 6
|
||||||
|
[] // Misc 7
|
||||||
|
];
|
||||||
|
|
||||||
|
//------------------------- Config handling
|
||||||
|
private _configEntries = "(getNumber (_x >> 'scope')) == 2" configClasses (configFile >> QGVAR(sorts));
|
||||||
|
|
||||||
|
{
|
||||||
|
private _finalArray = [];
|
||||||
|
|
||||||
|
private _class = configName _x;
|
||||||
|
private _displayName = getText (_x >> "displayName");
|
||||||
|
private _statement = getText (_x >> "statement");
|
||||||
|
(getArray (_x >> "tabs")) params ["_leftTabsList", "_rightTabsList"];
|
||||||
|
|
||||||
|
if (_statement != "") then {
|
||||||
|
_statement = compile _statement;
|
||||||
|
};
|
||||||
|
|
||||||
|
_finalArray = ["", _displayName, _statement];
|
||||||
|
|
||||||
|
if !(_leftTabsList isEqualTo []) then {
|
||||||
|
[_sortListLeftPanel, _leftTabsList, "L"] call _fnc_addToTabs;
|
||||||
|
};
|
||||||
|
|
||||||
|
if !(_rightTabsList isEqualTo []) then {
|
||||||
|
[_sortListRightPanel, _rightTabsList, "R"] call _fnc_addToTabs;
|
||||||
|
};
|
||||||
|
} foreach _configEntries;
|
||||||
|
|
||||||
|
missionNamespace setVariable [QGVAR(sortListLeftPanel), _sortListLeftPanel];
|
||||||
|
missionNamespace setVariable [QGVAR(sortListRightPanel), _sortListRightPanel];
|
@ -37,6 +37,10 @@ _ctrlPanel ctrlCommit FADE_DELAY;
|
|||||||
|
|
||||||
_ctrlPanel lbSetCurSel -1;
|
_ctrlPanel lbSetCurSel -1;
|
||||||
|
|
||||||
|
// Fill sort options
|
||||||
|
private _sortLeftCtrl = _display displayCtrl IDC_sortLeftTab;
|
||||||
|
[_display, _control, _sortLeftCtrl] call FUNC(fillSort);
|
||||||
|
|
||||||
// Handle icons and filling
|
// Handle icons and filling
|
||||||
switch true do {
|
switch true do {
|
||||||
case (_ctrlIDC in [IDC_buttonPrimaryWeapon, IDC_buttonHandgun, IDC_buttonSecondaryWeapon]) : {
|
case (_ctrlIDC in [IDC_buttonPrimaryWeapon, IDC_buttonHandgun, IDC_buttonSecondaryWeapon]) : {
|
||||||
@ -187,8 +191,7 @@ GVAR(currentLeftPanel) = _ctrlIDC;
|
|||||||
[QGVAR(leftPanelFilled), [_display, _ctrlIDC, GVAR(currentRightPanel)]] call CBA_fnc_localEvent;
|
[QGVAR(leftPanelFilled), [_display, _ctrlIDC, GVAR(currentRightPanel)]] call CBA_fnc_localEvent;
|
||||||
|
|
||||||
// Sort
|
// Sort
|
||||||
private _sortLeftCtrl = _display displayCtrl IDC_sortLeftTab;
|
[_sortLeftCtrl] call FUNC(sortPanel);
|
||||||
[_sortLeftCtrl, _sortLeftCtrl lbValue (lbCurSel _sortLeftCtrl)] call FUNC(sortPanel);
|
|
||||||
|
|
||||||
//Select current item
|
//Select current item
|
||||||
private _itemsToCheck = ((GVAR(currentItems) select [0,15]) + [GVAR(currentFace), GVAR(currentVoice), GVAR(currentInsignia)]) apply {tolower _x};
|
private _itemsToCheck = ((GVAR(currentItems) select [0,15]) + [GVAR(currentFace), GVAR(currentVoice), GVAR(currentInsignia)]) apply {tolower _x};
|
||||||
|
@ -351,30 +351,9 @@ if (GVAR(currentLeftPanel) in [IDC_buttonUniform, IDC_buttonVest, IDC_buttonBack
|
|||||||
|
|
||||||
// Sorting
|
// Sorting
|
||||||
private _sortRightCtrl = _display displayCtrl IDC_sortRightTab;
|
private _sortRightCtrl = _display displayCtrl IDC_sortRightTab;
|
||||||
private _sortRightCurSel = lbCurSel _sortRightCtrl;
|
[_display, _control, _sortRightCtrl] call FUNC(fillSort);
|
||||||
|
|
||||||
if (lbSize _sortRightCtrl == 3) then {
|
[_sortRightCtrl] call FUNC(sortPanel);
|
||||||
_sortRightCtrl lbDelete 2;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_leftPanelState) then {
|
|
||||||
_sortRightCtrl lbDelete 1;
|
|
||||||
_sortRightCtrl lbAdd (localize "STR_a3_rscdisplayarsenal_sort_mod");
|
|
||||||
_sortRightCtrl lbSetValue [1, 1];
|
|
||||||
|
|
||||||
_sortRightCtrl lbSetCurSel ([0, _sortRightCurSel] select (_sortRightCurSel != 2));
|
|
||||||
} else {
|
|
||||||
_sortRightCtrl lbDelete 1;
|
|
||||||
_sortRightCtrl lbAdd localize LSTRING(sortByWeightText);
|
|
||||||
_sortRightCtrl lbSetValue [1, 1];
|
|
||||||
|
|
||||||
_sortRightCtrl lbAdd localize LSTRING(sortByAmountText);
|
|
||||||
_sortRightCtrl lbSetValue [2, 2];
|
|
||||||
|
|
||||||
_sortRightCtrl lbSetCurSel _sortRightCurSel;
|
|
||||||
};
|
|
||||||
|
|
||||||
[_sortRightCtrl, _sortRightCtrl lbValue (lbCurSel _sortRightCtrl)] call FUNC(sortPanel);
|
|
||||||
|
|
||||||
// Select current data if not in a container
|
// Select current data if not in a container
|
||||||
if !(_itemsToCheck isEqualTo []) then {
|
if !(_itemsToCheck isEqualTo []) then {
|
||||||
|
99
addons/arsenal/functions/fnc_fillSort.sqf
Normal file
99
addons/arsenal/functions/fnc_fillSort.sqf
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
#include "..\defines.hpp"
|
||||||
|
/*
|
||||||
|
* Author: Alganthe, SynixeBrett
|
||||||
|
* Fill right panel.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Arsenal display <DISPLAY>
|
||||||
|
* 1: Tab control <CONTROL>
|
||||||
|
* 2: Sort control <CONTROL>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_display", "_control", "_sortCtrl"];
|
||||||
|
|
||||||
|
lbClear _sortCtrl;
|
||||||
|
|
||||||
|
private _right = false;
|
||||||
|
private _rightSort = ctrlIDC _sortCtrl == 17;
|
||||||
|
|
||||||
|
private _sorts = if (_rightSort && {GVAR(currentLeftPanel) in [IDC_buttonUniform ,IDC_buttonVest, IDC_buttonBackpack]}) then {
|
||||||
|
_right = true;
|
||||||
|
GVAR(sortListRightPanel) select (
|
||||||
|
switch (GVAR(currentRightPanel)) do {
|
||||||
|
case IDC_buttonOptic: { 0 };
|
||||||
|
case IDC_buttonItemAcc: { 1 };
|
||||||
|
case IDC_buttonMuzzle: { 2 };
|
||||||
|
case IDC_buttonBipod: { 3 };
|
||||||
|
case IDC_buttonCurrentMag;
|
||||||
|
case IDC_buttonCurrentMag2;
|
||||||
|
case IDC_buttonMag;
|
||||||
|
case IDC_buttonMagALL: { 4 };
|
||||||
|
case IDC_buttonThrow: { 5 };
|
||||||
|
case IDC_buttonPut: { 6 };
|
||||||
|
case IDC_buttonMisc: { 7 };
|
||||||
|
}
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
private _sidc = ctrlIDC _sortCtrl;
|
||||||
|
private _idc = ctrlIDC _control;
|
||||||
|
switch true do {
|
||||||
|
case (_sidc == 17): { // Right panel weapon attachment
|
||||||
|
GVAR(sortListRightPanel) select (
|
||||||
|
switch (_idc) do {
|
||||||
|
case IDC_buttonOptic: { 0 };
|
||||||
|
case IDC_buttonItemAcc: { 1 };
|
||||||
|
case IDC_buttonMuzzle: { 2 };
|
||||||
|
case IDC_buttonBipod: { 3 };
|
||||||
|
case IDC_buttonCurrentMag;
|
||||||
|
case IDC_buttonCurrentMag2;
|
||||||
|
case IDC_buttonMag;
|
||||||
|
case IDC_buttonMagALL: { 4 };
|
||||||
|
case IDC_buttonThrow: { 5 };
|
||||||
|
case IDC_buttonPut: { 6 };
|
||||||
|
case IDC_buttonMisc: { 7 };
|
||||||
|
}
|
||||||
|
)
|
||||||
|
};
|
||||||
|
case ([IDC_buttonFace, IDC_buttonVoice, IDC_buttonInsigna] find _idc > -1): {
|
||||||
|
[]
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
GVAR(sortListLeftPanel) select ([
|
||||||
|
IDC_buttonPrimaryWeapon,
|
||||||
|
IDC_buttonHandgun,
|
||||||
|
IDC_buttonSecondaryWeapon,
|
||||||
|
IDC_buttonUniform,
|
||||||
|
IDC_buttonVest,
|
||||||
|
IDC_buttonBackpack,
|
||||||
|
IDC_buttonHeadgear,
|
||||||
|
IDC_buttonGoggles,
|
||||||
|
IDC_buttonNVG,
|
||||||
|
IDC_buttonBinoculars,
|
||||||
|
IDC_buttonMap,
|
||||||
|
IDC_buttonGPS,
|
||||||
|
IDC_buttonRadio,
|
||||||
|
IDC_buttonCompass,
|
||||||
|
IDC_buttonWatch
|
||||||
|
] find _idc)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private _lastSort = [GVAR(lastSortLeft), GVAR(lastSortRight)] select _rightSort;
|
||||||
|
private _sortIndex = 0;
|
||||||
|
|
||||||
|
{
|
||||||
|
if (_x isEqualTo []) exitWith {};
|
||||||
|
_sortCtrl lbAdd (_x select 1);
|
||||||
|
if ((_x select 1) isEqualTo _lastSort) then {
|
||||||
|
_sortIndex = _forEachIndex;
|
||||||
|
};
|
||||||
|
} forEach _sorts;
|
||||||
|
|
||||||
|
_sortCtrl lbSetCurSel _sortIndex;
|
@ -1,12 +1,11 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#include "..\defines.hpp"
|
#include "..\defines.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Alganthe, Dedmen
|
* Author: Alganthe, Dedmen, SynixeBrett
|
||||||
* Sort arsenal panel.
|
* Sort arsenal panel.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Panel's control to sort <CONTROL>
|
* 0: Sort control <CONTROL>
|
||||||
* 1: Sorting mode <SCALAR>
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -14,60 +13,137 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_control", "_mode"];
|
params ["_sortControl"];
|
||||||
|
|
||||||
private _display = ctrlParent _control;
|
private _display = ctrlParent _sortControl;
|
||||||
private ["_panel", "_curSel", "_selected"];
|
|
||||||
|
|
||||||
// Right panel
|
private _rightSort = ctrlIDC _sortControl == 17;
|
||||||
if (ctrlIDC _control == 17 && {GVAR(currentLeftPanel) in [IDC_buttonUniform ,IDC_buttonVest, IDC_buttonBackpack]}) then {
|
private _right = _rightSort && {GVAR(currentLeftPanel) in [IDC_buttonUniform, IDC_buttonVest, IDC_buttonBackpack]};
|
||||||
_panel = _display displayCtrl IDC_rightTabContentListnBox;
|
|
||||||
_curSel = lnbCurSelRow _panel;
|
|
||||||
_selected = _panel lnbData [_curSel, 0];
|
|
||||||
|
|
||||||
switch (_mode) do {
|
if (_rightSort) then {
|
||||||
case 0: {
|
[
|
||||||
_panel lnbSort [1, false];
|
if (_right) then {
|
||||||
};
|
_display displayCtrl IDC_rightTabContentListnBox
|
||||||
|
} else {
|
||||||
case 1: {
|
_display displayCtrl IDC_rightTabContent
|
||||||
_panel lnbSortByValue [0, false];
|
},
|
||||||
};
|
switch (GVAR(currentRightPanel)) do {
|
||||||
|
case IDC_buttonCurrentMag;
|
||||||
case 2: {
|
case IDC_buttonCurrentMag2;
|
||||||
for "_i" from 0 to (((lnbsize _panel) select 0) - 1) do {
|
case IDC_buttonThrow;
|
||||||
_panel lnbSetText [[_i, 2], str (parseNumber (_panel lnbText [_i, 2]) / 1000)];
|
case IDC_buttonPut;
|
||||||
};
|
case IDC_buttonMag;
|
||||||
|
case IDC_buttonMagALL: { "CfgMagazines" };
|
||||||
_panel lnbSort [2, true];
|
default { "CfgWeapons" };
|
||||||
|
},
|
||||||
|
GVAR(sortListRightPanel) select (
|
||||||
for "_i" from 0 to (((lnbsize _panel) select 0) - 1) do {
|
switch (GVAR(currentRightPanel)) do {
|
||||||
_panel lnbSetText [[_i, 2], str (parseNumber (_panel lnbText [_i, 2]) * 1000)];
|
case IDC_buttonOptic: { 0 };
|
||||||
};
|
case IDC_buttonItemAcc: { 1 };
|
||||||
};
|
case IDC_buttonMuzzle: { 2 };
|
||||||
};
|
case IDC_buttonBipod: { 3 };
|
||||||
|
case IDC_buttonCurrentMag;
|
||||||
if (_cursel >= 0) then {
|
case IDC_buttonCurrentMag2;
|
||||||
for '_i' from 0 to (((lnbsize _panel) select 0) - 1) do {
|
case IDC_buttonMag;
|
||||||
if ((_panel lnbdata [_i, 0]) == _selected) exitwith {_panel lnbSetCurSelRow _i};
|
case IDC_buttonMagALL: { 4 };
|
||||||
};
|
case IDC_buttonThrow: { 5 };
|
||||||
};
|
case IDC_buttonPut: { 6 };
|
||||||
// Left panel
|
case IDC_buttonMisc: { 7 };
|
||||||
|
}
|
||||||
|
)
|
||||||
|
]
|
||||||
} else {
|
} else {
|
||||||
_panel = _display displayCtrl ([IDC_leftTabContent, IDC_rightTabContent] select (ctrlIDC _control == 17));
|
[
|
||||||
_curSel = lbCurSel _panel;
|
_display displayCtrl IDC_leftTabContent,
|
||||||
_selected = _panel lbData _curSel;
|
switch (GVAR(currentLeftPanel)) do {
|
||||||
|
case IDC_buttonBackpack: { "CfgVehicles" };
|
||||||
|
case IDC_buttonGoggles: { "CfgGlasses" };
|
||||||
|
default { "CfgWeapons" };
|
||||||
|
},
|
||||||
|
(GVAR(sortListLeftPanel) select ([
|
||||||
|
IDC_buttonPrimaryWeapon,
|
||||||
|
IDC_buttonHandgun,
|
||||||
|
IDC_buttonSecondaryWeapon,
|
||||||
|
IDC_buttonUniform,
|
||||||
|
IDC_buttonVest,
|
||||||
|
IDC_buttonBackpack,
|
||||||
|
IDC_buttonHeadgear,
|
||||||
|
IDC_buttonGoggles,
|
||||||
|
IDC_buttonNVG,
|
||||||
|
IDC_buttonBinoculars,
|
||||||
|
IDC_buttonMap,
|
||||||
|
IDC_buttonGPS,
|
||||||
|
IDC_buttonRadio,
|
||||||
|
IDC_buttonCompass,
|
||||||
|
IDC_buttonWatch
|
||||||
|
] find GVAR(currentLeftPanel)))
|
||||||
|
]
|
||||||
|
} params ["_panel", "_cfgClass", "_sorts"];
|
||||||
|
|
||||||
if (_mode > 0) then {
|
private _curSel = if (_right) then {
|
||||||
lbSortByValue _panel;
|
lnbCurSelRow _panel
|
||||||
|
} else {
|
||||||
|
lbCurSel _panel
|
||||||
|
};
|
||||||
|
private _selected = if (_right) then {
|
||||||
|
_panel lnbData [_curSel, 0];
|
||||||
|
} else {
|
||||||
|
_panel lbData _curSel
|
||||||
|
};
|
||||||
|
|
||||||
|
private _mode = 0 max lbCurSel _sortControl;
|
||||||
|
private _statement = _sorts select _mode select 2;
|
||||||
|
|
||||||
|
missionNamespace setVariable [
|
||||||
|
[QGVAR(lastSortLeft), QGVAR(lastSortRight)] select _rightSort,
|
||||||
|
_sorts select _mode select 1
|
||||||
|
];
|
||||||
|
|
||||||
|
private _for = if (_right) then {
|
||||||
|
for '_i' from 0 to ((lnbSize _panel select 0) - 1)
|
||||||
|
} else {
|
||||||
|
for '_i' from 1 to (lbSize _panel - 1)
|
||||||
|
};
|
||||||
|
|
||||||
|
_for do {
|
||||||
|
private _item = if (_right) then {
|
||||||
|
_panel lnbData [_i, 0]
|
||||||
} else {
|
} else {
|
||||||
lbsort _panel;
|
_panel lbData _i
|
||||||
};
|
};
|
||||||
|
private _itemCfg = configFile >> _cfgClass >> _item;
|
||||||
if (_cursel >= 0) then {
|
private _value = _itemCfg call _statement;
|
||||||
for '_i' from 0 to (lbsize _panel - 1) do {
|
if (_value isEqualType 0) then {
|
||||||
if ((_panel lbdata _i) == _selected) exitwith {_panel lbSetCurSel _i};
|
_value = [_value, 8] call CBA_fnc_formatNumber;
|
||||||
};
|
};
|
||||||
|
if (_value isEqualTo "") then {
|
||||||
|
_value = "_";
|
||||||
|
};
|
||||||
|
if (_right) then {
|
||||||
|
_panel lnbSetText [[_i, 1], format ["%1%2", _value, _panel lnbText [_i, 1]]];
|
||||||
|
} else {
|
||||||
|
_panel lbSetText [_i, format ["%1%2", _value, _panel lbText _i]];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_right) then {
|
||||||
|
_panel lnbSort [1, false];
|
||||||
|
|
||||||
|
_for do {
|
||||||
|
private _data = _panel lnbData [_i, 0];
|
||||||
|
if (_cursel >= 0) then {
|
||||||
|
if (_data == _selected) then {_panel lnbSetCurSelRow _i};
|
||||||
|
};
|
||||||
|
_panel lnbSetText [[_i, 1], getText (configFile >> _cfgClass >> _data >> "displayName")];
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
lbSort [_panel, "ASC"];
|
||||||
|
|
||||||
|
_for do {
|
||||||
|
private _data = _panel lbData _i;
|
||||||
|
if (_cursel >= 0) then {
|
||||||
|
if (_data == _selected) then {_panel lbSetCurSel _i};
|
||||||
|
};
|
||||||
|
_panel lbSetText [_i, getText (configFile >> _cfgClass >> _data >> "displayName")];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
34
addons/arsenal/functions/fnc_sortStatement_accuracy.sqf
Normal file
34
addons/arsenal/functions/fnc_sortStatement_accuracy.sqf
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: Alganthe, SynixeBrett
|
||||||
|
* Statement to sort weapons by their accuracy.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Item Config <CONFIG>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Sorting Value <NUMBER>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_config"];
|
||||||
|
|
||||||
|
private _fireModes = getArray (_config >> "modes");
|
||||||
|
private _dispersion = [];
|
||||||
|
|
||||||
|
{
|
||||||
|
if (getNumber (_config >> _x >> "showToPlayer") != 0) then {
|
||||||
|
private _n = log getNumber (_config >> _x >> "dispersion");
|
||||||
|
|
||||||
|
if (!finite _n) then {
|
||||||
|
_n = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
_dispersion pushBackUnique _n;
|
||||||
|
};
|
||||||
|
} foreach _fireModes;
|
||||||
|
|
||||||
|
_dispersion sort true;
|
||||||
|
|
||||||
|
10000000 - round ((_dispersion param [0, 0]) * 100000)
|
17
addons/arsenal/functions/fnc_sortStatement_magCount.sqf
Normal file
17
addons/arsenal/functions/fnc_sortStatement_magCount.sqf
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: SynixeBrett
|
||||||
|
* Statement to sort magazines by their ammo count.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Item Config <CONFIG>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Sorting Value <NUMBER>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_config"];
|
||||||
|
|
||||||
|
getNumber (_config >> "count")
|
27
addons/arsenal/functions/fnc_sortStatement_mass.sqf
Normal file
27
addons/arsenal/functions/fnc_sortStatement_mass.sqf
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: Alganthe, SynixeBrett
|
||||||
|
* Statement to sort items by their mass.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Item Config <CONFIG>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Sorting Value <NUMBER>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_config"];
|
||||||
|
|
||||||
|
private _mass = getNumber (_config >> "mass");
|
||||||
|
|
||||||
|
if (_mass == 0 && {isClass (_config >> "itemInfo")}) then {
|
||||||
|
_mass = getNumber (_config >> "itemInfo" >> "mass");
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_mass == 0 && {isClass (_config >> "WeaponSlotsInfo")}) then {
|
||||||
|
_mass = getNumber (_config >> "WeaponSlotsInfo" >> "mass");
|
||||||
|
};
|
||||||
|
|
||||||
|
_mass
|
26
addons/arsenal/functions/fnc_sortStatement_mod.sqf
Normal file
26
addons/arsenal/functions/fnc_sortStatement_mod.sqf
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: SynixeBrett
|
||||||
|
* Statement to sort items by the mod they belong to.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Item Config <CONFIG>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Mod Name to Sort By <STRING>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_config"];
|
||||||
|
|
||||||
|
private _dlc = "";
|
||||||
|
private _addons = configSourceAddonList _config;
|
||||||
|
if !(_addons isEqualTo []) then {
|
||||||
|
private _mods = configSourceModList (configfile >> "CfgPatches" >> _addons select 0);
|
||||||
|
if !(_mods isEqualTo []) then {
|
||||||
|
_dlc = _mods select 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
modParams [_dlc, ["name"]] param [0, ""]
|
26
addons/arsenal/functions/fnc_sortStatement_rateOfFire.sqf
Normal file
26
addons/arsenal/functions/fnc_sortStatement_rateOfFire.sqf
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: Alganthe, SynixeBrett
|
||||||
|
* Statement to sort weapons by their rate of fire.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Item Config <CONFIG>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Sorting Value <NUMBER>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_config"];
|
||||||
|
|
||||||
|
private _fireModes = getArray (_config >> "modes");
|
||||||
|
private _fireRate = [];
|
||||||
|
|
||||||
|
{
|
||||||
|
_fireRate pushBackUnique getNumber (_config >> _x >> "reloadTime");
|
||||||
|
} foreach _fireModes;
|
||||||
|
|
||||||
|
_fireRate sort true;
|
||||||
|
|
||||||
|
round (60 / (_fireRate param [0, 0]))
|
24
addons/arsenal/functions/fnc_sortStatement_scopeMag.sqf
Normal file
24
addons/arsenal/functions/fnc_sortStatement_scopeMag.sqf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: Alganthe, SynixeBrett
|
||||||
|
* Statement to sort optics by their magnification.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Item Config <CONFIG>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Sorting Value <NUMBER|STRING>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_config"];
|
||||||
|
|
||||||
|
private _minZoom = 999; // FOV, so smaller is more zoomed in
|
||||||
|
{
|
||||||
|
_minZoom = _minZoom min getNumber (_x >> "opticsZoomMin");
|
||||||
|
} forEach configProperties [_config >> "ItemInfo" >> "OpticsModes", "isClass _x"];
|
||||||
|
|
||||||
|
if (_minZoom in [0, 999]) exitWith {"?"};
|
||||||
|
|
||||||
|
round ((0.25 / _minZoom) * 10)
|
@ -380,6 +380,26 @@
|
|||||||
<Czech>Seřadit podle množství</Czech>
|
<Czech>Seřadit podle množství</Czech>
|
||||||
<Turkish>Miktara göre sırala</Turkish>
|
<Turkish>Miktara göre sırala</Turkish>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Arsenal_sortByLoadText">
|
||||||
|
<English>Sort by load</English>
|
||||||
|
<German>Nach Tragelast sortieren</German>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Arsenal_sortByAccuracyText">
|
||||||
|
<English>Sort by accuracy</English>
|
||||||
|
<German>Nach Genauigkeit sortieren</German>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Arsenal_sortByRateOfFireText">
|
||||||
|
<English>Sort by rate of fire</English>
|
||||||
|
<German>Nach Schussrate sortieren</German>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Arsenal_sortByMagnificationText">
|
||||||
|
<English>Sort by magnification</English>
|
||||||
|
<German>Nach Vergrößerung sortieren</German>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Arsenal_sortByMagCountText">
|
||||||
|
<English>Sort by ammo count</English>
|
||||||
|
<German>Nach Munitionszahl sortieren</German>
|
||||||
|
</Key>
|
||||||
<Key ID="STR_ACE_Arsenal_buttonShareTooltip">
|
<Key ID="STR_ACE_Arsenal_buttonShareTooltip">
|
||||||
<English>Share or stop sharing the selected loadout</English>
|
<English>Share or stop sharing the selected loadout</English>
|
||||||
<Spanish>Compartir o dejar de compartir el equipamiento seleccionado</Spanish>
|
<Spanish>Compartir o dejar de compartir el equipamiento seleccionado</Spanish>
|
||||||
|
@ -523,32 +523,10 @@ class GVAR(display) {
|
|||||||
h = QUOTE(6 * GRID_H);
|
h = QUOTE(6 * GRID_H);
|
||||||
onLBSelChanged = QUOTE(_this call FUNC(sortPanel));
|
onLBSelChanged = QUOTE(_this call FUNC(sortPanel));
|
||||||
sizeEx = QUOTE(5 * GRID_H);
|
sizeEx = QUOTE(5 * GRID_H);
|
||||||
class Items {
|
|
||||||
class Alphabet {
|
|
||||||
text="$STR_a3_rscdisplayarsenal_sort_alphabet";
|
|
||||||
default=1;
|
|
||||||
value= 0;
|
|
||||||
};
|
|
||||||
class Mod {
|
|
||||||
text="$STR_a3_rscdisplayarsenal_sort_mod";
|
|
||||||
value= 1;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
class sortRightTab: sortLeftTab {
|
class sortRightTab: sortLeftTab {
|
||||||
idc = IDC_sortRightTab;
|
idc = IDC_sortRightTab;
|
||||||
x = QUOTE(safezoneX + safezoneW - 93 * GRID_W);
|
x = QUOTE(safezoneX + safezoneW - 93 * GRID_W);
|
||||||
class Items {
|
|
||||||
class Alphabet {
|
|
||||||
text="$STR_a3_rscdisplayarsenal_sort_alphabet";
|
|
||||||
default=1;
|
|
||||||
value= 0;
|
|
||||||
};
|
|
||||||
class Weight {
|
|
||||||
text="$STR_a3_rscdisplayarsenal_sort_mod";
|
|
||||||
value= 1;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
class leftSearchbar: ctrlEdit {
|
class leftSearchbar: ctrlEdit {
|
||||||
idc = IDC_leftSearchbar;
|
idc = IDC_leftSearchbar;
|
||||||
|
Loading…
Reference in New Issue
Block a user