mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
Advanced trading fixes, server_handleSafeGear human readibility (#1777)
* Advanced trading fixes Fixes a few issues and a dupe with advanced trading as well as some localization of where a vehicle key is going. Z_at_buyItems: Now adds localization for the key getting added to your toolbelt, backpack and vehicle, this stops players thinking they didn't get a key when infact it was added to their backpack/vehicle. Z_at_canAfford.sqf: This fixes a dupe from a bad copy paste for whomever wrote this script, it was using _backpackMoney in the z_allowTakingMoneyFromVehicle part, changed to the proper variable _vehicleMoney. z_at_fillBuyableList.sqf: this fixes a bug where a vehicle would show green even when it isn't local, just basically added more checking to make sure the vehicle it's making green in the list is a) local, b) alive and that the typeOf == _name. z_at_logTrade.sqf: fixes some tidyness. advancedTrading/init.sqf: adds a z_checkCloseVehicle call otherwise even with Z_AllowTakingMoneyFromVehicle = true it will not get currency from your vehicle until you clicked on the "Vehicle" tab. dayz_server/server_tradeObject.sqf: More tidying as per the z_at_logTrade and removes the useless Player:, as it is obvious a player has bought something not an AI. dayz_server/server_handleSafeGear.sqf: Makes the diag_log at the end more human readable with GPS coordinates as well as the lock code for the safe or the lockbox. * advanced trading fixes. I hate you github WHY U GET MISSED?? STUPID GITHUB. * snappoints changes Fixes the issue @SmokeyBR reported https://github.com/EpochModTeam/DayZ-Epoch/issues/1766#issuecomment-253864795 Adds all floor types to snap list for all barriers so you can snap a sandbag etc to a floor instead of manually lining it up
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
private ["_weaponsToBuy","_backpacksToBuy","_toolsToBuy","_sidearmToBuy","_primaryToBuy","_priceToBuy"
|
||||
,"_enoughMoney","_myMoney","_canBuy","_moneyInfo","_count","_success","_toolClasses","_itemsToLog"
|
||||
,"_tCost","_bTotal","_backpack","_pistolMagsToBuy","_regularMagsToBuy","_hasPrimary","_p","_toolAmounts"];
|
||||
private ["_activatingPlayer","_bTotal","_backpack","_backpacksToBuy","_buyVehicle","_buyingType","_canBuy","_count","_dir","_enoughMoney","_hasPrimary","_helipad","_isKeyOK","_item2Add","_itemsToLog","_keyColor","_keyNumber","_keySelected","_location","_moneyInfo","_myMoney","_p","_parentClasses","_part_out","_pistolMagsToBuy","_price","_priceToBuy","_primaryToBuy","_regularMagsToBuy","_sidearmToBuy","_sign","_success","_tCost","_toolAmounts","_toolClasses","_toolsToBuy","_vehiclesToBuy","_weaponsToBuy","_worth"];
|
||||
|
||||
if (count Z_BuyingArray < 1) exitWith { systemChat localize "STR_EPOCH_TRADE_BUY_NO_ITEMS"; };
|
||||
|
||||
@@ -181,7 +179,11 @@ if (_enoughMoney) then {
|
||||
};
|
||||
_bTotal = _bTotal + (_x select 9);
|
||||
} count Z_BuyingArray;
|
||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_BACKPACK",_bTotal];
|
||||
if (_item2Add != "0") then {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_VEH_IN_BACKPACK",(Z_BuyingArray select 0) select 3];
|
||||
} else {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_BACKPACK",_bTotal];
|
||||
};
|
||||
};
|
||||
|
||||
if (Z_SellingFrom == 1) then { //vehicle
|
||||
@@ -203,7 +205,11 @@ if (_enoughMoney) then {
|
||||
};
|
||||
_bTotal = _bTotal + (_x select 9);
|
||||
} count Z_BuyingArray;
|
||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_VEHICLE",_bTotal,typeOf Z_vehicle];
|
||||
if (_item2Add != "0") then {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_VEH_IN_VEHICLE",(Z_BuyingArray select 0) select 3,typeOf (Z_vehicle)];
|
||||
} else {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_VEHICLE",_bTotal,typeOf Z_vehicle];
|
||||
};
|
||||
};
|
||||
|
||||
if (Z_SellingFrom == 2) then { //gear
|
||||
@@ -239,7 +245,11 @@ if (_enoughMoney) then {
|
||||
};
|
||||
_bTotal = _bTotal + (_x select 9);
|
||||
} count Z_BuyingArray;
|
||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_GEAR",_bTotal];
|
||||
if (_item2Add != "0") then {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_VEH_IN_GEAR",(Z_BuyingArray select 0) select 3];
|
||||
} else {
|
||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_GEAR",_bTotal];
|
||||
};
|
||||
};
|
||||
if (!Z_SingleCurrency) then {
|
||||
_success = [player,_priceToBuy,_moneyInfo,false,0] call Z_payDefault;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
private ["_worth","_total_currency","_return","_part","_totalToPay","_inventoryMoney","_backpackMoney","_kinds","_amounts","_vehicleMoney"];
|
||||
private ["_amounts","_backpackMoney","_backpackPlayer","_counter","_findGem","_forEachIndex","_inventoryMoney","_kinds","_mags","_part","_return","_totalToPay","_total_currency","_vehicleMoney","_worth"];
|
||||
|
||||
_totalToPay = _this;
|
||||
_return = [false, [], [], [], 0];
|
||||
@@ -45,7 +45,7 @@ if (Z_AllowTakingMoneyFromBackpack) then {
|
||||
if (_findGem >= 0) then {
|
||||
_worth = DZE_GemWorthList select _findGem;
|
||||
_total_currency = _total_currency + (_worth * (_amounts select _forEachIndex));
|
||||
_counter = 0 ;
|
||||
_counter = 0;
|
||||
while {_counter < (_amounts select _forEachIndex)} do {
|
||||
_backpackMoney set [count(_backpackMoney),_x];
|
||||
_counter = _counter + 1;
|
||||
@@ -68,7 +68,7 @@ if (Z_AllowTakingMoneyFromVehicle) then {
|
||||
_worth = (_part >> "worth");
|
||||
if isNumber (_worth) then {
|
||||
_total_currency = _total_currency + (getNumber(_worth) * (_amounts select _forEachIndex));
|
||||
_counter = 0 ;
|
||||
_counter = 0;
|
||||
while {_counter < (_amounts select _forEachIndex)} do {
|
||||
_vehicleMoney set [count(_vehicleMoney),_x];
|
||||
_counter = _counter + 1;
|
||||
@@ -80,7 +80,7 @@ if (Z_AllowTakingMoneyFromVehicle) then {
|
||||
_total_currency = _total_currency + (_worth * (_amounts select _forEachIndex));
|
||||
_counter = 0 ;
|
||||
while {_counter < (_amounts select _forEachIndex)} do {
|
||||
_backpackMoney set [count(_backpackMoney),_x];
|
||||
_vehicleMoney set [count(_vehicleMoney),_x];
|
||||
_counter = _counter + 1;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "defines.hpp"
|
||||
|
||||
Z_Selling = !Z_Selling;
|
||||
Z_Selling = !Z_Selling;
|
||||
if (Z_Selling) then {
|
||||
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SELLBUYTOGGLE) ctrlSetText localize "STR_EPOCH_PLAYER_291";
|
||||
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_FILTERBUTTON) ctrlSetText localize "STR_UI_FILTER";
|
||||
|
||||
@@ -12,10 +12,9 @@ _typeOf = typeOf (unitBackPack player);
|
||||
_type = _x select 1;
|
||||
_count = 0;
|
||||
|
||||
if (_type in DZE_tradeVehicle) then {
|
||||
_count = { local _x } count (nearestObjects [(getPosATL player), [_name], Z_VehicleDistance]);
|
||||
if (_type in DZE_tradeVehicle && {_name == typeOf (DZE_myVehicle)} && {local DZE_myVehicle} && {alive DZE_myVehicle}) then {
|
||||
_count = { (local _x && _x == DZE_myVehicle) } count (nearestObjects [(getPosATL player), [_name], Z_VehicleDistance]);
|
||||
};
|
||||
|
||||
if (_type == "trade_items") then {
|
||||
{
|
||||
if (isText(configFile >> "CfgWeapons" >> _x >> "Attachments" >> _name) or _name in getArray (configFile >> "CfgWeapons" >> _x >> "magazines")) then {
|
||||
|
||||
@@ -18,15 +18,15 @@ _Z_logTrade = {
|
||||
// Log to client RPT
|
||||
if (Z_SingleCurrency) then {
|
||||
if (_buyOrSell == "buy") then {
|
||||
diag_log format["%5: Bought %4 x %1 into %7 at %2 for %3x%6",_className,inTraderCity,_price,_quantity,localize "STR_EPOCH_PLAYER_289",_currency,_container];
|
||||
diag_log format["%5: Purchased %4x %1 into %7 at %2 for %3x%6",_className,inTraderCity,_price,_quantity,localize "STR_EPOCH_PLAYER_289",_currency,_container];
|
||||
} else {
|
||||
diag_log format["%5: Sold %4 x %1 from %7 at %2 for %3x%6",_className,inTraderCity,_price,_quantity,localize "STR_EPOCH_PLAYER_289",_currency,_container];
|
||||
diag_log format["%5: Sold %4x %1 from %7 at %2 for %3x%6",_className,inTraderCity,_price,_quantity,localize "STR_EPOCH_PLAYER_289",_currency,_container];
|
||||
};
|
||||
} else {
|
||||
if (_buyOrSell == "buy") then {
|
||||
diag_log format["%5: Bought %4 x %1 into %7 at %2 for %3",_className,inTraderCity,_tCost,_quantity,localize "STR_EPOCH_PLAYER_289",_currency,_container];
|
||||
diag_log format["%5: Purchased %4x %1 into %7 at %2 for %3",_className,inTraderCity,_tCost,_quantity,localize "STR_EPOCH_PLAYER_289",_currency,_container];
|
||||
} else {
|
||||
diag_log format["%5: Sold %4 x %1 from %7 at %2 for %3",_className,inTraderCity,_tCost,_quantity,localize "STR_EPOCH_PLAYER_289",_currency,_container];
|
||||
diag_log format["%5: Sold %4x %1 from %7 at %2 for %3",_className,inTraderCity,_tCost,_quantity,localize "STR_EPOCH_PLAYER_289",_currency,_container];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -12,16 +12,16 @@ _moneyInVehicle = _moneyInfo select 3;
|
||||
|
||||
if (!_justChecking) then {
|
||||
{
|
||||
_nil = [player, _x , 1] call BIS_fnc_invRemove;
|
||||
_nil = [player, _x , 1] call BIS_fnc_invRemove;
|
||||
} count _moneyInGear;
|
||||
|
||||
_moneyInGear = []; // Clear since money is removed now
|
||||
|
||||
if (count _moneyInBackpack > 0) then {
|
||||
_nil = [unitBackpack _player, _moneyInBackpack, [], []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
|
||||
_nil = [unitBackpack _player, _moneyInBackpack, [], []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
|
||||
};
|
||||
if (!isNull Z_vehicle && count _moneyInVehicle > 0) then {
|
||||
_nil = [Z_vehicle, _moneyInVehicle, [], []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
|
||||
_nil = [Z_vehicle, _moneyInVehicle, [], []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user