Add swap for classicBloodBagSystem in Adv. Trade

This commit is contained in:
ebaydayz
2016-05-08 17:31:23 -04:00
parent 5120d8a488
commit c0cb702534

View File

@@ -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_clearBuyList;
call Z_clearBuyingList; call Z_clearBuyingList;
Z_BuyableArray = []; Z_BuyableArray = [];
@@ -6,56 +6,63 @@ Z_BuyingArray = [];
_arrayOfTraderCat = Z_traderData; _arrayOfTraderCat = Z_traderData;
_counter = 0; _counter = 0;
{ {
_cat = format["Category_%1",(_arrayOfTraderCat select _forEachIndex select 1)]; _cat = format["Category_%1",(_arrayOfTraderCat select _forEachIndex select 1)];
_cfgtraders = missionConfigFile >> "CfgTraderCategory" >> _cat; _cfgtraders = missionConfigFile >> "CfgTraderCategory" >> _cat;
if (isNumber (_cfgtraders >> "duplicate")) then { if (isNumber (_cfgtraders >> "duplicate")) then {
_cat = format["Category_%1",getNumber (_cfgtraders >> "duplicate")]; _cat = format["Category_%1",getNumber (_cfgtraders >> "duplicate")];
_cfgtraders = missionConfigFile >> "CfgTraderCategory" >> _cat; _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{ if(_type == "trade_items")then{
_pic = getText (configFile >> 'CfgMagazines' >> _y >> 'picture'); _pic = getText (configFile >> 'CfgMagazines' >> _y >> 'picture');
_text = getText (configFile >> 'CfgMagazines' >> _y >> 'displayName'); _text = getText (configFile >> 'CfgMagazines' >> _y >> 'displayName');
}; };
if(_type == "trade_weapons")then{ if(_type == "trade_weapons")then{
_pic = getText (configFile >> 'CfgWeapons' >> _y >> 'picture'); _pic = getText (configFile >> 'CfgWeapons' >> _y >> 'picture');
_text = getText (configFile >> 'CfgWeapons' >> _y >> 'displayName'); _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'); _pic = getText (configFile >> 'CfgVehicles' >> _y >> 'picture');
_text = getText (configFile >> 'CfgVehicles' >> _y >> 'displayName'); _text = getText (configFile >> 'CfgVehicles' >> _y >> 'displayName');
}; };
if(!Z_SingleCurrency) then { if(!Z_SingleCurrency) then {
_buyCurrency = _buy select 1; _buyCurrency = _buy select 1;
_sellCurrency = _sell select 1, _sellCurrency = _sell select 1,
_part = (configFile >> "CfgMagazines" >> _buyCurrency); _part = (configFile >> "CfgMagazines" >> _buyCurrency);
_worth = getNumber(_part >> "worth"); _worth = getNumber(_part >> "worth");
if (_worth == 0) then { if (_worth == 0) then {
_worth = DZE_GemWorthList select (DZE_GemList find _buyCurrency); _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]];
}; };
}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; }forEach _arrayOfTraderCat;
Z_OriginalBuyableArray = [] + Z_BuyableArray; Z_OriginalBuyableArray = [] + Z_BuyableArray;