diff --git a/@ExileServer/addons/exad_vg/Functions/fn_VGStore.sqf b/@ExileServer/addons/exad_vg/Functions/fn_VGStore.sqf index 1397d17..b529c75 100644 --- a/@ExileServer/addons/exad_vg/Functions/fn_VGStore.sqf +++ b/@ExileServer/addons/exad_vg/Functions/fn_VGStore.sqf @@ -34,6 +34,7 @@ if!(isNil "ExAd_VG_CLEAN_ON_STORE")then{ clearItemCargoGlobal _objVeh; clearMagazineCargoGlobal _objVeh; clearWeaponCargoGlobal _objVeh; + _objVeh setVariable ["ExileMoney", 0, true]; } }; diff --git a/@ExileServer/extDB/sql_custom_v2/exile.ini b/@ExileServer/extDB/sql_custom_v2/exile.ini index ca73efe..2b0340c 100644 --- a/@ExileServer/extDB/sql_custom_v2/exile.ini +++ b/@ExileServer/extDB/sql_custom_v2/exile.ini @@ -1,4 +1,4 @@ -;1. Find [loadVehicleIdPage] and replace the section with this; +;1. Find following sections and replace the commented lines; [loadVehicleIdPage] ;SQL1_1 = SELECT id FROM vehicle LIMIT ?,? @@ -7,6 +7,27 @@ Number Of Inputs = 2 SQL1_INPUTS = 1,2 OUTPUT = 1 +; Removes vehicles that were not used within ? days +[deleteOldVehicles] +;SQL1_1 = DELETE FROM vehicle WHERE deleted_at < DATE_SUB(NOW(), INTERVAL ? DAY) +SQL1_1 = DELETE FROM vehicle WHERE territory_id IS NULL AND deleted_at < DATE_SUB(NOW(), INTERVAL ? DAY) +Number Of Inputs = 1 +SQL1_INPUTS = 1 + +; Marks for deletion vehicles that were not used within ? days +[markDeleteOldVehicles] +; SQL1_1 = UPDATE vehicle SET deleted_at = NOW() WHERE last_updated_at < DATE_SUB(NOW(), INTERVAL ? DAY) +SQL1_1 = UPDATE vehicle SET deleted_at = NOW() WHERE last_updated_at < DATE_SUB(NOW(), INTERVAL ? DAY) AND territory_id IS NULL +Number Of Inputs = 1 +SQL1_INPUTS = 1 + +; Removes vehicles that were not used within ? days +[deleteOldVehicles] +; SQL1_1 = DELETE FROM vehicle WHERE deleted_at < DATE_SUB(NOW(), INTERVAL ? DAY) AND territory_id IS NULL +SQL1_1 = DELETE FROM vehicle WHERE deleted_at < DATE_SUB(NOW(), INTERVAL ? DAY) +Number Of Inputs = 1 +SQL1_INPUTS = 1 + ;2. Add all below in the end of the file. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Virtual Garage related queries | ADDED BY [ExAd]Jan diff --git a/docs/XM8/createApp.md b/docs/XM8/createApp.md new file mode 100644 index 0000000..63cf99b --- /dev/null +++ b/docs/XM8/createApp.md @@ -0,0 +1,11 @@ +#Create Apps + +To create an app you need follow 4 simple steps + +1. + +2. + +3. + +4. diff --git a/mpmissions/Exile.Altis/ExAdClient/CfgFunctions.cpp b/mpmissions/Exile.Altis/ExAdClient/CfgFunctions.cpp index 4973641..6539250 100644 --- a/mpmissions/Exile.Altis/ExAdClient/CfgFunctions.cpp +++ b/mpmissions/Exile.Altis/ExAdClient/CfgFunctions.cpp @@ -27,4 +27,4 @@ class ExAd //#include "Grinding\CfgFunctions.cpp" //#include "HaloParachute\CfgFunctions.cpp" //#include "XM8\CfgFunctions.cpp" -}; +}; \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/Core/Functions/Utils/fn_localize.sqf b/mpmissions/Exile.Altis/ExAdClient/Core/Functions/Utils/fn_localize.sqf index 538aedd..1f4d718 100644 --- a/mpmissions/Exile.Altis/ExAdClient/Core/Functions/Utils/fn_localize.sqf +++ b/mpmissions/Exile.Altis/ExAdClient/Core/Functions/Utils/fn_localize.sqf @@ -1 +1 @@ -/* fn_localize.sqf Copyright 2016 Jan Babor Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ params [ ["_key", "", [""]], ["_value","N/A",[""]] ]; if(count _key == 0)exitWith{["localize", "_key is undefined/empty"] call ExAd_fnc_DebugHandler}; call compile format['%1 = if(isLocalized "%1")then{localize "%1"}else{"%3"};', _key, _value]; true \ No newline at end of file +/* fn_localize.sqf Copyright 2016 Jan Babor Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ params [ ["_key", "", [""]], ["_value","N/A",[""]] ]; if(count _key == 0)exitWith{["localize", "_key is undefined/empty"] call ExAd_fnc_DebugHandler}; call compile format['%1 = if(isLocalized "%1")then{localize "%1"}else{"%2"};', _key, _value]; true \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/VirtualGarage/Functions/fn_onBtnClickVG.sqf b/mpmissions/Exile.Altis/ExAdClient/VirtualGarage/Functions/fn_onBtnClickVG.sqf index 5b80d24..2abf36a 100644 --- a/mpmissions/Exile.Altis/ExAdClient/VirtualGarage/Functions/fn_onBtnClickVG.sqf +++ b/mpmissions/Exile.Altis/ExAdClient/VirtualGarage/Functions/fn_onBtnClickVG.sqf @@ -21,14 +21,14 @@ private ["_fnc","_idc","_data"]; _fnc = [_this,0,nil] call BIS_fnc_param; _idc = [_this,1,nil] call BIS_fnc_param; -diag_log str _this; - -if(isNil "ExAdCurFlagNetId" || isNil "_fnc" || isNil "_idc")exitWith{false}; +if(isNil "ExAdCurFlagNetId" || isNil "_fnc" || isNil "_idc")exitWith{ + disableUserInput false; + ["extraApps", 1] call ExileClient_gui_xm8_slide; + false +}; _data = lbData [_idc, lbCurSel _idc]; -diag_log str _data; - if(count _data == 0)then{ ["ErrorTitleAndText", ["ExAd - Virtual Garage", "You have to choose a vehicle in the proper list!!"]] call ExileClient_gui_toaster_addTemplateToast; }else{ diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_onCheckedChanged.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_onCheckedChanged.sqf new file mode 100644 index 0000000..464ca26 --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_onCheckedChanged.sqf @@ -0,0 +1,25 @@ +_state = [_this, 0, 0, [0]] call BIS_fnc_param; +_syncVar = [_this, 1, "", [""]] call BIS_fnc_param; +_slider = [_this, 2, controlNull, [0, controlNull]] call BIS_fnc_param; +_text = [_this, 3, controlNull, [0, controlNull]] call BIS_fnc_param; +_sliderView = [_this, 4, controlNull, [0, controlNull]] call BIS_fnc_param; +_varType = [_this, 5, "", [""]] call BIS_fnc_param; + +if (_state == 1) then { + call compile format ["%1 = true",_syncVar]; + call compile format ["profileNamespace setVariable ['%1',%1]", _syncVar]; + ctrlEnable [_slider, false]; + ctrlEnable [_text, false]; + + ctrlSetText [_text, str round ((sliderPosition _sliderView) min CHVD_maxObj)]; + sliderSetPosition [_slider, (sliderPosition _sliderView) min CHVD_maxObj]; + + call compile format ["%1 = %2", _varType, (sliderPosition _sliderView) min CHVD_maxObj]; + call compile format ["profileNamespace setVariable ['%1',%1]", _varType]; + [3] call CHVD_fnc_updateSettings; +} else { + call compile format ["%1 = false",_syncVar]; + call compile format ["profileNamespace setVariable ['%1',%1]", _syncVar]; + ctrlEnable [_slider, true]; + ctrlEnable [_text, true]; +}; \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_onEBinput.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_onEBinput.sqf new file mode 100644 index 0000000..b07294a --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_onEBinput.sqf @@ -0,0 +1,81 @@ +private ["_textValue","_updateType"]; +_varType1 = [_this, 0, "", [""]] call BIS_fnc_param; +_slider1 = [_this, 1, controlNull, [0, controlNull]] call BIS_fnc_param; +_text1 = [_this, 2, controlNull, [0, controlNull]] call BIS_fnc_param; +_varType2 = [_this, 3, "", [""]] call BIS_fnc_param; +_slider2 = [_this, 4, controlNull, [0, controlNull]] call BIS_fnc_param; +_text2 = [_this, 5, controlNull, [0, controlNull]] call BIS_fnc_param; +_syncVar = [_this, 6, "", [""]] call BIS_fnc_param; + +if (count _this < 7) then { + _updateType = 2; +} else { + if (call compile _syncVar) then { + _updateType = 3; + } else { + _updateType = 1; + }; +}; + +switch (_updateType) do { + case 1: { + _textValue = [ctrlText _text1, "0123456789"] call BIS_fnc_filterString; + _textValue = if (_textValue == "") then {0} else {call compile _textValue min 12000 max 0}; + + sliderSetPosition [_slider1, _textValue min CHVD_maxView]; + //ctrlSetText [_text1, str round (_textValue min CHVD_maxView)]; + sliderSetRange [_slider2, 0, _textValue min CHVD_maxView]; + + call compile format ["%1 = %2", _varType1, _textValue min CHVD_maxView]; + call compile format ["profileNamespace setVariable ['%1',%1]", _varType1]; + + if ((call compile _varType2) > _textValue) then { + sliderSetPosition [_slider2, _textValue min CHVD_maxObj]; + ctrlSetText [_text2, str round (_textValue min CHVD_maxObj)]; + + call compile format ["%1 = %2", _varType2, _textValue min CHVD_maxObj]; + call compile format ["profileNamespace setVariable ['%1',%1]", _varType2]; + }; + + [_updateType] call CHVD_fnc_updateSettings; + }; + case 2: { + _textValue = [ctrlText _text1, "0123456789"] call BIS_fnc_filterString; + _textValue = if (_textValue == "") then {0} else {call compile _textValue min 12000 max 0}; + + sliderSetPosition [_slider1, _textValue min CHVD_maxObj]; + //ctrlSetText [_text1, str round (_textValue min CHVD_maxObj)]; + + call compile format ["%1 = %2", _varType1, _textValue min CHVD_maxObj]; + call compile format ["profileNamespace setVariable ['%1',%1]", _varType1]; + + [_updateType] call CHVD_fnc_updateSettings; + }; + case 3: { + _textValue = [ctrlText _text1, "0123456789"] call BIS_fnc_filterString; + _textValue = if (_textValue == "") then {0} else {call compile _textValue min 12000 max 0}; + + sliderSetPosition [_slider1, _textValue min CHVD_maxView]; + //ctrlSetText [_text1, str round (_textValue min CHVD_maxView)]; + sliderSetRange [_slider2, 0, _textValue min CHVD_maxView]; + + call compile format ["%1 = %2", _varType1, _textValue min CHVD_maxView]; + call compile format ["profileNamespace setVariable ['%1',%1]", _varType1]; + + if ((call compile _varType2) > _textValue) then { + sliderSetPosition [_slider2, _textValue min CHVD_maxObj]; + ctrlSetText [_text2, str round (_textValue min CHVD_maxObj)]; + + call compile format ["%1 = %2", _varType2, _textValue min CHVD_maxObj]; + call compile format ["profileNamespace setVariable ['%1',%1]", _varType2]; + }; + + sliderSetPosition [_slider2, _textValue min CHVD_maxObj]; + ctrlSetText [_text2, str round (_textValue min CHVD_maxObj)]; + + call compile format ["%1 = %2", _varType2, _textValue min CHVD_maxObj]; + call compile format ["profileNamespace setVariable ['%1',%1]", _varType2]; + + [_updateType] call CHVD_fnc_updateSettings; + }; +}; \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_onEBterrainInput.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_onEBterrainInput.sqf new file mode 100644 index 0000000..89250d5 --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_onEBterrainInput.sqf @@ -0,0 +1,33 @@ +private ["_textValue"]; +_varType = [_this, 0, "", [""]] call BIS_fnc_param; +_textCtrl = [_this, 1, controlNull, [0, controlNull]] call BIS_fnc_param; +_listbox = [_this, 2, controlNull, [0, controlNull]] call BIS_fnc_param; + +_textValue = [ctrlText _textCtrl, "0123456789."] call BIS_fnc_filterString; +_textValue = if (_textValue == "") then {50} else {call compile _textValue min 50 max 3.125}; + + +if (!CHVD_allowNoGrass) then { + _textValue = _textValue min 48.99; +}; + +//update listbox +_listboxCtrl = (finddisplay 2900) displayCtrl _listbox; +//remove EH not to cause huge lag +_listboxCtrl ctrlRemoveAllEventHandlers "LBSelChanged"; +_sel = [_textValue] call CHVD_fnc_selTerrainQuality; +if (CHVD_allowNoGrass) then { + _listboxCtrl lbSetCurSel _sel; +} else { + _listboxCtrl lbSetCurSel (_sel - 1); +}; +//add EH again +_listboxCtrl ctrlSetEventHandler ["LBSelChanged", + format ["[_this select 1, '%1', %2] call CHVD_fnc_onLBSelChanged", _varType, _textCtrl] +]; + +//ctrlSetText [_textCtrl, str _textValue]; +call compile format ["%1 = %2",_varType, _textValue]; +call compile format ["profileNamespace setVariable ['%1',%1]", _varType]; + +[] call CHVD_fnc_updateTerrain; \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_onLBSelChanged.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_onLBSelChanged.sqf new file mode 100644 index 0000000..180b472 --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_onLBSelChanged.sqf @@ -0,0 +1,27 @@ +private ["_index","_terrainGrid"]; +_index = _this select 0; +_varType = _this select 1; +_text = _this select 2; + +_display = uiNameSpace getVariable ["RscExileXM8", displayNull]; +_ctrl = [_display,"ExAd_CHVD",_text] call ExAd_fnc_getAppCtrl; + +if (!CHVD_allowNoGrass) then { + _index = _index + 1; +}; + +switch (_index) do { + case 0: {_terrainGrid = 50}; + case 1: {_terrainGrid = 25}; + case 2: {_terrainGrid = 12.5}; + case 3: {_terrainGrid = 3.125}; +}; + +if (!CHVD_allowNoGrass) then { + _terrainGrid = _terrainGrid min 48.99; +}; + +_ctrl ctrlSetText format["%1",_terrainGrid]; +call compile format ["%1 = %2",_varType, _terrainGrid]; +call compile format ["profileNamespace setVariable ['%1',%1]", _varType]; +[] call CHVD_fnc_updateTerrain; \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_onSliderChange.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_onSliderChange.sqf new file mode 100644 index 0000000..78f0948 --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_onSliderChange.sqf @@ -0,0 +1,73 @@ +private ["_sliderPos","_updateType"]; +_varType1 = [_this, 0, "", [""]] call BIS_fnc_param; +_slider1 = ctrlIDC ([_this, 1, 0, [0, controlNull]] call BIS_fnc_param); +_sliderPos = [_this, 2, 0, [0]] call BIS_fnc_param; +_text1 = [_this, 3, 0, [0, controlNull]] call BIS_fnc_param; +_varType2 = [_this, 4, "", [""]] call BIS_fnc_param; +_slider2 = [_this, 5, 0, [0, controlNull]] call BIS_fnc_param; +_text2 = [_this, 6, 0, [0, controlNull]] call BIS_fnc_param; +_syncVar = [_this, 7, "", [""]] call BIS_fnc_param; + +if (count _this < 8) then { + _updateType = 2; +} else { + if (call compile _syncVar) then { + _updateType = 3; + } else { + _updateType = 1; + }; +}; + +switch (_updateType) do { + case 1: { + sliderSetPosition [_slider1, _sliderPos min CHVD_maxView]; + ctrlSetText [_text1, str round (_sliderPos min CHVD_maxView)]; + sliderSetRange [_slider2, 0, _sliderPos min CHVD_maxView]; + + call compile format ["%1 = %2", _varType1, _sliderPos min CHVD_maxView]; + call compile format ["profileNamespace setVariable ['%1',%1]", _varType1]; + + if ((call compile _varType2) > _sliderPos) then { + sliderSetPosition [_slider2, _sliderPos min CHVD_maxObj]; + ctrlSetText [_text2, str round (_sliderPos min CHVD_maxObj)]; + + call compile format ["%1 = %2", _varType2, _sliderPos min CHVD_maxObj]; + call compile format ["profileNamespace setVariable ['%1',%1]", _varType2]; + }; + + [_updateType] call CHVD_fnc_updateSettings; + }; + case 2: { + sliderSetPosition [_slider1, _sliderPos min CHVD_maxObj]; + ctrlSetText [_text1, str round (_sliderPos min CHVD_maxObj)]; + + call compile format ["%1 = %2", _varType1, _sliderPos min CHVD_maxObj]; + call compile format ["profileNamespace setVariable ['%1',%1]", _varType1]; + + [_updateType] call CHVD_fnc_updateSettings; + }; + case 3: { + sliderSetPosition [_slider1, _sliderPos min CHVD_maxView]; + ctrlSetText [_text1, str round (_sliderPos min CHVD_maxView)]; + sliderSetRange [_slider2, 0, _sliderPos min CHVD_maxView]; + + call compile format ["%1 = %2", _varType1, _sliderPos min CHVD_maxView]; + call compile format ["profileNamespace setVariable ['%1',%1]", _varType1]; + + if ((call compile _varType2) > _sliderPos) then { + sliderSetPosition [_slider2, _sliderPos min CHVD_maxObj]; + ctrlSetText [_text2, str round (_sliderPos min CHVD_maxObj)]; + + call compile format ["%1 = %2", _varType2, _sliderPos min CHVD_maxObj]; + call compile format ["profileNamespace setVariable ['%1',%1]", _varType2]; + }; + + sliderSetPosition [_slider2, _sliderPos min CHVD_maxObj]; + ctrlSetText [_text2, str round (_sliderPos min CHVD_maxObj)]; + + call compile format ["%1 = %2", _varType2, _sliderPos min CHVD_maxObj]; + call compile format ["profileNamespace setVariable ['%1',%1]", _varType2]; + + [_updateType] call CHVD_fnc_updateSettings; + }; +}; \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_selTerrainQuality.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_selTerrainQuality.sqf new file mode 100644 index 0000000..0853b83 --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_selTerrainQuality.sqf @@ -0,0 +1,20 @@ +private ["_output"]; +_terrainGrid = _this select 0; +switch (true) do { + case (_terrainGrid >= 49): { + _output = 0; + }; + case (_terrainGrid >= 25): { + _output = 1; + }; + case (_terrainGrid >= 12.5): { + _output = 2; + }; + case (_terrainGrid >= 3.125): { + _output = 3; + }; + default { + _output = 0; + }; +}; +_output \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_updateSettings.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_updateSettings.sqf new file mode 100644 index 0000000..e80bb0d --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_updateSettings.sqf @@ -0,0 +1,61 @@ +_updateType = [_this, 0, 0, [0]] call BIS_fnc_param; // 1 - view, 2 - obj, 3 - both, 0 - both and terrain +_inUAV = if (isNil {_this select 1}) then {UAVControl (getConnectedUAV player) select 1 != ""} else {_this select 1}; + +if (_inUAV) then { + switch (true) do { + case (getConnectedUAV player isKindOf "LandVehicle" || getConnectedUAV player isKindOf "Ship"): { + if (_updateType == 1 || _updateType == 0 || _updateType == 3) then { + setViewDistance CHVD_car; + }; + if (_updateType == 2 || _updateType == 0 || _updateType == 3) then { + setObjectViewDistance CHVD_carObj; + }; + }; + case (getConnectedUAV player isKindOf "Man"): { + if (_updateType == 1 || _updateType == 0 || _updateType == 3) then { + setViewDistance CHVD_foot; + }; + if (_updateType == 2 || _updateType == 0 || _updateType == 3) then { + setObjectViewDistance CHVD_footObj; + }; + }; + default { + if (_updateType == 1 || _updateType == 0 || _updateType == 3) then { + setViewDistance CHVD_air; + }; + if (_updateType == 2 || _updateType == 0 || _updateType == 3) then { + setObjectViewDistance CHVD_airObj; + }; + }; + }; +} else { + switch (true) do { + case (vehicle player isKindOf "LandVehicle" || vehicle player isKindOf "Ship"): { + if (_updateType == 1 || _updateType == 0 || _updateType == 3) then { + setViewDistance CHVD_car; + }; + if (_updateType == 2 || _updateType == 0 || _updateType == 3) then { + setObjectViewDistance CHVD_carObj; + }; + }; + case (vehicle player isKindOf "Air"): { + if (_updateType == 1 || _updateType == 0 || _updateType == 3) then { + setViewDistance CHVD_air; + }; + if (_updateType == 2 || _updateType == 0 || _updateType == 3) then { + setObjectViewDistance CHVD_airObj; + }; + }; + default { + if (_updateType == 1 || _updateType == 0 || _updateType == 3) then { + setViewDistance CHVD_foot; + }; + if (_updateType == 2 || _updateType == 0 || _updateType == 3) then { + setObjectViewDistance CHVD_footObj; + }; + }; + }; +}; +if (_updateType == 0) then { + [_inUAV] call CHVD_fnc_updateTerrain; +}; \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_updateTerrain.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_updateTerrain.sqf new file mode 100644 index 0000000..0e5515a --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Functions/fn_updateTerrain.sqf @@ -0,0 +1,27 @@ +_inUAV = if (isNil {_this select 0}) then {UAVControl (getConnectedUAV player) select 1 != ""} else {_this select 0}; + +if (_inUAV) then { + switch (true) do { + case (getConnectedUAV player isKindOf "LandVehicle" || getConnectedUAV player isKindOf "Ship"): { + setTerrainGrid CHVD_carTerrain; + }; + case (getConnectedUAV player isKindOf "Man"): { + setTerrainGrid CHVD_footTerrain; + }; + default { + setTerrainGrid CHVD_airTerrain; + }; + }; +} else { + switch (true) do { + case (vehicle player isKindOf "LandVehicle" || vehicle player isKindOf "Ship"): { + setTerrainGrid CHVD_carTerrain; + }; + case (vehicle player isKindOf "Air"): { + setTerrainGrid CHVD_airTerrain; + }; + default { + setTerrainGrid CHVD_footTerrain; + }; + }; +}; \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Icon_CHVD.paa b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Icon_CHVD.paa new file mode 100644 index 0000000..1aa7949 Binary files /dev/null and b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/Icon_CHVD.paa differ diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/config.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/config.sqf new file mode 100644 index 0000000..bf8e87d --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/config.sqf @@ -0,0 +1,90 @@ + +CHVD_allowNoGrass = true; //TRUE||FALSE + +CHVD_maxView = 12000; //0-12000 + +CHVD_maxObj = 12000; //0-12000 + + +/*///////////////////////////////////////////////////////////////////////////////////// +//////DON'T TOUCH ANYTHING BELLOW THIS HERE IF YOU DON'T KNOW WHAT YOU ARE DOING ////// +/////////////////////////////////////////////////////////////////////////////////////*/ + +{ + _x call ExAd_fnc_localize; +}forEach +[ + ["STR_chvd_title","View Distance Settings"],["STR_chvd_foot","ON FOOT"],["STR_chvd_car","IN CAR"],["STR_chvd_air","IN AIR"],["STR_chvd_view","VIEW"],["STR_chvd_object","OBJECT"],["STR_chvd_terrain","TERRAIN"],["STR_chvd_sync","Sync object with view"],["STR_chvd_close",""],["STR_chvd_low","Low"],["STR_chvd_standard","Standard"],["STR_chvd_high","High"],["STR_chvd_veryHigh","Very High"] +]; + +["STR_chvd_title","View Distance Settings"] call ExAd_fnc_localize; + +{ + _code = ''; + _function = _x select 0; + _file = format["ExAdClient\XM8\Apps\CHVD\Functions\%1", _x select 1]; + + _code = compileFinal (preprocessFileLineNumbers _file); + + missionNamespace setVariable [_function, _code]; +} +forEach +[ + ["CHVD_fnc_onCheckedChanged", "fn_onCheckedChanged.sqf"], + ["CHVD_fnc_onSliderChange", "fn_onSliderChange.sqf"], + ["CHVD_fnc_onLBSelChanged", "fn_onLBSelChanged.sqf"], + ["CHVD_fnc_onEBinput", "fn_onEBinput.sqf"], + ["CHVD_fnc_onEBterrainInput", "fn_onEBterrainInput.sqf"], + ["CHVD_fnc_selTerrainQuality", "fn_selTerrainQuality.sqf"], + ["CHVD_fnc_updateTerrain", "fn_updateTerrain.sqf"], + ["CHVD_fnc_updateSettings", "fn_updateSettings.sqf"] +]; + + +[] spawn { + CHVD_scriptRunning = true; + //Wait for mission init, in case there are variables defined some place else + waitUntil {time > 0 && !isNil "ExileClientPlayerIsSpawned"}; + + //Define variables, load from profileNamespace + CHVD_allowNoGrass = if (isNil "CHVD_allowNoGrass") then {true} else {CHVD_allowNoGrass}; + CHVD_maxView = if (isNil "CHVD_maxView") then {12000} else {CHVD_maxView}; + CHVD_maxObj = if (isNil "CHVD_maxObj") then {12000} else {CHVD_maxObj}; + + CHVD_footSyncObj = profileNamespace getVariable ["CHVD_footSyncObj",false]; + CHVD_carSyncObj = profileNamespace getVariable ["CHVD_carSyncObj",false]; + CHVD_airSyncObj = profileNamespace getVariable ["CHVD_airSyncObj",false]; + + CHVD_foot = (profileNamespace getVariable ["CHVD_foot",viewDistance]) min CHVD_maxView; + CHVD_car = (profileNamespace getVariable ["CHVD_car",viewDistance]) min CHVD_maxView; + CHVD_air = (profileNamespace getVariable ["CHVD_air",viewDistance]) min CHVD_maxView; + + CHVD_footObj = (profileNamespace getVariable ["CHVD_footObj",viewDistance]) min CHVD_maxObj; + CHVD_carObj = (profileNamespace getVariable ["CHVD_carObj",viewDistance]) min CHVD_maxObj; + CHVD_airObj = (profileNamespace getVariable ["CHVD_airObj",viewDistance]) min CHVD_maxObj; + + CHVD_footTerrain = if (CHVD_allowNoGrass) then {profileNamespace getVariable ["CHVD_footTerrain",25]} else {(profileNamespace getVariable ["CHVD_footTerrain",25]) min 48.99 max 3.125}; + CHVD_carTerrain = if (CHVD_allowNoGrass) then {profileNamespace getVariable ["CHVD_carTerrain",25]} else {(profileNamespace getVariable ["CHVD_carTerrain",25]) min 48.99 max 3.125}; + CHVD_airTerrain = if (CHVD_allowNoGrass) then {profileNamespace getVariable ["CHVD_airTerrain",25]} else {(profileNamespace getVariable ["CHVD_airTerrain",25]) min 48.99 max 3.125}; + + //Begin initialization + waitUntil {!isNull player}; + waitUntil {!isNull findDisplay 46}; + + //Detect when to change setting type + [] spawn { + for "_i" from 0 to 1 step 0 do { + [nil, false] call CHVD_fnc_updateSettings; + _currentVehicle = vehicle player; + waitUntil {_currentVehicle != vehicle player}; + }; + }; + [] spawn { + for "_i" from 0 to 1 step 0 do { + waitUntil {UAVControl (getConnectedUAV player) select 1 != ""}; + [nil, true] call CHVD_fnc_updateSettings; + waitUntil {UAVControl (getConnectedUAV player) select 1 == ""}; + [nil, false] call CHVD_fnc_updateSettings; + }; + }; +}; diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/onClose.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/onClose.sqf new file mode 100644 index 0000000..e69de29 diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/onLoad.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/onLoad.sqf new file mode 100644 index 0000000..ecbd0e1 --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/onLoad.sqf @@ -0,0 +1,101 @@ +/* + onLoad.sqf + + Copyright 2016 Jan Babor + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +params["_display","_slide","_idc"]; + +_pW = 0.025; +_pH = 0.04; + +_margin = 0.5; +_rowH = 1.3 * _pH; +_blockH = 6 * _pH; + +_leftCol = 0 * _pW; +_leftColW = 6 * _pW; + +_midCol = _leftCol + _leftColW + (_margin * _pW); +_midColW = 20 * _pW; + +_rightCol = _midCol + _midColW + (_margin * _pW); +_rightColW = 5 * _pW; + +_footTop = 1 * _pH; +_carTop = _footTop + _blockH; +_airTop = _carTop + _blockH; + +_slideClass = "ExAd_CHVD"; + +[_display,_slide,([_slideClass,"backButton"] call ExAd_fnc_getNextIDC),[27 * _pW, 17 * _pH, 6 * _pW, 1 * _pH],'["extraApps", 1] call ExileClient_gui_xm8_slide;',"GO BACK"] call ExAd_fnc_createButton; + + +_newParent = [_display,_slide,([_slideClass,"ctrlGrp"] call ExAd_fnc_getNextIDC),[0, _footTop, 34 * _pW, 16 * _pH]] call ExAd_fnc_createCtrlGrp; +_newParent ctrlEnable true; + +//ON FOOT +[_display,_newParent,([_slideClass,"strTxtFootTtl"] call ExAd_fnc_getNextIDC),[_leftCol, _footTop, _leftColW, _rowH],STR_chvd_foot,"PuristaMedium",1,"#ffffff","right",1] call ExAd_fnc_createStructuredText; +[_display,_newParent,([_slideClass,"strTxtFootSync"] call ExAd_fnc_getNextIDC),[_rightCol + (4 * _pw) - _midColW, _footTop, _midColW, _rowH],format["%1:",STR_chvd_sync],"PuristaMedium",1,"#ffffff","right",1] call ExAd_fnc_createStructuredText; +[_display,_newParent,([_slideClass,"cbFootSyncObj"] call ExAd_fnc_getNextIDC),[_rightCol + (3.8 * _pw), _footTop, _rightCol * 0.05, _rowH * 0.8],"",""] call ExAd_fnc_createCheckBox; + +[_display,_newParent,([_slideClass,"strTxtFootView"] call ExAd_fnc_getNextIDC),[_leftCol, _footTop + _rowH, _leftColW, _rowH],format["%1:",STR_chvd_view],"PuristaMedium",1,"#ffffff","right",1] call ExAd_fnc_createStructuredText; +[_display,_newParent,([_slideClass,"sliderFootView"] call ExAd_fnc_getNextIDC),[_midCol, _footTop + _rowH, _midColW, _rowH * 0.8]] call ExAd_fnc_createXSliderH; +[_display,_newParent,([_slideClass,"editFootView"] call ExAd_fnc_getNextIDC),[_rightCol, _footTop + _rowH, _rightColW, _rowH * 0.8]] call ExAd_fnc_createEdit; + +[_display,_newParent,([_slideClass,"strTxtFootObj"] call ExAd_fnc_getNextIDC),[_leftCol, _footTop + 2 * _rowH, _leftColW, _rowH],format["%1:",STR_chvd_object],"PuristaMedium",1,"#ffffff","right",1] call ExAd_fnc_createStructuredText; +[_display,_newParent,([_slideClass,"sliderFootObj"] call ExAd_fnc_getNextIDC),[_midCol, _footTop + 2 * _rowH, _midColW, _rowH * 0.8]] call ExAd_fnc_createXSliderH; +[_display,_newParent,([_slideClass,"editFootObj"] call ExAd_fnc_getNextIDC),[_rightCol, _footTop + 2 * _rowH, _rightColW, _rowH * 0.8]] call ExAd_fnc_createEdit; + +[_display,_newParent,([_slideClass,"strTxtFootTerrain"] call ExAd_fnc_getNextIDC),[_leftCol, _footTop + 3 * _rowH, _leftColW, _rowH],format["%1:",STR_chvd_terrain],"PuristaMedium",1,"#ffffff","right",1] call ExAd_fnc_createStructuredText; +[_display,_newParent,([_slideClass,"xListFootTerrain"] call ExAd_fnc_getNextIDC),[_midCol, _footTop + 3 * _rowH, _midColW, _rowH * 0.8],"",""] call ExAd_fnc_createXList; +[_display,_newParent,([_slideClass,"strTxtFootTerrainEdit"] call ExAd_fnc_getNextIDC),[_rightCol, _footTop + 3 * _rowH, _rightColW, _rowH * 0.8],"","PuristaMedium",1,"#ffffff","center",1] call ExAd_fnc_createStructuredText; + +//IN CAR +[_display,_newParent,([_slideClass,"strTxtCarTtl"] call ExAd_fnc_getNextIDC),[_leftCol, _carTop, _leftColW, _rowH],STR_chvd_car,"PuristaMedium",1,"#ffffff","right",1] call ExAd_fnc_createStructuredText; +[_display,_newParent,([_slideClass,"strTxtCarSync"] call ExAd_fnc_getNextIDC),[_rightCol + (4 * _pw) - _midColW, _carTop, _midColW, _rowH],format["%1:",STR_chvd_sync],"PuristaMedium",1,"#ffffff","right",1] call ExAd_fnc_createStructuredText; +[_display,_newParent,([_slideClass,"cbCarSyncObj"] call ExAd_fnc_getNextIDC),[_rightCol + (3.8 * _pw), _carTop, _rightCol * 0.05, _rowH * 0.8],"",""] call ExAd_fnc_createCheckBox; + +[_display,_newParent,([_slideClass,"strTxtCarView"] call ExAd_fnc_getNextIDC),[_leftCol, _carTop + _rowH, _leftColW, _rowH],format["%1:",STR_chvd_view],"PuristaMedium",1,"#ffffff","right",1] call ExAd_fnc_createStructuredText; +[_display,_newParent,([_slideClass,"sliderCarView"] call ExAd_fnc_getNextIDC),[_midCol, _carTop + _rowH, _midColW, _rowH * 0.8]] call ExAd_fnc_createXSliderH; +[_display,_newParent,([_slideClass,"editCarView"] call ExAd_fnc_getNextIDC),[_rightCol, _carTop + _rowH, _rightColW, _rowH * 0.8]] call ExAd_fnc_createEdit; + +[_display,_newParent,([_slideClass,"strTxtCarObj"] call ExAd_fnc_getNextIDC),[_leftCol, _carTop + 2 * _rowH, _leftColW, _rowH],format["%1:",STR_chvd_object],"PuristaMedium",1,"#ffffff","right",1] call ExAd_fnc_createStructuredText; +[_display,_newParent,([_slideClass,"sliderCarObj"] call ExAd_fnc_getNextIDC),[_midCol, _carTop + 2 * _rowH, _midColW, _rowH * 0.8]] call ExAd_fnc_createXSliderH; +[_display,_newParent,([_slideClass,"editCarObj"] call ExAd_fnc_getNextIDC),[_rightCol, _carTop + 2 * _rowH, _rightColW, _rowH * 0.8]] call ExAd_fnc_createEdit; + +[_display,_newParent,([_slideClass,"strTxtCarTerrain"] call ExAd_fnc_getNextIDC),[_leftCol, _carTop + 3 * _rowH, _leftColW, _rowH],format["%1:",STR_chvd_terrain],"PuristaMedium",1,"#ffffff","right",1] call ExAd_fnc_createStructuredText; +[_display,_newParent,([_slideClass,"xListCarTerrain"] call ExAd_fnc_getNextIDC),[_midCol, _carTop + 3 * _rowH, _midColW, _rowH * 0.8],"",""] call ExAd_fnc_createXList; +[_display,_newParent,([_slideClass,"strTxtCarTerrainEdit"] call ExAd_fnc_getNextIDC),[_rightCol, _carTop + 3 * _rowH, _rightColW, _rowH * 0.8],"","PuristaMedium",1,"#ffffff","center",1] call ExAd_fnc_createStructuredText; + + +//IN AIR +[_display,_newParent,([_slideClass,"strTxtAirTtl"] call ExAd_fnc_getNextIDC),[_leftCol, _airTop, _leftColW, _rowH],STR_chvd_air,"PuristaMedium",1,"#ffffff","right",1] call ExAd_fnc_createStructuredText; +[_display,_newParent,([_slideClass,"strTxtAirSync"] call ExAd_fnc_getNextIDC),[_rightCol + (4 * _pw) - _midColW, _airTop, _midColW, _rowH],format["%1:",STR_chvd_sync],"PuristaMedium",1,"#ffffff","right",1] call ExAd_fnc_createStructuredText; +[_display,_newParent,([_slideClass,"cbAirSyncObj"] call ExAd_fnc_getNextIDC),[_rightCol + (3.8 * _pw), _airTop, _rightCol * 0.05, _rowH * 0.8],"",""] call ExAd_fnc_createCheckBox; + +[_display,_newParent,([_slideClass,"strTxtAirView"] call ExAd_fnc_getNextIDC),[_leftCol, _airTop + _rowH, _leftColW, _rowH],format["%1:",STR_chvd_view],"PuristaMedium",1,"#ffffff","right",1] call ExAd_fnc_createStructuredText; +[_display,_newParent,([_slideClass,"sliderAirView"] call ExAd_fnc_getNextIDC),[_midCol, _airTop + _rowH, _midColW, _rowH * 0.8]] call ExAd_fnc_createXSliderH; +[_display,_newParent,([_slideClass,"editAirView"] call ExAd_fnc_getNextIDC),[_rightCol, _airTop + _rowH, _rightColW, _rowH * 0.8]] call ExAd_fnc_createEdit; + +[_display,_newParent,([_slideClass,"strTxtAirObj"] call ExAd_fnc_getNextIDC),[_leftCol, _airTop + 2 * _rowH, _leftColW, _rowH],format["%1:",STR_chvd_object],"PuristaMedium",1,"#ffffff","right",1] call ExAd_fnc_createStructuredText; +[_display,_newParent,([_slideClass,"sliderAirObj"] call ExAd_fnc_getNextIDC),[_midCol, _airTop + 2 * _rowH, _midColW, _rowH * 0.8]] call ExAd_fnc_createXSliderH; +[_display,_newParent,([_slideClass,"editAirObj"] call ExAd_fnc_getNextIDC),[_rightCol, _airTop + 2 * _rowH, _rightColW, _rowH * 0.8]] call ExAd_fnc_createEdit; + +[_display,_newParent,([_slideClass,"strTxtCarTerrain"] call ExAd_fnc_getNextIDC),[_leftCol, _airTop + 3 * _rowH, _leftColW, _rowH],format["%1:",STR_chvd_terrain],"PuristaMedium",1,"#ffffff","right",1] call ExAd_fnc_createStructuredText; +[_display,_newParent,([_slideClass,"xListAirTerrain"] call ExAd_fnc_getNextIDC),[_midCol, _airTop + 3 * _rowH, _midColW, _rowH * 0.8],"",""] call ExAd_fnc_createXList; +[_display,_newParent,([_slideClass,"strTxtAirTerrainEdit"] call ExAd_fnc_getNextIDC),[_rightCol, _airTop + 3 * _rowH, _rightColW, _rowH * 0.8],"","PuristaMedium",1,"#ffffff","center",1] call ExAd_fnc_createStructuredText; + + +true \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/onOpen.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/onOpen.sqf new file mode 100644 index 0000000..15f594c --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/CHVD/onOpen.sqf @@ -0,0 +1,139 @@ +_display = uiNameSpace getVariable ["RscExileXM8", displayNull]; +{ + ([_display,"ExAd_CHVD",_x select 0] call ExAd_fnc_getAppCtrl) ctrlSetText format["%1", _x select 1]; +} forEach +[ + ["editFootView", str round CHVD_foot], + ["editFootObj", str round CHVD_footObj], + ["editCarView", str round CHVD_car], + ["editCarObj", str round CHVD_carObj], + ["editAirView", str round CHVD_air], + ["editAirObj", str round CHVD_airObj], + ["strTxtFootTerrainEdit", str CHVD_footTerrain], + ["strTxtCarTerrainEdit", str CHVD_carTerrain], + ["strTxtAirTerrainEdit", str CHVD_airTerrain] +]; + +{ + private["_ctrl"]; + _ctrl = [_display,"ExAd_CHVD",_x select 0] call ExAd_fnc_getAppCtrl; + _ctrl sliderSetRange [0, _x select 2]; + _ctrl sliderSetSpeed [500, 500]; + _ctrl sliderSetPosition (_x select 1); +} forEach +[ + ["sliderFootView", CHVD_foot, CHVD_maxView], + ["sliderFootObj", CHVD_footObj, CHVD_maxObj], + ["sliderCarView", CHVD_car, CHVD_maxView], + ["sliderCarObj", CHVD_carObj, CHVD_maxObj], + ["sliderAirView", CHVD_air, CHVD_maxView], + ["sliderAirObj", CHVD_airObj, CHVD_maxObj] +]; + +{ + ([_display,"ExAd_CHVD",_x select 0] call ExAd_fnc_getAppCtrl) cbSetChecked (_x select 1); +} forEach +[ + ["cbFootSyncObj",CHVD_footSyncObj], + ["cbCarSyncObj",CHVD_carSyncObj], + ["cbAirSyncObj",CHVD_airSyncObj] +]; + +{ + _ctrl = [_display,"ExAd_CHVD",_x select 0] call ExAd_fnc_getAppCtrl; + if (CHVD_allowNoGrass) then { + _ctrl lbAdd STR_chvd_low; + }; + _ctrl lbAdd STR_chvd_standard; + _ctrl lbAdd STR_chvd_high; + _ctrl lbAdd STR_chvd_veryHigh; + + _sel = [_x select 1] call CHVD_fnc_selTerrainQuality; + if (CHVD_allowNoGrass) then { + _ctrl lbSetCurSel _sel; + } else { + _ctrl lbSetCurSel (_sel - 1); + }; +} forEach +[ + ["xListFootTerrain",CHVD_footTerrain], + ["xListCarTerrain",CHVD_carTerrain], + ["xListAirTerrain",CHVD_airTerrain] +]; + +//Edit eventHandlers +_sliderFootView = [_display,"ExAd_CHVD","sliderFootView"] call ExAd_fnc_getAppCtrl; +_editFootView = [_display,"ExAd_CHVD","editFootView"] call ExAd_fnc_getAppCtrl; +_sliderFootObj = [_display,"ExAd_CHVD","sliderFootObj"] call ExAd_fnc_getAppCtrl; +_editFootObj = [_display,"ExAd_CHVD","editFootObj"] call ExAd_fnc_getAppCtrl; +_cbFootSyncObj = [_display,"ExAd_CHVD","cbFootSyncObj"] call ExAd_fnc_getAppCtrl; + +_editFootView ctrlSetEventHandler ["KeyDown", format["['CHVD_foot', %1, _this select 0, 'CHVD_footObj', %2, %3, 'CHVD_footSyncObj'] call CHVD_fnc_onEBinput",ctrlIDC _sliderFootView, ctrlIDC _sliderFootObj, ctrlIDC _editFootObj]]; + +_editFootObj ctrlSetEventHandler ["KeyDown", format["['CHVD_footObj', %1, _this select 0] call CHVD_fnc_onEBinput", ctrlIDC _sliderFootObj]]; + +_cbFootSyncObj ctrlSetEventHandler ["CheckedChanged", format["[_this select 1, 'CHVD_footSyncObj', %1, %2, %3, 'CHVD_footObj'] call CHVD_fnc_onCheckedChanged", ctrlIDC _sliderFootObj, ctrlIDC _editFootObj, ctrlIDC _sliderFootView]]; + +_sliderFootView ctrlSetEventHandler ["SliderPosChanged", format["['CHVD_foot', _this select 0, _this select 1, %1, 'CHVD_footObj', %2, %3, 'CHVD_footSyncObj'] call CHVD_fnc_onSliderChange", ctrlIDC _editFootView, ctrlIDC _sliderFootObj, ctrlIDC _editFootObj]]; + +_sliderFootObj ctrlSetEventHandler ["SliderPosChanged", format["['CHVD_footObj', _this select 0, _this select 1, %1] call CHVD_fnc_onSliderChange", ctrlIDC _editFootObj]]; + + +_sliderCarView = [_display,"ExAd_CHVD","sliderCarView"] call ExAd_fnc_getAppCtrl; +_editCarView = [_display,"ExAd_CHVD","editCarView"] call ExAd_fnc_getAppCtrl; +_sliderCarObj = [_display,"ExAd_CHVD","sliderCarObj"] call ExAd_fnc_getAppCtrl; +_editCarObj = [_display,"ExAd_CHVD","editCarObj"] call ExAd_fnc_getAppCtrl; +_cbCarSyncObj = [_display,"ExAd_CHVD","cbCarSyncObj"] call ExAd_fnc_getAppCtrl; + +_editCarView ctrlSetEventHandler ["KeyDown", format["['CHVD_car', %1, _this select 0, 'CHVD_carObj', %2, %3, 'CHVD_carSyncObj'] call CHVD_fnc_onEBinput",ctrlIDC _sliderCarView, ctrlIDC _sliderCarObj, ctrlIDC _editCarObj]]; + +_editCarObj ctrlSetEventHandler ["KeyDown", format["['CHVD_carObj', %1, _this select 0] call CHVD_fnc_onEBinput", ctrlIDC _sliderCarObj]]; + +_cbCarSyncObj ctrlSetEventHandler ["CheckedChanged", format["[_this select 1, 'CHVD_carSyncObj', %1, %2, %3, 'CHVD_carObj'] call CHVD_fnc_onCheckedChanged", ctrlIDC _sliderCarObj, ctrlIDC _editCarObj, ctrlIDC _sliderCarView]]; + +_sliderCarView ctrlSetEventHandler ["SliderPosChanged", format["['CHVD_car', _this select 0, _this select 1, %1, 'CHVD_carObj', %2, %3, 'CHVD_carSyncObj'] call CHVD_fnc_onSliderChange", ctrlIDC _editCarView, ctrlIDC _sliderCarObj, ctrlIDC _editCarObj]]; + +_sliderCarObj ctrlSetEventHandler ["SliderPosChanged", format["['CHVD_carObj', _this select 0, _this select 1, %1] call CHVD_fnc_onSliderChange", ctrlIDC _editCarObj]]; + + +_sliderAirView = [_display,"ExAd_CHVD","sliderAirView"] call ExAd_fnc_getAppCtrl; +_editAirView = [_display,"ExAd_CHVD","editAirView"] call ExAd_fnc_getAppCtrl; +_sliderAirObj = [_display,"ExAd_CHVD","sliderAirObj"] call ExAd_fnc_getAppCtrl; +_editAirObj = [_display,"ExAd_CHVD","editAirObj"] call ExAd_fnc_getAppCtrl; +_cbAirSyncObj = [_display,"ExAd_CHVD","cbAirSyncObj"] call ExAd_fnc_getAppCtrl; + +_editAirView ctrlSetEventHandler ["KeyDown", format["['CHVD_air', %1, _this select 0, 'CHVD_airObj', %2, %3, 'CHVD_airSyncObj'] call CHVD_fnc_onEBinput",ctrlIDC _sliderAirView, ctrlIDC _sliderAirObj, ctrlIDC _editAirObj]]; + +_editAirObj ctrlSetEventHandler ["KeyDown", format["['CHVD_airObj', %1, _this select 0] call CHVD_fnc_onEBinput", ctrlIDC _sliderAirObj]]; + +_cbAirSyncObj ctrlSetEventHandler ["CheckedChanged", format["[_this select 1, 'CHVD_airSyncObj', %1, %2, %3, 'CHVD_airObj'] call CHVD_fnc_onCheckedChanged", ctrlIDC _sliderAirObj, ctrlIDC _editAirObj, ctrlIDC _sliderAirView]]; + +_sliderAirView ctrlSetEventHandler ["SliderPosChanged", format["['CHVD_air', _this select 0, _this select 1, %1, 'CHVD_airObj', %2, %3, 'CHVD_airSyncObj'] call CHVD_fnc_onSliderChange", ctrlIDC _editAirView, ctrlIDC _sliderAirObj, ctrlIDC _editAirObj]]; + +_sliderAirObj ctrlSetEventHandler ["SliderPosChanged", format["['CHVD_airObj', _this select 0, _this select 1, %1] call CHVD_fnc_onSliderChange", ctrlIDC _editAirObj]]; + + +{ + _ctrl = [_display,"ExAd_CHVD",_x select 0] call ExAd_fnc_getAppCtrl; + _handle = _ctrl ctrlSetEventHandler ["LBSelChanged", + format ["[_this select 1, '%1', '%2'] call CHVD_fnc_onLBSelChanged", _x select 1, _x select 2] + ]; +} forEach +[ + ["xListFootTerrain","CHVD_footTerrain","strTxtFootTerrainEdit"], + ["xListCarTerrain","CHVD_carTerrain","strTxtCarTerrainEdit"], + ["xListAirTerrain","CHVD_airTerrain","strTxtAirTerrainEdit"] +]; + + +_footObj = if(CHVD_footSyncObj)then{false}else{true}; +([_display,"ExAd_CHVD","sliderFootObj"] call ExAd_fnc_getAppCtrl) ctrlEnable _footObj; +([_display,"ExAd_CHVD","editFootObj"] call ExAd_fnc_getAppCtrl) ctrlEnable _footObj; + +_carObj = if(CHVD_carSyncObj)then{false}else{true}; +([_display,"ExAd_CHVD","sliderCarObj"] call ExAd_fnc_getAppCtrl) ctrlEnable _carObj; +([_display,"ExAd_CHVD","editCarObj"] call ExAd_fnc_getAppCtrl) ctrlEnable _carObj; + +_airObj = if(CHVD_airSyncObj)then{false}else{true}; +([_display,"ExAd_CHVD","sliderAirObj"] call ExAd_fnc_getAppCtrl) ctrlEnable _airObj; +([_display,"ExAd_CHVD","editAirObj"] call ExAd_fnc_getAppCtrl) ctrlEnable _airObj; diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/Info/Icon_SI.paa b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/Info/Icon_SI.paa new file mode 100644 index 0000000..1aa7949 Binary files /dev/null and b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/Info/Icon_SI.paa differ diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/Info/message.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/Info/message.sqf new file mode 100644 index 0000000..ce7a0a3 --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/Info/message.sqf @@ -0,0 +1,11 @@ +GENERAL RULES
+______________________________________________________________________________
+ +
SIDE-CHAT
+______________________________________________________________________________
+ +GREEN TRADE-ZONE RULES
+______________________________________________________________________________
+ +BUILDING RULES
+______________________________________________________________________________
diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/Info/onClose.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/Info/onClose.sqf new file mode 100644 index 0000000..e69de29 diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/Info/onLoad.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/Info/onLoad.sqf new file mode 100644 index 0000000..eab536b --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/Info/onLoad.sqf @@ -0,0 +1,35 @@ +/* + onLoad.sqf + + Copyright 2016 Jan Babor + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +params["_display","_slide","_idc"]; + +_pW = 0.025; +_pH = 0.04; +_leftCol = 0; +_leftColW = 12.8; +_rightCol = _leftCol + _leftColW + 2; +_rightColW = _leftColW + 3; +_margin = 0.2; + +_slideClass = "ExAd_Info"; + +[_display,_slide,([_slideClass,"backButton"] call ExAd_fnc_getNextIDC),[27 * _pW, 17 * _pH, 6 * _pW, 1 * _pH],'["extraApps", 1] call ExileClient_gui_xm8_slide;',STR_ExAd_VG_APP_BTN_BACK] call ExAd_fnc_createButton; + +_newParent = [_display,_slide,([_slideClass,"ctrlGrp"] call ExAd_fnc_getNextIDC),[_leftCol * _pW, 1 * _pH, (_leftColW + _rightCol + 6) * _pW, 16 * _pH]] call ExAd_fnc_createCtrlGrp; +[_display,_newParent,([_slideClass,"strTxt"] call ExAd_fnc_getNextIDC),[_leftCol * _pW, 1.5 * _pH, (_leftColW + _rightCol + 5) * _pW, 15 * _pH],"","PuristaMedium",1,"#ffffff","right",1] call ExAd_fnc_createStructuredText; + +true \ 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 new file mode 100644 index 0000000..b7ff8c1 --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/Info/onOpen.sqf @@ -0,0 +1,29 @@ +private["_display","_message","_strTxt","_pos"]; + +try +{ + _message = preprocessFileLineNumbers "ExAdClient\XM8\Apps\Info\message.sqf"; + _message = _message select [(_message find "ExAdClient") + (count "ExAdClient\XM8\Apps\Info\message.sqf") + 1]; + + if(count _message == 0)exitWith{ + throw "No server info provided"; + }; + + _display = uiNameSpace getVariable ["RscExileXM8", displayNull]; + if(isNull _display)exitWith{ + throw "No server info provided!"; + }; + + _strTxt = [_display,"ExAd_Info","strTxt"] call ExAd_fnc_getAppCtrl; + _strTxt ctrlSetStructuredText parseText format[_message]; + + _pos = ctrlPosition _strTxt; + _strTxt ctrlSetPosition [_pos select 0, _pos select 1, _pos select 2, ctrlTextHeight _strTxt]; + _strTxt ctrlcommit 0; + ([_display,"ExAd_Info","ctrlGrp"] call ExAd_fnc_getAppCtrl) ctrlEnable true; +} +catch +{ + ["ErrorTitleAndText", ["ExAd - Server Info", _exception]] 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/VG/Icon_VG.paa b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/VG/Icon_VG.paa new file mode 100644 index 0000000..e116406 Binary files /dev/null and b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/VG/Icon_VG.paa differ diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/VG/onLoad.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/VG/onLoad.sqf index 20b9a0e..594c384 100644 --- a/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/VG/onLoad.sqf +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Apps/VG/onLoad.sqf @@ -1,5 +1,5 @@ /* - fn_createExtraApps.sqf + onLoad.sqf Copyright 2016 Jan Babor diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/CfgFunctions.cpp b/mpmissions/Exile.Altis/ExAdClient/XM8/CfgFunctions.cpp index be363d6..575ebbf 100644 --- a/mpmissions/Exile.Altis/ExAdClient/XM8/CfgFunctions.cpp +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/CfgFunctions.cpp @@ -23,11 +23,15 @@ file = "ExAdClient\XM8\Functions"; class createBackgroundGUI {}; class createButton {}; class createCheckBox {}; + class createCtrlGrp {}; + class createEdit {}; class createExtraApps {}; class createFrame {}; class createList {}; class createPicture {}; class createStructuredText {}; + class createXList {}; + class createXSliderH {}; class getAppCtrl {}; class getNextIDC {}; class postInitXM8 {file = "ExAdClient\XM8\postInit.sqf"; postInit = 1;}; diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/CustomCode/ExileClient_gui_xm8_show.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/CustomCode/ExileClient_gui_xm8_show.sqf index 4668a5b..f999c7a 100644 --- a/mpmissions/Exile.Altis/ExAdClient/XM8/CustomCode/ExileClient_gui_xm8_show.sqf +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/CustomCode/ExileClient_gui_xm8_show.sqf @@ -49,7 +49,9 @@ if (ExileClientXM8CurrentSlide isEqualTo "party") then }; }; +//Add configured controls and add them to "More" call ExAd_fnc_createExtraApps; +call ExAd_fnc_addApps; { _slideControlID = getNumber (_x >> "controlID"); _slideName = configName _x; diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/CustomCode/ExileClient_gui_xm8_slide.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/CustomCode/ExileClient_gui_xm8_slide.sqf index e629f3f..92bf296 100644 --- a/mpmissions/Exile.Altis/ExAdClient/XM8/CustomCode/ExileClient_gui_xm8_slide.sqf +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/CustomCode/ExileClient_gui_xm8_slide.sqf @@ -23,10 +23,6 @@ if !(ExileClientXM8CurrentSlide isEqualTo _toSlideName) then _toSlideControlID = getNumber (_src >> "CfgXM8" >> _toSlideName >> "controlID"); _toSlideControl = _display displayCtrl _toSlideControlID; - //Add extra apps - if(_toSlideName == "extraApps")then{ - call ExAd_fnc_addApps; - }; _toSlideTitle = getText (_src >> "CfgXM8" >> _toSlideName >> "title"); _titleControl = _display displayCtrl 4004; diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_addApps.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_addApps.sqf index 1971178..e9ada58 100644 --- a/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_addApps.sqf +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_addApps.sqf @@ -41,10 +41,17 @@ while {_title != ""} do }; _display = uiNameSpace getVariable ["RscExileXM8", displayNull]; +_pW = 0.025; _pH = 0.04; { - private["_ctrl"]; + private["_ctrl","_pos","_logo"]; _ctrl = (_display displayCtrl _count2); + _pos = ctrlPosition _ctrl; + _slide = ctrlParentControlsGroup _ctrl; + + _logo = if(isText(missionConfigFile >> "CfgXM8" >> _x >> "logo"))then{getText(missionConfigFile >> "CfgXM8" >> _x >> "logo")}else{"ExAdClient\Core\Img\logo.paa"}; + [_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]]; diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_createButton.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_createButton.sqf index 7659a5e..d2269d0 100644 --- a/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_createButton.sqf +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_createButton.sqf @@ -1,6 +1,7 @@ params ["_display","_parent","_idc","_position",["_action",""],["_text",""],["_tooltip",""],"_ctrl"]; -_ctrl = _display ctrlCreate ["RscButtonMenu",_idc,_parent]; +/*_ctrl = _display ctrlCreate ["RscButtonMenu",_idc,_parent];*/ +_ctrl = _display ctrlCreate ["RscExileXM8ButtonMenu",_idc,_parent]; _ctrl ctrlSetPosition _position; _ctrl ctrlSetText _text; _ctrl ctrlSetEventHandler ["ButtonClick",_action]; diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_createCtrlGrp.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_createCtrlGrp.sqf new file mode 100644 index 0000000..2d9b76a --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_createCtrlGrp.sqf @@ -0,0 +1,7 @@ +params ["_display","_parent","_idc","_position","_ctrl"]; + +_ctrl = _display ctrlCreate ["RscControlsGroup", _idc, _parent]; +_ctrl ctrlSetPosition _position; +_ctrl ctrlCommit 0; + +_ctrl \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_createEdit.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_createEdit.sqf new file mode 100644 index 0000000..b1335b5 --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_createEdit.sqf @@ -0,0 +1,8 @@ +params ["_display","_parent","_idc","_position","_text"]; + +_ctrl = _display ctrlCreate ["RscEdit", _idc, _parent]; +_ctrl ctrlSetPosition _position; +_ctrl ctrlSetText _text; +_ctrl ctrlCommit 0; + +_ctrl \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_createXList.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_createXList.sqf new file mode 100644 index 0000000..d07cce3 --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_createXList.sqf @@ -0,0 +1,9 @@ +params ["_display","_parent","_idc","_position","_actionOnSelChanged","_tooltip","_ctrl"]; + +_ctrl = _display ctrlCreate ["RscXListBox",_idc,_parent]; +_ctrl ctrlSetPosition _position; +_ctrl ctrlSetEventHandler ["LBSelChanged",_actionOnSelChanged]; +_ctrl ctrlSetTooltip _tooltip; +_ctrl ctrlCommit 0; + +_ctrl \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_createXSliderH.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_createXSliderH.sqf new file mode 100644 index 0000000..6912d85 --- /dev/null +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/Functions/fn_createXSliderH.sqf @@ -0,0 +1,7 @@ +params ["_display","_parent","_idc","_position","_ctrl"]; + +_ctrl = _display ctrlCreate ["RscXSliderH", _idc, _parent]; +_ctrl ctrlSetPosition _position; +_ctrl ctrlCommit 0; + +_ctrl \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/customize.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/customize.sqf index c8508d9..cd45dc7 100644 --- a/mpmissions/Exile.Altis/ExAdClient/XM8/customize.sqf +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/customize.sqf @@ -14,4 +14,4 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -*/ +*/ \ No newline at end of file diff --git a/mpmissions/Exile.Altis/ExAdClient/XM8/postInit.sqf b/mpmissions/Exile.Altis/ExAdClient/XM8/postInit.sqf index f34de5c..b66e020 100644 --- a/mpmissions/Exile.Altis/ExAdClient/XM8/postInit.sqf +++ b/mpmissions/Exile.Altis/ExAdClient/XM8/postInit.sqf @@ -29,4 +29,8 @@ call compile preprocessFileLineNumbers _path; _code = compileFinal (preprocessFileLineNumbers getText(missionConfigFile >> "CfgXM8" >> _x >> "onClose")); missionNamespace setVariable [format["ExileClient_gui_xm8_slide_%1_onClose",_x], _code]; }; + + if(isText(missionConfigFile >> "CfgXM8" >> _x >> "config"))then{ + call compileFinal (preprocessFileLineNumbers getText(missionConfigFile >> "CfgXM8" >> _x >> "config")); + }; }forEach (getArray(missionConfigFile >> "CfgXM8" >> "extraApps")); \ No newline at end of file diff --git a/mpmissions/Exile.Altis/config.cpp b/mpmissions/Exile.Altis/config.cpp index e7e8bea..bf891bf 100644 --- a/mpmissions/Exile.Altis/config.cpp +++ b/mpmissions/Exile.Altis/config.cpp @@ -1,16 +1,26 @@ class CfgXM8 { - extraApps[] = {"ExAd_VG"}; + extraApps[] = {"ExAd_VG","ExAd_Info"}; class ExAd_VG { title = "Virtual Garage"; - controlID = 50000; //IDC:50000 -> 50014 + controlID = 50000; //IDC:50000 -> 50015 || These need to be unique and out of range from each other + logo = "ExadClient\XM8\Apps\VG\Icon_VG.paa"; onLoad = "ExAdClient\XM8\Apps\VG\onLoad.sqf"; onOpen = "ExAdClient\XM8\Apps\VG\onOpen.sqf"; onClose = "ExAdClient\XM8\Apps\VG\onClose.sqf"; + }; + class ExAd_Info + { + title = "Server Info"; + controlID = 50100; //IDC:50100 -> 50102 || These need to be unique and out of range from each other + logo = "ExadClient\XM8\Apps\Info\Icon_SI.paa"; + onLoad = "ExAdClient\XM8\Apps\Info\onLoad.sqf"; + onOpen = "ExAdClient\XM8\Apps\Info\onOpen.sqf"; + onClose = "ExAdClient\XM8\Apps\Info\onClose.sqf"; }; -}; +}; class CfgExileCustomCode { diff --git a/mpmissions/Exile.Altis/stringtable.xml b/mpmissions/Exile.Altis/stringtable.xml index 4c917b5..52ba0cb 100644 --- a/mpmissions/Exile.Altis/stringtable.xml +++ b/mpmissions/Exile.Altis/stringtable.xml @@ -35,7 +35,7 @@ %2 %1Pin code: %3 %1Fuel: %4 %1Damage: %5 %1Texture: %6 %1Items: %7 %1Magazines: %8 %1Weapons: %9 - Go Back + GO BACK Fetch