mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 20:13:13 +03:00
@@ -2,6 +2,8 @@ private ["_magazinesToBuy", "_weaponsToBuy", "_backpacksToBuy", "_toolsToBuy", "
|
|||||||
,"_enoughMoney", "_myMoney", "_canBuy", "_moneyInfo","_count","_success","_backpack","_toolClasses","_itemsToLog","_tCost","_bTotal"
|
,"_enoughMoney", "_myMoney", "_canBuy", "_moneyInfo","_count","_success","_backpack","_toolClasses","_itemsToLog","_tCost","_bTotal"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (count Z_BuyingArray < 1) exitWith { systemChat localize "STR_EPOCH_TRADE_BUY_NO_ITEMS"; };
|
||||||
|
|
||||||
_magazinesToBuy = 0;
|
_magazinesToBuy = 0;
|
||||||
_weaponsToBuy = 0;
|
_weaponsToBuy = 0;
|
||||||
_backpacksToBuy = 0;
|
_backpacksToBuy = 0;
|
||||||
@@ -9,14 +11,11 @@ _toolsToBuy = 0;
|
|||||||
_sidearmToBuy = 0;
|
_sidearmToBuy = 0;
|
||||||
_primaryToBuy = 0;
|
_primaryToBuy = 0;
|
||||||
_vehiclesToBuy = 0;
|
_vehiclesToBuy = 0;
|
||||||
_bTotal = 0;
|
|
||||||
|
|
||||||
_priceToBuy = 0;
|
_priceToBuy = 0;
|
||||||
_toolClasses = [];
|
_toolClasses = [];
|
||||||
_itemsToLog = [[],[],[],"buy"];
|
_itemsToLog = [[],[],[],"buy"];
|
||||||
|
|
||||||
if (count Z_BuyingArray < 1) exitWith { systemChat localize "STR_EPOCH_TRADE_BUY_NO_ITEMS"; };
|
|
||||||
|
|
||||||
if (Z_SingleCurrency) then {
|
if (Z_SingleCurrency) then {
|
||||||
{
|
{
|
||||||
if( _x select 1 == "trade_weapons")then{
|
if( _x select 1 == "trade_weapons")then{
|
||||||
@@ -106,6 +105,7 @@ if (Z_SingleCurrency) then {
|
|||||||
|
|
||||||
if(_enoughMoney) then {
|
if(_enoughMoney) then {
|
||||||
if(_canBuy) then {
|
if(_canBuy) then {
|
||||||
|
_bTotal = 0;
|
||||||
_buyVehicle = {
|
_buyVehicle = {
|
||||||
private "_location";
|
private "_location";
|
||||||
_part_out = _this select 0;
|
_part_out = _this select 0;
|
||||||
@@ -151,19 +151,17 @@ if(_enoughMoney) then {
|
|||||||
{
|
{
|
||||||
if( _x select 1 == "trade_weapons")then{
|
if( _x select 1 == "trade_weapons")then{
|
||||||
_backpack addWeaponCargoGlobal [_x select 0, _x select 9];
|
_backpack addWeaponCargoGlobal [_x select 0, _x select 9];
|
||||||
_bTotal = _bTotal + (_x select 9);
|
|
||||||
};
|
};
|
||||||
if( _x select 1 == "trade_items")then{
|
if( _x select 1 == "trade_items")then{
|
||||||
_backpack addMagazineCargoGlobal [_x select 0, _x select 9];
|
_backpack addMagazineCargoGlobal [_x select 0, _x select 9];
|
||||||
_bTotal = _bTotal + (_x select 9);
|
|
||||||
};
|
};
|
||||||
if((_x select 1) in ["trade_any_vehicle", "trade_any_vehicle_free", "trade_any_vehicle_old", "trade_any_bicycle", "trade_any_bicycle_old", "trade_any_boat", "trade_any_boat_old"])then{
|
if((_x select 1) in ["trade_any_vehicle", "trade_any_vehicle_free", "trade_any_vehicle_old", "trade_any_bicycle", "trade_any_bicycle_old", "trade_any_boat", "trade_any_boat_old"])then{
|
||||||
_item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
|
_item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
|
||||||
_bTotal = _bTotal + (_x select 9);
|
|
||||||
if (_item2Add != "0") then {
|
if (_item2Add != "0") then {
|
||||||
_backpack addWeaponCargoGlobal [_item2Add, 1];
|
_backpack addWeaponCargoGlobal [_item2Add, 1];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
_bTotal = _bTotal + (_x select 9);
|
||||||
} count Z_BuyingArray;
|
} count Z_BuyingArray;
|
||||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_BACKPACK",_bTotal];
|
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_BACKPACK",_bTotal];
|
||||||
};
|
};
|
||||||
@@ -172,23 +170,20 @@ if(_enoughMoney) then {
|
|||||||
{
|
{
|
||||||
if( _x select 1 == "trade_weapons")then{
|
if( _x select 1 == "trade_weapons")then{
|
||||||
Z_vehicle addWeaponCargoGlobal [_x select 0, _x select 9];
|
Z_vehicle addWeaponCargoGlobal [_x select 0, _x select 9];
|
||||||
_bTotal = _bTotal + (_x select 9);
|
|
||||||
};
|
};
|
||||||
if( _x select 1 == "trade_items")then{
|
if( _x select 1 == "trade_items")then{
|
||||||
Z_vehicle addMagazineCargoGlobal [_x select 0, _x select 9];
|
Z_vehicle addMagazineCargoGlobal [_x select 0, _x select 9];
|
||||||
_bTotal = _bTotal + (_x select 9);
|
|
||||||
};
|
};
|
||||||
if( _x select 1 == "trade_backpacks")then{
|
if( _x select 1 == "trade_backpacks")then{
|
||||||
Z_vehicle addBackpackCargoGlobal [_x select 0, _x select 9];
|
Z_vehicle addBackpackCargoGlobal [_x select 0, _x select 9];
|
||||||
_bTotal = _bTotal + (_x select 9);
|
|
||||||
};
|
};
|
||||||
if((_x select 1) in ["trade_any_vehicle", "trade_any_vehicle_free", "trade_any_vehicle_old", "trade_any_bicycle", "trade_any_bicycle_old", "trade_any_boat", "trade_any_boat_old"])then{
|
if((_x select 1) in ["trade_any_vehicle", "trade_any_vehicle_free", "trade_any_vehicle_old", "trade_any_bicycle", "trade_any_bicycle_old", "trade_any_boat", "trade_any_boat_old"])then{
|
||||||
_item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
|
_item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
|
||||||
_bTotal = _bTotal + (_x select 9);
|
|
||||||
if (_item2Add != "0") then {
|
if (_item2Add != "0") then {
|
||||||
Z_vehicle addWeaponCargoGlobal [_item2Add, 1];
|
Z_vehicle addWeaponCargoGlobal [_item2Add, 1];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
_bTotal = _bTotal + (_x select 9);
|
||||||
} count Z_BuyingArray;
|
} count Z_BuyingArray;
|
||||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_VEHICLE",_bTotal,typeOf Z_vehicle];
|
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_VEHICLE",_bTotal,typeOf Z_vehicle];
|
||||||
};
|
};
|
||||||
@@ -201,7 +196,6 @@ if(_enoughMoney) then {
|
|||||||
player addWeapon (_x select 0);
|
player addWeapon (_x select 0);
|
||||||
_count = _count + 1;
|
_count = _count + 1;
|
||||||
};
|
};
|
||||||
_bTotal = _bTotal + (_x select 9);
|
|
||||||
};
|
};
|
||||||
if( _x select 1 == "trade_items" ) then {
|
if( _x select 1 == "trade_items" ) then {
|
||||||
_count = 0;
|
_count = 0;
|
||||||
@@ -209,19 +203,17 @@ if(_enoughMoney) then {
|
|||||||
player addMagazine (_x select 0);
|
player addMagazine (_x select 0);
|
||||||
_count = _count + 1;
|
_count = _count + 1;
|
||||||
};
|
};
|
||||||
_bTotal = _bTotal + (_x select 9);
|
|
||||||
};
|
};
|
||||||
if( _x select 1 == "trade_backpacks")then{
|
if( _x select 1 == "trade_backpacks")then{
|
||||||
player addBackpack (_x select 0);
|
player addBackpack (_x select 0);
|
||||||
_bTotal = _bTotal + (_x select 9);
|
|
||||||
};
|
};
|
||||||
if((_x select 1) in ["trade_any_vehicle", "trade_any_vehicle_free", "trade_any_vehicle_old", "trade_any_bicycle", "trade_any_bicycle_old", "trade_any_boat", "trade_any_boat_old"])then{
|
if((_x select 1) in ["trade_any_vehicle", "trade_any_vehicle_free", "trade_any_vehicle_old", "trade_any_bicycle", "trade_any_bicycle_old", "trade_any_boat", "trade_any_boat_old"])then{
|
||||||
_item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
|
_item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
|
||||||
_bTotal = _bTotal + (_x select 9);
|
|
||||||
if (_item2Add != "0") then {
|
if (_item2Add != "0") then {
|
||||||
player addWeapon _item2Add;
|
player addWeapon _item2Add;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
_bTotal = _bTotal + (_x select 9);
|
||||||
} count Z_BuyingArray;
|
} count Z_BuyingArray;
|
||||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_GEAR",_bTotal];
|
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_GEAR",_bTotal];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Calculate the total price for single currency.
|
* Calculate the total price for single currency.
|
||||||
**/
|
**/
|
||||||
private ["_sellPrice","_ctrltext"];
|
private ["_sellPrice","_ctrltext","_bTotal"];
|
||||||
#include "defines.hpp"
|
#include "defines.hpp"
|
||||||
|
|
||||||
_sellPrice = 0;
|
_sellPrice = 0;
|
||||||
@@ -30,11 +30,15 @@ if(Z_SingleCurrency) then {
|
|||||||
_sellPrice = _sellPrice + ((_x select 2) * (_x select 11));
|
_sellPrice = _sellPrice + ((_x select 2) * (_x select 11));
|
||||||
}count Z_SellArray;
|
}count Z_SellArray;
|
||||||
_ctrltext = _sellPrice call Z_calcDefaultCurrency;
|
_ctrltext = _sellPrice call Z_calcDefaultCurrency;
|
||||||
|
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText format ["%1 (%2 items)", localize "STR_EPOCH_TRADE_SELLING", count Z_SellArray];
|
||||||
} else {
|
} else {
|
||||||
|
_bTotal = 0;
|
||||||
{
|
{
|
||||||
_sellPrice = _sellPrice + ((_x select 2) * (_x select 11) * (_x select 9));
|
_sellPrice = _sellPrice + ((_x select 2) * (_x select 11) * (_x select 9));
|
||||||
|
_bTotal = _bTotal + (_x select 9);
|
||||||
}count Z_BuyingArray;
|
}count Z_BuyingArray;
|
||||||
_ctrltext = _sellPrice call Z_calcDefaultCurrency;
|
_ctrltext = _sellPrice call Z_calcDefaultCurrency;
|
||||||
|
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText format ["%1 (%2 items)", localize "STR_EPOCH_TRADE_BUYING", _bTotal];
|
||||||
};
|
};
|
||||||
ctrlSetText [Z_AT_PRICEDISPLAY, ''];
|
ctrlSetText [Z_AT_PRICEDISPLAY, ''];
|
||||||
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_PRICEINFO) ctrlSetStructuredText parseText _ctrltext;
|
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_PRICEINFO) ctrlSetStructuredText parseText _ctrltext;
|
||||||
|
|||||||
Reference in New Issue
Block a user