Config to make Temp Vehicles tradeable

This commit is contained in:
He-Man 2018-04-06 17:57:42 +02:00
parent 8b6d609572
commit 561012b09c
3 changed files with 16 additions and 6 deletions

View File

@ -13,12 +13,13 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/traders/EPOCH_startNpcTrade.sqf https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/traders/EPOCH_startNpcTrade.sqf
*/ */
private ["_PlayerItemsOutBox","_TraderItemsOutBox","_config","_current_crypto","_sizeIn","_arrayIn","_item","_rounds","_mags","_itemMags","_index","_sizeOut","_arrayOut","_itemWorth","_itemTax","_tax","_maxrnd"]; private ["_EnableTempVehTrade","_PlayerItemsOutBox","_TraderItemsOutBox","_config","_current_crypto","_sizeIn","_arrayIn","_item","_rounds","_mags","_itemMags","_index","_sizeOut","_arrayOut","_itemWorth","_itemTax","_tax","_maxrnd"];
if (!isNil "EPOCH_TRADE_STARTED") exitWith{}; if (!isNil "EPOCH_TRADE_STARTED") exitWith{};
if (isNull _this) exitWith{}; if (isNull _this) exitWith{};
if (alive _this) then { if (alive _this) then {
_EnableTempVehTrade = ["CfgEpochClient", "EnableTempVehTrade", false] call EPOCH_fnc_returnConfigEntryV2;
_PlayerItemsOutBox = 41501; _PlayerItemsOutBox = 41501;
_TraderItemsOutBox = 41502; _TraderItemsOutBox = 41502;
_config = 'CfgPricing' call EPOCH_returnConfig; _config = 'CfgPricing' call EPOCH_returnConfig;
@ -65,7 +66,7 @@ if (alive _this) then {
if (!isNull _vehicle) then { if (!isNull _vehicle) then {
if (local _vehicle) then { if (local _vehicle) then {
_vehSlot = _vehicle getVariable["VEHICLE_SLOT", "ABORT"]; _vehSlot = _vehicle getVariable["VEHICLE_SLOT", "ABORT"];
if (_vehSlot != "ABORT") then { if (_vehSlot != "ABORT" || _EnableTempVehTrade) then {
_arrayIn pushBack [_item,_rounds]; _arrayIn pushBack [_item,_rounds];
_added = true; _added = true;
}; };

View File

@ -200,6 +200,8 @@ class CfgEpochClient
Fav_FastWeaponSwitching = "false"; // If enabled, same slot weapons from favorites bar are equipped instantly, otherwise reload action is played (recommended for immersion) Fav_FastWeaponSwitching = "false"; // If enabled, same slot weapons from favorites bar are equipped instantly, otherwise reload action is played (recommended for immersion)
Fav_BannedItems[] = {"FAK"}; // Items that users are not allowed to pin Fav_BannedItems[] = {"FAK"}; // Items that users are not allowed to pin
EnableTempVehTrade = "false"; // Enable selling of temp Vehicles (not handled by Epoch). Temp Vehicles will not be stored in Traders, but can be sold
// Advanced Vehicle Repair // Advanced Vehicle Repair
UseAdvancedVehicleRepair = "true"; // Switch On / Off Advanced Vehicle Repair (Does not effect SuppressedCraftingItems !) UseAdvancedVehicleRepair = "true"; // Switch On / Off Advanced Vehicle Repair (Does not effect SuppressedCraftingItems !)
EnableRemoveParts = "true"; // Enable removing Tires / Engines from Vehicles EnableRemoveParts = "true"; // Enable removing Tires / Engines from Vehicles

View File

@ -17,12 +17,13 @@ private [ "_MaxBankDebit","_SkipOut","_VAL","_aiItems","_bankBalance","_bankData
"_group","_helipad","_helipads","_item","_itemClasses","_itemQty","_itemQtys","_itemTax","_itemWorth","_itemsIn","_itemsOut","_lockOwner","_makeTradeIn","_message","_nearByHolder", "_group","_helipad","_helipads","_item","_itemClasses","_itemQty","_itemQtys","_itemTax","_itemWorth","_itemsIn","_itemsOut","_lockOwner","_makeTradeIn","_message","_nearByHolder",
"_objHiveKey","_objOwner","_playerCryptoLimit","_playerGroup","_playerNetID","_playerUID","_position","_qtyIndex","_response","_return","_returnIn","_returnOut","_road", "_objHiveKey","_objOwner","_playerCryptoLimit","_playerGroup","_playerNetID","_playerUID","_position","_qtyIndex","_response","_return","_returnIn","_returnOut","_road",
"_serverSettingsConfig","_slot","_smoke","_tax","_tmpposition","_tradeIn","_tradeOut","_tradeQtyTotal","_tradeTotal","_vars","_vehHiveKey","_vehObj","_vehSlot","_vehicle","_vehicleBought", "_serverSettingsConfig","_slot","_smoke","_tax","_tmpposition","_tradeIn","_tradeOut","_tradeQtyTotal","_tradeTotal","_vars","_vehHiveKey","_vehObj","_vehSlot","_vehicle","_vehicleBought",
"_vehicleSold","_vehicles","_vehslot","_wH","_wHPos","_wp","_kIndex","_playerCStats","_playerKarma","_playerKarmaAdj" "_vehicleSold","_vehicles","_vehslot","_wH","_wHPos","_wp","_kIndex","_playerCStats","_playerKarma","_playerKarmaAdj","_EnableTempVehTrade"
]; ];
params ["_trader","_itemsIn","_itemsOut","_player",["_token","",[""]] ]; params ["_trader","_itemsIn","_itemsOut","_player",["_token","",[""]] ];
_playerUID = getplayeruid _player; _playerUID = getplayeruid _player;
_EnableTempVehTrade = ["CfgEpochClient", "EnableTempVehTrade", false] call EPOCH_fnc_returnConfigEntryV2;
_serverSettingsConfig = configFile >> "CfgEpochServer"; _serverSettingsConfig = configFile >> "CfgEpochServer";
_vehicleSold = false; _vehicleSold = false;
_vehicleBought = false; _vehicleBought = false;
@ -75,7 +76,15 @@ if (_slot != -1) then {
_playerNetID = owner _player; _playerNetID = owner _player;
if (_playerNetID == (owner _vehicle)) then { if (_playerNetID == (owner _vehicle)) then {
_vehSlot = _vehicle getVariable["VEHICLE_SLOT", "ABORT"]; _vehSlot = _vehicle getVariable["VEHICLE_SLOT", "ABORT"];
if (!_vehicleSold && _vehSlot != "ABORT") then { if (!_vehicleSold && (_vehSlot != "ABORT" || _EnableTempVehTrade)) then {
_vehicleSold = true;
_makeTradeIn = true;
if (_vehSlot == "ABORT") exitwith {
_itemQty = 0;
_itemsIn set [_foreachindex,[_item,_itemQty]];
removeFromRemainsCollector [_vehicle];
deleteVehicle _vehicle;
};
_BaseClass = _vehicle getvariable ["VEHICLE_BaseClass",""]; _BaseClass = _vehicle getvariable ["VEHICLE_BaseClass",""];
if !(_BaseClass isequalto "") then { if !(_BaseClass isequalto "") then {
_item = _BaseClass; _item = _BaseClass;
@ -83,13 +92,11 @@ if (_slot != -1) then {
}; };
removeFromRemainsCollector [_vehicle]; removeFromRemainsCollector [_vehicle];
deleteVehicle _vehicle; deleteVehicle _vehicle;
_vehicleSold = true;
_vehHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), _vehSlot]; _vehHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), _vehSlot];
_VAL = []; _VAL = [];
["Vehicle", _vehHiveKey, _VAL] call EPOCH_fnc_server_hiveSET; ["Vehicle", _vehHiveKey, _VAL] call EPOCH_fnc_server_hiveSET;
EPOCH_VehicleSlots pushBack _vehSlot; EPOCH_VehicleSlots pushBack _vehSlot;
missionNamespace setVariable ['EPOCH_VehicleSlotCount', count EPOCH_VehicleSlots, true]; missionNamespace setVariable ['EPOCH_VehicleSlotCount', count EPOCH_VehicleSlots, true];
_makeTradeIn = true;
}; };
}; };
}; };