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 efe864c16..ebb623f53 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,4 @@ -private ["_arrayOfTraderCat","_counter","_cat","_cfgtraders","_y","_type","_buy","_sell","_pic","_text","_worth","_buyCurrency","_sellCurrency"]; +private ["_arrayOfTraderCat","_counter","_cat","_cfgtraders","_y","_type","_buy","_sell","_pic","_text","_worth","_buyCurrency","_sellCurrency","_ignore"]; call Z_clearBuyList; call Z_clearBuyingList; Z_BuyableArray = []; @@ -6,56 +6,63 @@ Z_BuyingArray = []; _arrayOfTraderCat = Z_traderData; _counter = 0; { - _cat = format["Category_%1",(_arrayOfTraderCat select _forEachIndex select 1)]; - _cfgtraders = missionConfigFile >> "CfgTraderCategory" >> _cat; - if (isNumber (_cfgtraders >> "duplicate")) then { - _cat = format["Category_%1",getNumber (_cfgtraders >> "duplicate")]; - _cfgtraders = missionConfigFile >> "CfgTraderCategory" >> _cat; + _cat = format["Category_%1",(_arrayOfTraderCat select _forEachIndex select 1)]; + _cfgtraders = missionConfigFile >> "CfgTraderCategory" >> _cat; + if (isNumber (_cfgtraders >> "duplicate")) then { + _cat = format["Category_%1",getNumber (_cfgtraders >> "duplicate")]; + _cfgtraders = missionConfigFile >> "CfgTraderCategory" >> _cat; + }; + for "_i" from 0 to (count _cfgtraders) - 1 do + { + _y = _cfgtraders select _i; + if (isClass _y) then + { + _y = configName (_y ); + + _type = getText(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "type"); + _buy = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "buy"); + _sell = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "sell"); + _pic = ""; + _text = ""; + _buyCurrency = ""; + _sellCurrency = ""; + _worth = 0; + _ignore = false; + if (dayz_classicBloodBagSystem && _y in dayz_typedBags) then { + if (_y == "bloodBagONEG") then {_y = "ItemBloodbag";} else {_ignore = true;}; }; - for "_i" from 0 to (count _cfgtraders) - 1 do - { - _y = _cfgtraders select _i; - if (isClass _y) then - { - _y = configName (_y ); - _type = getText(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "type"); - _buy = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "buy"); - _sell = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "sell"); - _pic = ""; - _text = ""; - _buyCurrency = ""; - _sellCurrency = ""; - _worth = 0; - if(_type == "trade_items")then{ - _pic = getText (configFile >> 'CfgMagazines' >> _y >> 'picture'); - _text = getText (configFile >> 'CfgMagazines' >> _y >> 'displayName'); - }; - 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{ - _pic = getText (configFile >> 'CfgVehicles' >> _y >> 'picture'); - _text = getText (configFile >> 'CfgVehicles' >> _y >> 'displayName'); - }; + if(_type == "trade_items")then{ + _pic = getText (configFile >> 'CfgMagazines' >> _y >> 'picture'); + _text = getText (configFile >> 'CfgMagazines' >> _y >> 'displayName'); + }; + 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{ + _pic = getText (configFile >> 'CfgVehicles' >> _y >> 'picture'); + _text = getText (configFile >> 'CfgVehicles' >> _y >> 'displayName'); + }; - if(!Z_SingleCurrency) then { - _buyCurrency = _buy select 1; - _sellCurrency = _sell select 1, - _part = (configFile >> "CfgMagazines" >> _buyCurrency); - _worth = getNumber(_part >> "worth"); - if (_worth == 0) then { - _worth = DZE_GemWorthList select (DZE_GemList find _buyCurrency); - }; - }else{ - _buyCurrency = CurrencyName; - _sellCurrency = CurrencyName; - }; - - Z_BuyableArray set [count(Z_BuyableArray) , [_y,_type,_buy select 0,_text,_pic,_forEachIndex,_sell select 0, _buyCurrency, _sellCurrency, 0,_cat, _worth]]; + if(!Z_SingleCurrency) then { + _buyCurrency = _buy select 1; + _sellCurrency = _sell select 1, + _part = (configFile >> "CfgMagazines" >> _buyCurrency); + _worth = getNumber(_part >> "worth"); + if (_worth == 0) then { + _worth = DZE_GemWorthList select (DZE_GemList find _buyCurrency); }; + }else{ + _buyCurrency = CurrencyName; + _sellCurrency = CurrencyName; }; + + if (!_ignore) then { + Z_BuyableArray set [count(Z_BuyableArray) , [_y,_type,_buy select 0,_text,_pic,_forEachIndex,_sell select 0, _buyCurrency, _sellCurrency, 0,_cat, _worth]]; + }; + }; + }; }forEach _arrayOfTraderCat; Z_OriginalBuyableArray = [] + Z_BuyableArray;