mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +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
49 lines
1.9 KiB
Plaintext
49 lines
1.9 KiB
Plaintext
/**
|
|
* call Z_calcPrice
|
|
*
|
|
* Calculate the total price for single currency.
|
|
**/
|
|
private ["_sellPrice","_ctrlText","_bTotal"];
|
|
#include "defines.hpp"
|
|
|
|
_bTotal = 0;
|
|
_sellPrice = 0;
|
|
|
|
if (Z_SingleCurrency) then {
|
|
_ctrlText = "";
|
|
if (Z_Selling) then {
|
|
{
|
|
_sellPrice = _sellPrice + (_x select 2);
|
|
} count Z_SellArray;
|
|
_ctrlText = format["%1 %2",[_sellPrice] call BIS_fnc_numberText,CurrencyName];
|
|
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText format ["%1 (%2 items)", localize "STR_EPOCH_TRADE_SELLING", count Z_SellArray];
|
|
} else {
|
|
{
|
|
_sellPrice = _sellPrice + ((_x select 2) * (_x select 9));
|
|
_bTotal = _bTotal + (_x select 9);
|
|
} count Z_BuyingArray;
|
|
_ctrlText = format["%1 %2",[_sellPrice] call BIS_fnc_numberText,CurrencyName];
|
|
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText format ["%1 (%2 items)", localize "STR_EPOCH_TRADE_BUYING", _bTotal];
|
|
};
|
|
ctrlSetText [Z_AT_PRICEDISPLAY, _ctrlText];
|
|
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_PRICEINFO) ctrlSetStructuredText parseText '';
|
|
} else {
|
|
if (Z_Selling) then {
|
|
_ctrlText = "";
|
|
{
|
|
_sellPrice = _sellPrice + ((_x select 2) * (_x select 11));
|
|
} count Z_SellArray;
|
|
_ctrlText = [_sellPrice,false] call Z_calcCurrency;
|
|
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText format ["%1 (%2 items)", localize "STR_EPOCH_TRADE_SELLING", count Z_SellArray];
|
|
} else {
|
|
{
|
|
_sellPrice = _sellPrice + ((_x select 2) * (_x select 11) * (_x select 9));
|
|
_bTotal = _bTotal + (_x select 9);
|
|
} count Z_BuyingArray;
|
|
_ctrlText = [_sellPrice,false] call Z_calcCurrency;
|
|
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText format ["%1 (%2 items)", localize "STR_EPOCH_TRADE_BUYING", _bTotal];
|
|
};
|
|
ctrlSetText [Z_AT_PRICEDISPLAY, ''];
|
|
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_PRICEINFO) ctrlSetStructuredText parseText _ctrlText;
|
|
};
|