From d6236dcb91807f4571d63e01d95bbcead4a37375 Mon Sep 17 00:00:00 2001 From: icomrade Date: Sun, 1 May 2016 16:24:38 -0400 Subject: [PATCH] Fix improper total price in advanced trading Also sort gems by value when giving total price. --- .../functions/z_at_calcDefaultCurrency.sqf | 37 ++++--------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcDefaultCurrency.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcDefaultCurrency.sqf index 351cea82a..c96e5854c 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcDefaultCurrency.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcDefaultCurrency.sqf @@ -88,37 +88,16 @@ _silver_1oz_a = floor(_total); _silver_1oz_b = _silver_10oz_a * 10; _silver_1oz = (_silver_1oz_a - _silver_1oz_b); -if (_ItemTopaz > 0) then { - _pic = getText (configFile >> 'CfgMagazines' >> 'ItemTopaz' >> 'picture'); - _string = format["%1x",_ItemTopaz,_pic, _string]; -}; -if (_ItemObsidian > 0) then { - _pic = getText (configFile >> 'CfgMagazines' >> 'ItemObsidian' >> 'picture'); - _string = format["%1x",_ItemObsidian,_pic, _string]; -}; -if (_ItemSapphire > 0) then { - _pic = getText (configFile >> 'CfgMagazines' >> 'ItemSapphire' >> 'picture'); - _string = format["%1x",_ItemSapphire,_pic, _string]; -}; -if (_ItemAmethyst > 0) then { - _pic = getText (configFile >> 'CfgMagazines' >> 'ItemAmethyst' >> 'picture'); - _string = format["%1x",_ItemAmethyst,_pic, _string]; -}; -if (_ItemEmerald > 0) then { - _pic = getText (configFile >> 'CfgMagazines' >> 'ItemEmerald' >> 'picture'); - _string = format["%1x",_ItemEmerald,_pic, _string]; -}; -if (_ItemCitrine > 0) then { - _pic = getText (configFile >> 'CfgMagazines' >> 'ItemCitrine' >> 'picture'); - _string = format["%1x",_ItemCitrine,_pic, _string]; -}; -if (_ItemRuby > 0) then { - _pic = getText (configFile >> 'CfgMagazines' >> 'ItemRuby' >> 'picture'); - _string = format["%1x",_ItemRuby,_pic, _string]; -}; +{ //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["%1x",_briefcase_100oz,_pic, _string]; + _string = format["%3%1x",_briefcase_100oz,_pic, _string]; }; if (_gold_10oz > 0) then { _pic = getText (configFile >> 'CfgMagazines' >> 'ItemGoldBar10oz' >> 'picture');