diff --git a/SQF/dayz_code/actions/AdvancedTrading/defaultInit.sqf b/SQF/dayz_code/actions/AdvancedTrading/defaultInit.sqf index 482a74be3..3452c0b08 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/defaultInit.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/defaultInit.sqf @@ -35,5 +35,5 @@ Z_canAfford = CPP PATH(z_at_canAfford.sqf); Z_calcFreeSpace = CPP PATH(z_at_calcFreeSpace.sqf); Z_returnChange = CPP PATH(z_at_returnChange.sqf); Z_payDefault = CPP PATH(z_at_payDefault.sqf); -z_calcDefaultCurrencyNoImg = CPP PATH(z_at_calcDefaultCurrencyNoImg.sqf); +z_calcCurrency = CPP PATH(z_at_calcCurrency.sqf); ZUPA_fnc_removeWeaponsAndMagazinesCargo = CPP PATH(zupa_fnc_removeWeaponsAndMagazinesCargo.sqf); 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 57b5c5681..d958d2d8a 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf @@ -254,7 +254,7 @@ if (_enoughMoney) then { systemChat format[localize "STR_EPOCH_TRADE_SUCCESS_COINS",[_priceToBuy] call BIS_fnc_numberText,CurrencyName]; } else { _tCost = ""; - _tCost = _priceToBuy call z_calcDefaultCurrencyNoImg; + _tCost = [_priceToBuy,true] call z_calcCurrency; if (_tCost != "") then { systemChat format[localize "STR_EPOCH_TRADE_BUY_SUCCESS",_tCost]; }; }; } else { diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcCurrency.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcCurrency.sqf new file mode 100644 index 000000000..3475f164d --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcCurrency.sqf @@ -0,0 +1,168 @@ +private ["_GemTotal","_GemTotal2","_ItemAmethyst","_ItemCitrine","_ItemEmerald","_ItemObsidian","_ItemRuby","_ItemSapphire","_ItemTopaz","_array","_briefcase_100oz","_fontSize","_gem","_gold_10oz","_gold_10oz_a","_gold_10oz_b","_gold_1oz","_gold_1oz_a","_gold_1oz_b","_noIMG","_pic","_silver_10oz","_silver_10oz_a","_silver_10oz_b","_silver_1oz","_silver_1oz_a","_silver_1oz_b","_string","_total","_value"]; + +_total = _this select 0; +_noIMG = _this select 1; +_fontSize = if (count _this > 2) then {_this select 2} else {1}; +_array = []; +_string = ""; + +_ItemTopaz = 0; +_ItemObsidian = 0; +_ItemSapphire = 0; +_ItemAmethyst = 0; +_ItemEmerald = 0; +_ItemCitrine = 0; +_ItemRuby = 0; +_GemTotal = 0; +_GemTotal2 = _total; + +{ + _gem = _x; + _value = DZE_GemWorthList select _forEachIndex; + switch(_gem) do { + case 'ItemTopaz': { + _ItemTopaz = floor(_GemTotal2 / _value); + if (_ItemTopaz >= 1) then { + _GemTotal = (_value * _ItemTopaz) + _GemTotal; + _GemTotal2 = _total - _GemTotal; + }; + }; + case 'ItemObsidian': { + _ItemObsidian = floor(_GemTotal2 / _value); + if (_ItemObsidian >= 1) then { + _GemTotal = (_value * _ItemObsidian) + _GemTotal; + _GemTotal2 = _total - _GemTotal; + }; + }; + case 'ItemSapphire': { + _ItemSapphire = floor(_GemTotal2 / _value); + if (_ItemSapphire >= 1) then { + _GemTotal = (_value * _ItemSapphire) + _GemTotal; + _GemTotal2 = _total - _GemTotal; + }; + }; + case 'ItemAmethyst': { + _ItemAmethyst = floor(_GemTotal2 / _value); + if (_ItemAmethyst >= 1) then { + _GemTotal = (_value * _ItemAmethyst) + _GemTotal; + _GemTotal2 = _total - _GemTotal; + }; + }; + case 'ItemEmerald': { + _ItemEmerald = floor(_GemTotal2 / _value); + if (_ItemEmerald >= 1) then { + _GemTotal = (_value * _ItemEmerald) + _GemTotal; + _GemTotal2 = _total - _GemTotal; + }; + }; + case 'ItemCitrine': { + _ItemCitrine = floor(_GemTotal2 / _value); + if (_ItemCitrine >= 1) then { + _GemTotal = (_value * _ItemCitrine) + _GemTotal; + _GemTotal2 = _total - _GemTotal; + }; + }; + case 'ItemRuby': { + _ItemRuby = floor(_GemTotal2 / _value); + if (_ItemRuby >= 1) then { + _GemTotal = (_value * _ItemRuby) + _GemTotal; + _GemTotal2 = _total - _GemTotal; + }; + }; + }; +} forEach DZE_GemList; +_total = _GemTotal2; + +_briefcase_100oz = floor(_total / 10000); + +_gold_10oz_a = floor(_total / 1000); +_gold_10oz_b = _briefcase_100oz * 10; +_gold_10oz = (_gold_10oz_a - _gold_10oz_b); + +_gold_1oz_a = floor(_total / 100); +_gold_1oz_b = _gold_10oz_a * 10; +_gold_1oz = (_gold_1oz_a - _gold_1oz_b); + +_silver_10oz_a = floor(_total / 10); +_silver_10oz_b = _gold_1oz_a * 10; +_silver_10oz = (_silver_10oz_a - _silver_10oz_b); + +_silver_1oz_a = floor(_total); +_silver_1oz_b = _silver_10oz_a * 10; +_silver_1oz = (_silver_1oz_a - _silver_1oz_b); + +{ //sort gems so they display on total price in order of descending worth + if (!isNil {call compile format["_%1",_x]} && {(call compile format["_%1",_x]) > 0}) then { + if (_noIMG) then { + _pic = getText (configFile >> 'CfgMagazines' >> _x >> 'displayName'); + _array set [count _array, format["%1 %2",(call compile format["_%1",_x]),_pic]]; + } else { + _pic = getText (configFile >> 'CfgMagazines' >> _x >> 'picture'); + _string = format["%3%1x",(call compile format["_%1",_x]),_pic, _string,_fontSize]; + }; + }; +} count DZE_GemList; + +if (_noIMG) then { + if (_briefcase_100oz >= 2) then { + _array set [count _array, format["%1 %2s",_briefcase_100oz,localize "STR_EPOCH_BRIEFCASE"]]; + }; + + if (_briefcase_100oz == 1) then { + _array set [count _array, format["%1 %2",_briefcase_100oz,localize "STR_EPOCH_BRIEFCASE"]]; + }; +} else { + if (_briefcase_100oz > 0) then { + _pic = getText (configFile >> 'CfgMagazines' >> 'ItemBriefcase100oz' >> 'picture'); + _string = format["%3%1x",_briefcase_100oz,_pic, _string,_fontSize]; + }; +}; + +if (_gold_10oz > 0) then { + if (_noIMG) then { + _array set [count _array, format["%1 %2",_gold_10oz,localize "STR_EPOCH_10OZGOLD"]]; + } else { + _pic = getText (configFile >> 'CfgMagazines' >> 'ItemGoldBar10oz' >> 'picture'); + _string = format["%3%1x",_gold_10oz,_pic, _string,_fontSize]; + }; +}; +if (_gold_1oz > 0) then { + if (_noIMG) then { + _array set [count _array, format["%1 %2",_gold_1oz,localize "STR_EPOCH_GOLD"]]; + } else { + _pic = getText (configFile >> 'CfgMagazines' >> 'ItemGoldBar' >> 'picture'); + _string = format["%3%1x",_gold_1oz,_pic, _string,_fontSize]; + }; +}; +if (_silver_10oz > 0) then { + if (_noIMG) then { + _array set [count _array, format["%1 %2",_silver_10oz,localize "STR_EPOCH_10OZSILVER"]]; + } else { + _pic = getText (configFile >> 'CfgMagazines' >> 'ItemSilverBar10oz' >> 'picture'); + _string = format["%3%1x",_silver_10oz,_pic, _string,_fontSize]; + }; +}; +if (_silver_1oz > 0) then { + if (_noIMG) then { + _array set [count _array, format["%1 %2",_silver_1oz,localize "STR_EPOCH_SILVER"]]; + } else { + _pic = getText (configFile >> 'CfgMagazines' >> 'ItemSilverBar' >> 'picture'); + _string = format["%3%1x",_silver_1oz,_pic, _string,_fontSize]; + }; +}; + +if (_noIMG) then { + { + if (_forEachIndex == 0) then { + _string = _x; + } else { + if (_forEachIndex == ((count _array) - 1)) then { + _string = _string + " and " + _x; + } else { + _string = _string + ", " + _x; + }; + }; + } forEach _array; +}; + +_string \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcDefaultCurrency.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcDefaultCurrency.sqf deleted file mode 100644 index c96e5854c..000000000 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcDefaultCurrency.sqf +++ /dev/null @@ -1,119 +0,0 @@ -private ["_ItemTopaz","_GemTotal","_ItemTopaz_ItemTopaz","_GemTotal2","_ItemObsidian","_ItemSapphire","_ItemAmethyst","_ItemEmerald","_ItemCitrine","_ItemRuby","_gem","_value","_pic","_string","_total","_briefcase_100oz","_gold_10oz_a","_gold_10oz_b","_gold_10oz","_gold_1oz_a","_gold_1oz_b","_gold_1oz","_silver_10oz_a","_silver_10oz_b","_silver_10oz","_silver_1oz_a","_silver_1oz_b","_silver_1oz"]; - -_total = _this; -_string = ""; - -_ItemTopaz = 0; -_ItemObsidian = 0; -_ItemSapphire = 0; -_ItemAmethyst = 0; -_ItemEmerald = 0; -_ItemCitrine = 0; -_ItemRuby = 0; -_GemTotal = 0; -_GemTotal2 = _total; - -{ - _gem = _x; - _value = DZE_GemWorthList select _forEachIndex; - switch(_gem) do { - case 'ItemTopaz': { - _ItemTopaz = floor(_GemTotal2 / _value); - if (_ItemTopaz >= 1) then { - _GemTotal = (_value * _ItemTopaz) + _GemTotal; - _GemTotal2 = _total - _GemTotal; - }; - }; - case 'ItemObsidian': { - _ItemObsidian = floor(_GemTotal2 / _value); - if (_ItemObsidian >= 1) then { - _GemTotal = (_value * _ItemObsidian) + _GemTotal; - _GemTotal2 = _total - _GemTotal; - }; - }; - case 'ItemSapphire': { - _ItemSapphire = floor(_GemTotal2 / _value); - if (_ItemSapphire >= 1) then { - _GemTotal = (_value * _ItemSapphire) + _GemTotal; - _GemTotal2 = _total - _GemTotal; - }; - }; - case 'ItemAmethyst': { - _ItemAmethyst = floor(_GemTotal2 / _value); - if (_ItemAmethyst >= 1) then { - _GemTotal = (_value * _ItemAmethyst) + _GemTotal; - _GemTotal2 = _total - _GemTotal; - }; - }; - case 'ItemEmerald': { - _ItemEmerald = floor(_GemTotal2 / _value); - if (_ItemEmerald >= 1) then { - _GemTotal = (_value * _ItemEmerald) + _GemTotal; - _GemTotal2 = _total - _GemTotal; - }; - }; - case 'ItemCitrine': { - _ItemCitrine = floor(_GemTotal2 / _value); - if (_ItemCitrine >= 1) then { - _GemTotal = (_value * _ItemCitrine) + _GemTotal; - _GemTotal2 = _total - _GemTotal; - }; - }; - case 'ItemRuby': { - _ItemRuby = floor(_GemTotal2 / _value); - if (_ItemRuby >= 1) then { - _GemTotal = (_value * _ItemRuby) + _GemTotal; - _GemTotal2 = _total - _GemTotal; - }; - }; - }; -} forEach DZE_GemList; -_total = _GemTotal2; - -_briefcase_100oz = floor(_total / 10000); - -_gold_10oz_a = floor(_total / 1000); -_gold_10oz_b = _briefcase_100oz * 10; -_gold_10oz = (_gold_10oz_a - _gold_10oz_b); - -_gold_1oz_a = floor(_total / 100); -_gold_1oz_b = _gold_10oz_a * 10; -_gold_1oz = (_gold_1oz_a - _gold_1oz_b); - -_silver_10oz_a = floor(_total / 10); -_silver_10oz_b = _gold_1oz_a * 10; -_silver_10oz = (_silver_10oz_a - _silver_10oz_b); - -_silver_1oz_a = floor(_total); -_silver_1oz_b = _silver_10oz_a * 10; -_silver_1oz = (_silver_1oz_a - _silver_1oz_b); - -{ //sort gems so they display on total price in order of descending worth - if (!isNil {call compile format["_%1",_x]} && {(call compile format["_%1",_x]) > 0}) then { - _pic = getText (configFile >> 'CfgMagazines' >> _x >> 'picture'); - _string = format["%3%1x",(call compile format["_%1",_x]),_pic, _string]; - }; -} count DZE_GemList; - -if (_briefcase_100oz > 0) then { - _pic = getText (configFile >> 'CfgMagazines' >> 'ItemBriefcase100oz' >> 'picture'); - _string = format["%3%1x",_briefcase_100oz,_pic, _string]; -}; -if (_gold_10oz > 0) then { - _pic = getText (configFile >> 'CfgMagazines' >> 'ItemGoldBar10oz' >> 'picture'); - _string = format["%3%1x",_gold_10oz,_pic, _string]; -}; -if (_gold_1oz > 0) then { - _pic = getText (configFile >> 'CfgMagazines' >> 'ItemGoldBar' >> 'picture'); - _string = format["%3%1x",_gold_1oz,_pic, _string]; -}; -if (_silver_10oz > 0) then { - _pic = getText (configFile >> 'CfgMagazines' >> 'ItemSilverBar10oz' >> 'picture'); - _string = format["%3%1x",_silver_10oz,_pic, _string]; -}; -if (_silver_1oz > 0) then { - _pic = getText (configFile >> 'CfgMagazines' >> 'ItemSilverBar' >> 'picture'); - _string = format["%3%1x",_silver_1oz,_pic, _string]; -}; - -_string diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcDefaultCurrencyNoImg.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcDefaultCurrencyNoImg.sqf deleted file mode 100644 index 292a5e391..000000000 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcDefaultCurrencyNoImg.sqf +++ /dev/null @@ -1,151 +0,0 @@ -private ["_ItemTopaz","_GemTotal","_ItemTopaz_ItemTopaz","_GemTotal2","_ItemObsidian","_ItemSapphire","_ItemAmethyst","_ItemEmerald","_ItemCitrine","_ItemRuby","_gem","_value","_string","_total","_briefcase_100oz","_gold_10oz_a","_gold_10oz_b","_gold_10oz","_gold_1oz_a","_gold_1oz_b","_gold_1oz","_silver_10oz_a","_silver_10oz_b","_silver_10oz","_silver_1oz_a","_silver_1oz_b","_silver_1oz","_dname"]; - -_total = _this; -_string = ""; - -_ItemTopaz = 0; -_ItemObsidian = 0; -_ItemSapphire = 0; -_ItemAmethyst = 0; -_ItemEmerald = 0; -_ItemCitrine = 0; -_ItemRuby = 0; -_GemTotal = 0; -_GemTotal2 = _total; - -{ - _gem = _x; - _value = DZE_GemWorthList select _forEachIndex; - switch(_gem) do { - case 'ItemTopaz': { - _ItemTopaz = floor(_GemTotal2 / _value); - if (_ItemTopaz >= 1) then { - _GemTotal = (_value * _ItemTopaz) + _GemTotal; - _GemTotal2 = _total - _GemTotal; - }; - }; - case 'ItemObsidian': { - _ItemObsidian = floor(_GemTotal2 / _value); - if (_ItemObsidian >= 1) then { - _GemTotal = (_value * _ItemObsidian) + _GemTotal; - _GemTotal2 = _total - _GemTotal; - }; - }; - case 'ItemSapphire': { - _ItemSapphire = floor(_GemTotal2 / _value); - if (_ItemSapphire >= 1) then { - _GemTotal = (_value * _ItemSapphire) + _GemTotal; - _GemTotal2 = _total - _GemTotal; - }; - }; - case 'ItemAmethyst': { - _ItemAmethyst = floor(_GemTotal2 / _value); - if (_ItemAmethyst >= 1) then { - _GemTotal = (_value * _ItemAmethyst) + _GemTotal; - _GemTotal2 = _total - _GemTotal; - }; - }; - case 'ItemEmerald': { - _ItemEmerald = floor(_GemTotal2 / _value); - if (_ItemEmerald >= 1) then { - _GemTotal = (_value * _ItemEmerald) + _GemTotal; - _GemTotal2 = _total - _GemTotal; - }; - }; - case 'ItemCitrine': { - _ItemCitrine = floor(_GemTotal2 / _value); - if (_ItemCitrine >= 1) then { - _GemTotal = (_value * _ItemCitrine) + _GemTotal; - _GemTotal2 = _total - _GemTotal; - }; - }; - case 'ItemRuby': { - _ItemRuby = floor(_GemTotal2 / _value); - if (_ItemRuby >= 1) then { - _GemTotal = (_value * _ItemRuby) + _GemTotal; - _GemTotal2 = _total - _GemTotal; - }; - }; - }; -} forEach DZE_GemList; - -_total = _GemTotal2; - -_briefcase_100oz = floor(_total / 10000); - -_gold_10oz_a = floor(_total / 1000); -_gold_10oz_b = _briefcase_100oz * 10; -_gold_10oz = (_gold_10oz_a - _gold_10oz_b); - -_gold_1oz_a = floor(_total / 100); -_gold_1oz_b = _gold_10oz_a * 10; -_gold_1oz = (_gold_1oz_a - _gold_1oz_b); - -_silver_10oz_a = floor(_total / 10); -_silver_10oz_b = _gold_1oz_a * 10; -_silver_10oz = (_silver_10oz_a - _silver_10oz_b); - -_silver_1oz_a = floor(_total); -_silver_1oz_b = _silver_10oz_a * 10; -_silver_1oz = (_silver_1oz_a - _silver_1oz_b); - -{ //sort gems so they display on total price in order of descending worth - if (!isNil {call compile format["_%1",_x]} && {(call compile format["_%1",_x]) > 0}) then { - _dname = getText (configFile >> 'CfgMagazines' >> _x >> 'displayName'); - if (_string == "") then { - _string = format["%1 %2",(call compile format["_%1",_x]),_dname]; - } else { - _string = format["%2 %1 %3",(call compile format["_%1",_x]),_string,_dname]; - }; - }; -} count DZE_GemList; - -if (_briefcase_100oz >= 2) then { - if (_string == "") then { - _string = format["%1 %2s",_briefcase_100oz,localize "STR_EPOCH_BRIEFCASE"]; - } else { - _string = format["%2 %1 %3s",_briefcase_100oz,_string,localize "STR_EPOCH_BRIEFCASE"]; - }; -}; - -if (_briefcase_100oz == 1) then { - if (_string == "") then { - _string = format["%1 %2",_briefcase_100oz,localize "STR_EPOCH_BRIEFCASE"]; - } else { - _string = format["%2 %1 %3",_briefcase_100oz,_string,localize "STR_EPOCH_BRIEFCASE"]; - }; -}; - -if (_gold_10oz > 0) then { - if (_string == "") then { - _string = format["%1 %2",_gold_10oz,localize "STR_EPOCH_10OZGOLD"]; - } else { - _string = format["%2 %1 %3",_gold_10oz,_string,localize "STR_EPOCH_10OZGOLD"]; - }; -}; - -if (_gold_1oz > 0) then { - if (_string == "") then { - _string = format["%1 %2",_gold_1oz,localize "STR_EPOCH_GOLD"]; - } else { - _string = format["%2 %1 %3",_gold_1oz,_string,localize "STR_EPOCH_GOLD"]; - }; -}; - -if (_silver_10oz > 0) then { - if (_string == "") then { - _string = format["%1 %2",_silver_10oz,localize "STR_EPOCH_10OZSILVER"]; - } else { - _string = format["%2 %1 %3",_silver_10oz,_string,localize "STR_EPOCH_10OZSILVER"]; - }; -}; - -if (_silver_1oz > 0) then { - if (_string == "") then { - _string = format["%1 %2",_silver_1oz,localize "STR_EPOCH_SILVER"]; - } else { - _string = format["%2 %1 %3",_silver_1oz,_string,localize "STR_EPOCH_SILVER"]; - }; -}; - -_string 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 d997a2bd3..10bfdb0de 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcPrice.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcPrice.sqf @@ -33,15 +33,15 @@ if (Z_SingleCurrency) then { { _sellPrice = _sellPrice + ((_x select 2) * (_x select 11)); } count Z_SellArray; - _ctrlText = _sellPrice call Z_calcDefaultCurrency; + _ctrlText = [_sellPrice,false] call Z_calcCurrency; (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; - (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText format ["%1 (%2 items)", localize "STR_EPOCH_TRADE_BUYING", _bTotal]; + _ctrlText = [_sellPrice,false] call Z_calcCurrency; + (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; 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 44203e61c..3a1cade5b 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_logTrade.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_logTrade.sqf @@ -12,8 +12,8 @@ _Z_logTrade = { case 1 : {localize "STR_EPOCH_TRADE_VEHICLE"}; case 2 : {localize "STR_UI_GEAR"}; }; - _tCost = _price call Z_calcDefaultCurrencyNoImg; - _currency = if (Z_SingleCurrency) then {"Coins"} else {""}; + _tCost = [_price,true] call Z_calcCurrency; + _currency = if (Z_SingleCurrency) then {CurrencyName} else {""}; // Log to client RPT if (Z_SingleCurrency) then { @@ -32,19 +32,7 @@ _Z_logTrade = { // Log to server RPT if (DZE_serverLogTrades) then { - if (Z_SingleCurrency) then { - if (_buyOrSell == "buy") then { - PVDZE_obj_Trade = [player,0,0,_className,inTraderCity,_currency,_price,_quantity,_container,false]; - } else { - PVDZE_obj_Trade = [player,0,1,_className,inTraderCity,_currency,_price,_quantity,_container,false]; - }; - } else { - if (_buyOrSell == "buy") then { - 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,if (_buyOrSell == "buy") then {0} else {1},_className,inTraderCity,_currency,if (Z_singleCurrency) then {_price} else {_tCost},_quantity,_container,false]; publicVariableServer "PVDZE_obj_Trade"; }; }; 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 f7657a78c..dafa1c042 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf @@ -227,7 +227,7 @@ if (typeName _money == "SCALAR") then { } else { _success = [_money,0,false,0,[],[],false] call Z_returnChange; _tCost = ""; - _tCost = _money call z_calcDefaultCurrencyNoImg; + _tCost = [_money,true] call z_calcCurrency; if (_tCost != "") then { systemChat format[localize "STR_EPOCH_TRADE_SELL_SUCCESS",_tCost]; }; }; _itemsToLog call Z_logTrade; diff --git a/SQF/dayz_code/actions/AdvancedTrading/init.sqf b/SQF/dayz_code/actions/AdvancedTrading/init.sqf index ea04bb5d0..a6374fab1 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/init.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/init.sqf @@ -66,7 +66,6 @@ if (isNil "Z_AdvancedTradingInit") then { Z_fillBuyingList = CPP PATH(z_at_fillBuyingList.sqf); Z_displayFreeSpace = CPP PATH(z_at_displayFreeSpace.sqf); Z_allowBuying = CPP PATH(z_at_allowBuying.sqf); - Z_calcDefaultCurrency = CPP PATH(z_at_calcDefaultCurrency.sqf); DZE_deleteTradedVehicle = CPP PATH(DZE_deleteTradedVehicle.sqf); Z_AdvancedTradingInit = true; diff --git a/SQF/dayz_code/actions/maintain_area.sqf b/SQF/dayz_code/actions/maintain_area.sqf index 442af0506..c5457b3bc 100644 --- a/SQF/dayz_code/actions/maintain_area.sqf +++ b/SQF/dayz_code/actions/maintain_area.sqf @@ -45,7 +45,7 @@ _req = { _count = _this; _amount = _count * DZE_maintainCurrencyRate; - _itemText = if (Z_SingleCurrency) then { CurrencyName } else { _amount call z_calcDefaultCurrencyNoImg }; + _itemText = if (Z_SingleCurrency) then { CurrencyName } else { [_amount,true] call z_calcCurrency }; [_amount,_itemText] };