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"
,"_duplicate","_quantity","_tool","_totalBagSlots","_pistolMags","_regularMags","_toBuyPistolMags"
,"_toBuyRegularMags","_type","_freeSpace","_backpack","_totalSpace","_toolAmounts","_allowedBinocular","_message"
,"_vehiclesToBuy","_allowedWeapons","_allowedPistolMags","_allowedRegularMags","_typeW"
];
_selection = Z_SellingFrom;
_return = false;
@@ -50,11 +51,12 @@ if (_selection == 2) then { //gear
_allowedBinocular = 2;
_duplicate = false;
{
switch getNumber (configFile >> "CfgWeapons" >> _x >> "type") do {
case 2: {_allowedSidearm = 0;}; //Pistol
case 4: {_allowedBackpacks = 0;}; //Launcher
case 4096: {_allowedBinocular = _allowedBinocular - 1;}; //Binocular slot
case 131072: {_allowedTools = _allowedTools - 1;}; //Toolbelt slot
_typeW = getNumber (configFile >> "CfgWeapons" >> _x >> "type");
call {
if (_typeW == 2) exitwith {_allowedSidearm = 0;}; //Pistol
if (_typeW == 4) exitwith {_allowedBackpacks = 0;}; //Launcher
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
} count (weapons player);
@@ -80,11 +82,11 @@ if (_selection == 2) then { //gear
if (_allowedPrimary >= _primaryToBuy && _allowedSidearm >= _sidearmToBuy && _allowedTools >= _toolsToBuy && !_duplicate && _allowedBinocular > -1) then {
_check1 = true;
} else {
_message = switch (true) do {
case (_duplicate): {localize "STR_EPOCH_TRADE_DUPLICATE_TOOL"};
case (_allowedBinocular < 0): {localize "STR_EPOCH_TRADE_BINOCULARS_FULL"};
case (_allowedTools < _toolsToBuy): {localize "STR_EPOCH_PLAYER_107"};
default {format[localize "STR_EPOCH_TRADE_GEAR_FULL",_allowedPrimary,_allowedSidearm,_allowedTools]};
_message = call {
if (_duplicate) exitWith {localize "STR_EPOCH_TRADE_DUPLICATE_TOOL"};
if (_allowedBinocular < 0) exitWith {localize "STR_EPOCH_TRADE_BINOCULARS_FULL"};
if (_allowedTools < _toolsToBuy) exitWith {localize "STR_EPOCH_PLAYER_107"};
format[localize "STR_EPOCH_TRADE_GEAR_FULL",_allowedPrimary,_allowedSidearm,_allowedTools];
};
systemChat _message;
};

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;
Z_BuyableArray = [];
_arrayOfTraderCat = Z_traderData;
_counter = 0;
{
_categoryNumber = _x select 1;
if (_categoryNumber == _this) exitWith {

View File

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

View File

@@ -8,7 +8,7 @@
*
* 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"
_weaps = _this select 0;
@@ -37,7 +37,7 @@ _HasKeyCheck = {
_totalPrice = 0;
_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.)
{
@@ -69,18 +69,18 @@ _processGear = {
_sell = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "sell");
_buy = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "buy");
if (_swap) then {_y = "ItemBloodbag"};
switch (true) do {
case (_passedType == "trade_items") :
call {
if (_passedType == "trade_items") exitwith
{
_pic = getText (configFile >> 'CfgMagazines' >> _y >> 'picture');
_text = getText (configFile >> 'CfgMagazines' >> _y >> 'displayName');
};
case (_passedType == "trade_weapons") :
if (_passedType == "trade_weapons") exitwith
{
_pic = getText (configFile >> 'CfgWeapons' >> _y >> 'picture');
_text = getText (configFile >> 'CfgWeapons' >> _y >> 'displayName');
};
case (_passedType in DZE_tradeObject) :
if (_passedType in DZE_tradeObject) exitwith
{
_pic = getText (configFile >> 'CfgVehicles' >> _y >> 'picture');
_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;

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"
_selection = _this select 0;
@@ -19,9 +19,10 @@ if (_selection == 2) then { //gear
_allowedBackpacks = if (isNull _backpack) then {1} else {0};
_allowedSidearm = 1;
{
switch getNumber (configFile >> "CfgWeapons" >> _x >> "type") do {
case 2: {_allowedSidearm = 0;}; //Pistol
case 4: {_allowedBackpacks = 0;}; //Launcher
_nr = getNumber (configFile >> "CfgWeapons" >> _x >> "type");
call {
if (_nr == 2) exitwith {_allowedSidearm = 0;}; //Pistol
if (_nr == 4) exitwith {_allowedBackpacks = 0;}; //Launcher
};
} count (weapons player);

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"
_item = _this select 0;
@@ -114,9 +114,19 @@ if (count _compatible > 0) then {
if (_displayText != "") then {
_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
];
};
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;

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",
"_weapons2","_config","_wepText","_turret","_text"];
"_weapons2","_config","_wepText","_turret","_text","_index","_picSell","_picBuy"];
#include "defines.hpp"

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"
_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;

View File

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

View File

@@ -4,24 +4,22 @@ private ['_item', '_type'];
_item = _this select 0;
_type = _item select 1;
switch (true) do {
case (_type == "trade_items") :
call {
if (_type == "trade_items") exitwith
{
[_item] call Z_displayItemInfo;
};
case (_type == "trade_weapons") :
if (_type == "trade_weapons") exitwith
{
[_item] call Z_displayWeaponInfo;
};
case (_type == "trade_backpacks") :
if (_type == "trade_backpacks") exitwith
{
[_item] call Z_displayBackpackInfo;
};
case (_type in DZE_tradeVehicle) :
if (_type in DZE_tradeVehicle) exitwith
{
[_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

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

View File

@@ -7,10 +7,10 @@ _Z_logTrade = {
_quantity = _this select 1;
_buyOrSell = _this select 2;
_price = _this select 3;
_container = switch (Z_SellingFrom) do {
case 0 : {"backpack"};
case 1 : {"vehicle"};
case 2 : {"gear"};
_container = call {
if (Z_SellingFrom == 0) exitwith {"backpack"};
if (Z_SellingFrom == 1) exitwith {"vehicle"};
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};

View File

@@ -1,6 +1,6 @@
// Made for DayZ Epoch by vbawol edited for AdvancedTrading by Zupa
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",
"_silver_10oz_a","_silver_10oz_b","_silver_10oz","_silver_1oz_a","_silver_1oz_b","_silver_1oz",
"_successful","_trade_total","_total_currency","_addRegularMag","_justChecking","_moneyAdded",
@@ -113,50 +113,50 @@ if (_return_change > 0) then {
{
_gem = _x;
_value = DZE_GemWorthList select _forEachIndex;
switch(_gem) do {
case 'ItemTopaz': {
call {
if (_gem == 'ItemTopaz') exitwith {
_ItemTopaz = floor(_GemTotal2 / _value);
if (_ItemTopaz >= 1) then {
_GemTotal = (_value * _ItemTopaz) + _GemTotal;
_GemTotal2 = _total - _GemTotal;
};
};
case 'ItemObsidian': {
if (_gem == 'ItemObsidian') exitwith {
_ItemObsidian = floor(_GemTotal2 / _value);
if (_ItemObsidian >= 1) then {
_GemTotal = (_value * _ItemObsidian) + _GemTotal;
_GemTotal2 = _total - _GemTotal;
};
};
case 'ItemSapphire': {
if (_gem == 'ItemSapphire') exitwith {
_ItemSapphire = floor(_GemTotal2 / _value);
if (_ItemSapphire >= 1) then {
_GemTotal = (_value * _ItemSapphire) + _GemTotal;
_GemTotal2 = _total - _GemTotal;
};
};
case 'ItemAmethyst': {
if (_gem == 'ItemAmethyst') exitwith {
_ItemAmethyst = floor(_GemTotal2 / _value);
if (_ItemAmethyst >= 1) then {
_GemTotal = (_value * _ItemAmethyst) + _GemTotal;
_GemTotal2 = _total - _GemTotal;
};
};
case 'ItemEmerald': {
if (_gem == 'ItemEmerald') exitwith {
_ItemEmerald = floor(_GemTotal2 / _value);
if (_ItemEmerald >= 1) then {
_GemTotal = (_value * _ItemEmerald) + _GemTotal;
_GemTotal2 = _total - _GemTotal;
};
};
case 'ItemCitrine': {
if (_gem == 'ItemCitrine') exitwith {
_ItemCitrine = floor(_GemTotal2 / _value);
if (_ItemCitrine >= 1) then {
_GemTotal = (_value * _ItemCitrine) + _GemTotal;
_GemTotal2 = _total - _GemTotal;
};
};
case 'ItemRuby': {
if (_gem == 'ItemRuby') exitwith {
_ItemRuby = floor(_GemTotal2 / _value);
if (_ItemRuby >= 1) then {
_GemTotal = (_value * _ItemRuby) + _GemTotal;

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 (Z_SellingFrom == 1 && (isNull DZE_myVehicle or !local DZE_myVehicle)) exitWith { systemChat localize "STR_EPOCH_PLAYER_245"; };
_tempArray = Z_SellArray;
closeDialog 2;
_outcome = [];
_weaponsArray = [];
@@ -17,7 +16,7 @@ _itemsCheckArray = [];
_itemsToLog = [[],[],[],"sell"];
_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;
_sellType = _this select 1;
_returnInfo = [];
@@ -66,24 +65,20 @@ _sellVehicle = {
_type = _x select 1;
_name = _x select 0;
switch (true) do {
case (_type == "trade_items") :
{
call {
if (_type == "trade_items") exitwith {
_itemsArray set [count(_itemsArray),_name];
_itemsCheckArray set [count(_itemsCheckArray),[_x select 2, _x select 11]];
};
case (_type == "trade_weapons") :
{
if (_type == "trade_weapons") exitwith {
_weaponsArray set [count(_weaponsArray),_name];
_weaponsCheckArray set [count(_weaponsCheckArray),[_x select 2, _x select 11]];
};
case (_type == "trade_backpacks") :
{
if (_type == "trade_backpacks") exitwith {
_bpArray set [count(_bpArray),_name];
_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 {
_VehKey = [DZE_myVehicle, _type] call _sellVehicle;
if (count _VehKey > 0) then {
@@ -112,7 +107,7 @@ _itemsToLog set [0,(_itemsArray + _weaponsArray + _bpArray + [typeOf DZE_myVehic
//gear
if (Z_SellingFrom == 2) then {
private ["_localResult", "_vehTraded"];
private ["_localResult", "_vehTraded","_bagTraded","_name","_type"];
_wA = [];
_mA = [];
_vehTraded = false;
@@ -219,7 +214,7 @@ if (typeName _money == "SCALAR") then {
player setVariable[(["cashMoney","globalMoney"] select Z_persistentMoney),(_wealth + _money),true];
systemChat format[localize "STR_EPOCH_TRADE_SUCCESS_CHANGE",[_money] call BIS_fnc_numberText,CurrencyName];
} else {
_success = [_money,0,false,0,[],[],false] call Z_returnChange;
[_money,0,false,0,[],[],false] call Z_returnChange;
_tCost = "";
_tCost = [_money,true] call z_calcCurrency;
if (_tCost != "") then { systemChat format[localize "STR_EPOCH_TRADE_SELL_SUCCESS",_tCost]; };

View File

@@ -6,7 +6,7 @@
Author:
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;
_mags = _this select 1;