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
This commit is contained in:
oiad
2016-07-31 02:03:00 +12:00
committed by ebaydayz
parent 1d2fc3b266
commit 7c4d25ef1a
59 changed files with 536 additions and 538 deletions

View File

@@ -1,7 +1,7 @@
private ["_selection","_return","_toBuyWeaps","_toBuyMags","_toBuyBags","_toolsToBuy","_sidearmToBuy","_primaryToBuy","_currentPrimarys"
,"_currentSec","_currentPrim","_currentTool","_p","_b","_check0","_check1","_check2","_check3","_check4","_mags","_weaps","_bags"
,"_normalBags","_normalMags","_normalWeaps","_allowedMags","_allowedPrimary","_allowedTools","_allowedSidearm","_allowedWeapons","_allowedBackpacks"
,"_totalSpace","_totalNewSpace","_counter","_parentClasses","_alreadyInBackpack","_kinds","_kinds2","_kinds3","_ammmounts","_ammmounts2","_ammmounts3",
,"_totalSpace","_totalNewSpace","_counter","_parentClasses","_alreadyInBackpack","_kinds","_kinds2","_kinds3","_amounts","_amounts2","_amounts3",
"_actualMags","_toolClasses","_duplicate","_quantity","_tool","_totalBagSlots"
];
_selection = Z_SellingFrom;
@@ -20,14 +20,14 @@ if (_vehiclesToBuy > 0) then {
_toolsToBuy = _toolsToBuy + _vehiclesToBuy;
};
if(_selection == 2) then{ //gear
if (_selection == 2) then { //gear
_actualMags = {!(_x in MeleeMagazines)} count (magazines player);
_allowedMags = 20 - _actualMags;
_currentPrimarys = 0;
_p = primaryWeapon player;
if ( !isNil '_p' && _p != "" ) then {
if (!isNil '_p' && _p != "") then {
_currentPrimarys = 1;
};
@@ -44,7 +44,7 @@ if(_selection == 2) then{ //gear
_currentBackpacks = 0;
_b = unitBackpack player;
if ( !isNull _b ) then {
if (!isNull _b) then {
_currentBackpacks = 1;
};
@@ -53,12 +53,12 @@ if(_selection == 2) then{ //gear
_allowedTools = 14; // 12 toolbelt + 1 Binocular + 1 NVG
_duplicate = false;
{
_parentClasses = [(configFile >> "CfgWeapons" >> _x ),true] call BIS_fnc_returnParents;
if( 'ItemCore' in _parentClasses || 'Binocular' in _parentClasses) then {
_parentClasses = [(configFile >> "CfgWeapons" >> _x),true] call BIS_fnc_returnParents;
if ('ItemCore' in _parentClasses || 'Binocular' in _parentClasses) then {
_allowedTools = _allowedTools - 1;
if (_x in _toolClasses) then {_duplicate = true;}; // Forbid purchasing duplicate tools into gear
}
}count (weapons player);
} count (weapons player);
{
_tool = _x;
@@ -70,32 +70,28 @@ if(_selection == 2) then{ //gear
_check2 = false;
_check3 = false;
if( _allowedPrimary >= _primaryToBuy && _allowedSidearm >= _sidearmToBuy && _allowedTools >= _toolsToBuy && !_duplicate)then{
if (_allowedPrimary >= _primaryToBuy && _allowedSidearm >= _sidearmToBuy && _allowedTools >= _toolsToBuy && !_duplicate) then {
_check1 = true;
}else{
} else {
systemChat format[localize "STR_EPOCH_TRADE_GEAR_FULL", _allowedPrimary, _allowedSidearm , _allowedTools];
};
if( _allowedMags >= _toBuyMags)then{
if (_allowedMags >= _toBuyMags) then {
_check2 = true;
}else{
} else {
systemChat format[localize "STR_EPOCH_TRADE_MAGS_FULL",_allowedMags];
};
if( _allowedBackpacks >= _toBuyBags)then{
if (_allowedBackpacks >= _toBuyBags) then {
_check3 = true;
}else{
systemChat format[localize "STR_EPOCH_TRADE_BAG_FULL",_allowedBackpacks];
};
if(_check1 && _check2 && _check3)then{
_return = true;
};
if (_check1 && _check2 && _check3) then { _return = true; };
};
if(_selection == 1) then{ //vehicle
if (_selection == 1) then { //vehicle
_allowedMags = 0;
_allowedWeapons = 0;
_allowedBackpacks = 0;
if ( !isNull Z_vehicle) then {
if (!isNull Z_vehicle) then {
_mags = getMagazineCargo Z_vehicle;
_weaps = getWeaponCargo Z_vehicle;
@@ -106,35 +102,34 @@ if(_selection == 1) then{ //vehicle
_normalBags = [];
_kinds = _mags select 0;
_ammmounts = _mags select 1;
_amounts = _mags select 1;
{
_counter = 0 ;
while{ _counter < ( _ammmounts select _forEachIndex)}do{
while {_counter < (_amounts select _forEachIndex)} do {
_normalMags set [count(_normalMags),_x];
_counter = _counter + 1;
};
}forEach _kinds;
} forEach _kinds;
_kinds2 = _weaps select 0;
_ammmounts2 = _weaps select 1;
_amounts2 = _weaps select 1;
{
_counter = 0 ;
while{ _counter < ( _ammmounts2 select _forEachIndex)}do{
while {_counter < (_amounts2 select _forEachIndex)} do {
_normalWeaps set [count(_normalWeaps),_x];
_counter = _counter + 1;
};
}forEach _kinds2;
} forEach _kinds2;
_kinds3 = _bags select 0;
_ammmounts3 = _bags select 1;
_amounts3 = _bags select 1;
{
_counter = 0 ;
while{ _counter < ( _ammmounts3 select _forEachIndex)}do{
while{_counter < (_amounts3 select _forEachIndex)} do {
_normalBags set [count(_normalBags),_x];
_counter = _counter + 1;
};
}forEach _kinds3;
} forEach _kinds3;
_allowedWeapons = getNumber (configFile >> 'CfgVehicles' >> (typeOf Z_vehicle) >> 'transportMaxWeapons') - count(_normalWeaps);
_allowedMags = getNumber (configFile >> 'CfgVehicles' >> (typeOf Z_vehicle) >> 'transportMaxMagazines') - count(_normalMags);
@@ -145,27 +140,26 @@ if(_selection == 1) then{ //vehicle
_check2 = false;
_check3 = false;
if( _allowedWeapons >= ( _toBuyWeaps + _toolsToBuy ) )then{
if (_allowedWeapons >= (_toBuyWeaps + _toolsToBuy)) then {
_check1 = true;
}else{
} else {
systemChat format[localize "STR_EPOCH_TRADE_VEHICLE_WEPS", _allowedWeapons];
};
if( _allowedMags >= _toBuyMags)then{
if (_allowedMags >= _toBuyMags) then {
_check2 = true;
}else{
} else {
systemChat format[localize "STR_EPOCH_TRADE_VEHICLE_MAGS", _allowedMags];
};
if( _allowedBackpacks >= _toBuyBags)then{
if (_allowedBackpacks >= _toBuyBags) then {
_check3 = true;
}else{
} else {
systemChat format[localize "STR_EPOCH_TRADE_VEHICLE_BAGS", _allowedBackpacks];
};
if(_check1 && _check2 && _check3)then{
_return = true;
};
if (_check1 && _check2 && _check3) then { _return = true; };
};
if(_selection == 0) then{ //backpack
if (_selection == 0) then { //backpack
_allowedWeapons = 0;
_allowedMags = 0;
_allowedBackpacks = 0;
@@ -185,41 +179,39 @@ if(_selection == 0) then{ //backpack
_normalWeaps = [];
_kinds = _mags select 0;
_ammmounts = _mags select 1;
_amounts = _mags select 1;
{
_counter = 0 ;
while{ _counter < ( _ammmounts select _forEachIndex)} do {
while {_counter < (_amounts select _forEachIndex)} do {
_normalMags set [count(_normalMags), _x];
_counter = _counter + 1;
};
}forEach _kinds;
} forEach _kinds;
_kinds2 = _weaps select 0;
_ammmounts2 = _weaps select 1;
_amounts2 = _weaps select 1;
{
_counter = 0 ;
while{ _counter < ( _ammmounts2 select _forEachIndex)} do {
while {_counter < (_amounts2 select _forEachIndex)} do {
_normalWeaps set [count(_normalWeaps), _x];
_counter = _counter + 1;
};
}forEach _kinds2;
} forEach _kinds2;
_allowedWeapons = getNumber (configFile >> 'CfgVehicles' >> (typeOf _backpack) >> 'transportMaxWeapons') - count(_normalWeaps);
_totalBagSlots = getNumber (configFile >> 'CfgVehicles' >> (typeOf _backpack) >> 'transportMaxMagazines');
_allowedMags = _totalBagSlots - count(_normalMags);
_currentPrim = 0;
_currentSec = 0;
_currentTool = 0;
{
_parentClasses = [(configFile >> "CfgWeapons" >> _x ),true] call BIS_fnc_returnParents;
if( 'ItemCore' in _parentClasses || 'Binocular' in _parentClasses ) then {
_parentClasses = [(configFile >> "CfgWeapons" >> _x),true] call BIS_fnc_returnParents;
if ('ItemCore' in _parentClasses || 'Binocular' in _parentClasses) then {
_currentTool = _currentTool + 1;
} else {
if( 'PistolCore' in _parentClasses )then {
if ('PistolCore' in _parentClasses) then {
_currentSec = _currentSec + 1;
} else {
_currentPrim = _currentPrim + 1;
@@ -227,15 +219,14 @@ if(_selection == 0) then{ //backpack
};
} count _normalWeaps;
_alreadyInBackpack = (10 * _currentPrim) + (5 * _currentSec) + _currentTool + count(_normalMags);
_totalNewSpace = 10 * _primaryToBuy + 5 * _sidearmToBuy + _toolsToBuy + _toBuyMags;
_totalSpace = _alreadyInBackpack + _totalNewSpace;
}else {
systemChat localize "STR_EPOCH_TRADE_NEED_BAG";
} else {
systemChat localize "STR_EPOCH_TRADE_NO_BACKPACK";
};
_check1 = false;
@@ -243,31 +234,27 @@ if(_selection == 0) then{ //backpack
_check3 = false;
_check4 = false;
if( _allowedWeapons >= _toBuyWeaps)then{
if (_allowedWeapons >= _toBuyWeaps) then {
_check1 = true;
} else {
systemChat format[localize "STR_EPOCH_TRADE_BAG_WEPS", _allowedWeapons];
};
if( _allowedMags >= _toBuyMags)then{
if (_allowedMags >= _toBuyMags) then {
_check2 = true;
} else {
systemChat format[localize "STR_EPOCH_TRADE_BAG_MAGS", _allowedMags];
};
if( _allowedBackpacks >= _toBuyBags)then{
if (_allowedBackpacks >= _toBuyBags) then {
_check3 = true;
} else {
systemChat format[localize "STR_EPOCH_TRADE_BAG_BAGS", _allowedBackpacks ];
};
if( _totalSpace <= _totalBagSlots)then{
if (_totalSpace <= _totalBagSlots) then {
_check4 = true;
}else{
} else {
systemChat localize "STR_EPOCH_TRADE_BACKPACK_FULL";
};
if(_check0 && _check1 && _check2 && _check3 && _check4)then{
_return = true;
};
if (_check0 && _check1 && _check2 && _check3 && _check4) then { _return = true; };
};
_return;
_return;