From 82b9ccf8b9978eee2871fad8ecfceeb068d95db7 Mon Sep 17 00:00:00 2001 From: Bjanski Date: Tue, 26 Jul 2016 13:08:57 +0200 Subject: [PATCH] Added new app Deploy Vehicle Small fix Server Info App --- .../XM8/Apps/DeployVehicle/config.sqf | 121 ++++++++++++++++++ .../ExAdClient/XM8/Apps/Info/onOpen.sqf | 1 + .../ExAdClient/XM8/Functions/fn_addApps.sqf | 5 +- 3 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 mpmissions/Exile.Altis/ExAdClient/XM8/Apps/DeployVehicle/config.sqf diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/DeployVehicle/config.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/DeployVehicle/config.sqf new file mode 100644 index 0000000..9f4d9a5 --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/DeployVehicle/config.sqf @@ -0,0 +1,121 @@ +ExAd_DV_DESPAWN_IDLE_TIME = 600; + +ExAd_XM8_DV_fnc_itemsInCargo = { + params ["_container","_itemArray","_item","_amount","_response"]; + + _item = toLower (_itemArray select 0); + _amount = _itemArray select 1; + + _response = false; + { + if(_item == toLower _x)then{ + _amount = _amount - 1; + }; + if(_amount <= 0)exitWith{_response = true} + }forEach magazines player; + + _response +}; + +ExAd_XM8_DV_fnc_itemsMissing = { + params["_recipe","_recipeStr"]; + + _recipeStr = ""; + { + private["_amount","_configName","_displayName","_text"]; + _amount = if(count _x > 1)then{_x select 1}else{1}; + _text = [_x select 0] call ExAd_XM8_DV_fnc_getDisplayName; + _recipeStr = _recipeStr + format["%1x : %2
",_amount, _text]; + }forEach _recipe; + + _response = format["You need
%1",_recipeStr]; + + _response +}; + +ExAd_XM8_DV_fnc_getDisplayName = { + params["_class","_configName","_displayName"]; + _configName = _class call ExileClient_util_gear_getConfigNameByClassName; + _displayName = getText(configFile >> _configName >> _class >> "displayName"); + _text = if(count _displayName > 0)then{_displayName}else{_class}; + + _text +}; + +ExAd_XM8_DV_fnc_canPack = { + ( ExileClientInteractionObject getVariable["ExAd_DV_Packable", false] ) +}; + +ExAd_XM8_DV_fnc_pack = { + ["despawnDeployableVehicle", [netId ExileClientInteractionObject]] call ExAd_fnc_serverDispatch; + +}; + +ExAd_XM8_DV_fnc_spawnVehicle = { + params["_slideClass","_bambiState","_delopyRecipe","_vehicleClass"]; + + try + { + _bambiState = if(isNumber(missionConfigFile >> "CfgXM8" >> _slideClass >> "bambiState")) then + { + if(getNumber(missionConfigFile >> "CfgXM8" >> _slideClass >> "bambiState") > 0)then{true}else{false} + } else {true}; + + if(_bambiState && !ExileClientPlayerIsBambi) then { throw "You can only spawn vehicles as a bambi!"}; + + _delopyRecipe = getArray(missionConfigFile >> "CfgXM8" >> _slideClass >> "recipe"); + if(count _delopyRecipe > 0) then + { + { + if(count _x > 1) then + { + _amount = if(_x select 1 == -1)then{1}else{_x select 1}; + if!([player, [_x select 0, _amount]] call ExAd_XM8_DV_fnc_itemsInCargo) then + { + throw ([_delopyRecipe] call ExAd_XM8_DV_fnc_itemsMissing); + }; + } else { + if!([player, _x select 0] call ExileClient_util_playerEquipment_contains) then + { + throw ([_delopyRecipe] call ExAd_XM8_DV_fnc_itemsMissing); + } + } + }forEach _delopyRecipe; + + { + _count = if(count _x > 1)then{(_x select 1)}else{1}; + for "_i" from 1 to _count do { + [player, _x select 0] call ExileClient_util_playerCargo_remove + } + }forEach _delopyRecipe; + }; + + _vehicleClass = getText(missionConfigFile >> "CfgXM8" >> _slideClass >> "vehicleClass"); + if!(isClass(configFile >> "CfgVehicles" >> _vehicleClass ))then { throw "The vehicle class doesn't exist"}; + + [_slideClass] spawn { + params["_slideClass"]; + disableUserInput true; + player playActionNow "Medic"; + + uiSleep 3; + ["spawnDeployableVehicle", [netId player, _slideClass]] call ExAd_fnc_serverDispatch; + uiSleep 1; + ["SuccessTitleAndText", ["Vehicle deployed"]] call ExileClient_gui_toaster_addTemplateToast; + ExileClientXM8CurrentSlide = "extraApps"; + disableUserInput false; + }; + + ["extraApps", 1] call ExileClient_gui_xm8_slide; + closeDialog 0; + + + } + catch{ + [_exception] spawn { + UISleep 0.5; + ["ErrorTitleAndText", ["ExAd - Deploy Vehicle", _this select 0]] call ExileClient_gui_toaster_addTemplateToast; + ["extraApps", 1] call ExileClient_gui_xm8_slide; + }; + }; +}; \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/Info/onOpen.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/Info/onOpen.sqf index 6507030..e037193 100644 --- a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/Info/onOpen.sqf +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/Info/onOpen.sqf @@ -20,6 +20,7 @@ try _pos = ctrlPosition _strTxt; _strTxt ctrlSetPosition [_pos select 0, _pos select 1, _pos select 2, ctrlTextHeight _strTxt]; _strTxt ctrlcommit 0; + ([_display,"ExAd_Info","strTxt"] call ExAd_fnc_getAppCtrl) ctrlEnable true; } catch { diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_addApps.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_addApps.sqf index e9ada58..cfe81c6 100644 --- a/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_addApps.sqf +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_addApps.sqf @@ -53,7 +53,10 @@ _pW = 0.025; _pH = 0.04; [_display,_slide,([_x,format["AppIcon%1",_count2]] call ExAd_fnc_getNextIDC),[(_pos select 0) + 1.5 * _pW, (_pos select 1) + 0.625 * _pH, 3 * _pW, 3 * _pH],_logo,[1,1,1,1],false,true,""] call ExAd_fnc_createPicture; _ctrl ctrlSetText getText(missionConfigFile >> "CfgXM8" >> _x >> "title"); - _ctrl ctrlSetEventHandler ["ButtonClick", format["['%1', 0] call ExileClient_gui_xm8_slide",_x]]; + _function = if(isText(missionConfigFile >> "CfgXM8" >> _x >> "quickFunction"))then{ + getText(missionConfigFile >> "CfgXM8" >> _x >> "quickFunction") + } else {format["['%1', 0] call ExileClient_gui_xm8_slide",_x]}; + _ctrl ctrlSetEventHandler ["ButtonClick", _function]; _count2 = _count2 + 1; }forEach _apps;