Add weight to items at traders

If the weight system is active all weights of the items will be displayed on the trader infos.

Also update the trading files and replace switch with call and exitwith which is faster.
This commit is contained in:
AirwavesMan
2020-09-12 03:10:31 +02:00
parent 9ad86a84a3
commit e5af93b50b
16 changed files with 141 additions and 115 deletions

View File

@@ -3,6 +3,7 @@ private ["_selection","_return","_toBuyWeaps","_toBuyTotalMags","_toBuyBags","_t
,"_allowedPrimary","_allowedTools","_allowedSidearm","_allowedBackpacks","_toolClasses" ,"_allowedPrimary","_allowedTools","_allowedSidearm","_allowedBackpacks","_toolClasses"
,"_duplicate","_quantity","_tool","_totalBagSlots","_pistolMags","_regularMags","_toBuyPistolMags" ,"_duplicate","_quantity","_tool","_totalBagSlots","_pistolMags","_regularMags","_toBuyPistolMags"
,"_toBuyRegularMags","_type","_freeSpace","_backpack","_totalSpace","_toolAmounts","_allowedBinocular","_message" ,"_toBuyRegularMags","_type","_freeSpace","_backpack","_totalSpace","_toolAmounts","_allowedBinocular","_message"
,"_vehiclesToBuy","_allowedWeapons","_allowedPistolMags","_allowedRegularMags","_typeW"
]; ];
_selection = Z_SellingFrom; _selection = Z_SellingFrom;
_return = false; _return = false;
@@ -28,20 +29,20 @@ if (_vehiclesToBuy > 0) then {
if (_selection == 2) then { //gear if (_selection == 2) then { //gear
_pistolMags = 0; _pistolMags = 0;
_regularMags = 0; _regularMags = 0;
{ {
_type = getNumber (configFile >> "CfgMagazines" >> _x >> "type"); _type = getNumber (configFile >> "CfgMagazines" >> _x >> "type");
if (_type == 16) then {_pistolMags = _pistolMags + 1;}; // WeaponSlotHandGunItem (pistol ammo slot) if (_type == 16) then {_pistolMags = _pistolMags + 1;}; // WeaponSlotHandGunItem (pistol ammo slot)
if (_type == 256) then {_regularMags = _regularMags + 1;}; // WeaponSlotItem (normal magazine) if (_type == 256) then {_regularMags = _regularMags + 1;}; // WeaponSlotItem (normal magazine)
} count (magazines player); } count (magazines player);
_allowedPistolMags = 8 - _pistolMags; _allowedPistolMags = 8 - _pistolMags;
_allowedRegularMags = 12 - _regularMags; _allowedRegularMags = 12 - _regularMags;
_p = primaryWeapon player; _p = primaryWeapon player;
_allowedPrimary = if (_p != "") then {0} else {1}; _allowedPrimary = if (_p != "") then {0} else {1};
if (DZE_TwoPrimaries == 2 && dayz_onBack == "") then { _allowedPrimary = _allowedPrimary + 1; }; if (DZE_TwoPrimaries == 2 && dayz_onBack == "") then { _allowedPrimary = _allowedPrimary + 1; };
_b = unitBackpack player; _b = unitBackpack player;
_allowedBackpacks = if (isNull _b) then {1} else {0}; _allowedBackpacks = if (isNull _b) then {1} else {0};
@@ -50,15 +51,16 @@ if (_selection == 2) then { //gear
_allowedBinocular = 2; _allowedBinocular = 2;
_duplicate = false; _duplicate = false;
{ {
switch getNumber (configFile >> "CfgWeapons" >> _x >> "type") do { _typeW = getNumber (configFile >> "CfgWeapons" >> _x >> "type");
case 2: {_allowedSidearm = 0;}; //Pistol call {
case 4: {_allowedBackpacks = 0;}; //Launcher if (_typeW == 2) exitwith {_allowedSidearm = 0;}; //Pistol
case 4096: {_allowedBinocular = _allowedBinocular - 1;}; //Binocular slot if (_typeW == 4) exitwith {_allowedBackpacks = 0;}; //Launcher
case 131072: {_allowedTools = _allowedTools - 1;}; //Toolbelt slot if (_typeW == 4096) exitwith {_allowedBinocular = _allowedBinocular - 1;}; //Binocular slot
if (_typeW == 131072) exitwith {_allowedTools = _allowedTools - 1;}; //Toolbelt slot
}; };
if (_x in _toolClasses) exitWith {_duplicate = true;}; // Forbid purchasing duplicate tools into gear if (_x in _toolClasses) exitWith {_duplicate = true;}; // Forbid purchasing duplicate tools into gear
} count (weapons player); } count (weapons player);
{ {
_tool = _x; _tool = _x;
_quantity = {(_tool == _x)} count _toolClasses; // Buying same tool multiple times with 1x quantity _quantity = {(_tool == _x)} count _toolClasses; // Buying same tool multiple times with 1x quantity
@@ -68,7 +70,7 @@ if (_selection == 2) then { //gear
_toolsToBuy = _toolsToBuy - 1; //Not counting binoculars in tool total (12) when buying in gear _toolsToBuy = _toolsToBuy - 1; //Not counting binoculars in tool total (12) when buying in gear
}; };
} forEach _toolClasses; } forEach _toolClasses;
{ {
if (_x > 1) exitWith {_duplicate = true;}; // Buying >1x quantity of a tool if (_x > 1) exitWith {_duplicate = true;}; // Buying >1x quantity of a tool
} count _toolAmounts; } count _toolAmounts;
@@ -80,11 +82,11 @@ if (_selection == 2) then { //gear
if (_allowedPrimary >= _primaryToBuy && _allowedSidearm >= _sidearmToBuy && _allowedTools >= _toolsToBuy && !_duplicate && _allowedBinocular > -1) then { if (_allowedPrimary >= _primaryToBuy && _allowedSidearm >= _sidearmToBuy && _allowedTools >= _toolsToBuy && !_duplicate && _allowedBinocular > -1) then {
_check1 = true; _check1 = true;
} else { } else {
_message = switch (true) do { _message = call {
case (_duplicate): {localize "STR_EPOCH_TRADE_DUPLICATE_TOOL"}; if (_duplicate) exitWith {localize "STR_EPOCH_TRADE_DUPLICATE_TOOL"};
case (_allowedBinocular < 0): {localize "STR_EPOCH_TRADE_BINOCULARS_FULL"}; if (_allowedBinocular < 0) exitWith {localize "STR_EPOCH_TRADE_BINOCULARS_FULL"};
case (_allowedTools < _toolsToBuy): {localize "STR_EPOCH_PLAYER_107"}; if (_allowedTools < _toolsToBuy) exitWith {localize "STR_EPOCH_PLAYER_107"};
default {format[localize "STR_EPOCH_TRADE_GEAR_FULL",_allowedPrimary,_allowedSidearm,_allowedTools]}; format[localize "STR_EPOCH_TRADE_GEAR_FULL",_allowedPrimary,_allowedSidearm,_allowedTools];
}; };
systemChat _message; systemChat _message;
}; };
@@ -96,13 +98,13 @@ if (_selection == 2) then { //gear
if (_allowedBackpacks >= _toBuyBags) then { if (_allowedBackpacks >= _toBuyBags) then {
_check3 = true; _check3 = true;
} else { } else {
if (_allowedBackpacks == 0) then { if (_allowedBackpacks == 0) then {
systemChat localize "STR_EPOCH_TRADE_HAVE_BACKPACK"; systemChat localize "STR_EPOCH_TRADE_HAVE_BACKPACK";
} else { } else {
systemChat localize "STR_EPOCH_TRADE_ONE_BACKPACK"; systemChat localize "STR_EPOCH_TRADE_ONE_BACKPACK";
}; };
}; };
if (_check1 && _check2 && _check3) then { _return = true; }; if (_check1 && _check2 && _check3) then { _return = true; };
}; };
@@ -180,7 +182,7 @@ if (_selection == 0) then { //backpack
systemChat localize "STR_EPOCH_TRADE_BACKPACK_FULL"; systemChat localize "STR_EPOCH_TRADE_BACKPACK_FULL";
}; };
}; };
if (_allowedMags >= _toBuyTotalMags) then { if (_allowedMags >= _toBuyTotalMags) then {
_check2 = true; _check2 = true;
} else { } else {
@@ -206,4 +208,4 @@ if (_selection == 0) then { //backpack
if (_check0 && _check1 && _check2 && _check3 && _check4) then { _return = true; }; if (_check0 && _check1 && _check2 && _check3 && _check4) then { _return = true; };
}; };
_return _return

View File

@@ -1,9 +1,9 @@
private ["_arrayOfTraderCat","_counter","_cat","_cfgtraders","_y","_type","_buy","_sell","_pic","_text","_worth","_buyCurrency","_sellCurrency","_ignore","_categoryNumber","_BcurrencyQty","_ScurrencyQty"]; private ["_arrayOfTraderCat","_part","_cat","_cfgtraders","_y","_type","_buy","_sell","_pic","_text","_worth","_buyCurrency","_sellCurrency","_ignore","_categoryNumber","_BcurrencyQty","_ScurrencyQty"];
call Z_clearBuyList; call Z_clearBuyList;
Z_BuyableArray = []; Z_BuyableArray = [];
_arrayOfTraderCat = Z_traderData; _arrayOfTraderCat = Z_traderData;
_counter = 0;
{ {
_categoryNumber = _x select 1; _categoryNumber = _x select 1;
if (_categoryNumber == _this) exitWith { if (_categoryNumber == _this) exitWith {

View File

@@ -20,50 +20,50 @@ _GemTotal2 = _total;
{ {
_gem = _x; _gem = _x;
_value = DZE_GemWorthList select _forEachIndex; _value = DZE_GemWorthList select _forEachIndex;
switch(_gem) do { call {
case 'ItemTopaz': { if (_gem == 'ItemTopaz') exitwith {
_ItemTopaz = floor(_GemTotal2 / _value); _ItemTopaz = floor(_GemTotal2 / _value);
if (_ItemTopaz >= 1) then { if (_ItemTopaz >= 1) then {
_GemTotal = (_value * _ItemTopaz) + _GemTotal; _GemTotal = (_value * _ItemTopaz) + _GemTotal;
_GemTotal2 = _total - _GemTotal; _GemTotal2 = _total - _GemTotal;
}; };
}; };
case 'ItemObsidian': { if (_gem == 'ItemObsidian') exitwith {
_ItemObsidian = floor(_GemTotal2 / _value); _ItemObsidian = floor(_GemTotal2 / _value);
if (_ItemObsidian >= 1) then { if (_ItemObsidian >= 1) then {
_GemTotal = (_value * _ItemObsidian) + _GemTotal; _GemTotal = (_value * _ItemObsidian) + _GemTotal;
_GemTotal2 = _total - _GemTotal; _GemTotal2 = _total - _GemTotal;
}; };
}; };
case 'ItemSapphire': { if (_gem == 'ItemSapphire') exitwith {
_ItemSapphire = floor(_GemTotal2 / _value); _ItemSapphire = floor(_GemTotal2 / _value);
if (_ItemSapphire >= 1) then { if (_ItemSapphire >= 1) then {
_GemTotal = (_value * _ItemSapphire) + _GemTotal; _GemTotal = (_value * _ItemSapphire) + _GemTotal;
_GemTotal2 = _total - _GemTotal; _GemTotal2 = _total - _GemTotal;
}; };
}; };
case 'ItemAmethyst': { if (_gem == 'ItemAmethyst') exitwith {
_ItemAmethyst = floor(_GemTotal2 / _value); _ItemAmethyst = floor(_GemTotal2 / _value);
if (_ItemAmethyst >= 1) then { if (_ItemAmethyst >= 1) then {
_GemTotal = (_value * _ItemAmethyst) + _GemTotal; _GemTotal = (_value * _ItemAmethyst) + _GemTotal;
_GemTotal2 = _total - _GemTotal; _GemTotal2 = _total - _GemTotal;
}; };
}; };
case 'ItemEmerald': { if (_gem == 'ItemEmerald') exitwith {
_ItemEmerald = floor(_GemTotal2 / _value); _ItemEmerald = floor(_GemTotal2 / _value);
if (_ItemEmerald >= 1) then { if (_ItemEmerald >= 1) then {
_GemTotal = (_value * _ItemEmerald) + _GemTotal; _GemTotal = (_value * _ItemEmerald) + _GemTotal;
_GemTotal2 = _total - _GemTotal; _GemTotal2 = _total - _GemTotal;
}; };
}; };
case 'ItemCitrine': { if (_gem == 'ItemCitrine') exitwith {
_ItemCitrine = floor(_GemTotal2 / _value); _ItemCitrine = floor(_GemTotal2 / _value);
if (_ItemCitrine >= 1) then { if (_ItemCitrine >= 1) then {
_GemTotal = (_value * _ItemCitrine) + _GemTotal; _GemTotal = (_value * _ItemCitrine) + _GemTotal;
_GemTotal2 = _total - _GemTotal; _GemTotal2 = _total - _GemTotal;
}; };
}; };
case 'ItemRuby': { if (_gem == 'ItemRuby') exitwith {
_ItemRuby = floor(_GemTotal2 / _value); _ItemRuby = floor(_GemTotal2 / _value);
if (_ItemRuby >= 1) then { if (_ItemRuby >= 1) then {
_GemTotal = (_value * _ItemRuby) + _GemTotal; _GemTotal = (_value * _ItemRuby) + _GemTotal;
@@ -166,4 +166,4 @@ if (_noIMG) then {
} forEach _array; } forEach _array;
}; };
_string _string

View File

@@ -8,7 +8,7 @@
* *
* Fills up the sellable list if the item has a valid config. * Fills up the sellable list if the item has a valid config.
**/ **/
private ["_weaps","_mags","_extraText","_arrayOfTraderCat","_totalPrice","_backUpText","_bags","_baseVehicle","_currencyQty","_swap","_swap2","_myVehType"]; private ["_weaps","_mags","_extraText","_arrayOfTraderCat","_totalPrice","_backUpText","_bags","_baseVehicle","_currencyQty","_swap","_swap2","_myVehType","_processGear","_HasKeyCheck","_vehTrade"];
#include "defines.hpp" #include "defines.hpp"
_weaps = _this select 0; _weaps = _this select 0;
@@ -37,7 +37,7 @@ _HasKeyCheck = {
_totalPrice = 0; _totalPrice = 0;
_processGear = { _processGear = {
private ["_configType","_passedType","_cat","_pic","_text","_sell","_buy","_buyCurrency","_sellCurrency","_worth"]; private ["_configType","_passedType","_cat","_pic","_text","_sell","_buy","_buyCurrency","_sellCurrency","_worth","_y","_HasKey","_part"];
_passedType = _this select 1; //Check for items that have the same magazine and weapon classname (PipeBomb, Stinger, Igla, etc.) _passedType = _this select 1; //Check for items that have the same magazine and weapon classname (PipeBomb, Stinger, Igla, etc.)
{ {
@@ -65,22 +65,22 @@ _processGear = {
_text = ""; _text = "";
_configType = getText(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "type"); _configType = getText(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "type");
if (_passedType == "find") then {_passedType = _configType;}; if (_passedType == "find") then {_passedType = _configType;};
_sell = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "sell"); _sell = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "sell");
_buy = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "buy"); _buy = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "buy");
if (_swap) then {_y = "ItemBloodbag"}; if (_swap) then {_y = "ItemBloodbag"};
switch (true) do { call {
case (_passedType == "trade_items") : if (_passedType == "trade_items") exitwith
{ {
_pic = getText (configFile >> 'CfgMagazines' >> _y >> 'picture'); _pic = getText (configFile >> 'CfgMagazines' >> _y >> 'picture');
_text = getText (configFile >> 'CfgMagazines' >> _y >> 'displayName'); _text = getText (configFile >> 'CfgMagazines' >> _y >> 'displayName');
}; };
case (_passedType == "trade_weapons") : if (_passedType == "trade_weapons") exitwith
{ {
_pic = getText (configFile >> 'CfgWeapons' >> _y >> 'picture'); _pic = getText (configFile >> 'CfgWeapons' >> _y >> 'picture');
_text = getText (configFile >> 'CfgWeapons' >> _y >> 'displayName'); _text = getText (configFile >> 'CfgWeapons' >> _y >> 'displayName');
}; };
case (_passedType in DZE_tradeObject) : if (_passedType in DZE_tradeObject) exitwith
{ {
_pic = getText (configFile >> 'CfgVehicles' >> _y >> 'picture'); _pic = getText (configFile >> 'CfgVehicles' >> _y >> 'picture');
_text = getText (configFile >> 'CfgVehicles' >> _y >> 'displayName'); _text = getText (configFile >> 'CfgVehicles' >> _y >> 'displayName');

View File

@@ -88,4 +88,14 @@ if (Z_SingleCurrency) then {
]; ];
}; };
if (DZE_R3F_WEIGHT) then {
private "_weight";
_weight = getNumber(configFile >> "CfgWeight" >> "Backpacks" >> _class >> "weight");
_formattedText = _formattedText + format [
"<t color='#bcbcbc' size='0.7'>%1: </t><t color='#ffffff' size='0.7'>%2 %3</t>"
,localize "STR_EPOCH_WEIGHT",_weight,localize "STR_R3F_WEIGHT_English"
];
};
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText;

View File

@@ -1,4 +1,4 @@
private ["_selection","_returnArray","_allowedMags","_allowedWeapons","_allowedBackpacks","_pic","_backpack","_actualMags","_freeSpace","_allowedPrimary","_allowedSidearm","_p"]; private ["_selection","_returnArray","_allowedMags","_allowedWeapons","_allowedBackpacks","_pic","_backpack","_actualMags","_freeSpace","_allowedPrimary","_allowedSidearm","_p","_nr","_totalBagSlots", "_totalSpace"];
#include "defines.hpp" #include "defines.hpp"
_selection = _this select 0; _selection = _this select 0;
@@ -10,21 +10,22 @@ if (_selection == 2) then { //gear
// Don't show pistol mag slots as item slots in gear. Player is informed of pistol mag slots count in systemChat. // Don't show pistol mag slots as item slots in gear. Player is informed of pistol mag slots count in systemChat.
_actualMags = {(getNumber (configFile >> "CfgMagazines" >> _x >> "type") == 256)} count (magazines player); // 256 = WeaponSlotItem (normal magazine) _actualMags = {(getNumber (configFile >> "CfgMagazines" >> _x >> "type") == 256)} count (magazines player); // 256 = WeaponSlotItem (normal magazine)
_allowedMags = 12 - _actualMags; _allowedMags = 12 - _actualMags;
_p = primaryWeapon player; _p = primaryWeapon player;
_allowedPrimary = if (_p != "") then {0} else {1}; _allowedPrimary = if (_p != "") then {0} else {1};
if (DZE_TwoPrimaries == 2 && dayz_onBack == "") then { _allowedPrimary = _allowedPrimary + 1; }; if (DZE_TwoPrimaries == 2 && dayz_onBack == "") then { _allowedPrimary = _allowedPrimary + 1; };
_backpack = unitBackpack player; _backpack = unitBackpack player;
_allowedBackpacks = if (isNull _backpack) then {1} else {0}; _allowedBackpacks = if (isNull _backpack) then {1} else {0};
_allowedSidearm = 1; _allowedSidearm = 1;
{ {
switch getNumber (configFile >> "CfgWeapons" >> _x >> "type") do { _nr = getNumber (configFile >> "CfgWeapons" >> _x >> "type");
case 2: {_allowedSidearm = 0;}; //Pistol call {
case 4: {_allowedBackpacks = 0;}; //Launcher if (_nr == 2) exitwith {_allowedSidearm = 0;}; //Pistol
if (_nr == 4) exitwith {_allowedBackpacks = 0;}; //Launcher
}; };
} count (weapons player); } count (weapons player);
// 12 toolbelt + 1 Binoculars + 1 NVG + 1 Pistol + 1 Primary = 16 (onBack isn't counted in weapons player) // 12 toolbelt + 1 Binoculars + 1 NVG + 1 Pistol + 1 Primary = 16 (onBack isn't counted in weapons player)
//_allowedWeapons = 16 - count(weapons player); //_allowedWeapons = 16 - count(weapons player);
// Don't show tool slots as weapon slots in gear. Player is informed of tool slots count in systemChat. // Don't show tool slots as weapon slots in gear. Player is informed of tool slots count in systemChat.
@@ -50,7 +51,7 @@ if (_selection == 1) then { //vehicle
_allowedMags = _freeSpace select 1; _allowedMags = _freeSpace select 1;
_allowedWeapons = _freeSpace select 2; _allowedWeapons = _freeSpace select 2;
_allowedBackpacks = _freeSpace select 3; _allowedBackpacks = _freeSpace select 3;
_pic = getText (configFile >> "CfgVehicles" >> (typeOf DZE_myVehicle) >> "picture"); _pic = getText (configFile >> "CfgVehicles" >> (typeOf DZE_myVehicle) >> "picture");
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText format [ (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText format [
@@ -69,7 +70,7 @@ if (_selection == 0) then { //backpack
_freeSpace = [_backpack,0,0,0,0] call Z_calcFreeSpace; _freeSpace = [_backpack,0,0,0,0] call Z_calcFreeSpace;
_totalSpace = _freeSpace select 0; _totalSpace = _freeSpace select 0;
_totalBagSlots = _freeSpace select 4; _totalBagSlots = _freeSpace select 4;
_pic = getText (configFile >> "CfgVehicles" >> (typeOf _backpack) >> "picture"); _pic = getText (configFile >> "CfgVehicles" >> (typeOf _backpack) >> "picture");
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText format [ (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText format [
@@ -87,4 +88,4 @@ if (_selection == 0) then { //backpack
"\z\addons\dayz_code\gui\gear\gear_ui_slots_weapons_white.paa",_returnArray select 1, "\z\addons\dayz_code\gui\gear\gear_ui_slots_weapons_white.paa",_returnArray select 1,
"\z\addons\dayz_code\gui\gear\gear_ui_slots_items_white.paa",_returnArray select 0, "\z\addons\dayz_code\gui\gear\gear_ui_slots_items_white.paa",_returnArray select 0,
"\z\addons\dayz_code\gui\gear\gear_ui_slots_backpacks_white.paa",_returnArray select 2 "\z\addons\dayz_code\gui\gear\gear_ui_slots_backpacks_white.paa",_returnArray select 2
]; ];

View File

@@ -1,4 +1,4 @@
private ["_item","_picture","_class","_display","_buyPrice","_sellPrice","_formattedText","_buyCurrency","_sellCurrency","_compatible","_weapon","_attach","_config","_compatibleText","_type","_text","_displayText"]; private ["_picBuy","_picSell","_item","_picture","_class","_display","_buyPrice","_sellPrice","_formattedText","_buyCurrency","_sellCurrency","_compatible","_weapon","_attach","_config","_compatibleText","_type","_text","_displayText"];
#include "defines.hpp" #include "defines.hpp"
_item = _this select 0; _item = _this select 0;
@@ -114,9 +114,19 @@ if (count _compatible > 0) then {
if (_displayText != "") then { if (_displayText != "") then {
_formattedText = _formattedText + format [ _formattedText = _formattedText + format [
"<t color='#bcbcbc' size='0.7'>%1: </t><t color='#ffffff' size='0.7'>%2</t>" "<t color='#bcbcbc' size='0.7'>%1: </t><t color='#ffffff' size='0.7'>%2</t><br />"
,localize "STR_EPOCH_DESCRIPTION",_displayText ,localize "STR_EPOCH_DESCRIPTION",_displayText
]; ];
}; };
if (DZE_R3F_WEIGHT) then {
private "_weight";
_weight = [getNumber(configFile >> "CfgWeight" >> "Magazines" >> _class >> "weight"),1] select ((configName(inheritsFrom(configFile >> "cfgMagazines" >> _class))) == "SkinBase");
_formattedText = _formattedText + format [
"<t color='#bcbcbc' size='0.7'>%1: </t><t color='#ffffff' size='0.7'>%2 %3</t>"
,localize "STR_EPOCH_WEIGHT",_weight,localize "STR_R3F_WEIGHT_English"
];
};
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText;

View File

@@ -1,6 +1,6 @@
private ['_item', '_type','_picture',"_class","_display","_transportMaxWeapons","_transportMaxMagazines","_transportmaxBackpacks" private ['_item','_picture',"_class","_display","_transportMaxWeapons","_transportMaxMagazines","_transportmaxBackpacks"
,"_buyPrice","_sellPrice","_buyCurrency","_sellCurrency","_formattedText","_fuelCapacity","_maxSpeed","_armor","_seats","_weapons", ,"_buyPrice","_sellPrice","_buyCurrency","_sellCurrency","_formattedText","_fuelCapacity","_maxSpeed","_armor","_seats","_weapons",
"_weapons2","_config","_wepText","_turret","_text"]; "_weapons2","_config","_wepText","_turret","_text","_index","_picSell","_picBuy"];
#include "defines.hpp" #include "defines.hpp"
@@ -208,5 +208,5 @@ if (count _weapons2 > 0) then {
localize "STR_EPOCH_WEAPONS",_wepText localize "STR_EPOCH_WEAPONS",_wepText
]; ];
}; };
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText;

View File

@@ -1,4 +1,4 @@
private ["_item","_picture","_class","_display","_buyPrice","_sellPrice","_magazines","_magText","_formattedText","_buyCurrency","_sellCurrency","_attachments","_attachText","_config","_text","_attach","_type"]; private ["_parentClasses","_picBuy","_picSell","_item","_picture","_class","_display","_buyPrice","_sellPrice","_magazines","_magText","_formattedText","_buyCurrency","_sellCurrency","_attachments","_attachText","_config","_text","_attach","_type"];
#include "defines.hpp" #include "defines.hpp"
_item = _this select 0; _item = _this select 0;
@@ -124,4 +124,14 @@ if !("ItemCore" in _parentClasses or "Binocular" in _parentClasses) then {
]; ];
}; };
if (DZE_R3F_WEIGHT) then {
private "_weight";
_weight = getNumber(configFile >> "CfgWeight" >> "Weapons" >> _class >> "weight");
_formattedText = _formattedText + format [
"<t color='#bcbcbc' size='0.7'>%1: </t><t color='#ffffff' size='0.7'>%2 %3</t>"
,localize "STR_EPOCH_WEIGHT",_weight,localize "STR_R3F_WEIGHT_English"
];
};
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText;

View File

@@ -22,8 +22,8 @@ _backpack = unitBackpack player;
call Z_calcPrice; call Z_calcPrice;
if (Z_Selling) then { if (Z_Selling) then {
switch (_lbIndex) do { call {
case 0: { //backpack if (_lbIndex == 0) exitwith { //backpack
if (!isNull _backpack) then { if (!isNull _backpack) then {
[localize "STR_EPOCH_TRADE_SELLING_BACKPACK"] call Z_fillTradeTitle; [localize "STR_EPOCH_TRADE_SELLING_BACKPACK"] call Z_fillTradeTitle;
Z_SellingFrom = 0; Z_SellingFrom = 0;
@@ -33,7 +33,7 @@ if (Z_Selling) then {
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SLOTSDISPLAY) ctrlSetStructuredText parseText " "; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SLOTSDISPLAY) ctrlSetStructuredText parseText " ";
}; };
}; };
case 1: { //vehicle if (_lbIndex == 1) exitwith { //vehicle
_canBuyInVehicle = true call Z_checkCloseVehicle; _canBuyInVehicle = true call Z_checkCloseVehicle;
if (_canBuyInVehicle) then { if (_canBuyInVehicle) then {
[localize "STR_EPOCH_TRADE_SELLING_VEHICLE"] call Z_fillTradeTitle; [localize "STR_EPOCH_TRADE_SELLING_VEHICLE"] call Z_fillTradeTitle;
@@ -44,7 +44,7 @@ if (Z_Selling) then {
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SLOTSDISPLAY) ctrlSetStructuredText parseText " "; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SLOTSDISPLAY) ctrlSetStructuredText parseText " ";
}; };
}; };
case 2: { //gear if (_lbIndex == 2) exitwith { //gear
[localize "STR_EPOCH_TRADE_SELLING_GEAR"] call Z_fillTradeTitle; [localize "STR_EPOCH_TRADE_SELLING_GEAR"] call Z_fillTradeTitle;
Z_SellingFrom = 2; Z_SellingFrom = 2;
call Z_getGearItems; call Z_getGearItems;
@@ -53,8 +53,8 @@ if (Z_Selling) then {
} else { } else {
ctrlSetText [Z_AT_TRADERLINE2, " "]; ctrlSetText [Z_AT_TRADERLINE2, " "];
ctrlSetText [Z_AT_TRADERLINE1, localize "STR_EPOCH_TRADE_SELLING_ALL"]; ctrlSetText [Z_AT_TRADERLINE1, localize "STR_EPOCH_TRADE_SELLING_ALL"];
switch (_lbIndex) do { call {
case 0: { //backpack if (_lbIndex == 0) exitwith { //backpack
if (!isNull _backpack) then { if (!isNull _backpack) then {
Z_SellingFrom = 0; Z_SellingFrom = 0;
[localize "STR_EPOCH_TRADE_BUYING_BACKPACK"] call Z_fillTradeTitle; [localize "STR_EPOCH_TRADE_BUYING_BACKPACK"] call Z_fillTradeTitle;
@@ -64,7 +64,7 @@ if (Z_Selling) then {
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SLOTSDISPLAY) ctrlSetStructuredText parseText " "; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SLOTSDISPLAY) ctrlSetStructuredText parseText " ";
}; };
}; };
case 1: { //vehicle if (_lbIndex == 1) exitwith { //vehicle
_canBuyInVehicle = true call Z_checkCloseVehicle; _canBuyInVehicle = true call Z_checkCloseVehicle;
if (_canBuyInVehicle) then { if (_canBuyInVehicle) then {
Z_SellingFrom = 1; Z_SellingFrom = 1;
@@ -75,7 +75,7 @@ if (Z_Selling) then {
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SLOTSDISPLAY) ctrlSetStructuredText parseText " "; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SLOTSDISPLAY) ctrlSetStructuredText parseText " ";
}; };
}; };
case 2: { //gear if (_lbIndex == 2) exitwith { //gear
Z_SellingFrom = 2; Z_SellingFrom = 2;
[localize "STR_EPOCH_TRADE_BUYING_GEAR"] call Z_fillTradeTitle; [localize "STR_EPOCH_TRADE_BUYING_GEAR"] call Z_fillTradeTitle;
[2] call Z_displayFreeSpace; [2] call Z_displayFreeSpace;

View File

@@ -4,24 +4,22 @@ private ['_item', '_type'];
_item = _this select 0; _item = _this select 0;
_type = _item select 1; _type = _item select 1;
switch (true) do { call {
case (_type == "trade_items") : if (_type == "trade_items") exitwith
{ {
[_item] call Z_displayItemInfo; [_item] call Z_displayItemInfo;
}; };
case (_type == "trade_weapons") : if (_type == "trade_weapons") exitwith
{ {
[_item] call Z_displayWeaponInfo; [_item] call Z_displayWeaponInfo;
}; };
case (_type == "trade_backpacks") : if (_type == "trade_backpacks") exitwith
{ {
[_item] call Z_displayBackpackInfo; [_item] call Z_displayBackpackInfo;
}; };
case (_type in DZE_tradeVehicle) : if (_type in DZE_tradeVehicle) exitwith
{ {
[_item] call Z_displayVehicleInfo; [_item] call Z_displayVehicleInfo;
}; };
default { (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText (parseText format["<t color='#ffffff'>%1</t>",localize "STR_EPOCH_TRADE_NO_INFO"]);
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText (parseText format["<t color='#ffffff'>%1</t>",localize "STR_EPOCH_TRADE_NO_INFO"]);
}
}; };

View File

@@ -8,20 +8,20 @@ private ['_item','_selectedList','_selectedIndex'];
_selectedList = _this select 0; _selectedList = _this select 0;
_selectedIndex = _this select 1; _selectedIndex = _this select 1;
_item = []; _item = [];
if (_selectedIndex >= 0) then { if (_selectedIndex >= 0) then {
switch (_selectedList) do { call {
case 'sellable': { if (_selectedList == 'sellable') exitwith {
_item = Z_SellableArray select _selectedIndex; _item = Z_SellableArray select _selectedIndex;
}; };
case 'selling': { if (_selectedList == 'selling') exitwith {
_item = Z_SellArray select _selectedIndex; _item = Z_SellArray select _selectedIndex;
}; };
case 'buyable': { if (_selectedList == 'buyable') exitwith {
_item = Z_BuyableArray select _selectedIndex; _item = Z_BuyableArray select _selectedIndex;
}; };
case 'buying': { if (_selectedList == 'buying') exitwith {
_item = Z_BuyingArray select _selectedIndex; _item = Z_BuyingArray select _selectedIndex;
}; };
}; };

View File

@@ -7,10 +7,10 @@ _Z_logTrade = {
_quantity = _this select 1; _quantity = _this select 1;
_buyOrSell = _this select 2; _buyOrSell = _this select 2;
_price = _this select 3; _price = _this select 3;
_container = switch (Z_SellingFrom) do { _container = call {
case 0 : {"backpack"}; if (Z_SellingFrom == 0) exitwith {"backpack"};
case 1 : {"vehicle"}; if (Z_SellingFrom == 1) exitwith {"vehicle"};
case 2 : {"gear"}; if (Z_SellingFrom == 2) exitwith {"gear"};
}; };
_price = if (Z_singleCurrency) then {format ["%1 %2",[_price] call BIS_fnc_numberText,CurrencyName]} else {[_price,true,1,1] call Z_calcCurrency}; _price = if (Z_singleCurrency) then {format ["%1 %2",[_price] call BIS_fnc_numberText,CurrencyName]} else {[_price,true,1,1] call Z_calcCurrency};
@@ -20,7 +20,7 @@ _Z_logTrade = {
} else { } else {
diag_log format["%1: Sold %2x %3 from %4 at %5 for %6",localize "STR_EPOCH_PLAYER_289",_quantity,_className,_container,inTraderCity,_price]; diag_log format["%1: Sold %2x %3 from %4 at %5 for %6",localize "STR_EPOCH_PLAYER_289",_quantity,_className,_container,inTraderCity,_price];
}; };
// Log to server RPT // Log to server RPT
if (DZE_serverLogTrades) then { if (DZE_serverLogTrades) then {
PVDZE_obj_Trade = [player,0,if (_buyOrSell == "buy") then {0} else {1},_className,inTraderCity,false,_price,_quantity,_container,false]; PVDZE_obj_Trade = [player,0,if (_buyOrSell == "buy") then {0} else {1},_className,inTraderCity,false,_price,_quantity,_container,false];
@@ -48,7 +48,7 @@ for "_i" from 0 to (count _prices)-1 do {
_amount = _amounts select _i; _amount = _amounts select _i;
_price = _prices select _i; _price = _prices select _i;
_quantity = {(_className == _x)} count _classNames; _quantity = {(_className == _x)} count _classNames;
if (_quantity > 1) then { if (_quantity > 1) then {
if !(_className in _queueNames) then {_queueNames set [count _queueNames,_className];}; if !(_className in _queueNames) then {_queueNames set [count _queueNames,_className];};
_index = _queueNames find _className; _index = _queueNames find _className;
@@ -63,4 +63,4 @@ if (count _queueNames > 0) then {
for "_i" from 0 to (count _queueNames)-1 do { for "_i" from 0 to (count _queueNames)-1 do {
[_queueNames select _i, _queueAmounts select _i, _buyOrSell, _queuePrices select _i] call _Z_logTrade; [_queueNames select _i, _queueAmounts select _i, _buyOrSell, _queuePrices select _i] call _Z_logTrade;
}; };
}; };

View File

@@ -1,6 +1,6 @@
// Made for DayZ Epoch by vbawol edited for AdvancedTrading by Zupa // Made for DayZ Epoch by vbawol edited for AdvancedTrading by Zupa
private ["_return_change","_ItemTopaz","_GemTotal","_GemTotal2","_ItemObsidian","_ItemSapphire", private ["_return_change","_ItemTopaz","_GemTotal","_GemTotal2","_ItemObsidian","_ItemSapphire",
"_ItemAmethyst","_ItemEmerald","_ItemCitrine","_ItemRuby","_gem","_value","_total","_briefcase_100oz_a", "_ItemAmethyst","_ItemEmerald","_ItemCitrine","_ItemRuby","_gem","_value","_total",
"_gold_10oz_a","_gold_10oz_b","_briefcase_100oz","_gold_10oz","_gold_1oz_a","_gold_1oz_b","_gold_1oz", "_gold_10oz_a","_gold_10oz_b","_briefcase_100oz","_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", "_silver_10oz_a","_silver_10oz_b","_silver_10oz","_silver_1oz_a","_silver_1oz_b","_silver_1oz",
"_successful","_trade_total","_total_currency","_addRegularMag","_justChecking","_moneyAdded", "_successful","_trade_total","_total_currency","_addRegularMag","_justChecking","_moneyAdded",
@@ -51,7 +51,7 @@ if (!Z_Selling) then {
_addRegularMag = { _addRegularMag = {
private ["_backpack","_freeBagSpace","_freeSpace","_regularMags","_justChecking","_moneyAdded","_item","_enoughRoom","_regularMagsToBuy","_moneyInGear","_moneyInBackpack","_freeGearSlots"]; private ["_backpack","_freeBagSpace","_freeSpace","_regularMags","_justChecking","_moneyAdded","_item","_enoughRoom","_regularMagsToBuy","_moneyInGear","_moneyInBackpack","_freeGearSlots"];
_moneyAdded = _this select 0; // Return change _moneyAdded = _this select 0; // Return change
_justChecking = _this select 1; _justChecking = _this select 1;
_item = _this select 2; _item = _this select 2;
@@ -64,10 +64,10 @@ _addRegularMag = {
_moneyInGear = 0; // All money was removed in Z_payDefault _moneyInGear = 0; // All money was removed in Z_payDefault
_moneyInBackpack = 0; // All money was removed in Z_payDefault _moneyInBackpack = 0; // All money was removed in Z_payDefault
}; };
_regularMags = {(getNumber (configFile >> "CfgMagazines" >> _x >> "type") == 256)} count (magazines player); // 256 = WeaponSlotItem (normal magazine) _regularMags = {(getNumber (configFile >> "CfgMagazines" >> _x >> "type") == 256)} count (magazines player); // 256 = WeaponSlotItem (normal magazine)
_freeGearSlots = 12 - ((_regularMags + _regularMagsToBuy + _moneyAdded) - _moneyInGear); _freeGearSlots = 12 - ((_regularMags + _regularMagsToBuy + _moneyAdded) - _moneyInGear);
if (_justChecking or _freeGearSlots < 0) then { if (_justChecking or _freeGearSlots < 0) then {
_freeBagSpace = 0; _freeBagSpace = 0;
_backpack = unitBackpack player; _backpack = unitBackpack player;
@@ -78,9 +78,9 @@ _addRegularMag = {
_enoughRoom = (_freeGearSlots + _freeBagSpace + _moneyInBackpack) >= 0; _enoughRoom = (_freeGearSlots + _freeBagSpace + _moneyInBackpack) >= 0;
// Return change into vehicle or on ground is not advised due to potential for theft // Return change into vehicle or on ground is not advised due to potential for theft
}; };
if (_justChecking) exitWith {_enoughRoom}; if (_justChecking) exitWith {_enoughRoom};
if (_freeGearSlots >= 0) then { if (_freeGearSlots >= 0) then {
player addMagazine _item; player addMagazine _item;
} else { } else {
@@ -113,50 +113,50 @@ if (_return_change > 0) then {
{ {
_gem = _x; _gem = _x;
_value = DZE_GemWorthList select _forEachIndex; _value = DZE_GemWorthList select _forEachIndex;
switch(_gem) do { call {
case 'ItemTopaz': { if (_gem == 'ItemTopaz') exitwith {
_ItemTopaz = floor(_GemTotal2 / _value); _ItemTopaz = floor(_GemTotal2 / _value);
if (_ItemTopaz >= 1) then { if (_ItemTopaz >= 1) then {
_GemTotal = (_value * _ItemTopaz) + _GemTotal; _GemTotal = (_value * _ItemTopaz) + _GemTotal;
_GemTotal2 = _total - _GemTotal; _GemTotal2 = _total - _GemTotal;
}; };
}; };
case 'ItemObsidian': { if (_gem == 'ItemObsidian') exitwith {
_ItemObsidian = floor(_GemTotal2 / _value); _ItemObsidian = floor(_GemTotal2 / _value);
if (_ItemObsidian >= 1) then { if (_ItemObsidian >= 1) then {
_GemTotal = (_value * _ItemObsidian) + _GemTotal; _GemTotal = (_value * _ItemObsidian) + _GemTotal;
_GemTotal2 = _total - _GemTotal; _GemTotal2 = _total - _GemTotal;
}; };
}; };
case 'ItemSapphire': { if (_gem == 'ItemSapphire') exitwith {
_ItemSapphire = floor(_GemTotal2 / _value); _ItemSapphire = floor(_GemTotal2 / _value);
if (_ItemSapphire >= 1) then { if (_ItemSapphire >= 1) then {
_GemTotal = (_value * _ItemSapphire) + _GemTotal; _GemTotal = (_value * _ItemSapphire) + _GemTotal;
_GemTotal2 = _total - _GemTotal; _GemTotal2 = _total - _GemTotal;
}; };
}; };
case 'ItemAmethyst': { if (_gem == 'ItemAmethyst') exitwith {
_ItemAmethyst = floor(_GemTotal2 / _value); _ItemAmethyst = floor(_GemTotal2 / _value);
if (_ItemAmethyst >= 1) then { if (_ItemAmethyst >= 1) then {
_GemTotal = (_value * _ItemAmethyst) + _GemTotal; _GemTotal = (_value * _ItemAmethyst) + _GemTotal;
_GemTotal2 = _total - _GemTotal; _GemTotal2 = _total - _GemTotal;
}; };
}; };
case 'ItemEmerald': { if (_gem == 'ItemEmerald') exitwith {
_ItemEmerald = floor(_GemTotal2 / _value); _ItemEmerald = floor(_GemTotal2 / _value);
if (_ItemEmerald >= 1) then { if (_ItemEmerald >= 1) then {
_GemTotal = (_value * _ItemEmerald) + _GemTotal; _GemTotal = (_value * _ItemEmerald) + _GemTotal;
_GemTotal2 = _total - _GemTotal; _GemTotal2 = _total - _GemTotal;
}; };
}; };
case 'ItemCitrine': { if (_gem == 'ItemCitrine') exitwith {
_ItemCitrine = floor(_GemTotal2 / _value); _ItemCitrine = floor(_GemTotal2 / _value);
if (_ItemCitrine >= 1) then { if (_ItemCitrine >= 1) then {
_GemTotal = (_value * _ItemCitrine) + _GemTotal; _GemTotal = (_value * _ItemCitrine) + _GemTotal;
_GemTotal2 = _total - _GemTotal; _GemTotal2 = _total - _GemTotal;
}; };
}; };
case 'ItemRuby': { if (_gem == 'ItemRuby') exitwith {
_ItemRuby = floor(_GemTotal2 / _value); _ItemRuby = floor(_GemTotal2 / _value);
if (_ItemRuby >= 1) then { if (_ItemRuby >= 1) then {
_GemTotal = (_value * _ItemRuby) + _GemTotal; _GemTotal = (_value * _ItemRuby) + _GemTotal;
@@ -254,13 +254,13 @@ if (_return_change > 0) then {
if (_justChecking) then { _moneyAdded = _moneyAdded + 1; } else { [1,false,format["ItemSilverBar%1oz",_silver_1oz]] call _addRegularMag; }; if (_justChecking) then { _moneyAdded = _moneyAdded + 1; } else { [1,false,format["ItemSilverBar%1oz",_silver_1oz]] call _addRegularMag; };
}; };
}; };
if (_justChecking) then { if (_justChecking) then {
_successful = [_moneyAdded,true,"",_regularMagsToBuy,_moneyInGear,_moneyInBackpack] call _addRegularMag; _successful = [_moneyAdded,true,"",_regularMagsToBuy,_moneyInGear,_moneyInBackpack] call _addRegularMag;
} else { } else {
_successful = true; _successful = true;
}; };
if (_combine) then {call player_forceSave;}; if (_combine) then {call player_forceSave;};
}; };

View File

@@ -1,9 +1,8 @@
private ["_tempArray","_outcome","_vehCheckArray","_vehArray","_weaponsArray","_itemsArray","_bpArray","_bpCheckArray","_weaponsCheckArray","_itemsCheckArray","_VehKey","_wA","_mA","_money","_itemData","_success","_bag","_itemsToLog","_tCost","_tSold","_wealth"]; private ["_sellVehicle","_outcome","_vehCheckArray","_vehArray","_weaponsArray","_itemsArray","_bpArray","_bpCheckArray","_weaponsCheckArray","_itemsCheckArray","_VehKey","_wA","_mA","_money","_itemData","_bag","_itemsToLog","_tCost","_tSold","_wealth"];
if (count Z_SellArray < 1) exitWith { systemChat localize "STR_EPOCH_TRADE_SELL_NO_ITEMS"; }; if (count Z_SellArray < 1) exitWith { systemChat localize "STR_EPOCH_TRADE_SELL_NO_ITEMS"; };
if (Z_SellingFrom == 1 && (isNull DZE_myVehicle or !local DZE_myVehicle)) exitWith { systemChat localize "STR_EPOCH_PLAYER_245"; }; if (Z_SellingFrom == 1 && (isNull DZE_myVehicle or !local DZE_myVehicle)) exitWith { systemChat localize "STR_EPOCH_PLAYER_245"; };
_tempArray = Z_SellArray;
closeDialog 2; closeDialog 2;
_outcome = []; _outcome = [];
_weaponsArray = []; _weaponsArray = [];
@@ -17,7 +16,7 @@ _itemsCheckArray = [];
_itemsToLog = [[],[],[],"sell"]; _itemsToLog = [[],[],[],"sell"];
_sellVehicle = { _sellVehicle = {
private ["_damage","_tireDmg","_tires","_okToSell","_returnInfo","_hitpoints","_objectID","_objectUID","_objectCharacterId","_notSetup","_vehicle"]; private ["_damage","_tireDmg","_tires","_okToSell","_returnInfo","_hitpoints","_objectID","_objectUID","_objectCharacterId","_notSetup","_vehicle","_sellType"];
_vehicle = _this select 0; _vehicle = _this select 0;
_sellType = _this select 1; _sellType = _this select 1;
_returnInfo = []; _returnInfo = [];
@@ -66,24 +65,20 @@ _sellVehicle = {
_type = _x select 1; _type = _x select 1;
_name = _x select 0; _name = _x select 0;
switch (true) do { call {
case (_type == "trade_items") : if (_type == "trade_items") exitwith {
{
_itemsArray set [count(_itemsArray),_name]; _itemsArray set [count(_itemsArray),_name];
_itemsCheckArray set [count(_itemsCheckArray),[_x select 2, _x select 11]]; _itemsCheckArray set [count(_itemsCheckArray),[_x select 2, _x select 11]];
}; };
case (_type == "trade_weapons") : if (_type == "trade_weapons") exitwith {
{
_weaponsArray set [count(_weaponsArray),_name]; _weaponsArray set [count(_weaponsArray),_name];
_weaponsCheckArray set [count(_weaponsCheckArray),[_x select 2, _x select 11]]; _weaponsCheckArray set [count(_weaponsCheckArray),[_x select 2, _x select 11]];
}; };
case (_type == "trade_backpacks") : if (_type == "trade_backpacks") exitwith {
{
_bpArray set [count(_bpArray),_name]; _bpArray set [count(_bpArray),_name];
_bpCheckArray set [count(_bpCheckArray),[_x select 2, _x select 11]]; _bpCheckArray set [count(_bpCheckArray),[_x select 2, _x select 11]];
}; };
case (_type in DZE_tradeVehicle) : if (_type in DZE_tradeVehicle) exitwith {
{
if (local DZE_myVehicle) then { if (local DZE_myVehicle) then {
_VehKey = [DZE_myVehicle, _type] call _sellVehicle; _VehKey = [DZE_myVehicle, _type] call _sellVehicle;
if (count _VehKey > 0) then { if (count _VehKey > 0) then {
@@ -112,7 +107,7 @@ _itemsToLog set [0,(_itemsArray + _weaponsArray + _bpArray + [typeOf DZE_myVehic
//gear //gear
if (Z_SellingFrom == 2) then { if (Z_SellingFrom == 2) then {
private ["_localResult", "_vehTraded"]; private ["_localResult", "_vehTraded","_bagTraded","_name","_type"];
_wA = []; _wA = [];
_mA = []; _mA = [];
_vehTraded = false; _vehTraded = false;
@@ -185,7 +180,7 @@ if (Z_SingleCurrency) then {
_money = _money + ((((_bpCheckArray select _forEachIndex) select 0)) * _x); _money = _money + ((((_bpCheckArray select _forEachIndex) select 0)) * _x);
_itemsToLog set [2, (_itemsToLog select 2) + [((((_bpCheckArray select _forEachIndex) select 0)) * _x)]]; _itemsToLog set [2, (_itemsToLog select 2) + [((((_bpCheckArray select _forEachIndex) select 0)) * _x)]];
} forEach (_outcome select 2); } forEach (_outcome select 2);
if (count _outcome > 3) then { if (count _outcome > 3) then {
_money = _money + ((_vehCheckArray select 0) select 0); _money = _money + ((_vehCheckArray select 0) select 0);
_itemsToLog set [2, (_itemsToLog select 2) + [((_vehCheckArray select 0) select 0)]]; _itemsToLog set [2, (_itemsToLog select 2) + [((_vehCheckArray select 0) select 0)]];
@@ -219,7 +214,7 @@ if (typeName _money == "SCALAR") then {
player setVariable[(["cashMoney","globalMoney"] select Z_persistentMoney),(_wealth + _money),true]; player setVariable[(["cashMoney","globalMoney"] select Z_persistentMoney),(_wealth + _money),true];
systemChat format[localize "STR_EPOCH_TRADE_SUCCESS_CHANGE",[_money] call BIS_fnc_numberText,CurrencyName]; systemChat format[localize "STR_EPOCH_TRADE_SUCCESS_CHANGE",[_money] call BIS_fnc_numberText,CurrencyName];
} else { } else {
_success = [_money,0,false,0,[],[],false] call Z_returnChange; [_money,0,false,0,[],[],false] call Z_returnChange;
_tCost = ""; _tCost = "";
_tCost = [_money,true] call z_calcCurrency; _tCost = [_money,true] call z_calcCurrency;
if (_tCost != "") then { systemChat format[localize "STR_EPOCH_TRADE_SELL_SUCCESS",_tCost]; }; if (_tCost != "") then { systemChat format[localize "STR_EPOCH_TRADE_SELL_SUCCESS",_tCost]; };

View File

@@ -6,7 +6,7 @@
Author: Author:
Zupa 2014-09-30 Zupa 2014-09-30
---------------------------------------------------------------------------- */ ---------------------------------------------------------------------------- */
private ["_vehInfo","_inCargo","_object","_mags","_weaps","_normalMags","_normalWeaps","_returnVar","_returnMag","_returnWeap","_freeSpace"]; private ["_vehInfo","_inCargo","_object","_mags","_weaps","_normalMags","_normalWeaps","_returnVar","_returnMag","_returnWeap","_freeSpace","_sell"];
_object = _this select 0; _object = _this select 0;
_mags = _this select 1; _mags = _this select 1;
@@ -65,4 +65,4 @@ _returnVar set [0,_returnMag];
_returnVar set [1,_returnWeap]; _returnVar set [1,_returnWeap];
_returnVar set [2,[]]; _returnVar set [2,[]];
_returnVar _returnVar