mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-04-17 09:53:21 +03:00
Advanced trading changes
This changes a few things in Advanced trading, mainly cosmetically. > Removes all the commented out lines that were the same in defines.sqf, let me know if these are there for a reason? > fixes the buying list to have localization support and has a total item count that works properly. > cosmetic change displaying backpack info on trader to bring it in line with the other menus > adds total item count to the selling list and added localization for that
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
private ["_magazinesToBuy", "_weaponsToBuy", "_backpacksToBuy", "_toolsToBuy", "_sidearmToBuy", "_primaryToBuy", "_priceToBuy"
|
||||
,"_enoughMoney", "_myMoney", "_canBuy", "_moneyInfo","_count","_success","_backpack","_toolClasses","_itemsToLog","_tcost"
|
||||
,"_enoughMoney", "_myMoney", "_canBuy", "_moneyInfo","_count","_success","_backpack","_toolClasses","_itemsToLog","_tCost","_bTotal"
|
||||
];
|
||||
|
||||
_magazinesToBuy = 0;
|
||||
@@ -9,6 +9,7 @@ _toolsToBuy = 0;
|
||||
_sidearmToBuy = 0;
|
||||
_primaryToBuy = 0;
|
||||
_vehiclesToBuy = 0;
|
||||
_bTotal = 0;
|
||||
|
||||
_priceToBuy = 0;
|
||||
_toolClasses = [];
|
||||
@@ -147,53 +148,60 @@ if(_enoughMoney) then {
|
||||
|
||||
if(Z_SellingFrom == 0) then { //backpack
|
||||
_backpack = unitBackpack player;
|
||||
systemChat format[localize "STR_EPOCH_TRADE_IN_BACKPACK",count (Z_BuyingArray)];
|
||||
{
|
||||
if( _x select 1 == "trade_weapons")then{
|
||||
_backpack addWeaponCargoGlobal [_x select 0, _x select 9];
|
||||
_bTotal = _bTotal + (_x select 9);
|
||||
};
|
||||
if( _x select 1 == "trade_items")then{
|
||||
_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{
|
||||
_item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
|
||||
_bTotal = _bTotal + (_x select 9);
|
||||
if (_item2Add != "0") then {
|
||||
_backpack addWeaponCargoGlobal [_item2Add, 1];
|
||||
};
|
||||
};
|
||||
} count Z_BuyingArray;
|
||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_BACKPACK",_bTotal];
|
||||
};
|
||||
|
||||
if(Z_SellingFrom == 1)then{ //vehicle
|
||||
if(Z_SellingFrom == 1) then { //vehicle
|
||||
{
|
||||
systemChat format["Adding %1 items in %2",count (Z_BuyingArray), typeOf Z_vehicle];
|
||||
if( _x select 1 == "trade_weapons")then{
|
||||
Z_vehicle addWeaponCargoGlobal [_x select 0, _x select 9];
|
||||
_bTotal = _bTotal + (_x select 9);
|
||||
};
|
||||
if( _x select 1 == "trade_items")then{
|
||||
Z_vehicle addMagazineCargoGlobal [_x select 0, _x select 9];
|
||||
_bTotal = _bTotal + (_x select 9);
|
||||
};
|
||||
if( _x select 1 == "trade_backpacks")then{
|
||||
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{
|
||||
_item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
|
||||
_bTotal = _bTotal + (_x select 9);
|
||||
if (_item2Add != "0") then {
|
||||
Z_vehicle addWeaponCargoGlobal [_item2Add, 1];
|
||||
};
|
||||
};
|
||||
} count Z_BuyingArray;
|
||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_VEHICLE",_bTotal,typeOf Z_vehicle];
|
||||
};
|
||||
|
||||
if(Z_SellingFrom == 2)then{ //gear
|
||||
systemChat format["Adding %1 items in gear",count (Z_BuyingArray)];
|
||||
if(Z_SellingFrom == 2) then { //gear
|
||||
{
|
||||
if( _x select 1 == "trade_weapons") then {
|
||||
_count = 0;
|
||||
while{ _count < (_x select 9)}do{
|
||||
player addWeapon (_x select 0);
|
||||
player addWeapon (_x select 0);
|
||||
_count = _count + 1;
|
||||
};
|
||||
_bTotal = _bTotal + (_x select 9);
|
||||
};
|
||||
if( _x select 1 == "trade_items" ) then {
|
||||
_count = 0;
|
||||
@@ -201,24 +209,28 @@ if(_enoughMoney) then {
|
||||
player addMagazine (_x select 0);
|
||||
_count = _count + 1;
|
||||
};
|
||||
_bTotal = _bTotal + (_x select 9);
|
||||
};
|
||||
if( _x select 1 == "trade_backpacks")then{
|
||||
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{
|
||||
_item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
|
||||
_bTotal = _bTotal + (_x select 9);
|
||||
if (_item2Add != "0") then {
|
||||
player addWeapon _item2Add;
|
||||
};
|
||||
};
|
||||
} count Z_BuyingArray;
|
||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_GEAR",_bTotal];
|
||||
};
|
||||
if (!Z_SingleCurrency) then {
|
||||
_success = [player,_priceToBuy, _moneyInfo] call Z_payDefault;
|
||||
if (_success) then {
|
||||
_tcost = "";
|
||||
_tcost = _priceToBuy call z_calcDefaultCurrencyNoImg;
|
||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_SUCCESS", _tcost];
|
||||
_tCost = "";
|
||||
_tCost = _priceToBuy call z_calcDefaultCurrencyNoImg;
|
||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_SUCCESS", _tCost];
|
||||
} else {
|
||||
systemChat localize "STR_EPOCH_TRADE_DEBUG";
|
||||
};
|
||||
@@ -234,10 +246,10 @@ if(_enoughMoney) then {
|
||||
} else {
|
||||
systemChat localize "STR_EPOCH_TRADE_CONTAINER_FULL";
|
||||
};
|
||||
}else{
|
||||
} else {
|
||||
if( Z_SingleCurrency) then {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_NEED_COINS",_priceToBuy,CurrencyName];
|
||||
} else {
|
||||
systemChat localize "STR_EPOCH_TRADE_NEED_MONEY";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user