diff --git a/SQF/dayz_code/compile/fn_selfActions.sqf b/SQF/dayz_code/compile/fn_selfActions.sqf index 090b3db0e..d6c93bc92 100644 --- a/SQF/dayz_code/compile/fn_selfActions.sqf +++ b/SQF/dayz_code/compile/fn_selfActions.sqf @@ -980,12 +980,11 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur } else { // Static Menu { - //diag_log format["DEBUG TRADER: %1", _x]; _buy = player addAction [format["Trade %1 %2 for %3 %4",(_x select 3),(_x select 5),(_x select 2),(_x select 6)], "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",[(_x select 0),(_x select 1),(_x select 2),(_x select 3),(_x select 4),(_x select 5),(_x select 6)], (_x select 7), true, true]; s_player_parts set [count s_player_parts,_buy]; } count (_traderMenu select 1); if (DZE_advancedTrading && DZE_ConfigTrader) then { - _buyV = player addAction [format["%1",localize "STR_EPOCH_PLAYER_289"], "\z\addons\dayz_code\actions\AdvancedTrading\init.sqf",(_traderMenu select 0), 999, true, false]; + _buyV = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\AdvancedTrading\init.sqf",(_traderMenu select 0), 999, true, false]; s_player_parts set [count s_player_parts,_buyV]; } else { // Database menu diff --git a/SQF/dayz_code/compile/player_traderMenuConfig.sqf b/SQF/dayz_code/compile/player_traderMenuConfig.sqf deleted file mode 100644 index f5335a7d3..000000000 --- a/SQF/dayz_code/compile/player_traderMenuConfig.sqf +++ /dev/null @@ -1,233 +0,0 @@ -// trader menu gui by maca134 -TraderDialogCatList = 12000; -TraderDialogItemList = 12001; -TraderDialogBuyPrice = 12002; -TraderDialogSellPrice = 12003; -TraderDialogBuyBtn = 12004; -TraderDialogSellBtn = 12005; -TraderDialogCurrency = 12006; - -TraderCurrentCatIndex = -1; -TraderCatList = []; -TraderItemList = []; - -TraderDialogLoadItemList = { - private ["_index","_trader_id","_activatingPlayer","_distance","_objclass","_item_list","_ignore"]; - TraderItemList = []; - _index = _this select 0; - - if (_index < 0) exitWith {}; - //TraderCurrentCatIndex = _index; - - _trader_id = TraderCatList select _index; - _activatingPlayer = player; - - lbClear TraderDialogItemList; - ctrlSetText [TraderDialogBuyPrice, ""]; - ctrlSetText [TraderDialogSellPrice, ""]; - - _cfgTraderCategory = missionConfigFile >> "CfgTraderCategory" >> (format["Category_%1",_trader_id]); - if (isNumber (_cfgTraderCategory >> "duplicate")) then { - _cfgTraderCategory = missionConfigFile >> "CfgTraderCategory" >> (format["Category_%1",getNumber (_cfgTraderCategory >> "duplicate")]); - }; - PVDZE_plr_TradeMenuResult = []; - - for "_i" from 0 to ((count _cfgTraderCategory) - 1) do { - _class = configName (_cfgTraderCategory select _i); - - _type = getText ((_cfgTraderCategory select _i) >> "type"); - _buy = getArray ((_cfgTraderCategory select _i) >> "buy"); - _sell = getArray ((_cfgTraderCategory select _i) >> "sell"); - - _buy set [2,1]; - _sell set [2,1]; - - _typeNum = 1; - if (_type == "trade_weapons") then { - _typeNum = 3; - } else { - if (_type in ["trade_backpacks", "trade_any_vehicle", "trade_any_vehicle_free", "trade_any_boat", "trade_any_bicycle"]) then { - _typeNum = 2; - }; - }; - - _ignore = false; - if (dayz_classicBloodBagSystem && _class in dayz_typedBags) then { - if (_class == "bloodBagONEG") then {_class = "ItemBloodbag";} else {_ignore = true;}; - }; - - _data = [9999,[_class,_typeNum],99999,_buy,_sell,0,_trader_id,_type]; - - if (!_ignore) then {PVDZE_plr_TradeMenuResult set [count PVDZE_plr_TradeMenuResult, _data];}; - }; - - lbClear TraderDialogItemList; - _item_list = []; - { - private ["_header", "_item", "_name", "_type", "_textPart", "_qty", "_buy", "_bqty", "_bname", "_btype", "_btextCurrency", "_sell", "_sqty", "_sname", "_stype", "_stextCurrency", "_order", "_order", "_afile", "_File", "_count", "_bag", "_bagclass", "_index", "_image"]; - _header = _x select 0; // "TRD" - _item = _x select 1; - _name = _item select 0; - _type = _item select 1; - switch (true) do { - case (_type == 1): { - _type = "CfgMagazines"; - }; - case (_type == 2): { - _type = "CfgVehicles"; - }; - case (_type == 3): { - _type = "CfgWeapons"; - }; - }; - // Display Name of item - _textPart = getText(configFile >> _type >> _name >> "displayName"); - - // Total in stock - _qty = _x select 2; - - // Buy Data from array - _buy = _x select 3; - _bqty = _buy select 0; - _bname = _buy select 1; - _btype = _buy select 2; - switch(true)do{ - case (_btype == 1): { - _btype = "CfgMagazines"; - }; - case (_btype == 2): { - _btype = "CfgVehicles"; - }; - case (_btype == 3): { - _btype = "CfgWeapons"; - }; - }; - - // Display Name of buy item - _btextCurrency = getText(configFile >> _btype >> _bname >> "displayName"); - - _sell = _x select 4; - _sqty = _sell select 0; - _sname = _sell select 1; - _stype = _sell select 2; - switch(true)do{ - case (_stype == 1): { - _stype = "CfgMagazines"; - }; - case (_stype == 2): { - _stype = "CfgVehicles"; - }; - case (_stype == 3): { - _stype = "CfgWeapons"; - }; - }; - // Display Name of sell item - _stextCurrency = getText(configFile >> _stype >> _sname >> "displayName"); - - // Menu sort order - _order = _x select 5; - - // Action file to use for trade - _afile = _x select 7; - _File = "\z\addons\dayz_code\actions\" + _afile + ".sqf"; - - _count = 0; - if(_type == "CfgVehicles") then { - if (_afile == "trade_backpacks") then { - _bag = unitBackpack player; - _bagclass = typeOf _bag; - if(_name == _bagclass) then { - _count = 1; - }; - } else { - if (isClass(configFile >> "CfgVehicles" >> _name)) then { - _distance = dayz_sellDistance_vehicle; - if (_name isKindOf "Air") then { - _distance = dayz_sellDistance_air; - }; - if (_name isKindOf "Ship") then { - _distance = dayz_sellDistance_boat; - }; - _count = {(typeOf _x) == _name} count (nearestObjects [(getPosATL player), [_name], _distance]); - }; - }; - }; - - if(_type == "CfgMagazines") then { - _count = {_x == _name} count magazines player; - }; - - if(_type == "CfgWeapons") then { - _count = {_x == _name} count weapons player; - }; - - _index = lbAdd [TraderDialogItemList, format["%1 (%2)", _textPart, _name]]; - - if (_count > 0) then { - lbSetColor [TraderDialogItemList, _index, [0, 1, 0, 1]]; - }; - - _image = getText(configFile >> _type >> _name >> "picture"); - lbSetPicture [TraderDialogItemList, _index, _image]; - - _item_list set [count _item_list, [ - _name, - _textPart, - _bqty, - _bname, - _btextCurrency, - _sqty, - _sname, - _stextCurrency, - _header, - _File - ]]; - } forEach PVDZE_plr_TradeMenuResult; - TraderItemList = _item_list; -}; - -TraderDialogShowPrices = { - private ["_index", "_item"]; - _index = _this select 0; - if (_index < 0) exitWith {}; - while {count TraderItemList < 1} do { uiSleep 1; }; - _item = TraderItemList select _index; - - _qty = {_x == (_item select 3)} count magazines player; - - ctrlSetText [TraderDialogBuyPrice, format["%1 %2", _item select 2, _item select 4]]; - - /* - if(_qty == 0) then { - ctrlEnable [TraderDialogBuyBtn, false]; - } else { - ctrlEnable [TraderDialogBuyBtn, true]; - }; - */ - - ctrlSetText [TraderDialogSellPrice, format["%1 %2", _item select 5, _item select 7]]; -}; - -TraderDialogBuy = { - private ["_index", "_item", "_data"]; - _index = _this select 0; - if (_index < 0) exitWith { - localize "STR_EPOCH_PLAYER_106" call dayz_rollingMessages; - }; - _item = TraderItemList select _index; - _data = [_item select 0, _item select 3, 1, _item select 2, "buy", _item select 4, _item select 1, _item select 8]; - [0, player, '', _data] execVM (_item select 9); - TraderItemList = []; -}; - -TraderDialogSell = { - private ["_index", "_item", "_data"]; - _index = _this select 0; - if (_index < 0) exitWith { - localize "STR_EPOCH_PLAYER_106" call dayz_rollingMessages; - }; - _item = TraderItemList select _index; - _data = [_item select 6, _item select 0, _item select 5, 1, "sell", _item select 1, _item select 7, _item select 8]; - [0, player, '', _data] execVM (_item select 9); - TraderItemList = []; -}; diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index 1a7c79a13..8c6eb48b1 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -511,13 +511,9 @@ if (!isDedicated) then { dayz_originalPlayer = player; - // trader menu code - if (DZE_ConfigTrader) then { - call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderMenuConfig.sqf"; - } else { - call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderMenuHive.sqf"; - }; - // recent murders menu code + // database trader menu + if (!DZE_ConfigTrader) then {call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderMenuHive.sqf";}; + // recent murders menu call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_murderMenu.sqf"; };