Files
DayZ-Epoch/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getBackpackItems.sqf
ebaydayz a5be49c546 Add handling of magazine overflow in AdvTrade and free slot icons
- Added proper handling of pistol mags and regular mags in gear to
prevent magazine overflow
- Added pre-check if return change will overflow gear + backpack free
space. If change will not fit in gear + backpack free space then buy is
prevented with a message notifying the player. In the case of a sale it
proceeds anyway, but notifies player if overflow occurs (see comments in
returnChange)
- Consolidated duplicate code for calculating free space and returning
cargo of an object into new calcFreeSpace
- Old calculateFreeSpace renamed to displayFreeSpace
- Added Weps/Mags/Bags icons to free slot numbers display
2016-07-31 18:38:53 -04:00

30 lines
845 B
Plaintext

/**
* call Z_getBackpackItems
*
* Gets all your items stored in your backpack and innitiates the selling list.
**/
private ["_backpack","_pic","_formattedText","_normalMags","_normalWeaps","_freeSpace"];
#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;
_freeSpace = [_backpack,0,0,0,0] call Z_calcFreeSpace;
_normalMags = _freeSpace select 5;
_normalWeaps = _freeSpace select 6;
[_normalMags,_normalWeaps, typeOf _backpack,[]] call Z_checkArrayInConfig;
};