Files
DayZ-Epoch/SQF/dayz_code/actions/AdvancedTrading/defaultInit.sqf
oiad 9889c8cd76 Merge z_calcDefaultCurrency and z_calcDefaultCurrencyNoImg (#1824)
* 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
2016-12-22 14:16:38 -05:00

40 lines
1.3 KiB
Plaintext

#define STRINGIFY(x) #x
#define PATH(sub_path) STRINGIFY(\z\addons\dayz_code\actions\AdvancedTrading\functions\sub_path)
#define CPP compile preprocessFileLineNumbers
private ["_tempGemList","_tempWorthList","_largest","_LargestGem"];
Z_SellingFrom = 2;
DZE_GemList = [];
DZE_GemWorthList = [];
_tempGemList = [];
_tempWorthList = [];
{
_tempGemList set [(count _tempGemList), (_x select 0)];
_tempWorthList set [(count _tempWorthList), (_x select 1)];
} count DZE_GemWorthArray;
for "_i" from 0 to ((count _tempGemList) - 1) do {
_largest = -1e9;
{
_largest = _largest max _x;
} forEach _tempWorthList;
_LargestGem = _tempGemList select (_tempWorthList find _largest);
_tempWorthList = _tempWorthList - [_largest];
_tempGemList = _tempGemList - [_LargestGem];
DZE_GemList set [(count DZE_GemList), _LargestGem];
DZE_GemWorthList set [(count DZE_GemWorthList), _largest];
};
Z_checkCloseVehicle = CPP PATH(z_at_checkCloseVehicle.sqf);
Z_canAfford = CPP PATH(z_at_canAfford.sqf);
Z_calcFreeSpace = CPP PATH(z_at_calcFreeSpace.sqf);
Z_returnChange = CPP PATH(z_at_returnChange.sqf);
Z_payDefault = CPP PATH(z_at_payDefault.sqf);
z_calcCurrency = CPP PATH(z_at_calcCurrency.sqf);
ZUPA_fnc_removeWeaponsAndMagazinesCargo = CPP PATH(zupa_fnc_removeWeaponsAndMagazinesCargo.sqf);