Recalculating of _currentStock

This commit is contained in:
He-Man 2018-03-30 15:58:17 +02:00
parent 2abcf105b5
commit 84d7167a14
2 changed files with 8 additions and 3 deletions

View File

@ -14,7 +14,7 @@
*/
private [ "_PlayerFilerDropDown","_PlayerItemsBox","_PlayerItemsOutBox","_TraderItemsOutBox","_CryptoInCtrl","_CryptoOutCtrl","_allowAdd","_uiItem","_rounds","_itemIcon","_itemColor","_errormsg","_stockLimit","_config",
"_itemClasses","_itemQtys","_qtyIndex","_limit","_sizeOut","_item","_vehicle","_itemName","_index","_maxrnd","_ItemIndex","_cryptoCount","_worth","_itemTax","_tax"
"_itemClasses","_itemQtys","_qtyIndex","_sizeOut","_item","_vehicle","_itemName","_index","_maxrnd","_ItemIndex","_cryptoCount","_worth","_itemTax","_tax"
];
params ["_control","_selected"];
_selected params ["_CurControl","_id"];

View File

@ -14,8 +14,8 @@
*/
//[[[cog import generate_private_arrays ]]]
private [ "_TraderGodMode","_StaticTraderItemPurge","_DynamicTraderRespawnCount","_TraderItemsDeleteRestart","_TraderInit","_TraderItemsClean","_newstock","_agent","_aiTables",
"_arr","_config","_currentStock","_existingStock","_indexStock","_limit","_markers","_objHiveKey","_pos","_randomAIUniform","_response","_response2","_schedule",
"_serverSettingsConfig","_staticTrader","_staticTradersArrCount","_staticTradersArray","_storedVehicleLimit","_traderSlotIndex","_work","_arrchanged","_deleteat"
"_arr","_config","_currentStock","_existingStock","_indexStock","_markers","_objHiveKey","_pos","_randomAIUniform","_response","_response2","_schedule",
"_serverSettingsConfig","_staticTrader","_staticTradersArrCount","_staticTradersArray","_storedVehicleLimit","_traderSlotIndex","_work","_arrchanged","_deleteat","_maxrnd"
];
//[[[end]]]
params [["_maxTraderLimit",0]];
@ -54,6 +54,11 @@ _TraderItemsClean = {
_delete = false;
_item = _arr select 0 select _idx;
_currentStock = (_arr select 1) param[_idx, 0];
_maxrnd = 1;
if ([_item,"cfgMagazines"] call Epoch_fnc_isAny) then {
_maxrnd = getnumber (configfile >> "cfgMagazines" >> _item >> "count");
};
_currentStock = _currentStock / _maxrnd;
if (_currentStock >= (_TraderItemCountPerItem select 0)) then {
_currentStock = _TraderItemCountPerItem select 1;
(_arr select 1) set [_idx,_currentStock];