mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
* 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
88 lines
3.2 KiB
Plaintext
88 lines
3.2 KiB
Plaintext
private ["_Z_logTrade","_classNames","_className","_amounts","_amount","_prices","_price","_quantity","_queueAmounts","_queueNames","_queuePrices","_index","_buyOrSell"];
|
|
|
|
_Z_logTrade = {
|
|
private ["_buyOrSell","_className","_container","_currency","_price","_quantity","_tCost"];
|
|
|
|
_className = _this select 0;
|
|
_quantity = _this select 1;
|
|
_buyOrSell = _this select 2;
|
|
_price = _this select 3;
|
|
_container = switch (Z_SellingFrom) do {
|
|
case 0 : {localize "STR_EPOCH_TRADE_BACKPACK"};
|
|
case 1 : {localize "STR_EPOCH_TRADE_VEHICLE"};
|
|
case 2 : {localize "STR_UI_GEAR"};
|
|
};
|
|
_tCost = _price call Z_calcDefaultCurrencyNoImg;
|
|
_currency = if (Z_SingleCurrency) then {"Coins"} else {""};
|
|
|
|
// Log to client RPT
|
|
if (Z_SingleCurrency) then {
|
|
if (_buyOrSell == "buy") then {
|
|
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 %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: 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 %4x %1 from %7 at %2 for %3",_className,inTraderCity,_tCost,_quantity,localize "STR_EPOCH_PLAYER_289",_currency,_container];
|
|
};
|
|
};
|
|
|
|
// Log to server RPT
|
|
if (DZE_serverLogTrades) then {
|
|
if (Z_SingleCurrency) then {
|
|
if (_buyOrSell == "buy") then {
|
|
PVDZE_obj_Trade = [player,0,0,_className,inTraderCity,_currency,_price,_quantity,_container,false];
|
|
} else {
|
|
PVDZE_obj_Trade = [player,0,1,_className,inTraderCity,_currency,_price,_quantity,_container,false];
|
|
};
|
|
} else {
|
|
if (_buyOrSell == "buy") then {
|
|
PVDZE_obj_Trade = [player,0,0,_className,inTraderCity,_currency,_tCost,_quantity,_container,false];
|
|
} else {
|
|
PVDZE_obj_Trade = [player,0,1,_className,inTraderCity,_currency,_tCost,_quantity,_container,false];
|
|
};
|
|
};
|
|
publicVariableServer "PVDZE_obj_Trade";
|
|
};
|
|
};
|
|
|
|
_classNames = _this select 0;
|
|
_amounts = _this select 1;
|
|
_amounts = _amounts - [0];
|
|
_prices = _this select 2;
|
|
_buyOrSell = _this select 3;
|
|
_queueNames = [];
|
|
_queueAmounts = [];
|
|
_queuePrices = [];
|
|
{
|
|
_queueAmounts set [_forEachIndex,0];
|
|
_queuePrices set [_forEachIndex,0];
|
|
} forEach _classNames;
|
|
|
|
if (count _prices < 1) exitWith {};
|
|
|
|
for "_i" from 0 to (count _prices)-1 do {
|
|
_className = _classNames select _i;
|
|
_amount = _amounts select _i;
|
|
_price = _prices select _i;
|
|
_quantity = {(_className == _x)} count _classNames;
|
|
|
|
if (_quantity > 1) then {
|
|
if !(_className in _queueNames) then {_queueNames set [count _queueNames,_className];};
|
|
_index = _queueNames find _className;
|
|
_queueAmounts set [_index, (_queueAmounts select _index) + _amount];
|
|
_queuePrices set [_index, (_queuePrices select _index) + _price];
|
|
} else {
|
|
[_className, _amount, _buyOrSell, _price] call _Z_logTrade;
|
|
};
|
|
};
|
|
|
|
if (count _queueNames > 0) then {
|
|
for "_i" from 0 to (count _queueNames)-1 do {
|
|
[_queueNames select _i, _queueAmounts select _i, _buyOrSell, _queuePrices select _i] call _Z_logTrade;
|
|
};
|
|
};
|