Files
DayZ-Epoch/SQF/dayz_code/actions/AdvancedTrading/functions/DZE_deleteTradedVehicle.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

68 lines
2.4 KiB
Plaintext

private ["_localResult2","_VehKey2","_keyArr","_deleteRet","_vehicle","_delType","_containerFindKey"];
_VehKey2 = (_this select 0) select 0;
_delType = _this select 1;
_containerFindKey = {
private ["_keys","_weapTypes"];
_keys = [];
_weapTypes = (_this select 1) select 0;
{
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"]) then {
if (str(getNumber(configFile >> "CfgWeapons" >> _x >> "keyid")) == (_this select 0)) then {
_keys set [count _keys, _x];
};
};
} forEach _weapTypes;
_keys;
};
if ((count _VehKey2) > 0) then {
if ((_VehKey2 select 0) == "0" || _delType in DZE_tradeVehicleKeyless) then {
_localResult2 = 1;
} else {
{
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"]) then {
if (str(getNumber(configFile >> "CfgWeapons" >> _x >> "keyid")) == (_VehKey2 select 0)) then {
_localResult2 = [player,_x,1] call BIS_fnc_invRemove;
};
};
} forEach (items player);
if ((typeOf (unitBackPack player)) != "") then {
_keyArr = [(_VehKey2 select 0), (getWeaponCargo (unitBackpack player))] call _containerFindKey;
_deleteRet = [unitBackpack player,[],_keyArr,[]] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
if (isNil "_localResult2") then {
_localResult2 = ((_deleteRet select 1) select 0);
} else {
if (_localResult2 == 0) then {
_localResult2 = ((_deleteRet select 1) select 0);
};
};
};
_vehicle = DZE_myVehicle;
if (count _this > 2 && {isNull _vehicle}) then {
_vehicle = _this select 2;
};
if (!isNull _vehicle) then {
_keyArr = [(_VehKey2 select 0), (getWeaponCargo _vehicle)] call _containerFindKey;
_deleteRet = [_vehicle,[],_keyArr,[]] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
if (isNil "_localResult2") then {
_localResult2 = ((_deleteRet select 1) select 0);
} else {
if (_localResult2 == 0) then {
_localResult2 = ((_deleteRet select 1) select 0);
};
};
};
if (!DZE_SaleRequiresKey) then {_localResult2 = 1;};
};
if (isNil "_localResult2") then {
_localResult2 = 0;
} else {
PVDZ_obj_Destroy = [(_VehKey2 select 2),(_VehKey2 select 3),player];
publicVariableServer "PVDZ_obj_Destroy";
deleteVehicle (_VehKey2 select 1);
};
} else {
_localResult2 = 0;
};
_localResult2;