From 1b9e6e93f4ab81396919d51644c16cbe19ea11d2 Mon Sep 17 00:00:00 2001 From: Bjanski Date: Wed, 13 Apr 2016 17:47:49 +0200 Subject: [PATCH] Core release candidate Core release candidate finished. --- @ExileServer/addons/exad_core/$PREFIX$ | 1 + .../Functions/System/fn_clientDispatch.sqf | 29 +++++++++ .../Functions/System/fn_clientRequest.sqf | 1 + .../Functions/Utils/fn_createArray.sqf | 28 +++++++++ .../Functions/Utils/fn_createCrate.sqf | 35 +++++++++++ .../Functions/Utils/fn_createMarker.sqf | 45 ++++++++++++++ .../Functions/Utils/fn_putInContainer.sqf | 59 +++++++++++++++++++ @ExileServer/addons/exad_core/PboPrefix.txt | 1 + @ExileServer/addons/exad_core/config.cpp | 41 +++++++++++++ .../Core/Functions/System/fn_debugHandler.sqf | 4 +- 10 files changed, 242 insertions(+), 2 deletions(-) create mode 100644 @ExileServer/addons/exad_core/$PREFIX$ create mode 100644 @ExileServer/addons/exad_core/Functions/System/fn_clientDispatch.sqf create mode 100644 @ExileServer/addons/exad_core/Functions/System/fn_clientRequest.sqf create mode 100644 @ExileServer/addons/exad_core/Functions/Utils/fn_createArray.sqf create mode 100644 @ExileServer/addons/exad_core/Functions/Utils/fn_createCrate.sqf create mode 100644 @ExileServer/addons/exad_core/Functions/Utils/fn_createMarker.sqf create mode 100644 @ExileServer/addons/exad_core/Functions/Utils/fn_putInContainer.sqf create mode 100644 @ExileServer/addons/exad_core/PboPrefix.txt diff --git a/@ExileServer/addons/exad_core/$PREFIX$ b/@ExileServer/addons/exad_core/$PREFIX$ new file mode 100644 index 0000000..6c475df --- /dev/null +++ b/@ExileServer/addons/exad_core/$PREFIX$ @@ -0,0 +1 @@ +exad_core \ No newline at end of file diff --git a/@ExileServer/addons/exad_core/Functions/System/fn_clientDispatch.sqf b/@ExileServer/addons/exad_core/Functions/System/fn_clientDispatch.sqf new file mode 100644 index 0000000..b5df25e --- /dev/null +++ b/@ExileServer/addons/exad_core/Functions/System/fn_clientDispatch.sqf @@ -0,0 +1,29 @@ +/* + fn_clientDispatch.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. +*/ + +private ["_params","_recipents"]; + +_params = [_this,0,nil] call BIS_fnc_param; +_recipents = [_this,1,-2,[0]] call BIS_fnc_param; +_jip = [_this,2,false] call BIS_fnc_param; + +if(isNil "_params")exitWith{false}; + +_resString = _params remoteExec ["ExAd_fnc_incomingRequest",_recipents,_jip]; + +_resString \ No newline at end of file diff --git a/@ExileServer/addons/exad_core/Functions/System/fn_clientRequest.sqf b/@ExileServer/addons/exad_core/Functions/System/fn_clientRequest.sqf new file mode 100644 index 0000000..4393f68 --- /dev/null +++ b/@ExileServer/addons/exad_core/Functions/System/fn_clientRequest.sqf @@ -0,0 +1 @@ +/** * fn_incomingRequest.sqf * Modified by Jan Babor 2016 * * Originally * ExileClient_system_network_dispatchIncomingMessage * * Exile Mod * www.exilemod.com * © 2015 Exile Mod Team * * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. */ private["_payload","_messageName","_messageParameters","_allowedParameters","_message","_exception"]; _payload = _this; try { if (isNil "_payload") then { throw "Message payload is not defined!"; }; if (typeName _payload != "ARRAY") then { throw "Message payload is not a array!"; }; if (count _payload != 2) then { throw format ["Wrong envelope field count! Payload: %1", _payload]; }; _messageName = _payload select 0; _messageParameters = _payload select 1; if !(isClass (configFile >> "CfgNetworkMessages" >> _messageName)) then { throw format ["Forbidden message name! Payload: %1", _payload]; }; _allowedParameters = getArray(configFile >> "CfgNetworkMessages" >> _messageName >> "parameters"); if (count _messageParameters != count _allowedParameters) then { throw format ["Parameter count mismatch! Payload: %1", _payload]; }; { if (_x != typeName (_messageParameters select _forEachIndex)) then { throw format ["Parameter type mismatch! Payload: %1", _payload]; }; } forEach _allowedParameters; diag_log format["Dispatching message '%1'...", _messageName]; call compile format["_messageParameters call ExAdServer_fnc_%1;",_messageName]; } catch { ["clientRequest", _exception, true] call ExAd_fnc_debugHandler; }; true \ No newline at end of file diff --git a/@ExileServer/addons/exad_core/Functions/Utils/fn_createArray.sqf b/@ExileServer/addons/exad_core/Functions/Utils/fn_createArray.sqf new file mode 100644 index 0000000..3a3647a --- /dev/null +++ b/@ExileServer/addons/exad_core/Functions/Utils/fn_createArray.sqf @@ -0,0 +1,28 @@ +/* + fn_createArray.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. +*/ + +private ["_array"]; + +_array = []; +{ + for "_i" from 1 to (_x select 0) do { + _array pushBack (_x select 1) + } +}forEach _this; + +_array \ No newline at end of file diff --git a/@ExileServer/addons/exad_core/Functions/Utils/fn_createCrate.sqf b/@ExileServer/addons/exad_core/Functions/Utils/fn_createCrate.sqf new file mode 100644 index 0000000..fc5ed2f --- /dev/null +++ b/@ExileServer/addons/exad_core/Functions/Utils/fn_createCrate.sqf @@ -0,0 +1,35 @@ +/* + fn_createCrate.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. +*/ + +private["_pos","_list","_crateType","_crate"]; + +_pos = [_this,0,[0,0,0]] call BIS_fnc_param; +_list = [_this,1,[]] call BIS_fnc_param; +_crateType = [_this,2,"Box_IND_AmmoVeh_F"] call BIS_fnc_param; + +_crate = _crateType createVehicle _pos; +clearBackpackCargoGlobal _crate; +clearItemCargoGlobal _crate; +clearMagazineCargoGlobal _crate; +clearWeaponCargoGlobal _crate; + +{ + _crate addItemCargoGlobal [_x select 0,_x select 1] +}forEach _list; + +_crate \ No newline at end of file diff --git a/@ExileServer/addons/exad_core/Functions/Utils/fn_createMarker.sqf b/@ExileServer/addons/exad_core/Functions/Utils/fn_createMarker.sqf new file mode 100644 index 0000000..d2e0ce2 --- /dev/null +++ b/@ExileServer/addons/exad_core/Functions/Utils/fn_createMarker.sqf @@ -0,0 +1,45 @@ +/* + fn_createMarker.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. +*/ + +private["_markerPos","_markerColor","_markerSize","_markerName","_markerText","_markerDot","_markers","_marker","_dot"]; + +_markerPos = [_this,0,[0,0,0]] call BIS_fnc_param; +_markerColor = [_this,1,"Default"] call BIS_fnc_param; +_markerSize = [_this,2,50] call BIS_fnc_param; +_markerName = [_this,3,("ExAdMarker" + str diag_tickTime)] call BIS_fnc_param; +_markerText = [_this,4,""] call BIS_fnc_param; +_markerDot = [_this,5,false] call BIS_fnc_param; + +_markers = []; + +_marker = createMarker [_markerName,_markerPos]; +_marker setMarkerColor _markerColor; +_marker setMarkerShape "ELLIPSE"; +_marker setMarkerBrush "Solid"; +_marker setMarkerSize [_markerSize,_markerSize]; +_marker setMarkerText (_markerText); +_markers pushBack _marker; +if(_markerDot)then{ + _dot = createMarker [format["%1dot",_markerName], _markerPos]; + _dot setMarkerColor "ColorBlack"; + _dot setMarkerType "mil_dot"; + _dot setMarkerText _markerText; + _markers pushBack _dot; +}; + +_markers \ No newline at end of file diff --git a/@ExileServer/addons/exad_core/Functions/Utils/fn_putInContainer.sqf b/@ExileServer/addons/exad_core/Functions/Utils/fn_putInContainer.sqf new file mode 100644 index 0000000..5a3e123 --- /dev/null +++ b/@ExileServer/addons/exad_core/Functions/Utils/fn_putInContainer.sqf @@ -0,0 +1,59 @@ +/* + fn_putInContainer.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. +*/ + +private["_lootHolder","_itemClassName","_cargoType","_magazineClassNames","_magazineClassName","_numberOfMagazines"]; + +_lootHolder = _this select 0; +_itemClassName = _this select 1; + +_cargoType = _itemClassName call ExileClient_util_cargo_getType; + +switch (_cargoType) do { + case 1: + { + if (_itemClassName isEqualTo "Exile_Item_MountainDupe") then + { + _lootHolder addMagazineCargoGlobal [_itemClassName, 2]; + } + else + { + _lootHolder addMagazineCargoGlobal [_itemClassName, 1]; + }; + }; + case 3: + { + _lootHolder addBackpackCargoGlobal [_itemClassName, 1]; + }; + case 2: + { + _lootHolder addWeaponCargoGlobal [_itemClassName, 1]; + if (_itemClassName != "Exile_Melee_Axe") then + { + _magazineClassNames = getArray(configFile >> "CfgWeapons" >> _itemClassName >> "magazines"); + if (count(_magazineClassNames) > 0) then + { + _magazineClassName = _magazineClassNames select (floor(random (count _magazineClassNames))); + _numberOfMagazines = 1 + floor(random 3); + _lootHolder addMagazineCargoGlobal [_magazineClassName, _numberOfMagazines]; + }; + }; + }; + default { _lootHolder addItemCargoGlobal [_itemClassName,1]; }; +}; + +true \ No newline at end of file diff --git a/@ExileServer/addons/exad_core/PboPrefix.txt b/@ExileServer/addons/exad_core/PboPrefix.txt new file mode 100644 index 0000000..6c475df --- /dev/null +++ b/@ExileServer/addons/exad_core/PboPrefix.txt @@ -0,0 +1 @@ +exad_core \ No newline at end of file diff --git a/@ExileServer/addons/exad_core/config.cpp b/@ExileServer/addons/exad_core/config.cpp index e69de29..79f7c41 100644 --- a/@ExileServer/addons/exad_core/config.cpp +++ b/@ExileServer/addons/exad_core/config.cpp @@ -0,0 +1,41 @@ +/* + config.cpp + + 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. +*/ + +class CfgPatches { + class ExAd_Core { + requiredVersion = 0.1; + requiredAddons[] = {"exile_server"}; + }; +}; + +class CfgFunctions { + class ExAdServer { + class System { + file = "exad_core\Functions\System"; + class clientDispatch {}; + class clientRequest {}; + }; + class Utils { + file = "exad_core\Functions\Utils"; + class createArray {}; + class createCrate {}; + class createMarker {}; + class putInContainer {}; + }; + }; +}; diff --git a/mpmissions/Exile.Altis/ExAdClient/Core/Functions/System/fn_debugHandler.sqf b/mpmissions/Exile.Altis/ExAdClient/Core/Functions/System/fn_debugHandler.sqf index bf1c8bc..566df80 100644 --- a/mpmissions/Exile.Altis/ExAdClient/Core/Functions/System/fn_debugHandler.sqf +++ b/mpmissions/Exile.Altis/ExAdClient/Core/Functions/System/fn_debugHandler.sqf @@ -15,8 +15,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -params ["_fnc","_exception"]; +params ["_fnc","_exception",["_server", false]]; if(ExAd_Debug)then{ - diag_log format["ExAd Debugger: Error in %1 - '%2'",_fnc, _exception] + diag_log format["ExAd%3 Debugger: Error in %1 - '%2'",_fnc, _exception, (if(_server)then{"Server"}else{""})] } \ No newline at end of file