Files
DayZ-Epoch/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_payDefault.sqf
oiad 1c7e96a0ff Advanced trading modifications, maintain_area modifications (#1780)
* Advanced trading modifications, maintain_area modifications

This lot of changes brings forth the following:

Sets up a "default" set of compiles that are the minimum needed for
maintain_area.sqf and custom scripts to utilize the gem based currency
that @icomrade added.

maintain_area.sqf: This will now utilize the gem based currency system.

Removed the redundant Z_Vehicle and replaced it with the Epoch built in
DZE_myVehicle

z_at_buyItems: Code tidying and optimization

z_at_checkCloseVehicle: Tidied up the code since removing Z_Vehicle
allowed us to remove some now useless code.

z_at_getVehicleItems: Removed the nearestObjects check for your vehicle
since we now do z_checkCloseVehicle on Advanced trading start up.

* Advanced trading missed redundant variables

As per description

* Advanced trading rework

We don't need to check for close vehicle anymore now for backpack money
since we've made z_vehicle redundant.

* Revert "Advanced trading rework"

This reverts commit a589bd19b9.

* Advanced trading rework

We don't need to check for close vehicle anymore now for backpack money
since we've made z_vehicle redundant.

* Advanced trading rework

More rework

* Remove single currency add/remove coins functions

at request of @ebaydayz.
2016-10-28 19:29:04 -04:00

35 lines
1.1 KiB
Plaintext

private ["_player","_toPay","_moneyInfo","_totalWorth","_moneyInGear","_moneyInBackpack","_moneyInVehicle","_success","_justChecking","_regularMagsToBuy"];
_player = _this select 0;
_toPay = _this select 1;
_moneyInfo = _this select 2;
_justChecking = _this select 3;
_regularMagsToBuy = _this select 4;
_totalWorth = _moneyInfo select 4;
_moneyInGear = _moneyInfo select 1;
_moneyInBackpack = _moneyInfo select 2;
_moneyInVehicle = _moneyInfo select 3;
if (!_justChecking) then {
{
_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;
};
if (!isNull DZE_myVehicle && count _moneyInVehicle > 0) then {
_nil = [DZE_myVehicle, _moneyInVehicle, [], []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
};
};
if (_totalWorth - _toPay == 0) then { // Money in inventory was exact amount
_success = true;
} else {
_success = [_toPay,_totalWorth,_justChecking,_regularMagsToBuy,_moneyInGear,_moneyInBackpack,false] call Z_returnChange;
};
_success