Add launcher handling to advanced trading

This commit is contained in:
ebaydayz
2016-10-31 13:07:07 -04:00
parent cd48b883a7
commit 866358e4d0
10 changed files with 125 additions and 17 deletions

View File

@@ -50,10 +50,12 @@ if (_selection == 2) then { //gear
_allowedBinocular = 2;
_duplicate = false;
{
_type = getNumber (configFile >> "CfgWeapons" >> _x >> "type");
if (_type == 2) then { _allowedSidearm = 0; }; // WeaponSlotHandGun (occupies pistol slot)
if (_type == 4096) then { _allowedBinocular = _allowedBinocular - 1; }; // WeaponSlotBinocular
if (_type == 131072) then { _allowedTools = _allowedTools - 1; }; // WeaponSlotInventory (toolbelt slot)
switch getNumber (configFile >> "CfgWeapons" >> _x >> "type") do {
case 2: {_allowedSidearm = 0;}; //Pistol
case 4: {_allowedBackpacks = 0;}; //Launcher
case 4096: {_allowedBinocular = _allowedBinocular - 1;}; //Binocular slot
case 131072: {_allowedTools = _allowedTools - 1;}; //Toolbelt slot
};
if (_x in _toolClasses) exitWith {_duplicate = true;}; // Forbid purchasing duplicate tools into gear
} count (weapons player);

View File

@@ -66,7 +66,7 @@ if (Z_SingleCurrency) then {
if ('PistolCore' in _parentClasses) then {
_sidearmToBuy = _sidearmToBuy + (_x select 9);
} else {
_primaryToBuy = _primaryToBuy + (_x select 9);
_primaryToBuy = _primaryToBuy + (_x select 9); //Include launchers in this count since they also take up 10 slots in backpack
};
};
_priceToBuy = _priceToBuy + ((_x select 11)*(_x select 2)*(_x select 9));

View File

@@ -14,11 +14,14 @@ if (_selection == 2) then { //gear
_p = primaryWeapon player;
_allowedPrimary = if (_p != "") then {0} else {1};
if (DZE_TwoPrimaries == 2 && dayz_onBack == "") then { _allowedPrimary = _allowedPrimary + 1; };
_backpack = unitBackpack player;
_allowedBackpacks = if (isNull _backpack) then {1} else {0};
_allowedSidearm = 1;
{
if (getNumber (configFile >> "CfgWeapons" >> _x >> "type") == 2) exitWith { // 2 = WeaponSlotHandGun (occupies pistol slot)
_allowedSidearm = 0;
switch getNumber (configFile >> "CfgWeapons" >> _x >> "type") do {
case 2: {_allowedSidearm = 0;}; //Pistol
case 4: {_allowedBackpacks = 0;}; //Launcher
};
} count (weapons player);
@@ -34,9 +37,6 @@ if (_selection == 2) then { //gear
, _pic
];
_backpack = unitBackpack player;
_allowedBackpacks = if (isNull _backpack) then {1} else {0};
_returnArray = [_allowedMags, _allowedWeapons, _allowedBackpacks];
};