ACE3/addons/disarming/functions/fnc_showItemsInListbox.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

64 lines
2.4 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: PabstMirror
*
* Shows a list of inventory items in a listBox control.
*
* Arguments:
* 0: RscListBox <CONTROL>
* 1: ItemArray [["itemClassnames"],[counts]] <ARRAY>
*
* Return Value:
* None
*
* Example:
* [theListBox, [["ace_bandage"],[2]]] call ace_disarming_fnc_showItemsInListbox
*
* Public: No
*/
disableSerialization;
params ["_listBoxCtrl", "_itemsCountArray"];
{
private _classname = _x;
private _count = (_itemsCountArray select 1) select _forEachIndex;
if ((_classname != DUMMY_ITEM) && {_classname != "ACE_FakePrimaryWeapon"}) then { //Don't show the dummy potato or fake weapon
private _configPath = configNull;
private _displayName = "";
private _picture = "";
switch (true) do {
case (isClass (configFile >> "CfgWeapons" >> _classname)): {
_configPath = (configFile >> "CfgWeapons");
_displayName = getText (_configPath >> _classname >> "displayName");
_picture = getText (_configPath >> _classname >> "picture");
};
case (isClass (configFile >> "CfgMagazines" >> _classname)): {
_configPath = (configFile >> "CfgMagazines");
_displayName = getText (_configPath >> _classname >> "displayName");
_picture = getText (_configPath >> _classname >> "picture");
};
case (isClass (configFile >> "CfgVehicles" >> _classname)): {
_configPath = (configFile >> "CfgVehicles");
_displayName = getText (_configPath >> _classname >> "displayName");
_picture = getText (_configPath >> _classname >> "picture");
};
case (isClass (configFile >> "CfgGlasses" >> _classname)): {
_configPath = (configFile >> "CfgGlasses");
_displayName = getText (_configPath >> _classname >> "displayName");
_picture = getText (_configPath >> _classname >> "picture");
};
default {
ERROR(format ["[%1] - bad classname", _classname]);
};
};
_listBoxCtrl lbAdd format ["%1", _displayName];
_listBoxCtrl lbSetData [((lbSize _listBoxCtrl) - 1), _classname];
_listBoxCtrl lbSetPicture [((lbSize _listBoxCtrl) - 1), _picture];
_listBoxCtrl lbSetTextRight [((lbSize _listBoxCtrl) - 1), str _count];
};
} forEach (_itemsCountArray select 0);