From f848305b50684830cd78901b4e2e0ae0e4c01bcd Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Sun, 1 May 2016 19:02:29 -0400 Subject: [PATCH] Update Advanced Trading with category reuse support Tested and working ok. Updating with change from: https://github.com/EpochModTeam/DayZ-Epoch/commit/03b8c38c6a9a8473d75addcfec113193f7b2ec6c --- CHANGE LOG 1.0.6.txt | 1 + .../AdvancedTrading/functions/z_at_calcBuyableList.sqf | 4 ++++ .../AdvancedTrading/functions/z_at_checkArrayInConfig.sqf | 3 +++ 3 files changed, 8 insertions(+) diff --git a/CHANGE LOG 1.0.6.txt b/CHANGE LOG 1.0.6.txt index ebbd0eb12..6896d1c10 100644 --- a/CHANGE LOG 1.0.6.txt +++ b/CHANGE LOG 1.0.6.txt @@ -31,6 +31,7 @@ [NEW] Added waves effect during stormy weather #974 @FramedYannick @ebaydayz [NEW] Optional variable to prevent stealing from backpacks by non-friendlies at traders. Set DZE_BackpackAntiTheft = true; in init.sqf @ebaydayz [NEW] Zupa's Advanced Trading is now included as part of the Epoch Code, enabled with DZE_advancedTrading = true; NOT COMPATIBLE WITH DATABASE TRADERS @icomrade @Windmolders +[NEW] With config based traders categories can be reused by setting the duplicate=#; value. # is the category number to copy. @ebaydayz [NEW] Gems are now treated as variable value currency (Advanced Trading only). configure gem values using DZE_GemWorthArray =[]; see ConfigVariables.sqf for more info @icomrade [NEW] Gem rarity is now configurable for mining using DZE_GemOccurance =[]; see ConfigVariables.sqf for more info @icomrade [NEW] Plot Management by Zupa is now included and enabled by default with variable DZE_plotManagement, see ConfigVariables.sqf @DevZupa @Bruce-LXXVI diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcBuyableList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcBuyableList.sqf index fd7b721a2..efe864c16 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcBuyableList.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcBuyableList.sqf @@ -8,6 +8,10 @@ _counter = 0; { _cat = format["Category_%1",(_arrayOfTraderCat select _forEachIndex select 1)]; _cfgtraders = missionConfigFile >> "CfgTraderCategory" >> _cat; + if (isNumber (_cfgtraders >> "duplicate")) then { + _cat = format["Category_%1",getNumber (_cfgtraders >> "duplicate")]; + _cfgtraders = missionConfigFile >> "CfgTraderCategory" >> _cat; + }; for "_i" from 0 to (count _cfgtraders) - 1 do { _y = _cfgtraders select _i; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkArrayInConfig.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkArrayInConfig.sqf index c93c011c2..ce84d81a1 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkArrayInConfig.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkArrayInConfig.sqf @@ -48,6 +48,9 @@ if(_total > 0)then{ { private ["_cat","_excists","_pic","_text","_type","_sell","_buy","_buyCurrency","_sellCurrency","_worth"]; _cat = format["Category_%1",(_arrayOfTraderCat select _forEachIndex select 1)]; + if (isNumber (missionConfigFile >> "CfgTraderCategory" >> _cat >> "duplicate")) then { + _cat = format["Category_%1",getNumber (missionConfigFile >> "CfgTraderCategory" >> _cat >> "duplicate")]; + }; _excists = isClass(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y ); if(_excists)exitWith{ _pic = "";