diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/DZE_deleteTradedVehicle.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/DZE_deleteTradedVehicle.sqf
index 6f2d5f987..ac02faa26 100644
--- a/SQF/dayz_code/actions/AdvancedTrading/functions/DZE_deleteTradedVehicle.sqf
+++ b/SQF/dayz_code/actions/AdvancedTrading/functions/DZE_deleteTradedVehicle.sqf
@@ -29,7 +29,7 @@ if ((count _VehKey2) > 0) then {
} forEach (items player);
if ((typeOf (unitBackPack player)) != "") then {
_keyArr = [(_VehKey2 select 0), (getWeaponCargo (unitBackpack player))] call _containerFindKey;
- _deleteRet = [unitBackpack player,[],_keyArr] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
+ _deleteRet = [unitBackpack player,[],_keyArr,[]] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
if (isNil "_localResult2") then {
_localResult2 = ((_deleteRet select 1) select 0);
} else {
@@ -44,7 +44,7 @@ if ((count _VehKey2) > 0) then {
};
if (!isNull _vehicle) then {
_keyArr = [(_VehKey2 select 0), (getWeaponCargo _vehicle)] call _containerFindKey;
- _deleteRet = [_vehicle,[],_keyArr] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
+ _deleteRet = [_vehicle,[],_keyArr,[]] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
if (isNil "_localResult2") then {
_localResult2 = ((_deleteRet select 1) select 0);
} else {
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 68b531129..7580d2675 100644
--- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf
+++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf
@@ -6,7 +6,7 @@ private ["_selection","_return","_toBuyWeaps","_toBuyTotalMags","_toBuyBags","_t
];
_selection = Z_SellingFrom;
_return = false;
-_toBuyWeaps = _this select 0;
+_toBuyWeaps = _this select 0; // Does not include tools
_toBuyPistolMags = (_this select 1) select 0;
_toBuyRegularMags = (_this select 1) select 1;
_toBuyTotalMags = _toBuyPistolMags + _toBuyRegularMags;
@@ -20,7 +20,7 @@ _allowedMags = 0;
_allowedWeapons = 0;
_allowedBackpacks = 0;
-if (_vehiclesToBuy > 1) exitWith {systemChat localize "STR_EPOCH_TRADE_ONE_VEHICLE"; false;};
+if (_vehiclesToBuy > 1) exitWith {systemChat localize "STR_EPOCH_TRADE_ONE_VEHICLE"; false};
if (_vehiclesToBuy > 0) then {
_toolsToBuy = _toolsToBuy + _vehiclesToBuy;
};
@@ -53,15 +53,9 @@ if (_selection == 2) then { //gear
_allowedSidearm = 0;
};
} count (weapons player);
-
- _currentBackpacks = 0;
-
+
_b = unitBackpack player;
- if (!isNull _b) then {
- _currentBackpacks = 1;
- };
-
- _allowedBackpacks = 1 - _currentBackpacks;
+ _allowedBackpacks = if (isNull _b) then {1} else {0};
_allowedTools = 14; // 12 toolbelt + 1 Binocular + 1 NVG
_duplicate = false;
@@ -87,6 +81,7 @@ if (_selection == 2) then { //gear
_check1 = true;
} else {
systemChat format[localize "STR_EPOCH_TRADE_GEAR_FULL", _allowedPrimary, _allowedSidearm , _allowedTools];
+ if (_duplicate) then { systemChat localize "STR_EPOCH_TRADE_DUPLICATE_TOOL"; };
};
if (_allowedPistolMags >= _toBuyPistolMags && _allowedRegularMags >= _toBuyRegularMags) then {
_check2 = true;
@@ -95,6 +90,8 @@ if (_selection == 2) then { //gear
};
if (_allowedBackpacks >= _toBuyBags) then {
_check3 = true;
+ } else {
+ systemChat localize "STR_EPOCH_TRADE_HAVE_BACKPACK";
};
if (_check1 && _check2 && _check3) then { _return = true; };
@@ -141,8 +138,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;
+ _allowedWeapons = _freeSpace select 2; // needed since some bags have >= 5 slots but transportMaxWeapons = 0;
_totalBagSlots = _freeSpace select 4;
} else {
systemChat localize "STR_EPOCH_TRADE_NO_BACKPACK";
@@ -151,29 +147,26 @@ if (_selection == 0) then { //backpack
_check1 = false;
_check2 = false;
_check3 = false;
- _check4 = false;
- if (_allowedWeapons >= _toBuyWeaps) then {
+ 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 {
+
+ if (_toBuyBags < 1) then { // A backpack can not hold any backpacks
_check2 = true;
} else {
- systemChat format[localize "STR_EPOCH_TRADE_BAG_MAGS", _allowedMags];
- };
- if (_toBuyBags < 1) then { // A backpack can not hold any backpacks
- _check3 = true;
+ systemChat localize "STR_EPOCH_TRADE_BAG_BAGS";
};
if (_totalSpace <= _totalBagSlots) then {
- _check4 = true;
+ _check3 = true;
} else {
systemChat localize "STR_EPOCH_TRADE_BACKPACK_FULL";
};
- if (_check0 && _check1 && _check2 && _check3 && _check4) then { _return = true; };
+ if (_check0 && _check1 && _check2 && _check3) 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 709e08997..a9f517227 100644
--- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf
+++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf
@@ -1,5 +1,5 @@
private ["_weaponsToBuy","_backpacksToBuy","_toolsToBuy","_sidearmToBuy","_primaryToBuy","_priceToBuy"
-,"_enoughMoney","_myMoney","_canBuy","_moneyInfo","_count","_success","_backpack","_toolClasses","_itemsToLog"
+,"_enoughMoney","_myMoney","_canBuy","_moneyInfo","_count","_success","_toolClasses","_itemsToLog"
,"_tCost","_bTotal","_backpack","_pistolMagsToBuy","_regularMagsToBuy"];
if (count Z_BuyingArray < 1) exitWith { systemChat localize "STR_EPOCH_TRADE_BUY_NO_ITEMS"; };
@@ -14,7 +14,6 @@ _primaryToBuy = 0;
_vehiclesToBuy = 0;
_priceToBuy = 0;
-_backpack = unitBackpack player;
_toolClasses = [];
_itemsToLog = [[],[],[],"buy"];
@@ -95,6 +94,7 @@ if (Z_SingleCurrency) then {
};
_canBuy = [_weaponsToBuy,[_pistolMagsToBuy,_regularMagsToBuy],_backpacksToBuy,_toolsToBuy,_sidearmToBuy,_primaryToBuy,_vehiclesToBuy,_toolClasses] call Z_allowBuying;
+if (!_canBuy) exitWith {}; // Keep systemChat reasons for failure in Z_allowBuying for sanity
_myMoney = player getVariable[Z_MoneyVariable,0];
@@ -113,147 +113,141 @@ if (Z_SingleCurrency) then {
_enoughMoney = _moneyInfo select 0;
};
-if (Z_SellingFrom == 0 && _backpacksToBuy > 0) exitWith { systemChat localize "STR_EPOCH_TRADE_BAG_BAGS"; }; //backpack
-if (Z_SellingFrom == 2 && !isNull _backpack && _backpacksToBuy > 0) exitWith { systemChat localize "STR_EPOCH_TRADE_HAVE_BACKPACK"; }; //gear
-
+// Pre-check if player has enough room to accept change
_success = if (Z_SingleCurrency) then { true } else { [player,_priceToBuy,_moneyInfo,true,_regularMagsToBuy] call Z_payDefault };
if (!_success) exitWith { systemChat localize "STR_EPOCH_TRADE_GEAR_AND_BAG_FULL"; }; // Not enough room in gear or bag to accept change
if (_enoughMoney) then {
- if (_canBuy) then {
_bTotal = 0;
- _buyVehicle = {
- private "_location";
- _part_out = _this select 0;
- _buyingType = _this select 1;
- _keySelected = "0";
- _isKeyOK= false;
- if (_buyingType in ["trade_any_vehicle_free", "trade_any_bicycle", "trade_any_bicycle_old"]) then {
- _isKeyOK = true;
- } else {
- _keyColor = ["Green","Red","Blue","Yellow","Black"] call BIS_fnc_selectRandom;
- _keyNumber = (floor(random 2500)) + 1;
- _keySelected = format["ItemKey%1%2",_keyColor,_keyNumber];
- _isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected);
- };
- if (!_isKeyOK) exitWith {localize "str_epoch_player_107" call dayz_rollingMessages; "";};
- _activatingPlayer = player;
- _dir = round(random 360);
- _helipad = nearestObjects [player, ["HeliHCivil","HeliHempty"], 100];
-
- if (count _helipad > 0) then {
- _location = (getPosATL (_helipad select 0));
- } else {
- _location = [([player] call FNC_GetPos),0,20,1,0,2000,0] call BIS_fnc_findSafePos;
- };
-
- _veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"];
- _location = ([_veh] call FNC_GetPos);
-
- if (_buyingType in ["trade_any_vehicle_free", "trade_any_bicycle", "trade_any_bicycle_old"]) then {
- PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,true,"0",_activatingPlayer];
- } else {
- PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,false,_keySelected,_activatingPlayer];
- };
- publicVariableServer "PVDZE_veh_Publish2";
- _keySelected;
- };
- systemChat localize "STR_EPOCH_PLAYER_105";
-
- closeDialog 2;
-
- if (Z_SellingFrom == 0) then { //backpack
- _backpack = unitBackpack player;
- {
- if (_x select 1 == "trade_weapons") then {
- _backpack addWeaponCargoGlobal [_x select 0, _x select 9];
- };
- if (_x select 1 == "trade_items") then {
- _backpack addMagazineCargoGlobal [_x select 0, _x select 9];
- };
- if ((_x select 1) in ["trade_any_vehicle", "trade_any_vehicle_free", "trade_any_vehicle_old", "trade_any_bicycle", "trade_any_bicycle_old", "trade_any_boat", "trade_any_boat_old"]) then {
- _item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
- if (_item2Add != "0") then {
- _backpack addWeaponCargoGlobal [_item2Add, 1];
- };
- };
- _bTotal = _bTotal + (_x select 9);
- } count Z_BuyingArray;
- systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_BACKPACK",_bTotal];
- };
-
- if (Z_SellingFrom == 1) then { //vehicle
- {
- if (_x select 1 == "trade_weapons") then {
- Z_vehicle addWeaponCargoGlobal [_x select 0, _x select 9];
- };
- if (_x select 1 == "trade_items") then {
- Z_vehicle addMagazineCargoGlobal [_x select 0, _x select 9];
- };
- if (_x select 1 == "trade_backpacks") then {
- Z_vehicle addBackpackCargoGlobal [_x select 0, _x select 9];
- };
- if ((_x select 1) in ["trade_any_vehicle", "trade_any_vehicle_free", "trade_any_vehicle_old", "trade_any_bicycle", "trade_any_bicycle_old", "trade_any_boat", "trade_any_boat_old"]) then {
- _item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
- if (_item2Add != "0") then {
- Z_vehicle addWeaponCargoGlobal [_item2Add, 1];
- };
- };
- _bTotal = _bTotal + (_x select 9);
- } count Z_BuyingArray;
- systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_VEHICLE",_bTotal,typeOf Z_vehicle];
- };
-
- if (Z_SellingFrom == 2) then { //gear
- {
- if (_x select 1 == "trade_weapons") then {
- _count = 0;
- while { _count < (_x select 9)} do {
- player addWeapon (_x select 0);
- _count = _count + 1;
- };
- };
- if (_x select 1 == "trade_items") then {
- _count = 0;
- while { _count < (_x select 9)} do {
- player addMagazine (_x select 0);
- _count = _count + 1;
- };
- };
- if (_x select 1 == "trade_backpacks") then {
- player addBackpack (_x select 0);
- };
- if ((_x select 1) in ["trade_any_vehicle", "trade_any_vehicle_free", "trade_any_vehicle_old", "trade_any_bicycle", "trade_any_bicycle_old", "trade_any_boat", "trade_any_boat_old"]) then {
- _item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
- if (_item2Add != "0") then {
- player addWeapon _item2Add;
- };
- };
- _bTotal = _bTotal + (_x select 9);
- } count Z_BuyingArray;
- systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_GEAR",_bTotal];
- };
- if (!Z_SingleCurrency) then {
- _success = [player,_priceToBuy,_moneyInfo,false,0] call Z_payDefault;
- if (_success) then {
- _tCost = "";
- _tCost = _priceToBuy call z_calcDefaultCurrencyNoImg;
- if (_tCost != "") then { systemChat format[localize "STR_EPOCH_TRADE_BUY_SUCCESS",_tCost]; };
- } else {
- systemChat localize "STR_EPOCH_TRADE_DEBUG";
- };
+ _buyVehicle = {
+ private "_location";
+ _part_out = _this select 0;
+ _buyingType = _this select 1;
+ _keySelected = "0";
+ _isKeyOK= false;
+ if (_buyingType in ["trade_any_vehicle_free", "trade_any_bicycle", "trade_any_bicycle_old"]) then {
+ _isKeyOK = true;
} else {
- _success = [player,_priceToBuy] call SC_fnc_removeCoins;
- if (_success) then {
- systemChat format[localize "STR_EPOCH_TRADE_SUCCESS_COINS", _priceToBuy, CurrencyName];
- } else {
- systemChat localize "STR_EPOCH_TRADE_DEBUG";
- };
+ _keyColor = ["Green","Red","Blue","Yellow","Black"] call BIS_fnc_selectRandom;
+ _keyNumber = (floor(random 2500)) + 1;
+ _keySelected = format["ItemKey%1%2",_keyColor,_keyNumber];
+ _isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected);
};
- _itemsToLog call Z_logTrade;
- } else {
- systemChat localize "STR_EPOCH_TRADE_CONTAINER_FULL";
+ if (!_isKeyOK) exitWith {localize "str_epoch_player_107" call dayz_rollingMessages; "";};
+ _activatingPlayer = player;
+ _dir = round(random 360);
+ _helipad = nearestObjects [player, ["HeliHCivil","HeliHempty"], 100];
+
+ if (count _helipad > 0) then {
+ _location = (getPosATL (_helipad select 0));
+ } else {
+ _location = [([player] call FNC_GetPos),0,20,1,0,2000,0] call BIS_fnc_findSafePos;
+ };
+
+ _veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"];
+ _location = ([_veh] call FNC_GetPos);
+
+ if (_buyingType in ["trade_any_vehicle_free", "trade_any_bicycle", "trade_any_bicycle_old"]) then {
+ PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,true,"0",_activatingPlayer];
+ } else {
+ PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,false,_keySelected,_activatingPlayer];
+ };
+ publicVariableServer "PVDZE_veh_Publish2";
+ _keySelected;
};
+ systemChat localize "STR_EPOCH_PLAYER_105";
+
+ closeDialog 2;
+
+ if (Z_SellingFrom == 0) then { //backpack
+ _backpack = unitBackpack player;
+ {
+ if (_x select 1 == "trade_weapons") then {
+ _backpack addWeaponCargoGlobal [_x select 0, _x select 9];
+ };
+ if (_x select 1 == "trade_items") then {
+ _backpack addMagazineCargoGlobal [_x select 0, _x select 9];
+ };
+ if ((_x select 1) in ["trade_any_vehicle", "trade_any_vehicle_free", "trade_any_vehicle_old", "trade_any_bicycle", "trade_any_bicycle_old", "trade_any_boat", "trade_any_boat_old"]) then {
+ _item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
+ if (_item2Add != "0") then {
+ _backpack addWeaponCargoGlobal [_item2Add, 1];
+ };
+ };
+ _bTotal = _bTotal + (_x select 9);
+ } count Z_BuyingArray;
+ systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_BACKPACK",_bTotal];
+ };
+
+ if (Z_SellingFrom == 1) then { //vehicle
+ {
+ if (_x select 1 == "trade_weapons") then {
+ Z_vehicle addWeaponCargoGlobal [_x select 0, _x select 9];
+ };
+ if (_x select 1 == "trade_items") then {
+ Z_vehicle addMagazineCargoGlobal [_x select 0, _x select 9];
+ };
+ if (_x select 1 == "trade_backpacks") then {
+ Z_vehicle addBackpackCargoGlobal [_x select 0, _x select 9];
+ };
+ if ((_x select 1) in ["trade_any_vehicle", "trade_any_vehicle_free", "trade_any_vehicle_old", "trade_any_bicycle", "trade_any_bicycle_old", "trade_any_boat", "trade_any_boat_old"]) then {
+ _item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
+ if (_item2Add != "0") then {
+ Z_vehicle addWeaponCargoGlobal [_item2Add, 1];
+ };
+ };
+ _bTotal = _bTotal + (_x select 9);
+ } count Z_BuyingArray;
+ systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_VEHICLE",_bTotal,typeOf Z_vehicle];
+ };
+
+ if (Z_SellingFrom == 2) then { //gear
+ {
+ if (_x select 1 == "trade_weapons") then {
+ _count = 0;
+ while { _count < (_x select 9)} do {
+ player addWeapon (_x select 0);
+ _count = _count + 1;
+ };
+ };
+ if (_x select 1 == "trade_items") then {
+ _count = 0;
+ while { _count < (_x select 9)} do {
+ player addMagazine (_x select 0);
+ _count = _count + 1;
+ };
+ };
+ if (_x select 1 == "trade_backpacks") then {
+ player addBackpack (_x select 0);
+ };
+ if ((_x select 1) in ["trade_any_vehicle", "trade_any_vehicle_free", "trade_any_vehicle_old", "trade_any_bicycle", "trade_any_bicycle_old", "trade_any_boat", "trade_any_boat_old"]) then {
+ _item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
+ if (_item2Add != "0") then {
+ player addWeapon _item2Add;
+ };
+ };
+ _bTotal = _bTotal + (_x select 9);
+ } count Z_BuyingArray;
+ systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_GEAR",_bTotal];
+ };
+ if (!Z_SingleCurrency) then {
+ _success = [player,_priceToBuy,_moneyInfo,false,0] call Z_payDefault;
+ if (_success) then {
+ _tCost = "";
+ _tCost = _priceToBuy call z_calcDefaultCurrencyNoImg;
+ if (_tCost != "") then { systemChat format[localize "STR_EPOCH_TRADE_BUY_SUCCESS",_tCost]; };
+ } else {
+ systemChat localize "STR_EPOCH_TRADE_DEBUG";
+ };
+ } else {
+ _success = [player,_priceToBuy] call SC_fnc_removeCoins;
+ if (_success) then {
+ systemChat format[localize "STR_EPOCH_TRADE_SUCCESS_COINS", _priceToBuy, CurrencyName];
+ } else {
+ systemChat localize "STR_EPOCH_TRADE_DEBUG";
+ };
+ };
+ _itemsToLog call Z_logTrade;
} else {
if (Z_SingleCurrency) then {
systemChat format[localize "STR_EPOCH_TRADE_NEED_COINS",_priceToBuy,CurrencyName];
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 855fe6a76..fc9555ce2 100644
--- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayFreeSpace.sqf
+++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayFreeSpace.sqf
@@ -51,8 +51,6 @@ if (_selection == 0) then { //backpack
if (!isNull _backpack) then {
_freeSpace = [_backpack,0,0,0,0] call Z_calcFreeSpace;
_totalSpace = _freeSpace select 0;
- _allowedMags = _freeSpace select 1;
- _allowedWeapons = _freeSpace select 2;
_totalBagSlots = _freeSpace select 4;
_pic = getText (configFile >> "CfgVehicles" >> (typeOf _backpack) >> "picture");
diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getVehicleItems.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getVehicleItems.sqf
index c604293ab..93966bdb9 100644
--- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getVehicleItems.sqf
+++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getVehicleItems.sqf
@@ -35,7 +35,8 @@ if (!isNull _vehicle) then {
_normalMags = _freeSpace select 5;
_normalWeaps = _freeSpace select 6;
//_normalBags = _freeSpace select 7;
- // Can't sell backpacks from vehicle because there is currently no command to remove single backpacks from cargo (only clearBackpackCargo which removes all)
+ // Don't allow selling backpacks from vehicles because we can not get backpack contents.
+ // We can only remove all backpacks with clearBackpackCargo and then add back new empty backpacks for ones that weren't sold.
[_normalWeaps,_normalMags,typeOf _vehicle,[]] call Z_checkArrayInConfig;
};
diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_payDefault.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_payDefault.sqf
index 93a6a2860..4d25c4e47 100644
--- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_payDefault.sqf
+++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_payDefault.sqf
@@ -16,10 +16,10 @@ if (!_justChecking) then {
} count _moneyInGear;
if (count _moneyInBackpack > 0) then {
- _nil = [unitBackpack _player, _moneyInBackpack, []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
+ _nil = [unitBackpack _player, _moneyInBackpack, [], []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
};
if (!isNull Z_vehicle && count _moneyInVehicle > 0) then {
- _nil = [Z_vehicle, _moneyInVehicle, []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
+ _nil = [Z_vehicle, _moneyInVehicle, [], []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
};
};
diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf
index ac3be2191..621de4efd 100644
--- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf
+++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf
@@ -110,7 +110,7 @@ if (Z_SellingFrom == 0) then {
systemchat format[localize "STR_EPOCH_TRADE_SELL_IN_BACKPACK",count _tSold];
};
if (Z_SellingFrom == 1) then {
- _outcome = [Z_vehicle,_itemsArray,_weaponsArray,_bpArray, _vehArray] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
+ _outcome = [Z_vehicle,_itemsArray,_weaponsArray,_vehArray] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
systemchat format[localize "STR_EPOCH_TRADE_SELL_IN_VEHICLE",count _tSold,typeOf Z_vehicle];
};
diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf
index 47c7be729..1c63edc39 100644
--- a/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf
+++ b/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf
@@ -1,48 +1,29 @@
/* ----------------------------------------------------------------------------
Examples:
- _result = [_backpack, ["SmokeShell","M16_AMMO"],["M16","M16","M240"],["backpack1","backpack2"]] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
- _result == [[1,0,0,1,1,1,0],[1,0,0,1],[1,0]]; // 1 = success, 0 = fail ->(item was not in cargo)
+ _result = [_backpack, ["SmokeShell","M16_AMMO"],["M16","M16","M240"], _vehInfo] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
+ _result == [[1,0,0,1,1,1,0],[1,0,0,1],[]]; // 1 = success, 0 = fail ->(item was not in cargo)
Author:
Zupa 2014-09-30
---------------------------------------------------------------------------- */
-private ["_bags","_vehInfo","_inCargo","_object","_items","_weaps","_normalMags","_normalWeaps","_normalBags","_returnVar","_returnMag","_returnWeap","_returnBag","_freeSpace"];
+private ["_vehInfo","_inCargo","_object","_mags","_weaps","_normalMags","_normalWeaps","_returnVar","_returnMag","_returnWeap","_freeSpace"];
_object = _this select 0;
-_items = _this select 1;
+_mags = _this select 1;
_weaps = _this select 2;
-_bags = [];
-_vehInfo = [];
-
-if (count _this > 3) then {
- if (count (_this select 3) > 0) then {
- if (typeName ((_this select 3) select 0) == "STRING") then {
- _bags = _this select 3;
- } else {
- _vehInfo = _this select 3;
- };
- };
- if (count _this == 5) then {
- _vehInfo = _this select 4;
- };
-};
+_vehInfo = _this select 3;
_freeSpace = [_object,0,0,0,0] call Z_calcFreeSpace;
_normalMags = _freeSpace select 5;
_normalWeaps = _freeSpace select 6;
-_normalBags = _freeSpace select 7;
clearMagazineCargoGlobal _object;
clearWeaponCargoGlobal _object;
-if (count _bags > 0) then {
- clearBackpackCargoGlobal _object;
-};
-
_returnVar = [];
_returnMag = [];
_returnWeap = [];
-_returnBag = [];
+
{
_inCargo = _normalMags find _x;
if (_inCargo > -1) then {
@@ -51,25 +32,13 @@ _returnBag = [];
} else {
_returnMag set [count(_returnMag),0];
};
-} count _items;
+} count _mags;
+
_normalMags = _normalMags - ["soldItem"];
{
_object addMagazineCargoGlobal [_x, 1];
} count _normalMags;
-{
- _inCargo = _normalBags find _x;
- if (_inCargo > -1) then {
- _normalBags set [_inCargo, "soldItem"];
- _returnBag set [count(_returnBag),1];
- } else {
- _returnBag set [count(_returnBag),0];
- };
-} count _bags;
-{
- _object addBackpackCargoGlobal [_x, 1];
-} count _normalBags;
-
{
_inCargo = _normalWeaps find _x;
if (_inCargo > -1) then {
@@ -84,7 +53,6 @@ _normalWeaps = _normalWeaps - ["soldItem"];
{
_object addWeaponCargoGlobal [_x, 1];
} count _normalWeaps;
-_normalWeaps = _normalWeaps - ["soldItem"];
if (count _vehInfo > 0) then {
_sell = [_vehInfo, ((_vehInfo select 0) select 4), _object] call DZE_deleteTradedVehicle;
@@ -95,6 +63,6 @@ if (count _vehInfo > 0) then {
_returnVar set [0,_returnMag];
_returnVar set [1,_returnWeap];
-_returnVar set [2,_returnBag];
+_returnVar set [2,[]];
_returnVar
\ No newline at end of file
diff --git a/SQF/dayz_code/stringtable.xml b/SQF/dayz_code/stringtable.xml
index ed4b0f5d8..0143eb896 100644
--- a/SQF/dayz_code/stringtable.xml
+++ b/SQF/dayz_code/stringtable.xml
@@ -16182,6 +16182,9 @@
You can only purchase one vehicle at a time.
Вы можете купить только один транспорт за сделку.
+
+ You can not buy more than one of the same tool into your gear.
+
You can only buy %1 primary, %2 sidearm and %3 tools into your gear.
Вы можете купить в снаряжение: оружия-%1, пистолетов-%2, инструментов-%3.
@@ -16209,10 +16212,6 @@
Only %1 weapons will fit into your backpack.
В рюкзак поместится оружия: %1.
-
- Only %1 mags will fit into your backpack.
- В рюкзак поместится предметов: %1.
-
You can't purchase a backpack into your backpack.
В рюкзак поместится рюкзаков: 0.
@@ -16259,17 +16258,6 @@
DEBUG: Something went wrong in the pay process. Please report this issue.
Отладка: Что-то пошло не так в процессе оплаты. Пожалуйста, сообщите об этой проблеме.
-
- Cannot buy: No empty slots!
- Kauf nicht möglich: Keine freien Slots
- Impossibile comprare: nessuno slot vuoto!
- No puedes comprar: ¡no hay huecos libres!
- Achat impossible : aucun emplacement vide !
- Nelze koupit: Není volné místo!
- Нет пустых ячеек!
- Nie można kupić: brak wolnych miejsc!
- Nem vásárolhatsz! Nincs üres hely!
-
Cannot buy: Not enough empty slots in your gear or bag to accept change!