Files
DayZ-Epoch/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getBackpackItems.sqf
oiad 7c4d25ef1a Advanced trading tidying, spelling fixes, private fixes and string fixes (#1716)
* Advanced trading tidying, spelling fixes, private fixes and string fixes.

Fixes snap building issue with metal floors
Fixed spelling mistakes in various scripts
Fixed formatting uglyness in various scripts
Fixed invalid private lines in various scripts
Changed Advanced trading so buying worked more like selling, You can't
select backpack if you don't have a pack nor can you select a vehicle if
you don't have a vehicle.
Removed some redundant strings from Advanced trading and changed a few
of the strings to be more englishy
Removed the ability to buy a backpack into your backpack (You cant do
this anyway)
Fixed a bug where if you had nothing in your backpack it would break the
checkArrayInConfig script so the titlebar would not refresh correctly
Removed slot counts on no backpack and no vehicle (No need for it, just
clutter)
Moved backpack/vehicle checking to z_at_getContainer.sqf

* Last part of tidyness fixes

Last part of tidyness fixes

* Actual backpack fix

Lets actually fix the buying backpack into backpack or backpack when you
already have one.

* Missing from commit

Missing from commit
2016-07-30 10:03:00 -04:00

50 lines
1.3 KiB
Plaintext

/**
* call Z_getBackpackItems
*
* Gets all your items stored in your backpack and innitiates the selling list.
**/
private ["_backpack","_pic","_formattedText","_mags","_weaps","_normalMags","_normalWeaps","_kinds","_kinds2","_amounts","_amounts2"];
#include "defines.hpp"
call Z_clearLists;
Z_SellableArray = [];
Z_SellArray = [];
_backpack = unitBackpack player;
if (!isNull _backpack) then {
_pic = getText (configFile >> 'CfgVehicles' >> (typeOf _backpack) >> 'picture');
_formattedText = format [
"<img image='%1' size='3' align='center'/>"
, _pic
];
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText _formattedText;
_mags = getMagazineCargo _backpack;
_weaps = getWeaponCargo _backpack;
_normalMags = [];
_normalWeaps = [];
_kinds = _mags select 0;
_amounts = _mags select 1;
{
_counter = 0 ;
while {_counter < (_amounts select _forEachIndex)} do {
_normalMags set [count(_normalMags),_x];
_counter = _counter + 1;
};
} forEach _kinds;
_kinds2 = _weaps select 0;
_amounts2 = _weaps select 1;
{
_counter = 0 ;
while {_counter < (_amounts2 select _forEachIndex)} do {
_normalWeaps set [count(_normalWeaps),_x];
_counter = _counter + 1;
};
} forEach _kinds2;
[_normalMags,_normalWeaps, typeOf _backpack,[]] call Z_checkArrayInConfig;
};