mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
* server_updateObject force update for single currency This modifies server_updateObject to force update/save to the hive if the item being saved is in the DZE_MoneyStorageClasses array. Previously if you force saved the object multiple times, the coins would not get updated until the inventory changed, which if this was for a bank object it would never update. (This applies if you are using PVDZ_veh_Save to save the object) * z_at_calcDefaultCurrencyNoImg prettyfication This fixes a long standing issue in my brain about how this text was always displayed, to me it seemed very untidy and just thrown together (since I borrowed it from the IMG version) Changes the output from this example: 7 Ruby 1 Amethyst 3 Gold 4 10oz Silver 5 Silver To this prettier and more logical example: 7 Ruby, 1 Amethyst, 3 Gold, 4 10oz Silver and 5 Silver Make texts great again! * z_at_logtrade fixes Removes hard coded "Coins" text and replaces it with configVariables version. Also removes duplicate code and simplifies it. * Merge z_calcDefaultCurrency and z_calcDefaultCurrencyNoImg This merges these two files together since they are largely the same, this also adds an optional argument to change the font size which is useful for custom scripts that use this function. Examples of use: [_number,true] call z_calcCurrency; // Return a string of text with no images [_number,false] call z_calcCurrency; // Return a string of text with images [_number,false,0.7] call z_calcCurrency; // Return a string of text with the currency in it and sets the font size to 0.7
76 lines
2.8 KiB
Plaintext
76 lines
2.8 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,true] call Z_calcCurrency;
|
|
_currency = if (Z_SingleCurrency) then {CurrencyName} 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 %3 %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 %3 %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 {
|
|
PVDZE_obj_Trade = [player,0,if (_buyOrSell == "buy") then {0} else {1},_className,inTraderCity,_currency,if (Z_singleCurrency) then {_price} else {_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;
|
|
};
|
|
};
|