diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf index 7580d2675..e94525fe2 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf @@ -1,5 +1,5 @@ private ["_selection","_return","_toBuyWeaps","_toBuyTotalMags","_toBuyBags","_toolsToBuy","_sidearmToBuy" -,"_primaryToBuy","_currentPrimarys","_p","_b","_check0","_check1","_check2","_check3","_check4","_allowedMags" +,"_primaryToBuy","_p","_b","_check0","_check1","_check2","_check3","_check4","_allowedMags" ,"_allowedPrimary","_allowedTools","_allowedSidearm","_allowedBackpacks","_parentClasses","_toolClasses" ,"_duplicate","_quantity","_tool","_totalBagSlots","_pistolMags","_regularMags","_toBuyPistolMags" ,"_toBuyRegularMags","_type","_freeSpace","_backpack","_totalSpace" @@ -37,14 +37,8 @@ if (_selection == 2) then { //gear _allowedPistolMags = 8 - _pistolMags; _allowedRegularMags = 12 - _regularMags; - _currentPrimarys = 0; - _p = primaryWeapon player; - if (!isNil '_p' && _p != "") then { - _currentPrimarys = 1; - }; - - _allowedPrimary = 1 - _currentPrimarys; + _allowedPrimary = if (!isNil "_p" && _p != "") then {0} else {1}; // (secondaryWeapon player) returns launcher, doesn't work for pistol _allowedSidearm = 1; @@ -138,6 +132,7 @@ if (_selection == 0) then { //backpack _check0 = true; _freeSpace = [_backpack,_primaryToBuy,_sidearmToBuy,_toolsToBuy,_toBuyTotalMags] call Z_calcFreeSpace; _totalSpace = _freeSpace select 0; + _allowedMags = _freeSpace select 1; _allowedWeapons = _freeSpace select 2; // needed since some bags have >= 5 slots but transportMaxWeapons = 0; _totalBagSlots = _freeSpace select 4; } else { @@ -147,26 +142,33 @@ if (_selection == 0) then { //backpack _check1 = false; _check2 = false; _check3 = false; + _check4 = false; if (_allowedWeapons >= _toBuyWeaps) then { //_toBuyWeaps does not include tools (which can exceed transportMaxWeapons in backpacks but not vehicles) _check1 = true; } else { systemChat format[localize "STR_EPOCH_TRADE_BAG_WEPS", _allowedWeapons]; }; + + if (_allowedMags >= _toBuyTotalMags) then { + _check2 = true; + } else { + systemChat format[localize "STR_EPOCH_TRADE_BAG_MAGS", _allowedMags]; + }; if (_toBuyBags < 1) then { // A backpack can not hold any backpacks - _check2 = true; + _check3 = true; } else { systemChat localize "STR_EPOCH_TRADE_BAG_BAGS"; }; if (_totalSpace <= _totalBagSlots) then { - _check3 = true; + _check4 = true; } else { - systemChat localize "STR_EPOCH_TRADE_BACKPACK_FULL"; + if (_check1 && _check2 && _check3) then { systemChat localize "STR_EPOCH_TRADE_BACKPACK_FULL"; }; // Avoids redundant message }; - if (_check0 && _check1 && _check2 && _check3) then { _return = true; }; + if (_check0 && _check1 && _check2 && _check3 && _check4) then { _return = true; }; }; _return \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf index a9f517227..37d8b1a6d 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf @@ -155,7 +155,7 @@ if (_enoughMoney) then { publicVariableServer "PVDZE_veh_Publish2"; _keySelected; }; - systemChat localize "STR_EPOCH_PLAYER_105"; + //systemChat localize "STR_EPOCH_PLAYER_105"; // "Stand still to complete trade". Medic animation loop no longer used. closeDialog 2; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayFreeSpace.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayFreeSpace.sqf index fc9555ce2..70d6261a5 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayFreeSpace.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayFreeSpace.sqf @@ -1,14 +1,30 @@ -private ["_selection","_returnArray","_allowedMags","_allowedWeapons","_allowedBackpacks","_pic","_backpack","_actualMags","_freeSpace"]; +private ["_selection","_returnArray","_allowedMags","_allowedWeapons","_allowedBackpacks","_pic","_backpack","_actualMags","_freeSpace","_allowedPrimary","_allowedSidearm","_p"]; #include "defines.hpp" _selection = _this select 0; _returnArray = [0,0,0]; if (_selection == 2) then { //gear - _actualMags = {!(_x in MeleeMagazines)} count (magazines player); - _allowedMags = 20 - _actualMags; - // 12 toolbelt + 1 Binoculars + 1 NVG + 1 Pistol + 1 Primary (onBack isn't counted in weapons player) - _allowedWeapons = 16 - count(weapons player); + //_actualMags = {!(_x in MeleeMagazines)} count (magazines player); + //_allowedMags = 20 - _actualMags; //8 pistol + 12 regular = 20 + // Don't show pistol mag slots as item slots in gear. Player is informed of pistol mag slots count in systemChat. + _actualMags = {(getNumber (configFile >> "CfgMagazines" >> _x >> "type") == 256)} count (magazines player); // 256 = WeaponSlotItem (normal magazine) + _allowedMags = 12 - _actualMags; + + _p = primaryWeapon player; + _allowedPrimary = if (!isNil "_p" && _p != "") then {0} else {1}; + + _allowedSidearm = 1; + { + if (getNumber (configFile >> "CfgWeapons" >> _x >> "type") == 2) exitWith { // 2 = WeaponSlotHandGun (occupies pistol slot) + _allowedSidearm = 0; + }; + } count (weapons player); + + // 12 toolbelt + 1 Binoculars + 1 NVG + 1 Pistol + 1 Primary = 16 (onBack isn't counted in weapons player) + //_allowedWeapons = 16 - count(weapons player); + // Don't show tool slots as weapon slots in gear. Player is informed of tool slots count in systemChat. + _allowedWeapons = _allowedPrimary + _allowedSidearm; _pic = getText (configFile >> "CfgVehicles" >> (typeOf player) >> "portrait"); diff --git a/SQF/dayz_code/stringtable.xml b/SQF/dayz_code/stringtable.xml index 0143eb896..9f36bc095 100644 --- a/SQF/dayz_code/stringtable.xml +++ b/SQF/dayz_code/stringtable.xml @@ -16208,6 +16208,10 @@ Total backpack space exceeded. + + Only %1 mags will fit into your backpack. + В рюкзак поместится предметов: %1. + Only %1 weapons will fit into your backpack. В рюкзак поместится оружия: %1.