From 7c4d25ef1a4851415e090af927f9f687165e3554 Mon Sep 17 00:00:00 2001 From: oiad Date: Sun, 31 Jul 2016 02:03:00 +1200 Subject: [PATCH] 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 --- SQF/dayz_code/Configs/CfgExtra/snappoints.hpp | 8 +- .../object_removePlotRadius.sqf | 14 +- .../A_Plot_for_Life/object_showPlotRadius.sqf | 8 +- .../A_Plot_for_Life/plot_take_ownership.sqf | 21 ++- .../functions/SC_fnc_addCoins.sqf | 2 + .../functions/SC_fnc_removeCoins.sqf | 28 ++-- .../functions/z_at_allowBuying.sqf | 117 +++++++------- .../functions/z_at_buyItems.sqf | 72 +++++---- .../functions/z_at_calcBuyableList.sqf | 17 +- .../functions/z_at_calcPrice.sqf | 46 +++--- .../functions/z_at_calculateFreeSpace.sqf | 14 +- .../functions/z_at_canAfford.sqf | 28 ++-- .../functions/z_at_changeBuySell.sqf | 4 +- .../functions/z_at_checkArrayInConfig.sqf | 147 ++++++++---------- .../functions/z_at_checkCloseVehicle.sqf | 7 +- .../functions/z_at_clearBuyList.sqf | 3 +- .../functions/z_at_clearBuyingList.sqf | 4 +- .../functions/z_at_clearLists.sqf | 3 +- .../functions/z_at_clearSellableList.sqf | 3 +- .../functions/z_at_displayBackpackInfo.sqf | 15 +- .../functions/z_at_displayItemInfo.sqf | 2 + .../functions/z_at_displayVehicleInfo.sqf | 4 +- .../functions/z_at_displayWeaponInfo.sqf | 8 +- .../functions/z_at_fillBuyableList.sqf | 4 +- .../functions/z_at_fillBuyingList.sqf | 4 +- .../functions/z_at_fillCategories.sqf | 3 +- .../functions/z_at_fillSellList.sqf | 4 +- .../functions/z_at_fillSellingList.sqf | 4 +- .../functions/z_at_filleTradeTitle.sqf | 4 +- .../functions/z_at_filterList.sqf | 25 +-- .../functions/z_at_getBackpackItems.sqf | 22 ++- .../functions/z_at_getContainer.sqf | 57 ++++--- .../functions/z_at_getGearItems.sqf | 7 +- .../functions/z_at_getItemConfig.sqf | 4 +- .../functions/z_at_getItemInfo.sqf | 8 +- .../functions/z_at_getVehicleItems.sqf | 32 ++-- .../functions/z_at_logTrade.sqf | 12 +- .../functions/z_at_payDefault.sqf | 6 +- .../functions/z_at_pushItemToList.sqf | 6 +- .../z_at_removeItemFromBuyingList.sqf | 6 +- .../functions/z_at_removeItemFromList.sqf | 6 +- .../functions/z_at_sellItems.sqf | 72 ++++----- .../functions/z_at_toBuyingList.sqf | 4 +- ...upa_fnc_removeWeaponsAndMagazinesCargo.sqf | 56 +++---- .../actions/AdvancedTrading/init.sqf | 9 +- .../actions/doorManagement/doorAddFriend.sqf | 3 +- .../actions/doorManagement/doorGetFriends.sqf | 3 +- .../doorManagement/doorNearbyHumans.sqf | 3 +- .../doorManagement/doorRemoveFriend.sqf | 3 +- .../doorManagement/initDoorManagement.sqf | 23 +-- .../doorManagement/player_enterCode.sqf | 3 +- .../actions/plotManagement/plotAddFriend.sqf | 4 +- .../actions/plotManagement/plotGetFriends.sqf | 1 + .../plotManagement/plotNearbyHumans.sqf | 1 + .../actions/plotManagement/plotObjects.sqf | 10 +- .../plotManagement/plotRemoveFriend.sqf | 3 +- SQF/dayz_code/configVariables.sqf | 2 +- SQF/dayz_code/credits.txt | 2 +- SQF/dayz_code/stringtable.xml | 83 ++++------ 59 files changed, 536 insertions(+), 538 deletions(-) diff --git a/SQF/dayz_code/Configs/CfgExtra/snappoints.hpp b/SQF/dayz_code/Configs/CfgExtra/snappoints.hpp index 227947950..ca03ff1f4 100644 --- a/SQF/dayz_code/Configs/CfgExtra/snappoints.hpp +++ b/SQF/dayz_code/Configs/CfgExtra/snappoints.hpp @@ -304,10 +304,10 @@ class SnapBuilding { class MetalFloor_DZ: FloorsWallsStairs{ points[] = { {0,0,0,"Pivot"}, - {0, -2.64, 0.025,"Back"}, - {0, 2.64, 0.025,"Front"}, - {-2.64, 0, 0.025,"Left"}, - {2.64, 0, 0.025,"Right"} + {0, -2.64, 0.166,"Back"}, + {0, 2.64, 0.166,"Front"}, + {-2.64, 0, 0.166,"Left"}, + {2.64, 0, 0.166,"Right"} }; radius = 12; }; diff --git a/SQF/dayz_code/actions/A_Plot_for_Life/object_removePlotRadius.sqf b/SQF/dayz_code/actions/A_Plot_for_Life/object_removePlotRadius.sqf index f95c4eb0f..15b8383df 100644 --- a/SQF/dayz_code/actions/A_Plot_for_Life/object_removePlotRadius.sqf +++ b/SQF/dayz_code/actions/A_Plot_for_Life/object_removePlotRadius.sqf @@ -1,19 +1,18 @@ // Remove preview build by RimBlock (http://epochmod.com/forum/index.php?/user/12612-rimblock/) - -private ["_location","_object","_objects","_i","_dir","_nearPlotPole","_validMarkers","_findNearestPoles","_poleinv","_IsNearPlot","_plotpole"]; +private ["_distance","_plotPole","_findNearestPoles","_validMarkers","_isNearPlot","_poleInv"] _distance = (DZE_PlotPole select 0) + 5; // check for near plot -_plotpole = nearestobject [(vehicle player),"Plastic_Pole_EP1_DZ"]; +_plotPole = nearestobject [(vehicle player),"Plastic_Pole_EP1_DZ"]; _findNearestPoles = (position _plotpole) nearEntities ["Land_coneLight", _distance]; _validMarkers = []; -_isnearplot = 0; +_isNearPlot = 0; { - _poleinv = _x getVariable ["inventory",[]]; + _poleInv = _x getVariable ["inventory",[]]; - if (_poleinv select 0 == "PPMarker") then { + if (_poleInv select 0 == "PPMarker") then { _validMarkers set [count _validMarkers,_x]; }; } count _findNearestPoles; @@ -26,5 +25,4 @@ if (_IsNearPlot > 0) then{ diag_log format["Object remove plot radius: [Destroying object: %1]",_x]; deleteVehicle _x; } count _validMarkers; -}; - +}; \ No newline at end of file diff --git a/SQF/dayz_code/actions/A_Plot_for_Life/object_showPlotRadius.sqf b/SQF/dayz_code/actions/A_Plot_for_Life/object_showPlotRadius.sqf index 377207552..80f8cdff5 100644 --- a/SQF/dayz_code/actions/A_Plot_for_Life/object_showPlotRadius.sqf +++ b/SQF/dayz_code/actions/A_Plot_for_Life/object_showPlotRadius.sqf @@ -1,11 +1,10 @@ // Build preview adopted from Axe Cop (@vos) Base Destruction Script // Amended by RimBlock (http://epochmod.com/forum/index.php?/user/12612-rimblock/) to allow plot radius removal. - -private ["_location","_object","_i","_dir","_nearPlotPole","_light","_lightlocationtemp","_lightlocation","_lightarray"]; +private ["_location","_object","_i","_nearPlotPole","_lightArray","_BD_radius","_BD_center","_color"]; // global vars _nearPlotPole = nearestObject [player, "Plastic_Pole_EP1_DZ"]; -_lightarray = []; +_lightArray = []; //"privatized" center variable _BD_radius = DZE_PlotPole select 0; @@ -21,6 +20,3 @@ for "_i" from 0 to 360 step (450 / _BD_radius) do { _object setVariable ["Inventory", ["PPMarker"],true]; _object enableSimulation false; _object setpos _location; - -}; - diff --git a/SQF/dayz_code/actions/A_Plot_for_Life/plot_take_ownership.sqf b/SQF/dayz_code/actions/A_Plot_for_Life/plot_take_ownership.sqf index 7aaaadc79..8ebc10806 100644 --- a/SQF/dayz_code/actions/A_Plot_for_Life/plot_take_ownership.sqf +++ b/SQF/dayz_code/actions/A_Plot_for_Life/plot_take_ownership.sqf @@ -23,7 +23,7 @@ if (_isowner select 0) then { { _object = _x; _classname = typeOf _object; - if (_classname in DZE_plotTakeOwnershipItems)then { + if (_classname in DZE_plotTakeOwnershipItems) then { _isowner = [player, _object] call FNC_check_access; diag_log text "Plot Take Ownership: Object in DZE_plotTakeOwnershipItems"; @@ -44,9 +44,9 @@ if (_isowner select 0) then { _object setvariable["ObjectID", "0"]; if (_classname in DZE_DoorsLocked) then { - _charID = _object getVariable ["characterID",dayz_characterID]; - }else{ - _charID = dayz_characterID; + _charID = _object getVariable ["characterID",dayz_characterID]; + } else { + _charID = dayz_characterID; }; _position = getPosATL _object; @@ -56,25 +56,25 @@ if (_isowner select 0) then { _invW = getWeaponCargo _object; { if ((count _x) != 0) then {_itemsExist = true;}; - }foreach _invW; + } foreach _invW; _invM = getMagazineCargo _object; - if !(_itemsExist) then{ + if !(_itemsExist) then { { if ((count _x) != 0) then {_itemsExist = true;}; }foreach _invM; }; _invB = getBackpackCargo _object; - if !(_itemsExist) then{ + if !(_itemsExist) then { { if ((count _x) != 0) then {_itemsExist = true;}; - }foreach _invB; + } foreach _invB; }; - if (_itemsExist) then{ + if (_itemsExist) then { _inventory = format["[%1,%2,%3]", _invW, _invM, _invB]; - }else{ + } else { _inventory = "[]"; }; @@ -92,5 +92,4 @@ if (_isowner select 0) then { }; } count _findNearestObjects; format[localize "STR_EPOCH_APLOTFORLIFE_TAKE_OWNERSHIP",_changecount] call dayz_rollingMessages; - }; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/SC_fnc_addCoins.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/SC_fnc_addCoins.sqf index a9dfd626a..e25281fe9 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/SC_fnc_addCoins.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/SC_fnc_addCoins.sqf @@ -1,4 +1,5 @@ private ["_player","_amount","_wealth","_newwealth", "_result"]; + _player = _this select 0; _amount = _this select 1; _result = false; @@ -10,4 +11,5 @@ if (_player == player) then {call player_forceSave;}; _player setVariable ["moneychanged",1,true]; _newwealth = _player getVariable[Z_MoneyVariable,0]; if (_newwealth >= _wealth) then { _result = true; }; + _result diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/SC_fnc_removeCoins.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/SC_fnc_removeCoins.sqf index c558175df..a92bb1643 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/SC_fnc_removeCoins.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/SC_fnc_removeCoins.sqf @@ -1,21 +1,23 @@ private ["_player","_amount","_wealth","_newwealth", "_result"]; + _player = _this select 0; _amount = _this select 1; _result = false; _wealth = _player getVariable[Z_MoneyVariable,0]; -if(_amount > 0)then{ -if (_wealth < _amount) then { -_result = false; +if (_amount > 0) then { + if (_wealth < _amount) then { + _result = false; + } else { + _newwealth = _wealth - _amount; + _player setVariable[Z_MoneyVariable,_newwealth, true]; + _player setVariable ["moneychanged",1,true]; + _result = true; + // can't use (magazines _player), server_playerSync expects nested array with ammo counts from player_countMagazines + // also fourth parameter in PVDZ_plr_Save is now used for achievements + if (_player == player) then { call player_forceSave; }; + }; } else { -_newwealth = _wealth - _amount; -_player setVariable[Z_MoneyVariable,_newwealth, true]; -_player setVariable ["moneychanged",1,true]; -_result = true; -// can't use (magazines _player), server_playerSync expects nested array with ammo counts from player_countMagazines -// also fourth parameter in PVDZ_plr_Save is now used for achievements -if (_player == player) then {call player_forceSave;}; -}; -}else{ -_result = true; + _result = true; }; + _result 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 a29b6d265..7b73e8e6c 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf @@ -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; \ No newline at end of file +_return; 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 7302c70b3..43d53cbd2 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 ["_magazinesToBuy", "_weaponsToBuy", "_backpacksToBuy", "_toolsToBuy", "_sidearmToBuy", "_primaryToBuy", "_priceToBuy" -,"_enoughMoney", "_myMoney", "_canBuy", "_moneyInfo","_count","_success","_backpack","_toolClasses","_itemsToLog","_tCost","_bTotal" +,"_enoughMoney", "_myMoney", "_canBuy", "_moneyInfo","_count","_success","_backpack","_toolClasses","_itemsToLog","_tCost","_bTotal","_backpack" ]; if (count Z_BuyingArray < 1) exitWith { systemChat localize "STR_EPOCH_TRADE_BUY_NO_ITEMS"; }; @@ -11,21 +11,22 @@ _toolsToBuy = 0; _sidearmToBuy = 0; _primaryToBuy = 0; _vehiclesToBuy = 0; - _priceToBuy = 0; + +_backpack = unitBackpack player; _toolClasses = []; _itemsToLog = [[],[],[],"buy"]; if (Z_SingleCurrency) then { { - if( _x select 1 == "trade_weapons")then{ + if (_x select 1 == "trade_weapons") then { _parentClasses = [(configFile >> "CfgWeapons" >> (_x select 0)),true] call BIS_fnc_returnParents; - if( 'ItemCore' in _parentClasses || 'Binocular' in _parentClasses) then { + if ('ItemCore' in _parentClasses || 'Binocular' in _parentClasses) then { _toolsToBuy = _toolsToBuy + (_x select 9); _toolClasses set [count _toolClasses,(_x select 0)]; } else { _weaponsToBuy = _weaponsToBuy + (_x select 9); - if('PistolCore' in _parentClasses)then { + if ('PistolCore' in _parentClasses) then { _sidearmToBuy = _sidearmToBuy + (_x select 9); } else { _primaryToBuy = _primaryToBuy + (_x select 9); // _ammount @@ -33,15 +34,15 @@ if (Z_SingleCurrency) then { }; _priceToBuy = _priceToBuy + ((_x select 9)*(_x select 2)); }; - if( _x select 1 == "trade_items")then{ + if (_x select 1 == "trade_items") then { _magazinesToBuy = _magazinesToBuy + (_x select 9) ; _priceToBuy = _priceToBuy + ((_x select 9)*(_x select 2)); }; - if( _x select 1 == "trade_backpacks")then{ + if (_x select 1 == "trade_backpacks") then { _backpacksToBuy = _backpacksToBuy + (_x select 9) ; _priceToBuy = _priceToBuy + ((_x select 9)*(_x select 2)); // _price * _amount }; - 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{ + 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 { _vehiclesToBuy = _vehiclesToBuy + (_x select 9) ; _priceToBuy = _priceToBuy + ((_x select 9)*(_x select 2)); // _price * _amount }; @@ -51,14 +52,14 @@ if (Z_SingleCurrency) then { } count Z_BuyingArray; } else { { - if( _x select 1 == "trade_weapons")then{ + if (_x select 1 == "trade_weapons") then { _parentClasses = [(configFile >> "CfgWeapons" >> (_x select 0)),true] call BIS_fnc_returnParents; - if( 'ItemCore' in _parentClasses || 'Binocular' in _parentClasses) then { + if ('ItemCore' in _parentClasses || 'Binocular' in _parentClasses) then { _toolsToBuy = _toolsToBuy + (_x select 9); _toolClasses set [count _toolClasses,(_x select 0)]; } else { _weaponsToBuy = _weaponsToBuy + (_x select 9); - if('PistolCore' in _parentClasses)then { + if ('PistolCore' in _parentClasses) then { _sidearmToBuy = _sidearmToBuy + (_x select 9); } else { _primaryToBuy = _primaryToBuy + (_x select 9); @@ -66,15 +67,15 @@ if (Z_SingleCurrency) then { }; _priceToBuy = _priceToBuy + ((_x select 11)*(_x select 2)*(_x select 9)); // _worth * _price * _amount }; - if( _x select 1 == "trade_items")then{ + if (_x select 1 == "trade_items") then { _magazinesToBuy = _magazinesToBuy + (_x select 9) ; _priceToBuy = _priceToBuy + ((_x select 11) *(_x select 2)*(_x select 9)); }; - if( _x select 1 == "trade_backpacks")then{ + if (_x select 1 == "trade_backpacks") then { _backpacksToBuy = _backpacksToBuy + (_x select 9) ; _priceToBuy = _priceToBuy + ((_x select 11)*(_x select 2)*(_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{ + 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 { _vehiclesToBuy = _vehiclesToBuy + (_x select 9) ; _priceToBuy = _priceToBuy + ((_x select 11)*(_x select 2)*(_x select 9)); }; @@ -103,8 +104,11 @@ if (Z_SingleCurrency) then { _enoughMoney = _moneyInfo select 0; }; -if(_enoughMoney) then { - if(_canBuy) then { +if (Z_SellingFrom == 0 && _backpacksToBuy >= 1) exitWith { systemChat localize "STR_EPOCH_TRADE_BAG_BAGS"; }; //backpack +if (Z_SellingFrom == 2 && !isNull _backpack) exitWith { systemChat localize "STR_EPOCH_TRADE_HAVE_BACKPACK"; }; //gear + +if (_enoughMoney) then { + if (_canBuy) then { _bTotal = 0; _buyVehicle = { private "_location"; @@ -125,7 +129,7 @@ if(_enoughMoney) then { _dir = round(random 360); _helipad = nearestObjects [player, ["HeliHCivil","HeliHempty"], 100]; - if(count _helipad > 0) then { + 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; @@ -146,16 +150,16 @@ if(_enoughMoney) then { closeDialog 2; - if(Z_SellingFrom == 0) then { //backpack + if (Z_SellingFrom == 0) then { //backpack _backpack = unitBackpack player; { - if( _x select 1 == "trade_weapons")then{ + if (_x select 1 == "trade_weapons") then { _backpack addWeaponCargoGlobal [_x select 0, _x select 9]; }; - if( _x select 1 == "trade_items")then{ + 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{ + 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]; @@ -166,18 +170,18 @@ if(_enoughMoney) then { systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_BACKPACK",_bTotal]; }; - if(Z_SellingFrom == 1) then { //vehicle + if (Z_SellingFrom == 1) then { //vehicle { - if( _x select 1 == "trade_weapons")then{ + if (_x select 1 == "trade_weapons") then { Z_vehicle addWeaponCargoGlobal [_x select 0, _x select 9]; }; - if( _x select 1 == "trade_items")then{ + if (_x select 1 == "trade_items") then { Z_vehicle addMagazineCargoGlobal [_x select 0, _x select 9]; }; - if( _x select 1 == "trade_backpacks")then{ + 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{ + 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]; @@ -188,26 +192,26 @@ if(_enoughMoney) then { systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_VEHICLE",_bTotal,typeOf Z_vehicle]; }; - if(Z_SellingFrom == 2) then { //gear + if (Z_SellingFrom == 2) then { //gear { - if( _x select 1 == "trade_weapons") then { + if (_x select 1 == "trade_weapons") then { _count = 0; - while{ _count < (_x select 9)}do{ + while { _count < (_x select 9)} do { player addWeapon (_x select 0); _count = _count + 1; }; }; - if( _x select 1 == "trade_items" ) then { + if (_x select 1 == "trade_items") then { _count = 0; - while{ _count < (_x select 9)} do { + while { _count < (_x select 9)} do { player addMagazine (_x select 0); _count = _count + 1; }; }; - if( _x select 1 == "trade_backpacks")then{ + 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{ + 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; @@ -239,7 +243,7 @@ if(_enoughMoney) then { systemChat localize "STR_EPOCH_TRADE_CONTAINER_FULL"; }; } else { - if( Z_SingleCurrency) then { + if (Z_SingleCurrency) then { systemChat format[localize "STR_EPOCH_TRADE_NEED_COINS",_priceToBuy,CurrencyName]; } else { systemChat localize "STR_EPOCH_TRADE_NEED_MONEY"; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcBuyableList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcBuyableList.sqf index 6b668a17e..aa882a861 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcBuyableList.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcBuyableList.sqf @@ -1,4 +1,5 @@ private ["_arrayOfTraderCat","_counter","_cat","_cfgtraders","_y","_type","_buy","_sell","_pic","_text","_worth","_buyCurrency","_sellCurrency","_ignore","_categoryNumber"]; + call Z_clearBuyList; Z_BuyableArray = []; _arrayOfTraderCat = Z_traderData; @@ -17,7 +18,7 @@ _counter = 0; _y = _cfgtraders select _i; if (isClass _y) then { - _y = configName (_y ); + _y = configName (_y); _type = getText(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "type"); _buy = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "buy"); @@ -32,20 +33,20 @@ _counter = 0; if (_y == "bloodBagONEG") then {_y = "ItemBloodbag";} else {_ignore = true;}; }; - if(_type == "trade_items")then{ + if (_type == "trade_items") then { _pic = getText (configFile >> 'CfgMagazines' >> _y >> 'picture'); _text = getText (configFile >> 'CfgMagazines' >> _y >> 'displayName'); }; - if(_type == "trade_weapons")then{ + if (_type == "trade_weapons") then { _pic = getText (configFile >> 'CfgWeapons' >> _y >> 'picture'); _text = getText (configFile >> 'CfgWeapons' >> _y >> 'displayName'); }; - if(_type in ["trade_backpacks", "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{ + if (_type in ["trade_backpacks", "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 { _pic = getText (configFile >> 'CfgVehicles' >> _y >> 'picture'); _text = getText (configFile >> 'CfgVehicles' >> _y >> 'displayName'); }; - if(!Z_SingleCurrency) then { + if (!Z_SingleCurrency) then { _buyCurrency = _buy select 1; _sellCurrency = _sell select 1, _part = (configFile >> "CfgMagazines" >> _buyCurrency); @@ -53,7 +54,7 @@ _counter = 0; if (_worth == 0) then { _worth = DZE_GemWorthList select (DZE_GemList find _buyCurrency); }; - }else{ + } else { _buyCurrency = CurrencyName; _sellCurrency = CurrencyName; }; @@ -64,7 +65,7 @@ _counter = 0; }; }; }; -}forEach _arrayOfTraderCat; +} forEach _arrayOfTraderCat; Z_CategoryView = false; Z_Selling = true; // flipped in ChangeBuySell @@ -72,4 +73,4 @@ call Z_ChangeBuySell; Z_OriginalBuyableArray = [] + Z_BuyableArray; call Z_fillBuyableList; -call Z_calcPrice; \ No newline at end of file +call Z_calcPrice; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcPrice.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcPrice.sqf index 51c41214e..55998e3a6 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcPrice.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcPrice.sqf @@ -3,46 +3,46 @@ * * Calculate the total price for single currency. **/ -private ["_sellPrice","_ctrltext","_bTotal"]; +private ["_sellPrice","_ctrlText","_bTotal"]; #include "defines.hpp" _bTotal = 0; _sellPrice = 0; -if(Z_SingleCurrency) then { - _ctrltext = ''; - if(Z_Selling)then{ +if (Z_SingleCurrency) then { + _ctrlText = ""; + if (Z_Selling) then { { - _sellPrice = _sellPrice + (_x select 2); - }count Z_SellArray; - _ctrltext = format["%1 %2", _sellPrice , CurrencyName]; + _sellPrice = _sellPrice + (_x select 2); + } count Z_SellArray; + _ctrlText = format["%1 %2", _sellPrice , CurrencyName]; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText format ["%1 (%2 items)", localize "STR_EPOCH_TRADE_SELLING", count Z_SellArray]; } else { { - _sellPrice = _sellPrice + ((_x select 2) * (_x select 9)); - _bTotal = _bTotal + (_x select 9); - }count Z_BuyingArray; - _ctrltext = format["%1 %2", _sellPrice , CurrencyName]; + _sellPrice = _sellPrice + ((_x select 2) * (_x select 9)); + _bTotal = _bTotal + (_x select 9); + } count Z_BuyingArray; + _ctrlText = format["%1 %2", _sellPrice , CurrencyName]; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText format ["%1 (%2 items)", localize "STR_EPOCH_TRADE_BUYING", _bTotal]; }; - ctrlSetText [Z_AT_PRICEDISPLAY, _ctrltext]; + ctrlSetText [Z_AT_PRICEDISPLAY, _ctrlText]; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_PRICEINFO) ctrlSetStructuredText parseText ''; } else { - if(Z_Selling)then { - _ctrltext = ""; + if (Z_Selling) then { + _ctrlText = ""; { - _sellPrice = _sellPrice + ((_x select 2) * (_x select 11)); - }count Z_SellArray; - _ctrltext = _sellPrice call Z_calcDefaultCurrency; + _sellPrice = _sellPrice + ((_x select 2) * (_x select 11)); + } count Z_SellArray; + _ctrlText = _sellPrice call Z_calcDefaultCurrency; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText format ["%1 (%2 items)", localize "STR_EPOCH_TRADE_SELLING", count Z_SellArray]; } else { { - _sellPrice = _sellPrice + ((_x select 2) * (_x select 11) * (_x select 9)); - _bTotal = _bTotal + (_x select 9); - }count Z_BuyingArray; - _ctrltext = _sellPrice call Z_calcDefaultCurrency; + _sellPrice = _sellPrice + ((_x select 2) * (_x select 11) * (_x select 9)); + _bTotal = _bTotal + (_x select 9); + } count Z_BuyingArray; + _ctrlText = _sellPrice call Z_calcDefaultCurrency; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText format ["%1 (%2 items)", localize "STR_EPOCH_TRADE_BUYING", _bTotal]; }; - ctrlSetText [Z_AT_PRICEDISPLAY, '']; - (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_PRICEINFO) ctrlSetStructuredText parseText _ctrltext; + ctrlSetText [Z_AT_PRICEDISPLAY, '']; + (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_PRICEINFO) ctrlSetStructuredText parseText _ctrlText; }; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calculateFreeSpace.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calculateFreeSpace.sqf index 97745dd98..cfb4b781d 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calculateFreeSpace.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calculateFreeSpace.sqf @@ -5,7 +5,7 @@ private["_selection","_returnArray","_allowedMags","_allowedWeapons","_allowedBa _selection = _this select 0; _returnArray = [0,0,0]; -if(_selection == 2) then{ //gear +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) @@ -24,7 +24,7 @@ if(_selection == 2) then{ //gear _returnArray = [_allowedMags, _allowedWeapons, _allowedBackpacks]; }; -if(_selection == 1) then{ //vehicle +if (_selection == 1) then { //vehicle _allowedMags = 0; _allowedWeapons = 0; _allowedBackpacks = 0; @@ -46,21 +46,21 @@ if(_selection == 1) then{ //vehicle { _vehicleMagazines = _vehicleMagazines + _x; - }count ( _tempMagazinesArray select 1); + } count (_tempMagazinesArray select 1); _tempWeaponsArray = getWeaponCargo Z_vehicle; { _vehicleWeapons = _vehicleWeapons + _x; - }count ( _tempWeaponsArray select 1); + } count (_tempWeaponsArray select 1); _tempBackpackArray = getBackpackCargo Z_vehicle; { _vehicleBackpacks = _vehicleBackpacks + _x; - }count ( _tempBackpackArray select 1); + } count (_tempBackpackArray select 1); _allowedWeapons = getNumber (configFile >> 'CfgVehicles' >> (typeOf Z_vehicle) >> 'transportMaxWeapons'); _allowedMags = getNumber (configFile >> 'CfgVehicles' >> (typeOf Z_vehicle) >> 'transportMaxMagazines'); @@ -68,7 +68,7 @@ if(_selection == 1) then{ //vehicle }; _returnArray = [_allowedMags - _vehicleMagazines, _allowedWeapons - _vehicleWeapons, _allowedBackpacks - _vehicleBackpacks]; }; -if(_selection == 0) then{ //backpack +if (_selection == 0) then { //backpack _allowedBackpacks = 0; _totalBagSlots = 0; _alreadyInBackpack = 0; @@ -113,7 +113,7 @@ if(_selection == 0) then{ //backpack _currentSec = 0; _currentTool = 0; { - _parentClasses = [(configFile >> "CfgWeapons" >> _x ),true] call BIS_fnc_returnParents; + _parentClasses = [(configFile >> "CfgWeapons" >> _x),true] call BIS_fnc_returnParents; if ('ItemCore' in _parentClasses or 'Binocular' in _parentClasses) then { _currentTool = _currentTool + 1; } else { diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_canAfford.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_canAfford.sqf index 00897c6ee..b239a256f 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_canAfford.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_canAfford.sqf @@ -1,4 +1,4 @@ -private ['_worth', '_total_currency','_return','_part','_totalToPay','_inventoryMoney','_backpackMoney',"_kinds","_kinds2","_kinds3","_ammmounts","_ammmounts2","_ammmounts3" +private ['_worth', '_total_currency','_return','_part','_totalToPay','_inventoryMoney','_backpackMoney',"_kinds","_kinds2","_kinds3","_amounts","_amounts2","_amounts3" ,"_vehicleMoney"]; _totalToPay = _this; @@ -24,20 +24,20 @@ _inventoryMoney = []; _return set [1, _inventoryMoney]; -if( Z_AllowTakingMoneyFromBackpack ) then { +if (Z_AllowTakingMoneyFromBackpack) then { _backpackPlayer = unitBackpack player; if (!isNull _backpackPlayer) then { _mags = getMagazineCargo _backpackPlayer; _backpackMoney = []; _kinds = _mags select 0; - _ammmounts = _mags select 1; + _amounts = _mags select 1; { _part = (configFile >> "CfgMagazines" >> _x); _worth = (_part >> "worth"); if isNumber (_worth) then { - _total_currency = _total_currency + ( getNumber(_worth) * (_ammmounts select _forEachIndex)); + _total_currency = _total_currency + (getNumber(_worth) * (_amounts select _forEachIndex)); _counter = 0 ; - while{_counter < (_ammmounts select _forEachIndex)} do { + while {_counter < (_amounts select _forEachIndex)} do { _backpackMoney set [count(_backpackMoney),_x]; _counter = _counter + 1; }; @@ -45,9 +45,9 @@ if( Z_AllowTakingMoneyFromBackpack ) then { _findGem = DZE_GemList find _x; if (_findGem >= 0) then { _worth = DZE_GemWorthList select _findGem; - _total_currency = _total_currency + (_worth * (_ammmounts select _forEachIndex)); + _total_currency = _total_currency + (_worth * (_amounts select _forEachIndex)); _counter = 0 ; - while{_counter < (_ammmounts select _forEachIndex)} do { + while {_counter < (_amounts select _forEachIndex)} do { _backpackMoney set [count(_backpackMoney),_x]; _counter = _counter + 1; }; @@ -58,19 +58,19 @@ if( Z_AllowTakingMoneyFromBackpack ) then { }; }; -if( Z_AllowTakingMoneyFromVehicle ) then { +if (Z_AllowTakingMoneyFromVehicle) then { if (!isNull Z_vehicle) then { _mags = getMagazineCargo Z_vehicle; _vehicleMoney = []; _kinds = _mags select 0; - _ammmounts = _mags select 1; + _amounts = _mags select 1; { _part = (configFile >> "CfgMagazines" >> _x); _worth = (_part >> "worth"); if isNumber (_worth) then { - _total_currency = _total_currency + ( getNumber(_worth) * (_ammmounts select _forEachIndex)); + _total_currency = _total_currency + (getNumber(_worth) * (_amounts select _forEachIndex)); _counter = 0 ; - while{_counter < ( _ammmounts select _forEachIndex)}do{ + while {_counter < (_amounts select _forEachIndex)} do { _vehicleMoney set [count(_vehicleMoney),_x]; _counter = _counter + 1; }; @@ -78,9 +78,9 @@ if( Z_AllowTakingMoneyFromVehicle ) then { _findGem = DZE_GemList find _x; if (_findGem >= 0) then { _worth = DZE_GemWorthList select _findGem; - _total_currency = _total_currency + (_worth * (_ammmounts select _forEachIndex)); + _total_currency = _total_currency + (_worth * (_amounts select _forEachIndex)); _counter = 0 ; - while{_counter < (_ammmounts select _forEachIndex)} do { + while {_counter < (_amounts select _forEachIndex)} do { _backpackMoney set [count(_backpackMoney),_x]; _counter = _counter + 1; }; @@ -91,7 +91,7 @@ if( Z_AllowTakingMoneyFromVehicle ) then { }; }; -if ( _totalToPay <= _total_currency) then { +if (_totalToPay <= _total_currency) then { _return set [0, true]; _return set [4, _total_currency]; }; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_changeBuySell.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_changeBuySell.sqf index a5fc45650..72c2bb9d7 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_changeBuySell.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_changeBuySell.sqf @@ -6,7 +6,7 @@ if (Z_Selling) then { (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_FILTERBUTTON) ctrlSetText localize "STR_UI_FILTER"; {ctrlShow [_x,true];} forEach [Z_AT_SELLABLELIST,Z_AT_SELLINGLIST,Z_AT_SELLBUTTON,Z_AT_ADDSELLITEMBUTTON,Z_AT_ADDALLSELLITEMBUTTON,Z_AT_REMOVESELLITEMBUTTON,Z_AT_REMOVEALLSELLITEMBUTTON,Z_AT_FILTERBOX]; // show {ctrlShow [_x,false];} forEach [Z_AT_BUYABLELIST,Z_AT_BUYINGLIST,Z_AT_BUYBUTTON,Z_AT_ADDBUYITEMBUTTON,Z_AT_BUYINGAMOUNT,Z_AT_REMOVEBUYITEMBUTTON,Z_AT_REMOVEALLBUYITEMBUTTON,Z_AT_SLOTSDISPLAY,Z_AT_BACKBUTTON]; // hide -}else{ +} else { (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SELLBUYTOGGLE) ctrlSetText localize "STR_EPOCH_PLAYER_292"; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_FILTERBUTTON) ctrlSetText localize "STR_UI_FILTER"; {ctrlShow [_x,true];} forEach [Z_AT_BUYABLELIST,Z_AT_BUYINGLIST,Z_AT_BUYBUTTON,Z_AT_ADDBUYITEMBUTTON,Z_AT_BUYINGAMOUNT,Z_AT_REMOVEBUYITEMBUTTON,Z_AT_REMOVEALLBUYITEMBUTTON,Z_AT_SLOTSDISPLAY,Z_AT_FILTERBOX,Z_AT_BACKBUTTON]; // show @@ -32,4 +32,4 @@ if (Z_ResetContainer) then { (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText ""; ctrlSetText [Z_AT_TRADERLINE2, " "]; ctrlSetText [Z_AT_TRADERLINE1, localize "STR_EPOCH_TRADE_SELLING_ALL"]; -}; \ No newline at end of file +}; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkArrayInConfig.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkArrayInConfig.sqf index 9e9358691..9837a42f7 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkArrayInConfig.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkArrayInConfig.sqf @@ -8,7 +8,7 @@ * * Fills up the sell or buy list if the item has a valid config. **/ -private ["_weaps","_mags","_extraText","_all","_total","_arrayOfTraderCat","_totalPrice","_ctrltext","_backUpText","_bags"]; +private ["_weaps","_mags","_extraText","_all","_arrayOfTraderCat","_totalPrice","_backUpText","_bags"]; #include "defines.hpp" _weaps = _this select 0; @@ -16,13 +16,14 @@ _mags = _this select 1; _extraText = _this select 2; _bags = _this select 3; _vehTrade = false; + if (false call Z_checkCloseVehicle) then { _all = _weaps + _mags + _bags + [(typeOf Z_vehicle)]; _vehTrade = true; } else { _all = _weaps + _mags + _bags; }; -_total = count(_all); + _arrayOfTraderCat = Z_traderData; _HasKeyCheck = { _obj = _this select 0; @@ -44,92 +45,80 @@ _HasKeyCheck = { _keyFound; }; _totalPrice = 0; -if(_total > 0)then{ + +{ + _y = _x; { - _y = _x; - { - private ["_cat","_excists","_pic","_text","_type","_sell","_buy","_buyCurrency","_sellCurrency","_worth"]; - _cat = format["Category_%1",(_arrayOfTraderCat select _forEachIndex select 1)]; - if (isNumber (missionConfigFile >> "CfgTraderCategory" >> _cat >> "duplicate")) then { - _cat = format["Category_%1",getNumber (missionConfigFile >> "CfgTraderCategory" >> _cat >> "duplicate")]; + private ["_cat","_exists","_pic","_text","_type","_sell","_buy","_buyCurrency","_sellCurrency","_worth"]; + _cat = format["Category_%1",(_arrayOfTraderCat select _forEachIndex select 1)]; + if (isNumber (missionConfigFile >> "CfgTraderCategory" >> _cat >> "duplicate")) then { + _cat = format["Category_%1",getNumber (missionConfigFile >> "CfgTraderCategory" >> _cat >> "duplicate")]; + }; + _exists = isClass(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y); + if (_exists) exitWith { + _pic = ""; + _text = ""; + _type = getText(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "type"); + _sell = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "sell"); + _buy = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "buy"); + switch (true) do { + case (_type == "trade_items") : + { + _pic = getText (configFile >> 'CfgMagazines' >> _y >> 'picture'); + _text = getText (configFile >> 'CfgMagazines' >> _y >> 'displayName'); + }; + case (_type == "trade_weapons") : + { + _pic = getText (configFile >> 'CfgWeapons' >> _y >> 'picture'); + _text = getText (configFile >> 'CfgWeapons' >> _y >> 'displayName'); + }; + case (_type in ["trade_backpacks", "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"]) : + { + _pic = getText (configFile >> 'CfgVehicles' >> _y >> 'picture'); + _text = getText (configFile >> 'CfgVehicles' >> _y >> 'displayName'); + }; }; - _excists = isClass(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y ); - if(_excists)exitWith{ - _pic = ""; - _text = ""; - _type = getText(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "type"); - _sell = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "sell"); - _buy = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "buy"); - switch (true) do { - case (_type == "trade_items") : - { - _pic = getText (configFile >> 'CfgMagazines' >> _y >> 'picture'); - _text = getText (configFile >> 'CfgMagazines' >> _y >> 'displayName'); - }; - case (_type == "trade_weapons") : - { - _pic = getText (configFile >> 'CfgWeapons' >> _y >> 'picture'); - _text = getText (configFile >> 'CfgWeapons' >> _y >> 'displayName'); - }; - case (_type in ["trade_backpacks", "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"]) : - { - _pic = getText (configFile >> 'CfgVehicles' >> _y >> 'picture'); - _text = getText (configFile >> 'CfgVehicles' >> _y >> 'displayName'); - }; - }; - if( isNil '_text')then{ - _text = _y; + if (isNil '_text') then { _text = _y; }; + _HasKey = true; + if (_vehTrade && {(typeOf Z_vehicle) == _y}) then { + if (!(_type in ["trade_any_bicycle", "trade_any_bicycle_old", "trade_any_vehicle_free"]) && DZE_SaleRequiresKey) then { + _HasKey = [Z_vehicle, _all] call _HasKeyCheck; }; - _HasKey = true; - if (_vehTrade && {(typeOf Z_vehicle) == _y}) then { - if (!(_type in ["trade_any_bicycle", "trade_any_bicycle_old", "trade_any_vehicle_free"]) && DZE_SaleRequiresKey) then { - _HasKey = [Z_vehicle, _all] call _HasKeyCheck; - }; - }; - if (!_HasKey) exitWith {}; - - _worth = 0; - - if(!Z_SingleCurrency) then { - _buyCurrency = _buy select 1; - _sellCurrency = _sell select 1; - _part = (configFile >> "CfgMagazines" >> _sellCurrency); - _worth = getNumber(_part >> "worth"); - if (_worth == 0) then { - _worth = DZE_GemWorthList select (DZE_GemList find _buyCurrency); - }; - }else{ - _buyCurrency = CurrencyName; - _sellCurrency = CurrencyName; - }; - - Z_SellableArray set [count(Z_SellableArray) , [_y, _type, _sell select 0, _text, _pic, _forEachIndex, _buy select 0, _sellCurrency, _buyCurrency, 0 ,_cat, _worth]]; - _totalPrice = _totalPrice + (_sell select 0); }; - }forEach _arrayOfTraderCat; - }count _all; + if (!_HasKey) exitWith {}; - Z_OriginalSellableArray = [] + Z_SellableArray; + _worth = 0; - _backUpText = _extraText; + if (!Z_SingleCurrency) then { + _buyCurrency = _buy select 1; + _sellCurrency = _sell select 1; + _part = (configFile >> "CfgMagazines" >> _sellCurrency); + _worth = getNumber(_part >> "worth"); + if (_worth == 0) then { _worth = DZE_GemWorthList select (DZE_GemList find _buyCurrency); }; + } else { + _buyCurrency = CurrencyName; + _sellCurrency = CurrencyName; + }; - if(Z_SellingFrom != 2)then{ - _extraText = getText (configFile >> 'CfgVehicles' >> _extraText >> 'displayName'); - }; - if (isNil '_extraText')then{ - _extraText = _backUpText; - }; + Z_SellableArray set [count(Z_SellableArray) , [_y, _type, _sell select 0, _text, _pic, _forEachIndex, _buy select 0, _sellCurrency, _buyCurrency, 0 ,_cat, _worth]]; + _totalPrice = _totalPrice + (_sell select 0); + }; + } forEach _arrayOfTraderCat; +} count _all; - if (Z_SingleCurrency) then { - _ctrltext = format[localize "STR_EPOCH_TRADE_OFFER", _totalPrice,CurrencyName]; - ctrlSetText [Z_AT_TRADERLINE2, _ctrltext]; - } else { - ctrlSetText [Z_AT_TRADERLINE2, '']; - }; +Z_OriginalSellableArray = [] + Z_SellableArray; - _ctrltext = format[localize "STR_EPOCH_TRADE_ACCEPT", count(Z_SellableArray) , _extraText]; - ctrlSetText [Z_AT_TRADERLINE1, _ctrltext]; +_backUpText = _extraText; - call Z_fillSellList; +if (Z_SellingFrom != 2) then { _extraText = getText (configFile >> 'CfgVehicles' >> _extraText >> 'displayName'); }; +if (isNil '_extraText') then { _extraText = _backUpText; }; + +if (Z_SingleCurrency) then { + ctrlSetText [Z_AT_TRADERLINE2, format[localize "STR_EPOCH_TRADE_OFFER", _totalPrice,CurrencyName]]; +} else { + ctrlSetText [Z_AT_TRADERLINE2, '']; }; +ctrlSetText [Z_AT_TRADERLINE1, format[localize "STR_EPOCH_TRADE_ACCEPT", count(Z_SellableArray) , _extraText]]; + +call Z_fillSellList; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkCloseVehicle.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkCloseVehicle.sqf index 4e305ec8d..a04dbcf60 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkCloseVehicle.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkCloseVehicle.sqf @@ -1,4 +1,5 @@ private ["_vehicle","_list","_result","_pos"]; + Z_vehicle = objNull; _vehicle = objNull; _pos = [player] call FNC_GetPos; @@ -7,9 +8,10 @@ _list = nearestObjects [_pos, ["Air","LandVehicle","Ship"], Z_VehicleDistance]; if (!isNull _x && local _x && alive _x) then { _vehicle = _x; }; -}count _list; +} count _list; _result = false; -if(!isNull _vehicle)then{ + +if (!isNull _vehicle) then { Z_vehicle = _vehicle; _result = true; if (_this) then { // Set trade title, don't set on menu start up since gear is selected initially. @@ -21,4 +23,5 @@ if(!isNull _vehicle)then{ }; }; }; + _result diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearBuyList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearBuyList.sqf index 7eff76146..28a4fc4bc 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearBuyList.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearBuyList.sqf @@ -4,5 +4,6 @@ * Clears the visual listbox of items you could buy. **/ #include "defines.hpp" + lbClear Z_AT_BUYABLELIST; -lbSetCurSel [Z_AT_BUYABLELIST,-1]; // clear \ No newline at end of file +lbSetCurSel [Z_AT_BUYABLELIST,-1]; // clear diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearBuyingList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearBuyingList.sqf index dfa694445..1b2f9f7b7 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearBuyingList.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearBuyingList.sqf @@ -3,6 +3,6 @@ * * Clears the visual listbox of items you were going to buy. **/ - #include "defines.hpp" -lbClear Z_AT_BUYINGLIST; \ No newline at end of file + +lbClear Z_AT_BUYINGLIST; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearLists.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearLists.sqf index 84f1d29e6..04f1b8027 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearLists.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearLists.sqf @@ -4,5 +4,6 @@ * Clears the visual listbox of items you were going to sell and could be selled. **/ #include "defines.hpp" + lbClear Z_AT_SELLABLELIST; -lbClear Z_AT_SELLINGLIST; \ No newline at end of file +lbClear Z_AT_SELLINGLIST; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearSellableList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearSellableList.sqf index 9fd7d6009..995715bb2 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearSellableList.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearSellableList.sqf @@ -4,4 +4,5 @@ * Clears the visual listbox of items you were going to sell. **/ #include "defines.hpp" -lbClear Z_AT_SELLABLELIST; \ No newline at end of file + +lbClear Z_AT_SELLABLELIST; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayBackpackInfo.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayBackpackInfo.sqf index 57c260f2e..ba58e4d8a 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayBackpackInfo.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayBackpackInfo.sqf @@ -1,7 +1,4 @@ -private ["_item","_picture","_class","_display","_transportMaxWeapons","_transportMaxMagazines","_transportmaxBackpacks","_buyPrice","_sellPrice" -,"_buyCurrency","_sellCurrency","_formattedText","_picBuy","_picSell" -]; - +private ["_item","_picture","_class","_display","_transportMaxWeapons","_transportMaxMagazines","_transportmaxBackpacks","_buyPrice","_sellPrice","_buyCurrency","_sellCurrency","_formattedText","_picBuy","_picSell"]; #include "defines.hpp" _item = _this select 0; @@ -15,27 +12,27 @@ _transportMaxMagazines = 0; _buyPrice = 0; _sellPrice = 0; -if(Z_Selling)then{ +if (Z_Selling) then { _buyPrice = _item select 6; _buyCurrency = _item select 8; _sellPrice = _item select 2; _sellCurrency = _item select 7; -}else{ +} else { _buyPrice = _item select 2; _buyCurrency = _item select 7; _sellPrice = _item select 6; _sellCurrency = _item select 8; }; -if ( isNumber (configFile >> 'CfgVehicles' >> _class >> 'transportMaxWeapons')) then { +if (isNumber (configFile >> 'CfgVehicles' >> _class >> 'transportMaxWeapons')) then { _transportMaxWeapons = getNumber (configFile >> 'CfgVehicles' >> _class >> 'transportMaxWeapons'); }; -if ( isNumber (configFile >> 'CfgVehicles' >> _class >> 'transportMaxMagazines')) then { +if (isNumber (configFile >> 'CfgVehicles' >> _class >> 'transportMaxMagazines')) then { _transportMaxMagazines = getNumber (configFile >> 'CfgVehicles' >> _class >> 'transportMaxMagazines'); }; -if ( Z_SingleCurrency ) then { +if (Z_SingleCurrency) then { _buyCurrency = CurrencyName; _sellCurrency = CurrencyName; _formattedText = format [ diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayItemInfo.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayItemInfo.sqf index 246ee9887..de872552b 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayItemInfo.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayItemInfo.sqf @@ -1,11 +1,13 @@ private ['_item','_picture','_class','_display','_buyPrice','_sellPrice','_formattedText','_buyCurrency','_sellCurrency','_compatible','_weapon','_attach','_config','_compatibleText','_type','_text']; #include "defines.hpp" + _item = _this select 0; _picture = _item select 4; _class = _item select 0; _display = _item select 3; _buyPrice = 0; _sellPrice = 0; + if (Z_Selling) then { _buyPrice = _item select 6; _buyCurrency = _item select 8; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayVehicleInfo.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayVehicleInfo.sqf index c7e6faca0..5ff6784c9 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayVehicleInfo.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayVehicleInfo.sqf @@ -1,7 +1,6 @@ private ['_item', '_type','_picture',"_class","_display","_transportMaxWeapons","_transportMaxMagazines","_transportmaxBackpacks" ,"_buyPrice","_sellPrice","_buyCurrency","_sellCurrency","_formattedText","_fuelCapacity","_maxSpeed","_armor","_seats","_weapons", -"_weapons2","_config","_wepText","_turret","_text" -]; +"_weapons2","_config","_wepText","_turret","_text"]; #include "defines.hpp" @@ -129,7 +128,6 @@ if (Z_SingleCurrency) then { , _picture, _display, _class, _transportmaxBackpacks, _sellPrice, _buyPrice, CurrencyName, _transportMaxWeapons,_transportMaxMagazines, localize "STR_EPOCH_NAME", localize "STR_EPOCH_CLASS", localize "STR_EPOCH_PLAYER_292", localize "STR_EPOCH_PLAYER_291", localize "STR_EPOCH_MAGS", localize "STR_EPOCH_WEPS", localize "STR_EPOCH_BAGS", localize "STR_EPOCH_ARMOR",_armor,localize "STR_EPOCH_FUEL",_fuelCapacity,localize "STR_EPOCH_MAX",localize "STR_EPOCH_SPEED",_maxSpeed,localize "STR_EPOCH_SEATS",_seats,localize "STR_EPOCH_WEAPONS",_wepText ]; - } else { _picSell = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'picture'); _sellCurrency = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'displayName'); diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayWeaponInfo.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayWeaponInfo.sqf index be6239357..00bf0ad25 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayWeaponInfo.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayWeaponInfo.sqf @@ -45,7 +45,7 @@ _attachText = ""; } forEach _attachments; _magazines = []; -if( isArray (configFile >> 'CfgWeapons' >> _class >> 'magazines')) then { +if (isArray (configFile >> 'CfgWeapons' >> _class >> 'magazines')) then { { _magazines set [count _magazines, getText (configFile >> "CfgMagazines" >> _x >> "displayName")]; } forEach (getArray (configFile >> 'CfgWeapons' >> _class >> 'magazines')); @@ -53,13 +53,13 @@ if( isArray (configFile >> 'CfgWeapons' >> _class >> 'magazines')) then { _magText = ""; { - if( _forEachIndex > 0) then { + if (_forEachIndex > 0) then { _magText = _magText + ', ' + _x; } else { _magText = _magText + _x; }; -}foreach _magazines; +} foreach _magazines; if (Z_SingleCurrency) then { _formattedText = format [ @@ -70,7 +70,7 @@ if (Z_SingleCurrency) then { "%10: %5 %7
" , _picture, _display, _class, _magText, _sellPrice, _buyPrice, CurrencyName, localize "STR_EPOCH_NAME", localize "STR_EPOCH_CLASS", localize "STR_EPOCH_PLAYER_292", localize "STR_EPOCH_PLAYER_291" ]; -}else { +} else { _picSell = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'picture'); _sellCurrency = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'displayName'); _picBuy = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'picture'); diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillBuyableList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillBuyableList.sqf index 1fd2f09dc..c1e4f1ce6 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillBuyableList.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillBuyableList.sqf @@ -1,5 +1,7 @@ +private "_index"; #include "defines.hpp" + { _index = lbAdd [Z_AT_BUYABLELIST, _x select 3]; lbSetPicture [Z_AT_BUYABLELIST, _index, _x select 4 ]; -} count Z_BuyableArray; \ No newline at end of file +} count Z_BuyableArray; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillBuyingList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillBuyingList.sqf index 7cf87f263..c4e76c0b1 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillBuyingList.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillBuyingList.sqf @@ -1,5 +1,7 @@ +private "_index"; #include "defines.hpp" + { _index = lbAdd [Z_AT_BUYINGLIST, _x select 3]; lbSetPicture [Z_AT_BUYINGLIST, _index, _x select 4]; -}count Z_BuyingArray; \ No newline at end of file +} count Z_BuyingArray; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillCategories.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillCategories.sqf index 47ffbab8e..0a0705e19 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillCategories.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillCategories.sqf @@ -1,8 +1,9 @@ private "_index"; #include "defines.hpp" + call Z_clearBuyList; { _index = lbAdd [Z_AT_BUYABLELIST,_x select 0]; lbSetPicture [Z_AT_BUYABLELIST,_index,"\z\addons\dayz_code\gui\epoch\arrow_right.paa"]; -} forEach Z_traderData; \ No newline at end of file +} forEach Z_traderData; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillSellList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillSellList.sqf index 8f209c403..7adb7889f 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillSellList.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillSellList.sqf @@ -3,8 +3,10 @@ * * Visualy fills in the listbox of items that can be sold. **/ +private "_index"; #include "defines.hpp" + { _index = lbAdd [Z_AT_SELLABLELIST, _x select 3]; lbSetPicture [Z_AT_SELLABLELIST, _index, _x select 4 ]; -}count Z_SellableArray; \ No newline at end of file +} count Z_SellableArray; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillSellingList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillSellingList.sqf index 9e4adb0ff..7095fcc0d 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillSellingList.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillSellingList.sqf @@ -3,8 +3,10 @@ * * Visualy fills in the listbox of items currently being sold. **/ +private "_index"; #include "defines.hpp" + { _index = lbAdd [Z_AT_SELLINGLIST, _x select 3]; lbSetPicture [Z_AT_SELLINGLIST, _index, _x select 4]; -}count Z_SellArray; \ No newline at end of file +} count Z_SellArray; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_filleTradeTitle.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_filleTradeTitle.sqf index 05aef9901..2b29a83ea 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_filleTradeTitle.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_filleTradeTitle.sqf @@ -5,6 +5,8 @@ * * Changes the indication of where you are selling/buying from in the trade window. **/ +private "_text"; #include "defines.hpp" + _text = _this select 0; -ctrlSetText [Z_AT_CONTAINERINDICATOR, _text]; \ No newline at end of file +ctrlSetText [Z_AT_CONTAINERINDICATOR, _text]; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_filterList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_filterList.sqf index 4042799f3..713a6d68e 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_filterList.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_filterList.sqf @@ -5,15 +5,16 @@ * * Filters the buyable or sellable list on your input. **/ +private ["_query","_newSellArray","_newBuyArray"]; -if(count _this > 0) then { +if (count _this > 0) then { _query = _this select 0; // the search string. - if(Z_Selling)then { + if (Z_Selling) then { if (count Z_SellArray > 0) exitWith {}; //Do not filter if items already in selling list (dupes) - if(isNil '_query' || _query == "") then { + if (isNil '_query' || _query == "") then { _newSellArray = []; { - if( _x find Z_SellArray < 0) then { + if (_x find Z_SellArray < 0) then { _newSellArray set [count(_newSellArray), _x]; }; } forEach Z_OriginalSellableArray; @@ -22,11 +23,11 @@ if(count _this > 0) then { call Z_clearSellableList; call Z_fillSellList; - }else { + } else { _newSellArray = []; { - if(( [_query,(_x select 0)] call fnc_inString) || ([_query,(_x select 3)] call fnc_inString) ) then { - if( _x find Z_SellArray < 0 ) then { + if (([_query,(_x select 0)] call fnc_inString) || ([_query,(_x select 3)] call fnc_inString)) then { + if (_x find Z_SellArray < 0) then { _newSellArray set [count(_newSellArray), _x]; }; }; @@ -35,15 +36,15 @@ if(count _this > 0) then { call Z_clearSellableList; call Z_fillSellList; }; - }else { - if(isNil '_query' || _query == "") then { + } else { + if (isNil '_query' || _query == "") then { Z_BuyableArray = [] + Z_OriginalBuyableArray; call Z_clearBuyList; call Z_fillBuyableList; - }else { + } else { _newBuyArray = []; { - if(( [_query,(_x select 0)] call fnc_inString) || ([_query,(_x select 3)] call fnc_inString) ) then { + if (([_query,(_x select 0)] call fnc_inString) || ([_query,(_x select 3)] call fnc_inString)) then { _newBuyArray set [count(_newBuyArray), _x]; }; } forEach Z_OriginalBuyableArray; @@ -52,4 +53,4 @@ if(count _this > 0) then { call Z_fillBuyableList; }; }; -}; \ No newline at end of file +}; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getBackpackItems.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getBackpackItems.sqf index c1c9eda26..9e8bc9465 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getBackpackItems.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getBackpackItems.sqf @@ -3,12 +3,14 @@ * * Gets all your items stored in your backpack and innitiates the selling list. **/ +private ["_backpack","_pic","_formattedText","_mags","_weaps","_normalMags","_normalWeaps","_kinds","_kinds2","_amounts","_amounts2"]; #include "defines.hpp" -private ["_backpack","_pic","_formattedText","_mags","_weaps","_normalMags","_normalWeaps","_kinds","_kinds2","_ammmounts","_ammmounts2","_ctrltext"]; + call Z_clearLists; Z_SellableArray = []; Z_SellArray = []; _backpack = unitBackpack player; + if (!isNull _backpack) then { _pic = getText (configFile >> 'CfgVehicles' >> (typeOf _backpack) >> 'picture'); @@ -24,30 +26,24 @@ if (!isNull _backpack) then { _normalMags = []; _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; [_normalMags,_normalWeaps, typeOf _backpack,[]] call Z_checkArrayInConfig; -}else{ - _ctrltext = localize "STR_EPOCH_TRADE_STUPID"; - ctrlSetText [Z_AT_TRADERLINE2, _ctrltext]; - - _ctrltext = localize "STR_EPOCH_TRADE_NO_BACKPACK"; - ctrlSetText [Z_AT_TRADERLINE1, _ctrltext]; }; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getContainer.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getContainer.sqf index 9b77327f6..9c6d55166 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getContainer.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getContainer.sqf @@ -1,11 +1,11 @@ /** * call Z_getContainer * -* Switches between selling and buying and the item container (gear/vehicle/bakcpack) and initiates item loading. +* Switches between selling and buying and the item container (gear/vehicle/backpack) and initiates item loading. **/ -private ["_lbIndex","_canBuyInVehicle"]; +private ["_lbIndex","_canBuyInVehicle","_backpack"]; #include "defines.hpp" -(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SLOTSDISPLAY) ctrlSetText format["0 / 0 / 0"]; + if (Z_Selling) then { call Z_clearBuyingList; Z_BuyingArray = []; @@ -15,22 +15,34 @@ Z_SellableArray = []; Z_SellArray = []; _lbIndex = _this select 0; +_backpack = unitBackpack player; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText ""; call Z_calcPrice; -if(Z_Selling)then{ +if (Z_Selling) then { switch (_lbIndex) do { case 0: { - [localize "STR_EPOCH_TRADE_SELLING_BACKPACK"] call Z_filleTradeTitle; - Z_SellingFrom = 0; - call Z_getBackpackItems; + if (!isNull _backpack) then { + [localize "STR_EPOCH_TRADE_SELLING_BACKPACK"] call Z_filleTradeTitle; + Z_SellingFrom = 0; + call Z_getBackpackItems; + } else { + ctrlSetText [Z_AT_TRADERLINE1, localize "STR_EPOCH_TRADE_NO_BACKPACK"]; + ctrlSetText [Z_AT_SLOTSDISPLAY, " "]; + }; }; case 1: { - [localize "STR_EPOCH_TRADE_SELLING_VEHICLE"] call Z_filleTradeTitle; - Z_SellingFrom = 1; - call Z_getVehicleItems; + _canBuyInVehicle = true call Z_checkCloseVehicle; + if (_canBuyInVehicle) then { + [localize "STR_EPOCH_TRADE_SELLING_VEHICLE"] call Z_filleTradeTitle; + Z_SellingFrom = 1; + call Z_getVehicleItems; + } else { + ctrlSetText [Z_AT_TRADERLINE1, localize "STR_EPOCH_PLAYER_245"]; + ctrlSetText [Z_AT_SLOTSDISPLAY, " "]; + }; }; case 2: { [localize "STR_EPOCH_TRADE_SELLING_GEAR"] call Z_filleTradeTitle; @@ -38,24 +50,29 @@ if(Z_Selling)then{ call Z_getGearItems; }; }; -}else{ +} else { ctrlSetText [Z_AT_TRADERLINE2, " "]; ctrlSetText [Z_AT_TRADERLINE1, localize "STR_EPOCH_TRADE_SELLING_ALL"]; switch (_lbIndex) do { case 0: { - Z_SellingFrom = 0; - [localize "STR_EPOCH_TRADE_BUYING_BACKPACK"] call Z_filleTradeTitle; - [0] call Z_calculateFreeSpace; + if (!isNull _backpack) then { + Z_SellingFrom = 0; + [localize "STR_EPOCH_TRADE_BUYING_BACKPACK"] call Z_filleTradeTitle; + [0] call Z_calculateFreeSpace; + } else { + ctrlSetText [Z_AT_TRADERLINE1, localize "STR_EPOCH_TRADE_NO_BACKPACK"]; + ctrlSetText [Z_AT_SLOTSDISPLAY, " "]; + }; }; case 1: { - Z_SellingFrom = 1; - [localize "STR_EPOCH_TRADE_BUYING_VEHICLE"] call Z_filleTradeTitle; _canBuyInVehicle = true call Z_checkCloseVehicle; - if(_canBuyInVehicle)then{ + if (_canBuyInVehicle) then { + Z_SellingFrom = 1; + [localize "STR_EPOCH_TRADE_BUYING_VEHICLE"] call Z_filleTradeTitle; [1] call Z_calculateFreeSpace; - }else{ - systemChat localize "STR_EPOCH_PLAYER_245"; - (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SLOTSDISPLAY) ctrlSetText format["%1 / %2 / %3",0,0,0]; + } else { + ctrlSetText [Z_AT_TRADERLINE1, localize "STR_EPOCH_PLAYER_245"]; + ctrlSetText [Z_AT_SLOTSDISPLAY, " "]; }; }; case 2: { diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getGearItems.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getGearItems.sqf index 6e6ccdedd..4250709f0 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getGearItems.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getGearItems.sqf @@ -1,10 +1,11 @@ /** -* call Z_getBackpackItems +* call Z_getGearItems * * Gets all your items stored in your gear and innitiates the selling list. **/ -private ["_mags","_weaps","_skin","_formattedText","_bag","_bags"]; +private ["_mags","_weaps","_skin","_formattedText","_bag","_bags","_pic"]; #include "defines.hpp" + call Z_clearLists; Z_SellArray = []; Z_SellableArray = []; @@ -23,4 +24,4 @@ _formattedText = format [ (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText _formattedText; -[_weaps,_mags,localize "STR_EPOCH_YOUR_GEAR",_bags] call Z_checkArrayInConfig; +[_weaps,_mags,toLower (localize "STR_UI_GEAR"),_bags] call Z_checkArrayInConfig; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getItemConfig.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getItemConfig.sqf index 7cefd4f23..623a38d75 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getItemConfig.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getItemConfig.sqf @@ -1,6 +1,6 @@ - -#include "defines.hpp" private ['_item', '_type']; +#include "defines.hpp" + _item = _this select 0; _type = _item select 1; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getItemInfo.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getItemInfo.sqf index 10e912e3d..83e5836d4 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getItemInfo.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getItemInfo.sqf @@ -10,8 +10,8 @@ _selectedIndex = _this select 1; _item = []; -if(_selectedIndex >= 0) then { - switch(_selectedList) do { +if (_selectedIndex >= 0) then { + switch (_selectedList) do { case 'sellable': { _item = Z_SellableArray select _selectedIndex; }; @@ -27,6 +27,6 @@ if(_selectedIndex >= 0) then { }; }; -if( count _item > 0) then { +if (count _item > 0) then { [_item] call Z_getItemConfig; -}; \ No newline at end of file +}; 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 647fed2ff..de3b0e16c 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getVehicleItems.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getVehicleItems.sqf @@ -1,9 +1,11 @@ /** -* call Z_getBackpackItems +* call Z_getVehicleItems * * Gets all your items stored in your vehicle and innitiates the selling list. **/ +private ["_vehicle","_pos","_list","_formattedText","_pic","_mags","_weaps","_bags","_normalMags","_normalWeaps","_normalBags","_kinds","_amounts","_counter","_kinds2","_amounts2"]; #include "defines.hpp" + Z_vehicle = objNull; call Z_clearLists; Z_SellableArray = []; @@ -16,7 +18,7 @@ _list = nearestObjects [_pos, ["Air","LandVehicle","Ship"], Z_VehicleDistance]; if (!isNull _x && local _x && alive _x) then { _vehicle = _x; }; -}count _list; +} count _list; if (!isNull _vehicle) then { systemChat format[localize "STR_EPOCH_TRADE_SELECTED",typeOf _vehicle]; @@ -38,43 +40,37 @@ if (!isNull _vehicle) then { _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; + _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; // Can't sell backpacks from vehicle because there is currently no command to remove single backpacks from cargo (only clearBackpackCargo which removes all) /* _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; */ [_normalWeaps,_normalMags, typeOf _vehicle,_normalBags] call Z_checkArrayInConfig; -}else{ - _ctrltext = localize "STR_EPOCH_PLAYER_245"; - ctrlSetText [Z_AT_TRADERLINE2, _ctrltext]; - - _ctrltext = localize "STR_EPOCH_TRADE_NO_VEHICLE"; - ctrlSetText [Z_AT_TRADERLINE1, _ctrltext]; }; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_logTrade.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_logTrade.sqf index 4bba7a5bb..020889f41 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_logTrade.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_logTrade.sqf @@ -1,7 +1,7 @@ private ["_Z_logTrade","_classNames","_className","_amounts","_amount","_prices","_price","_quantity","_queueAmounts","_queueNames","_queuePrices","_index","_buyOrSell"]; _Z_logTrade = { - private ["_buyOrSell","_className","_container","_currency","_price","_quantity"]; + private ["_buyOrSell","_className","_container","_currency","_price","_quantity","_tCost"]; _className = _this select 0; _quantity = _this select 1; @@ -12,7 +12,7 @@ _Z_logTrade = { case 1 : {localize "STR_EPOCH_TRADE_VEHICLE"}; case 2 : {localize "STR_UI_GEAR"}; }; - _tcost = _price call Z_calcDefaultCurrencyNoImg; + _tCost = _price call Z_calcDefaultCurrencyNoImg; _currency = if (Z_SingleCurrency) then {"Coins"} else {""}; // Log to client RPT @@ -24,9 +24,9 @@ _Z_logTrade = { }; } else { if (_buyOrSell == "buy") then { - diag_log format["%5: Bought %4 x %1 into %7 at %2 for %3",_className,inTraderCity,_tcost,_quantity,localize "STR_EPOCH_PLAYER_289",_currency,_container]; + diag_log format["%5: Bought %4 x %1 into %7 at %2 for %3",_className,inTraderCity,_tCost,_quantity,localize "STR_EPOCH_PLAYER_289",_currency,_container]; } else { - diag_log format["%5: Sold %4 x %1 from %7 at %2 for %3",_className,inTraderCity,_tcost,_quantity,localize "STR_EPOCH_PLAYER_289",_currency,_container]; + diag_log format["%5: Sold %4 x %1 from %7 at %2 for %3",_className,inTraderCity,_tCost,_quantity,localize "STR_EPOCH_PLAYER_289",_currency,_container]; }; }; @@ -40,9 +40,9 @@ _Z_logTrade = { }; } else { if (_buyOrSell == "buy") then { - PVDZE_obj_Trade = [player,0,0,_className,inTraderCity,_currency,_tcost,_quantity,_container,false]; + PVDZE_obj_Trade = [player,0,0,_className,inTraderCity,_currency,_tCost,_quantity,_container,false]; } else { - PVDZE_obj_Trade = [player,0,1,_className,inTraderCity,_currency,_tcost,_quantity,_container,false]; + PVDZE_obj_Trade = [player,0,1,_className,inTraderCity,_currency,_tCost,_quantity,_container,false]; }; }; publicVariableServer "PVDZE_obj_Trade"; 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 466663aee..21e82c8a7 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_payDefault.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_payDefault.sqf @@ -10,12 +10,12 @@ _moneyInVehicle = _moneyInfo select 3; { _nil = [player, _x , 1] call BIS_fnc_invRemove; -}count _moneyInGear; +} count _moneyInGear; -if (count _moneyInBackpack > 0 ) then { +if (count _moneyInBackpack > 0) then { _nil = [unitBackpack _player, _moneyInBackpack, []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo; }; -if (!isNull Z_vehicle && count _moneyInVehicle > 0 ) then { +if (!isNull Z_vehicle && count _moneyInVehicle > 0) then { _nil = [Z_vehicle, _moneyInVehicle, []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo; }; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_pushItemToList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_pushItemToList.sqf index 1a39505bd..fbcfc3641 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_pushItemToList.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_pushItemToList.sqf @@ -1,6 +1,8 @@ +private ["_index","_temp","_index2"]; #include "defines.hpp" + _index = _this select 0; -if(!isNil"_index" && _index > -1)then { +if (!isNil"_index" && _index > -1) then { lbDelete [Z_AT_SELLABLELIST, _index]; _temp = Z_SellableArray select _index; //_item = [_temp select 0,_temp select 1 ,_temp select 2,_temp select 3, _temp select 4 ]; @@ -10,4 +12,4 @@ if(!isNil"_index" && _index > -1)then { _index2 = lbAdd [Z_AT_SELLINGLIST, _temp select 3]; lbSetPicture [Z_AT_SELLINGLIST, _index2, _temp select 4]; call Z_calcPrice; -}; \ No newline at end of file +}; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeItemFromBuyingList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeItemFromBuyingList.sqf index a06246881..771122fd0 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeItemFromBuyingList.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeItemFromBuyingList.sqf @@ -1,8 +1,10 @@ +private "_index"; #include "defines.hpp" + _index = _this select 0; -if(!isNil"_index" && _index > -1)then { +if (!isNil"_index" && _index > -1) then { lbDelete [Z_AT_BUYINGLIST, _index]; Z_BuyingArray set [_index,"deleted"]; Z_BuyingArray = Z_BuyingArray - ["deleted"]; call Z_calcPrice; -}; \ No newline at end of file +}; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeItemFromList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeItemFromList.sqf index 438d791c6..afcd56e8e 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeItemFromList.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeItemFromList.sqf @@ -1,6 +1,8 @@ +private ["_index","_temp","_index2"]; #include "defines.hpp" + _index = _this select 0; -if(!isNil"_index" && _index > -1)then { +if (!isNil"_index" && _index > -1) then { lbDelete [Z_AT_SELLINGLIST, _index]; _temp = Z_SellArray select _index; //_item = [_temp select 0,_temp select 1 ,_temp select 2,_temp select 3, _temp select 4 ]; @@ -10,4 +12,4 @@ if(!isNil"_index" && _index > -1)then { _index2 = lbAdd [Z_AT_SELLABLELIST, _temp select 3]; lbSetPicture [Z_AT_SELLABLELIST, _index2, _temp select 4]; call Z_calcPrice; -}; \ No newline at end of file +}; 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 59dfef2a1..46900aedb 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf @@ -35,14 +35,14 @@ _sellVehicle = { if (!(_sellType in ["trade_any_boat", "trade_any_boat_old"])) then { _hitpoints = _obj call vehicle_getHitpoints; { - if(["Wheel",_x,false] call fnc_inString) then { + if (["Wheel",_x,false] call fnc_inString) then { _damage = [_obj,_x] call object_getHit; _tireDmg = _tireDmg + _damage; _tires = _tires + 1; }; } forEach _hitpoints; - if(_tireDmg > 0 && _tires > 0) then { - if((_tireDmg / _tires) > 0.75) then { + if (_tireDmg > 0 && _tires > 0) then { + if ((_tireDmg / _tires) > 0.75) then { _okToSell = false; }; }; @@ -52,14 +52,16 @@ _sellVehicle = { _objectCharacterId = _obj getVariable ["CharacterID","0"]; _notSetup = (_objectID == "0" && _objectUID == "0"); - if(local _obj && !isNull _obj && alive _obj && !_notSetup) then { - if(_okToSell) then { + if (local _obj && !isNull _obj && alive _obj && !_notSetup) then { + if (_okToSell) then { _returnInfo = [_objectCharacterId, _obj, _objectID, _objectUID, _sellType]; } else { - systemChat format[localize "str_epoch_player_182",typeOf _obj]; _returnInfo = []; + systemChat format[localize "str_epoch_player_182",typeOf _obj]; + _returnInfo = []; }; } else { - systemChat localize "str_epoch_player_245"; _returnInfo = []; + systemChat localize "str_epoch_player_245"; + _returnInfo = []; }; }; _returnInfo; @@ -99,7 +101,7 @@ _sellVehicle = { }; }; }; -}forEach Z_SellArray; +} forEach Z_SellArray; _tSold = _itemsArray + _weaponsArray + _bpArray + _vehArray; @@ -115,7 +117,7 @@ if (Z_SellingFrom == 1) then { _itemsToLog set [0,(_itemsArray + _weaponsArray + _bpArray + [typeOf Z_vehicle])]; //gear -if (Z_SellingFrom == 2)then{ +if (Z_SellingFrom == 2) then { private ["_localResult", "_vehTraded"]; _wA = []; _mA = []; @@ -139,23 +141,23 @@ if (Z_SellingFrom == 2)then{ if (_type == "trade_items") then {_name = configFile >> "CfgMagazines" >> _name;}; if (_type == "trade_weapons") then {_name = configFile >> "CfgWeapons" >> _name;}; _localResult = [player,_name,1] call BIS_fnc_invRemove; // Use config for BIS_fnc_invRemove - if(_localResult != 1)then{ - if(_x select 1 == "trade_items")then{ + if (_localResult != 1) then { + if (_x select 1 == "trade_items") then { _mA set [count(_mA),0]; - }else{ + } else { _wA set [count(_wA),0]; }; - }else{ - if(_x select 1 == "trade_items")then{ + } else { + if (_x select 1 == "trade_items") then { _mA set [count(_mA),1]; - }else{ + } else { _wA set [count(_wA),1]; }; }; }; }; - }forEach Z_SellArray; + } forEach Z_SellArray; _outcome set [0,_mA]; _outcome set [1,_wA]; @@ -169,22 +171,22 @@ if (Z_SellingFrom == 2)then{ systemchat format[localize "STR_EPOCH_TRADE_SELL_IN_GEAR",count _tSold]; }; -{ _itemsToLog set [1, (_itemsToLog select 1) + _x] } forEach _outcome; +{_itemsToLog set [1, (_itemsToLog select 1) + _x]} forEach _outcome; _money = 0; if (Z_SingleCurrency) then { { - _money = _money + ( (((_itemsCheckArray select _forEachIndex) select 0)) * _x) ; - _itemsToLog set [2, (_itemsToLog select 2) + [( (((_itemsCheckArray select _forEachIndex) select 0)) * _x)]]; - }forEach (_outcome select 0); + _money = _money + ((((_itemsCheckArray select _forEachIndex) select 0)) * _x) ; + _itemsToLog set [2, (_itemsToLog select 2) + [((((_itemsCheckArray select _forEachIndex) select 0)) * _x)]]; + } forEach (_outcome select 0); { - _money = _money + ( (((_weaponsCheckArray select _forEachIndex) select 0)) * _x) ; - _itemsToLog set [2, (_itemsToLog select 2) + [( (((_weaponsCheckArray select _forEachIndex) select 0)) * _x)]]; - }forEach (_outcome select 1); + _money = _money + ((((_weaponsCheckArray select _forEachIndex) select 0)) * _x) ; + _itemsToLog set [2, (_itemsToLog select 2) + [((((_weaponsCheckArray select _forEachIndex) select 0)) * _x)]]; + } forEach (_outcome select 1); { - _money = _money + ( ( ((_bpCheckArray select _forEachIndex) select 0) ) * _x) ; - _itemsToLog set [2, (_itemsToLog select 2) + [( (((_bpCheckArray select _forEachIndex) select 0)) * _x)]]; - }forEach (_outcome select 2); + _money = _money + ((((_bpCheckArray select _forEachIndex) select 0)) * _x) ; + _itemsToLog set [2, (_itemsToLog select 2) + [((((_bpCheckArray select _forEachIndex) select 0)) * _x)]]; + } forEach (_outcome select 2); if (count _outcome > 3) then { _money = _money + ((_vehCheckArray select 0) select 0); @@ -193,19 +195,19 @@ if (Z_SingleCurrency) then { } else { { _itemData = _itemsCheckArray select _forEachIndex; - _money = _money + ( (_itemData select 0) * (_itemData select 1) * _x); - _itemsToLog set [2, (_itemsToLog select 2) + [( (_itemData select 0) * (_itemData select 1) * _x)]]; - }forEach (_outcome select 0); + _money = _money + ((_itemData select 0) * (_itemData select 1) * _x); + _itemsToLog set [2, (_itemsToLog select 2) + [((_itemData select 0) * (_itemData select 1) * _x)]]; + } forEach (_outcome select 0); { _itemData = _weaponsCheckArray select _forEachIndex; - _money = _money + ( (_itemData select 0) * (_itemData select 1) * _x); - _itemsToLog set [2, (_itemsToLog select 2) + [( (_itemData select 0) * (_itemData select 1) * _x)]]; - }forEach (_outcome select 1); + _money = _money + ((_itemData select 0) * (_itemData select 1) * _x); + _itemsToLog set [2, (_itemsToLog select 2) + [((_itemData select 0) * (_itemData select 1) * _x)]]; + } forEach (_outcome select 1); { _itemData = _bpCheckArray select _forEachIndex; - _money = _money + ( (_itemData select 0) * (_itemData select 1) * _x); - _itemsToLog set [2, (_itemsToLog select 2) + [( (_itemData select 0) * (_itemData select 1) * _x)]]; - }forEach (_outcome select 2); + _money = _money + ((_itemData select 0) * (_itemData select 1) * _x); + _itemsToLog set [2, (_itemsToLog select 2) + [((_itemData select 0) * (_itemData select 1) * _x)]]; + } forEach (_outcome select 2); if ((count _outcome) > 3) then { _itemData = _vehCheckArray select 0; _money = _money + ((_itemData select 0) * (_itemData select 1)); diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_toBuyingList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_toBuyingList.sqf index 13abcd0b6..c5b0ee779 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_toBuyingList.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_toBuyingList.sqf @@ -1,9 +1,9 @@ private ["_amount","_index","_index2","_temp"]; - #include "defines.hpp" + _index = _this select 0; _amount = parseNumber(_this select 1); -if(!isNil"_index" && _index > -1 && (typeName _amount == "SCALAR") && _amount > 0 )then { +if (!isNil"_index" && _index > -1 && (typeName _amount == "SCALAR") && _amount > 0) then { _temp = [] + (Z_BuyableArray select _index); _temp set [9,(ceil _amount)]; Z_BuyingArray set [count(Z_BuyingArray),_temp]; 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 eea56129c..ead36caee 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------------- 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 == [[1,0,0,1,1,1,0],[1,0,0,1],[1,0]]; // 1 = success, 0 = fail ->(item was not in cargo) Author: Zupa 2014-09-30 @@ -14,7 +14,7 @@ _weaps = _this select 2; _bags = []; _vehInfo = []; -if(count _this > 3) then { +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; @@ -46,31 +46,31 @@ _unit_allBags_count = _unit_allBags select 1; clearMagazineCargoGlobal _unit; clearWeaponCargoGlobal _unit; -if( count _bags > 0 )then{ +if (count _bags > 0) then { clearBackpackCargoGlobal _unit; }; { _counter = 0 ; - while{ _counter < ( _unit_allItems_count select _forEachIndex)}do{ - _normalItems set [count(_normalItems),_x]; - _counter = _counter + 1; + while {_counter < (_unit_allItems_count select _forEachIndex)} do { + _normalItems set [count(_normalItems),_x]; + _counter = _counter + 1; }; -}forEach _unit_allItems_types; +} forEach _unit_allItems_types; { _counter = 0 ; - while{ _counter < ( _unit_allWeaps_count select _forEachIndex)}do{ - _normalWeaps set [count(_normalWeaps),_x]; - _counter = _counter + 1; + while {_counter < (_unit_allWeaps_count select _forEachIndex)} do { + _normalWeaps set [count(_normalWeaps),_x]; + _counter = _counter + 1; }; -}forEach _unit_allWeaps_types; +} forEach _unit_allWeaps_types; { _counter = 0 ; - while{ _counter < ( _unit_allBags_count select _forEachIndex)}do{ - _normalBagss set [count(_normalBags),_x]; - _counter = _counter + 1; + while {_counter < (_unit_allBags_count select _forEachIndex)} do { + _normalBagss set [count(_normalBags),_x]; + _counter = _counter + 1; }; -}forEach _unit_allBags_types; +} forEach _unit_allBags_types; _returnVar = []; _returnMag = []; @@ -78,45 +78,45 @@ _returnWeap = []; _returnBag = []; { _inCargo = _normalItems find _x; - if(_inCargo > -1)then{ + if (_inCargo > -1) then { _normalItems set [_inCargo, "soldItem"]; _returnMag set [count(_returnMag),1]; - }else{ + } else { _returnMag set [count(_returnMag),0]; }; -}count _items; +} count _items; _normalItems = _normalItems - ["soldItem"]; { _unit addMagazineCargoGlobal [_x, 1]; -}count _normalItems; +} count _normalItems; { _inCargo = _normalBags find _x; - if(_inCargo > -1)then{ + if (_inCargo > -1) then { _normalBags set [_inCargo, "soldItem"]; _returnBag set [count(_returnBag),1]; - }else{ + } else { _returnBag set [count(_returnBag),0]; }; -}count _bags; +} count _bags; { _unit addBackpackCargoGlobal [_x, 1]; -}count _normalBags; +} count _normalBags; { _inCargo = _normalWeaps find _x; - if(_inCargo > -1)then{ + if (_inCargo > -1) then { _normalWeaps set [_inCargo, "soldItem"]; _returnWeap set [count(_returnWeap),1]; - }else{ + } else { _returnWeap set [count(_returnWeap),0]; }; -}count _weaps; +} count _weaps; _normalWeaps = _normalWeaps - ["soldItem"]; { _unit addWeaponCargoGlobal [_x, 1]; -}count _normalWeaps; +} count _normalWeaps; _normalWeaps = _normalWeaps - ["soldItem"]; if (count _vehInfo > 0) then { @@ -130,4 +130,4 @@ _returnVar set [0,_returnMag]; _returnVar set [1,_returnWeap]; _returnVar set [2,_returnBag]; -_returnVar; \ No newline at end of file +_returnVar; diff --git a/SQF/dayz_code/actions/AdvancedTrading/init.sqf b/SQF/dayz_code/actions/AdvancedTrading/init.sqf index b620f785a..dbc0f712c 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/init.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/init.sqf @@ -2,13 +2,13 @@ disableSerialization; Z_traderData = (_this select 3); // gets the trader data ( e.g menu_Functionary1 ) -if( isNil "Z_traderData" || count (Z_traderData) == 0)exitWith{ +if (isNil "Z_traderData" || count (Z_traderData) == 0) exitWith { localize "STR_EPOCH_TRADE_ERROR" call dayz_rollingMessages; }; -if(DZE_ActionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; }; +if (DZE_ActionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; }; -if(isNil "Z_AdvancedTradingInit")then{ +if (isNil "Z_AdvancedTradingInit") then { //#include "config.sqf"; // Moved to dayz_code/configVariables.sqf #include "\z\addons\dayz_code\actions\AdvancedTrading\functions\defines.hpp" @@ -34,7 +34,6 @@ if(isNil "Z_AdvancedTradingInit")then{ DZE_GemWorthList set [(count DZE_GemWorthList), _largest]; }; - Z_Selling = true; Z_SellingFrom = 2; Z_vehicle = objNull; @@ -45,7 +44,7 @@ if(isNil "Z_AdvancedTradingInit")then{ Z_BuyableArray = []; Z_BuyingArray = []; - if( isNil 'CurrencyName' && Z_SingleCurrency )then{ + if (isNil 'CurrencyName' && Z_SingleCurrency) then { CurrencyName = 'Coins'; // fallback }; if (!Z_SingleCurrency) then { diff --git a/SQF/dayz_code/actions/doorManagement/doorAddFriend.sqf b/SQF/dayz_code/actions/doorManagement/doorAddFriend.sqf index b36c1d72b..defa7e311 100644 --- a/SQF/dayz_code/actions/doorManagement/doorAddFriend.sqf +++ b/SQF/dayz_code/actions/doorManagement/doorAddFriend.sqf @@ -1,4 +1,5 @@ -private ["_pos","_plots","_inList"]; +private ["_pos","_plots","_inList","_friends","_toAdd"]; + _pos = _this select 0; if (_pos < 0) exitWith {}; _toAdd = (Humans select _pos); diff --git a/SQF/dayz_code/actions/doorManagement/doorGetFriends.sqf b/SQF/dayz_code/actions/doorManagement/doorGetFriends.sqf index 3676099d8..cf24ceaa5 100644 --- a/SQF/dayz_code/actions/doorManagement/doorGetFriends.sqf +++ b/SQF/dayz_code/actions/doorManagement/doorGetFriends.sqf @@ -1,4 +1,5 @@ -private ["_plots","_friendlies","_thePlot"]; +private ["_friends"]; + lbClear 7102; _friends = TheDoor getVariable ["doorfriends",[]]; { diff --git a/SQF/dayz_code/actions/doorManagement/doorNearbyHumans.sqf b/SQF/dayz_code/actions/doorManagement/doorNearbyHumans.sqf index 31b7c8df2..f0acc2891 100644 --- a/SQF/dayz_code/actions/doorManagement/doorNearbyHumans.sqf +++ b/SQF/dayz_code/actions/doorManagement/doorNearbyHumans.sqf @@ -1,4 +1,5 @@ -private ["_close"]; +private ["_closePeople","_friendUID","_friendName"]; + lbClear 7101; _closePeople = player nearEntities ["CAManBase", 10]; if (!DZE_doorManagementMustBeClose) then {_closePeople = playableUnits}; diff --git a/SQF/dayz_code/actions/doorManagement/doorRemoveFriend.sqf b/SQF/dayz_code/actions/doorManagement/doorRemoveFriend.sqf index dda038bb6..46e183c4b 100644 --- a/SQF/dayz_code/actions/doorManagement/doorRemoveFriend.sqf +++ b/SQF/dayz_code/actions/doorManagement/doorRemoveFriend.sqf @@ -1,4 +1,5 @@ -private ["_list","_plots","_thePlot","_friends"]; +private ["_pos","_friends","_toRemove","_newList"]; + _pos = _this select 0; if (_pos < 0) exitWith {}; _friends = TheDoor getVariable ["doorfriends", []]; diff --git a/SQF/dayz_code/actions/doorManagement/initDoorManagement.sqf b/SQF/dayz_code/actions/doorManagement/initDoorManagement.sqf index 658516797..635b55a0b 100644 --- a/SQF/dayz_code/actions/doorManagement/initDoorManagement.sqf +++ b/SQF/dayz_code/actions/doorManagement/initDoorManagement.sqf @@ -1,5 +1,7 @@ +private ["_display","isOwner"]; disableSerialization; -if(count(_this) > 0) then + +if (count(_this) > 0) then { TheDoor = _this select 3; } else { @@ -11,19 +13,18 @@ _display = findDisplay 61144; _display closeDisplay 3000; // Check player access -_isowner = [player, TheDoor] call FNC_check_access; -if( ((_isowner select 0) && DZE_doorManagementAllowManage_owner) // door owner - || ((_isowner select 1) && DZE_doorManagementAllowManage_ownerFriendlies) // door owner's friendly tagged - || ((_isowner select 2) && DZE_doorManagementAllowManage_plotOwner) // plot owner - || ((_isowner select 3) && DZE_doorManagementAllowManage_plotFriends) // plot friends - || ((_isowner select 4) && DZE_doorManagementAllowManage_plotAdmins) // plot management admins - || ((_isowner select 5) && DZE_doorManagementAllowManage_doorFriends) // door friends - || ((_isowner select 6) && DZE_doorManagementAllowManage_doorAdmins) // door management admins +_isOwner = [player, TheDoor] call FNC_check_access; +if( ((_isOwner select 0) && DZE_doorManagementAllowManage_owner) // door owner + || ((_isOwner select 1) && DZE_doorManagementAllowManage_ownerFriendlies) // door owner's friendly tagged + || ((_isOwner select 2) && DZE_doorManagementAllowManage_plotOwner) // plot owner + || ((_isOwner select 3) && DZE_doorManagementAllowManage_plotFriends) // plot friends + || ((_isOwner select 4) && DZE_doorManagementAllowManage_plotAdmins) // plot management admins + || ((_isOwner select 5) && DZE_doorManagementAllowManage_doorFriends) // door friends + || ((_isOwner select 6) && DZE_doorManagementAllowManage_doorAdmins) // door management admins ) then { createDialog "DoorManagement"; call DoorNearbyHumans; call DoorGetFriends; } else { localize "STR_EPOCH_DOORMANAGEMENT_NORIGHTS" call dayz_rollingMessages; -}; - +}; \ No newline at end of file diff --git a/SQF/dayz_code/actions/doorManagement/player_enterCode.sqf b/SQF/dayz_code/actions/doorManagement/player_enterCode.sqf index 1914a46c5..b654e8318 100644 --- a/SQF/dayz_code/actions/doorManagement/player_enterCode.sqf +++ b/SQF/dayz_code/actions/doorManagement/player_enterCode.sqf @@ -1,8 +1,9 @@ +private "_display"; // Close DoorAccess _display = findDisplay 61144; _display closeDisplay 3000; -if(DZE_doorManagementAllowManualCode) then { +if (DZE_doorManagementAllowManualCode) then { //DZE_Lock_Door != (this getvariable['CharacterID','0']); DZE_topCombo = 0; DZE_midCombo = 0; diff --git a/SQF/dayz_code/actions/plotManagement/plotAddFriend.sqf b/SQF/dayz_code/actions/plotManagement/plotAddFriend.sqf index 6904802a7..5c5ba1e95 100644 --- a/SQF/dayz_code/actions/plotManagement/plotAddFriend.sqf +++ b/SQF/dayz_code/actions/plotManagement/plotAddFriend.sqf @@ -1,4 +1,5 @@ -private ["_pos","_plots","_thePlot","_inList"]; +private ["_pos","_plots","_thePlot","_inList","_toAdd","_friends"]; + _pos = _this select 0; if (_pos < 0) exitWith {}; _toAdd = (Humans select _pos); @@ -18,6 +19,5 @@ if (isServer) then { publicVariableServer "PVDZ_veh_Save"; }; - call PlotGetFriends; call PlotNearbyHumans; \ No newline at end of file diff --git a/SQF/dayz_code/actions/plotManagement/plotGetFriends.sqf b/SQF/dayz_code/actions/plotManagement/plotGetFriends.sqf index 143a716dd..e85c6fd70 100644 --- a/SQF/dayz_code/actions/plotManagement/plotGetFriends.sqf +++ b/SQF/dayz_code/actions/plotManagement/plotGetFriends.sqf @@ -1,4 +1,5 @@ private ["_plots","_friendlies","_thePlot"]; + lbClear 7002; _plots = nearestObjects [[player] call FNC_getPos, ["Plastic_Pole_EP1_DZ"],15]; _thePlot = _plots select 0; diff --git a/SQF/dayz_code/actions/plotManagement/plotNearbyHumans.sqf b/SQF/dayz_code/actions/plotManagement/plotNearbyHumans.sqf index 6a2a843c7..569bae7d3 100644 --- a/SQF/dayz_code/actions/plotManagement/plotNearbyHumans.sqf +++ b/SQF/dayz_code/actions/plotManagement/plotNearbyHumans.sqf @@ -1,4 +1,5 @@ private ["_closePeople","_friendUID","_friendName"]; + lbClear 7001; if (!DZE_plotManagementMustBeClose) then {_closePeople = playableUnits;} else {_closePeople = player nearEntities ["CAManBase", 10];}; Humans = []; diff --git a/SQF/dayz_code/actions/plotManagement/plotObjects.sqf b/SQF/dayz_code/actions/plotManagement/plotObjects.sqf index c909257ac..23442fbbb 100644 --- a/SQF/dayz_code/actions/plotManagement/plotObjects.sqf +++ b/SQF/dayz_code/actions/plotManagement/plotObjects.sqf @@ -1,4 +1,4 @@ -private ["_newWealth","_missing","_missingQty","_proceed","_itemIn","_countIn","_target","_objectClasses","_range","_objects","_requirements","_count","_cost","_option","_buildables"]; +private ["_range","_buildables","_count","_colour","_result","_ctrl"]; disableSerialization; _range = DZE_PlotPole select 0; @@ -7,11 +7,11 @@ _count = count (nearestObjects [[player] call FNC_getPos,_buildables,_range]); _colour = "#ffffff"; -if(_count / DZE_BuildingLimit * 100 < 40)then{ -_colour = "#00ff00"; +if (_count / DZE_BuildingLimit * 100 < 40) then { + _colour = "#00ff00"; }; -if(_count / DZE_BuildingLimit * 100 > 75)then{ -_colour = "#ff0000"; +if (_count / DZE_BuildingLimit * 100 > 75) then { + _colour = "#ff0000"; }; _ctrl = ((uiNamespace getVariable "PlotManagement") displayCtrl 7014); diff --git a/SQF/dayz_code/actions/plotManagement/plotRemoveFriend.sqf b/SQF/dayz_code/actions/plotManagement/plotRemoveFriend.sqf index 8580118a1..3c9fee22a 100644 --- a/SQF/dayz_code/actions/plotManagement/plotRemoveFriend.sqf +++ b/SQF/dayz_code/actions/plotManagement/plotRemoveFriend.sqf @@ -1,4 +1,5 @@ private ["_pos","_plots","_thePlot","_friends","_toRemove","_newList"]; + _pos = _this select 0; if (_pos < 0) exitWith {}; _plots = nearestObjects [[player] call FNC_getPos, ["Plastic_Pole_EP1_DZ"],15]; @@ -7,7 +8,7 @@ _friends = _thePlot getVariable ["plotfriends", []]; _toRemove = (_friends select _pos); _newList = []; { - if(_x select 0 != _toRemove select 0)then{ + if(_x select 0 != _toRemove select 0) then { _newList set [(count _newList), _x]; }; } count _friends; diff --git a/SQF/dayz_code/configVariables.sqf b/SQF/dayz_code/configVariables.sqf index 7ac5e01e3..6ad4bb659 100644 --- a/SQF/dayz_code/configVariables.sqf +++ b/SQF/dayz_code/configVariables.sqf @@ -51,7 +51,7 @@ DZE_GodModeBaseExclude = []; //Array of object class names excluded from the god DZE_advancedTrading = true; //Use advanced trading system. WARNING: set to false if you use database traders, you should use config-traders anyway! DZE_serverLogTrades = true; // Log trades to server RPT (sent with publicVariableServer on every trade) DZE_GemWorthArray = [["ItemTopaz",15000], ["ItemObsidian",20000], ["ItemSapphire",25000], ["ItemAmethyst",30000], ["ItemEmerald",35000], ["ItemCitrine",40000], ["ItemRuby",45000]]; //array of gem prices, works only in advanced trading -DZE_SaleRequiresKey = false; //Require the player has the key for a vehicle in oreder to sell it. The key can be in the player's toolbelt or backpack, or the vehicle's inventory. False by default +DZE_SaleRequiresKey = false; //Require the player has the key for a vehicle in order to sell it. The key can be in the player's toolbelt or backpack, or the vehicle's inventory. False by default Z_AT_FolderLocation = '\z\addons\dayz_code\actions\AdvancedTrading'; Z_VehicleDistance = 40; // Distance that a vehicle needs to be to see it's content or to sell it. Z_SingleCurrency = false; // Does your server use a single currency system. diff --git a/SQF/dayz_code/credits.txt b/SQF/dayz_code/credits.txt index ae49f8ca6..9ace43301 100644 --- a/SQF/dayz_code/credits.txt +++ b/SQF/dayz_code/credits.txt @@ -40,7 +40,7 @@ feature. * [DDesmond] (https://github.com/ddesmond) * [Sharkiller](https://github.com/Sharkiller) (Spanish Tranlations) * [Defwen](https://github.com/Defwen) (Czech Translations) -* [[VB]AWOL](https://github.com/vbawol) + * [[VB]AWOL](https://github.com/vbawol) * [Paul Tomany](https://github.com/Sequisha) * [M1lkM8n](https://github.com/M1lkm8n) * [JST](https://github.com/Cybersam248) diff --git a/SQF/dayz_code/stringtable.xml b/SQF/dayz_code/stringtable.xml index 07be83543..b8b2d0dfc 100644 --- a/SQF/dayz_code/stringtable.xml +++ b/SQF/dayz_code/stringtable.xml @@ -13162,7 +13162,7 @@ Vytvořit Dřevěnou ohradu - Failed, you must get into drivers seat first. + You must get into the drivers seat of a vehicle first. Fehlgeschlagen, Sie müssen zuerst auf den Fahrersitz. Вы должны попасть на сиденье водителя хотя бы раз. @@ -16062,28 +16062,28 @@ Prodejní - Selling from gear. + Selling from your gear. Verkauf aus meiner Ausrüstung. Продажа из снаряжения. - Selling from gear. - Selling from gear. - Selling from gear. + Selling from your gear. + Selling from your gear. + Selling from your gear. - Selling from vehicle. + Selling from your vehicle. Verkauf aus dem Fahrzeug. Продажа из транспорта. - Selling from vehicle. - Selling from vehicle. - Selling from vehicle. + Selling from your vehicle. + Selling from your vehicle. + Selling from your vehicle. - Selling from backpack. + Selling from your backpack. Verkauf aus dem Rucksack. Продажа из рюкзака. - Selling from backpack. - Selling from backpack. - Selling from backpack. + Selling from your backpack. + Selling from your backpack. + Selling from your backpack. These are all the items I'm selling. @@ -16094,28 +16094,28 @@ These are all the items I'm selling. - Buying in vehicle. + Buying into your vehicle. Kauf ins Fahrzeug. Покупка в транспорт. - Buying in vehicle. - Buying in vehicle. - Buying in vehicle. + Buying into your vehicle. + Buying into your vehicle. + Buying into your vehicle. - Buying in backpack. + Buying into your backpack. Kauf in den Rucksack. Покупка в рюкзак. - Buying in backpack. - Buying in backpack. - Buying in backpack. + Buying into your backpack. + Buying into your backpack. + Buying into your backpack. - Buying in gear. + Buying into your gear. Kauf in meine Ausrüstung. Покупка в снаряжение. - Buying in gear. - Buying in gear. - Buying in gear. + Buying into your gear. + Buying into your gear. + Buying into your gear. Nothing @@ -16147,18 +16147,6 @@ Détails Podrobnosti - - I'm not stupid. - Ich bin doch nicht blöd. - Я не глупый. - I'm not stupid. - I'm not stupid. - I'm not stupid. - - - I do not see any vehicle. - Я не вижу вашего транспорта. - You are not wearing a backpack. Du hast keinen Rucksack. @@ -16167,6 +16155,9 @@ You are not wearing a backpack. You are not wearing a backpack. + + You already have a backpack. + I would offer %1 %2. Ich biete %1 %2. @@ -16176,7 +16167,7 @@ I would offer %1 %2. - I accept %1 items from %2. + I accept %1 items from your %2. Ich nehme %1 aus %2. Я беру: %1 шт. из %2. I accept %1 items from %2. @@ -16192,17 +16183,13 @@ Вы можете купить только один транспорт за сделку. - You can only buy %1 primary, %2 sidearm and %3 tools in your gear. + You can only buy %1 primary, %2 sidearm and %3 tools into your gear. Вы можете купить в снаряжение: оружия-%1, пистолетов-%2, инструментов-%3. You can only buy %1 magazines into your gear. Вы можете купить предметов в снаряжение: %1. - - You can only buy %1 backpacks into your gear. - Вы можете купить рюкзаков в снаряжение: %1. - You can only buy %1 weapons into your vehicle. Вы можете купить оружия в ваш автомобиль: %1. @@ -16215,10 +16202,6 @@ You can only buy %1 backpacks into your vehicle. Вы можете купить рюкзаков в ваш транспорт: %1. - - You need a backpack. - Вам нужен рюкзак. - Total backpack space exceeded. @@ -16231,7 +16214,7 @@ В рюкзак поместится предметов: %1. - Only %1 bags will fit into your backpack. + You can't purchase a backpack into your backpack. В рюкзак поместится рюкзаков: %1. @@ -16407,10 +16390,6 @@ Des places Sedadla - - your gear - вашего снаряжения - Metal Floor Metal Floor