ACE3/addons/arsenal/functions/fnc_compileStats.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05:00

136 lines
3.6 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Alganthe
* Create the internal stats arrays when needed for the first time
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public: No
*/
if (!isNil QGVAR(statsListLeftPanel)) exitWith {};
private _fnc_addToTabs = {
params ["_tabsList", "_tabsToAddTo", "_sideString"];
{
private _currentTab = _tabsList select _x;
private _availablePagesCount = {count _x < 5} count _currentTab;
private _arrayToSave = +_finalArray;
_arrayToSave set [0, ([_class, _sideString, [str _x, format ["0%1", _x]] select (_x < 10)] joinString "")];
if (_availablePagesCount > 0) then {
{
if (count _x < 5) exitWith {
(_currentTab select _forEachIndex) append [_arrayToSave];
};
} foreach _currentTab;
} else {
_currentTab pushBack [_arrayToSave];
};
} foreach _tabsToAddTo;
};
private _fnc_sortLists = {
params ["_tabsList"];
{
private _page = _x;
{
{
reverse _x;
} foreach _x;
_x sort false;
{
reverse _x;
} foreach _x;
} foreach _page;
} foreach _tabsList;
};
private _statsListLeftPanel = [
[[]], // 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 _statsListRightPanel = [
[[]], // 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(stats));
{
private _finalArray = [];
private _class = configName _x;
private _stats = getArray (_x >> "stats");
private _displayName = getText (_x >> "displayName");
private _showBar = getNumber (_x >> "showBar") == 1;
private _showText = getNumber (_x >> "showText") == 1;
private _condition = getText (_x >> "condition");
private _priority = getNumber (_x >> "priority");
(getArray (_x >> "tabs")) params ["_leftTabsList", "_rightTabsList"];
if (_condition != "") then {
_condition = compile _condition;
};
_finalArray = ["", _stats, _displayName, [_showBar, _showText], [{}, {}, _condition], _priority];
if (_showBar) then {
private _barStatement = compile (getText (_x >> "barStatement"));
(_finalArray select 4) set [0, _barStatement];
};
if (_showText) then {
private _textStatement = compile (getText (_x >> "textStatement"));
(_finalArray select 4) set [1, _textStatement];
};
TRACE_3("stats array", _finalArray, _leftTabsList, _rightTabsList);
if (count _leftTabsList > 0) then {
[_statsListLeftPanel, _leftTabsList, "L"] call _fnc_addToTabs;
};
if (count _rightTabsList > 0) then {
[_statsListRightPanel, _rightTabsList, "R"] call _fnc_addToTabs;
};
} foreach _configEntries;
[_statsListLeftPanel] call _fnc_sortLists;
[_statsListRightPanel] call _fnc_sortLists;
//------------------------- Config Handling
missionNamespace setVariable [QGVAR(statsListLeftPanel), _statsListLeftPanel];
missionNamespace setVariable [QGVAR(statsListRightPanel), _statsListRightPanel];