Allow disabling of buying or selling

Set price of the item to -1 in the Cfg traders files to disallow buying
or selling
This commit is contained in:
icomrade
2016-09-03 14:26:43 -04:00
parent 1b60d0d963
commit ffef031863
11 changed files with 82 additions and 42 deletions

View File

@@ -46,6 +46,7 @@
[NEW] Added new BRDM2, AN2, HMMWV, Mi17 and Cessna _DZ classes with radar disabled. #1746 @AirWavesMan
[NEW] Added SCAR Mk16 and Mk17 variants, L86 and AA12 to loot tables and traders. #1743 @AirWavesMan
[NEW] Players can now manually push stuck planes backwards to free them. @ebaydayz
[NEW] You may set the buying or selling price of any item to -1 to disallow the respective trading action, only with config traders and advanced trading @icomrade
[CHANGED] Combattimeout now uses diag_tickTime instead of time.
[CHANGED] AmmoBoxSmall_556/762 is replaced with DZ_AmmoBoxUS/RU/EU/CZ and MedBox0 is replaced with DZ_MedBox (new model)

View File

@@ -29,6 +29,8 @@ _counter = 0;
_sellCurrency = "";
_worth = 0;
_ignore = false;
_BcurrencyQty = _buy select 0;
_ScurrencyQty = _sell select 0;
if (dayz_classicBloodBagSystem && _y in dayz_typedBags) then {
if (_y == "bloodBagONEG") then {_y = "ItemBloodbag";} else {_ignore = true;};
};
@@ -58,9 +60,10 @@ _counter = 0;
_buyCurrency = CurrencyName;
_sellCurrency = CurrencyName;
};
if (_BcurrencyQty < 0) then {_buyCurrency = "Unavailable"; _ignore = true;};
if (_ScurrencyQty < 0) then {_sellCurrency = "Unavailable";};
if (!_ignore) then { // Fill buyable list for one category only
Z_BuyableArray set [count Z_BuyableArray, [_y,_type,_buy select 0,_text,_pic,_forEachIndex,_sell select 0, _buyCurrency, _sellCurrency, 0,_cat, _worth]];
Z_BuyableArray set [count Z_BuyableArray, [_y,_type,_BcurrencyQty,_text,_pic,_forEachIndex, _ScurrencyQty, _buyCurrency, _sellCurrency, 0,_cat, _worth]];
};
};
};

View File

@@ -92,7 +92,7 @@ _totalPrice = 0;
if (!_HasKey) exitWith {};
_worth = 0;
_currencyQty = _buy select 0;
if (!Z_SingleCurrency) then {
_buyCurrency = _buy select 1;
_sellCurrency = _sell select 1;
@@ -103,8 +103,10 @@ _totalPrice = 0;
_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]];
if (_currencyQty < 0) then {_buyCurrency = "Unavailable";};
if ((_sell select 0) >= 0) then {
Z_SellableArray set [count(Z_SellableArray) , [_y, _type, _sell select 0, _text, _pic, _forEachIndex, _currencyQty, _sellCurrency, _buyCurrency, 0 ,_cat, _worth]];
};
_totalPrice = _totalPrice + (_sell select 0);
};
} forEach _arrayOfTraderCat;

View File

@@ -45,8 +45,8 @@ if (Z_SingleCurrency) then {
_display,
_class,
CurrencyName,
[_sellPrice] call BIS_fnc_numberText,
[_buyPrice] call BIS_fnc_numberText,
if (_sellPrice >= 0) then {[_sellPrice] call BIS_fnc_numberText;} else {"";},
if (_buyPrice >= 0) then {[_buyPrice] call BIS_fnc_numberText;} else {"";},
CurrencyName,
_transportMaxWeapons,
_transportMaxMagazines,
@@ -58,10 +58,16 @@ if (Z_SingleCurrency) then {
localize "STR_EPOCH_MAGS"
];
} else {
_picSell = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'picture');
_sellCurrency = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'displayName');
_picBuy = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'picture');
_buyCurrency = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'displayName');
_picSell = "";
if (_sellPrice >= 0) then {
_picSell = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'picture');
_sellCurrency = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'displayName');
};
_picBuy = "";
if (_buyPrice >= 0) then {
_picBuy = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'picture');
_buyCurrency = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'displayName');
};
_formattedText = format [
"<img image='%1' size='3' align='center'/><br />" +
@@ -75,8 +81,8 @@ if (Z_SingleCurrency) then {
_display,
_class,
_buyCurrency,
_sellPrice,
_buyPrice,
if (_sellPrice >= 0) then {_sellPrice} else {"";},
if (_buyPrice >= 0) then {_buyPrice} else {"";},
_sellCurrency,
_transportMaxWeapons,
_transportMaxMagazines,

View File

@@ -61,8 +61,8 @@ if (Z_SingleCurrency) then {
_display,
_class,
'lazy',
[_sellPrice] call BIS_fnc_numberText,
[_buyPrice] call BIS_fnc_numberText,
if (_sellPrice >= 0) then {[_sellPrice] call BIS_fnc_numberText;} else {"";},
if (_buyPrice >= 0) then {[_buyPrice] call BIS_fnc_numberText;} else {"";},
CurrencyName,
localize "STR_EPOCH_NAME",
localize "STR_EPOCH_CLASS",
@@ -70,10 +70,16 @@ if (Z_SingleCurrency) then {
localize "STR_EPOCH_PLAYER_291"
];
} else {
_picSell = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'picture');
_sellCurrency = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'displayName');
_picBuy = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'picture');
_buyCurrency = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'displayName');
_picSell = "";
if (_sellPrice >= 0) then {
_picSell = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'picture');
_sellCurrency = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'displayName');
};
_picBuy = "";
if (_buyPrice >= 0) then {
_picBuy = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'picture');
_buyCurrency = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'displayName');
};
_formattedText = format [
"<img image='%1' size='3' align='center'/><br />" +
"<t color='#33BFFF' size='0.7'>%11: </t><t color='#ffffff' size='0.7'>%2</t><br />" +
@@ -84,8 +90,8 @@ if (Z_SingleCurrency) then {
_display,
_class,
'lazy',
_sellPrice,
_buyPrice,
if (_sellPrice >= 0) then {_sellPrice} else {"";},
if (_buyPrice >= 0) then {_buyPrice} else {"";},
_sellCurrency,
_picSell,
_buyCurrency,

View File

@@ -129,8 +129,8 @@ if (Z_SingleCurrency) then {
_display,
_class,
_transportmaxBackpacks,
[_sellPrice] call BIS_fnc_numberText,
[_buyPrice] call BIS_fnc_numberText,
if (_sellPrice >= 0) then {[_sellPrice] call BIS_fnc_numberText;} else {"";},
if (_buyPrice >= 0) then {[_buyPrice] call BIS_fnc_numberText;} else {"";},
CurrencyName,
_transportMaxWeapons,
_transportMaxMagazines,
@@ -155,10 +155,16 @@ if (Z_SingleCurrency) then {
"\z\addons\dayz_code\gui\gear\gear_ui_slots_backpacks_white.paa"
];
} else {
_picSell = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'picture');
_sellCurrency = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'displayName');
_picBuy = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'picture');
_buyCurrency = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'displayName');
_picSell = "";
if (_sellPrice >= 0) then {
_picSell = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'picture');
_sellCurrency = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'displayName');
};
_picBuy = "";
if (_buyPrice >= 0) then {
_picBuy = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'picture');
_buyCurrency = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'displayName');
};
_formattedText = format [
"<img image='%1' size='3' /><br />" +
@@ -174,8 +180,8 @@ if (Z_SingleCurrency) then {
_display,
_class,
_transportmaxBackpacks,
_sellPrice,
_buyPrice,
if (_sellPrice >= 0) then {_sellPrice} else {"";},
if (_buyPrice >= 0) then {_buyPrice} else {"";},
_buyCurrency,
_transportMaxWeapons,
_transportMaxMagazines,

View File

@@ -72,8 +72,8 @@ if (Z_SingleCurrency) then {
_display,
_class,
_magText,
[_sellPrice] call BIS_fnc_numberText,
[_buyPrice] call BIS_fnc_numberText,
if (_sellPrice >= 0) then {[_sellPrice] call BIS_fnc_numberText;} else {"";},
if (_buyPrice >= 0) then {[_buyPrice] call BIS_fnc_numberText;} else {"";},
CurrencyName,
localize "STR_EPOCH_NAME",
localize "STR_EPOCH_CLASS",
@@ -81,11 +81,16 @@ if (Z_SingleCurrency) then {
localize "STR_EPOCH_PLAYER_291"
];
} else {
_picSell = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'picture');
_sellCurrency = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'displayName');
_picBuy = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'picture');
_buyCurrency = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'displayName');
_picSell = "";
if (_sellPrice >= 0) then {
_picSell = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'picture');
_sellCurrency = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'displayName');
};
_picBuy = "";
if (_buyPrice >= 0) then {
_picBuy = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'picture');
_buyCurrency = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'displayName');
};
_formattedText = format [
"<img image='%1' size='3' align='center' /><br />" +
"<t color='#33BFFF' size='0.7'>%11: </t><t color='#ffffff' size='0.7'>%2</t><br />" +
@@ -96,8 +101,8 @@ if (Z_SingleCurrency) then {
_display,
_class,
_magText,
_sellPrice,
_buyPrice,
if (_sellPrice >= 0) then {_sellPrice} else {"";},
if (_buyPrice >= 0) then {_buyPrice} else {"";},
_sellCurrency,
_buyCurrency,
_picSell,

View File

@@ -33,5 +33,9 @@ _count = 0;
if (_count > 0) then {
lbSetColor [Z_AT_BUYABLELIST, _index, [0, 1, 0, 1]];
} else {
if ((_x select 6) < 0) then { //color items only allowed to either be sold or purchased
lbSetColor [Z_AT_BUYABLELIST, _index, [0, 0.57, 1, 1]];
};
};
} count Z_BuyableArray;

View File

@@ -9,4 +9,7 @@ private "_index";
{
_index = lbAdd [Z_AT_SELLABLELIST, _x select 3];
lbSetPicture [Z_AT_SELLABLELIST, _index, _x select 4 ];
if ((_x select 6) < 0) then { //color items only allowed to either be sold or purchased
lbSetColor [Z_AT_SELLABLELIST, _index, [0, 0.57, 1, 1]];
};
} count Z_SellableArray;

View File

@@ -11,7 +11,7 @@ if (count _this > 0) then {
_query = _this select 0; // the search string.
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 {
@@ -37,7 +37,7 @@ if (count _this > 0) then {
call Z_fillSellList;
};
} else {
if (isNil '_query' || _query == "") then {
if (isNil '_query' || {_query == ""}) then {
Z_BuyableArray = [] + Z_OriginalBuyableArray;
call Z_clearBuyList;
call Z_fillBuyableList;

View File

@@ -3,11 +3,15 @@ private ["_amount","_index","_index2","_temp"];
_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")) then {
_temp = [] + (Z_BuyableArray select _index);
_temp set [9,(ceil _amount)];
Z_BuyingArray set [count(Z_BuyingArray),_temp];
_index2 = lbAdd [Z_AT_BUYINGLIST, format["%1x: %2",_temp select 9,_temp select 3]];
if (_amount > 0) then {
_index2 = lbAdd [Z_AT_BUYINGLIST, format["%1x: %2",_temp select 9,_temp select 3]];
} else {
_index2 = lbAdd [Z_AT_BUYINGLIST, "This trader does not sell this item"];
};
lbSetPicture [Z_AT_BUYINGLIST, _index2, _temp select 4];
call Z_calcPrice;
};