_playerNetID = _this select 0; _targetNetID = _this select 1; try { // Get the player object based on how the server is set up if (ArcasDevTools_Server_Exiled) then { _playerObject = _playerNetID call ExileServer_system_session_getPlayerObject; } else { _playerObject = objectFromNetID _playerNetID; }; // Make sure we have something to work with if (isNull _playerObject) then { throw "Player is Null"; }; _targetObject = objectFromNetid(_targetNetID); if ([_playerObject, _targetObject] call ArcasServer_util_isNullOrDead) then { throw "Target is dead or null"; }; // Get some information _playerUID = getPlayerUID _playerObject; _playerName = name _playerObject; // Get some information _targetUID = getPlayerUID _playerObject; _targetName = name _playerObject; // Make sure nobody is trying to call this without us knowing if !(_playerUID in ADT_DEVELOPER_UIDS) then { throw format["Player %1 does not have access!", _playerUID]; }; if !(_targetObject getVariable ["ADT_TempAccessGranted", false]) then { throw format["Target %1 already has access to ADT Lite", _targetName]; }; ADT_PACKAGE = { // Key F5 ADTLITE_KeyOpen = 0x3F; ADTLITE_Vehicles = []; ADTLITE_IsOpen = false; ADTLITE_ExileClient = false; ADTLITE_AftermathClient = false; ADTLITE_Spawn = false; ADTLITE_Thread_Godmode = false; ADTLITE_KeyUp = -1; ADTLITE_KeyDown = -1; ADTLITE_MapTP_KeyDown = -1; ADTLITE_MapTP_WaitingForClick = false; ADTLITE_MapTP_KeyUp = -1; ADTLITE_Functions = [ ["Godmode", "adt_fn_godmode", "adt_toggle_godmode_enabled"], ["Map TP", "adt_fn_mapTP", "adt_toggle_mapTP_enabled"], ["Forward TP", "adt_fn_forwardTP", "adt_toggle_forwardTP_enabled"], ["Jump", "adt_fn_jump", "adt_toggle_jump_enabled"], ["Heal Self", "adt_fn_healSelf"], ["Teleport To Target", "adt_fn_teleportToTarget"], ["Spawn Vehicle", "adt_fn_loadVehicle"], ["Virtual Arsenal", "adt_fn_virtualArsenal"] ]; ADTLITE_BackgroundBlur = ppEffectCreate ["dynamicBlur", 401]; ADTLITE_BackgroundBlur ppEffectAdjust [1]; ADTLITE_BackgroundBlur ppEffectCommit 0; ADTLITE_BackgroundBlur ppEffectEnable false; // Check for exile client if (isClass (configFile >> "CfgPatches" >> "exile_client")) then { ADTLITE_ExileClient = true; }; // Check for Aftermath Client if (isClass (configFile >> "CfgPatches" >> "aftermath_client")) then { ADTLITE_AftermathClient = true; }; ////////////////////////////////////////////////////////////////////////////////////////////////// // FUNCTIONS! ////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////// /* Compile any configs */ //////////////////////////////////////////////////// adt_fn_compileConfigs = { { ADTLITE_Vehicles pushBack [getText(configFile >> "CfgVehicles" >> configName _x >> "displayName"), (configName _x)]; true } count ('((getNumber (_x >> ''scope'') >= 2) && {!(getText(_x >> ''picture'') isEqualTo '''')} && {configName _x isKindOf ''allVehicles'' && !(configName _x isKindOf ''Man'')})' configClasses (configFile >> 'CfgVehicles')); ADTLITE_Vehicles sort true; }; //////////////////////////////////////////////////// /* Displays a notification */ //////////////////////////////////////////////////// adt_fn_notify = { _message = _this; if (_message isEqualType []) then { _message = format["%1 Toggled [%2]", _this select 0, ["OFF", "ON"] select (_this select 1)]; }; if (ADTLITE_ExileClient) then { ["SuccessTitleAndText", ["ADT Lite", _message]] call ExileClient_gui_toaster_addTemplateToast; } else { systemChat _message; }; }; //////////////////////////////////////////////////// /* Toggles the background blur */ //////////////////////////////////////////////////// adt_fn_toggleBlur = { if (_this) then { ADTLITE_BackgroundBlur ppEffectAdjust [2]; ADTLITE_BackgroundBlur ppEffectEnable true; ADTLITE_BackgroundBlur ppEffectCommit 1; } else { ADTLITE_BackgroundBlur ppEffectAdjust [0]; ADTLITE_BackgroundBlur ppEffectCommit 0; ADTLITE_BackgroundBlur ppEffectEnable false; }; }; //////////////////////////////////////////////////// /* Creates a simple ctrl Input: Type <STRING> Position <ARRAY> Text <STRING> (Optional) BackgroundColor <ARRAY> (Optional) Output: Control */ //////////////////////////////////////////////////// adt_fn_buildCtrl = { _type = _this select 0; _position = _this select 1; _idc = param [2, -1]; _text = param [3, ""]; _backgroundColor = param [4, [1,1,1,0]]; _ctrl = _display ctrlCreate [_type, _idc]; _ctrl ctrlSetText _text; _ctrl ctrlSetBackgroundColor _backgroundColor; _ctrl ctrlSetPosition [ (_position select 0) * safezoneW + safezoneX, (_position select 1) * safezoneH + safezoneY, (_position select 2) * safezoneW, (_position select 3) * safezoneH ]; _ctrl ctrlCommit 0; _ctrl }; //////////////////////////////////////////////////// /* Build the GUI */ //////////////////////////////////////////////////// adt_fn_buildGUI = { disableSerialization; private _display = findDisplay 46 createDisplay "RscDisplayEmpty"; uiNamespace setVariable ["RscADTLite", _display]; _display displayAddEventHandler ["Unload", { false call adt_fn_toggleBlur; ADTLITE_IsOpen = false; ADTLITE_Spawn = false; }]; //////////////////////////////////////////////////// // Player Section //////////////////////////////////////////////////// // Title ["RscText", [0.0101562, 0.0116, 0.118594, 0.022], -1, "Online Players", [0.251, 0.322, 0.227, 1]] call adt_fn_buildCtrl; // Background ["RscText", [0.0101562, 0.038, 0.118594, 0.297], -1, "", [0.161, 0.161, 0.161, 0.8]] call adt_fn_buildCtrl; // Listbox private _playerListbox = ["RscListbox", [0.0101558, 0.071, 0.118594, 0.253], IDC_ADT_LITE_PLAYER_LISTBOX, "", [0.161, 0.161, 0.161, 0.9]] call adt_fn_buildCtrl; // Searchbox private _playerSearchbox = ["RscEdit", [0.0153125, 0.0446, 0.108281, 0.022]] call adt_fn_buildCtrl; // Add the players into the listbox lbClear _playerListbox; { private _dist = round(player distance getPos _x); private _playerIndex = _playerListbox lbAdd format["%1", name _x]; _playerListbox lbSetTextRight [_playerIndex, format["%1m", _dist]]; if (_x isEqualTo player) then { _playerListbox lbSetColor [_playerIndex, [0.196,0.804,0.196,1]]; }; _playerListbox lbSetData [_playerIndex, (netID _x)]; } forEach allPlayers; // Handle the player Searchbox EH _playerSearchbox ctrlRemoveAllEventHandlers "KeyUp"; _playerSearchbox ctrlAddEventHandler ["KeyUp", { disableSerialization; private _display = uiNamespace getVariable ["RscADTLite", displayNull]; private _playerListbox = _display displayCtrl IDC_ADT_LITE_PLAYER_LISTBOX; if !(isNull _playerListbox) then { private _search = toLower(ctrlText (_this select 0)); // Remove all the players lbClear _playerListbox; // Add them back { private _playerName = name _x; if ((toLower _playerName) find _search > -1) then { private _dist = round(player distance getPos _x); private _playerIndex = _playerListbox lbAdd format["%1", _playerName]; _playerListbox lbSetTextRight [_playerIndex, format["%1m", _dist]]; if (_x isEqualTo player) then { _playerListbox lbSetColor [_playerIndex, [0.196,0.804,0.196,1]]; }; _playerListbox lbSetData [_playerIndex, (netID _x)]; }; } forEach allPlayers; }; }]; //////////////////////////////////////////////////// // Functions Section //////////////////////////////////////////////////// // Title ["RscText", [0.0101562, 0.3526, 0.118594, 0.022], -1, "Functions", [0.227, 0.251, 0.322, 1]] call adt_fn_buildCtrl; // Background ["RscText", [0.0101564, 0.379, 0.118594, 0.605], -1, "", [0.161, 0.161, 0.161, 0.8]] call adt_fn_buildCtrl; // Listbox private _functionListbox = ["RscListbox", [0.0101558, 0.412, 0.118594, 0.539], IDC_ADT_LITE_FUNCTION_LISTBOX, "", [0.161, 0.161, 0.161, 0.9]] call adt_fn_buildCtrl; // Searchbox private _functionSearchbox = ["RscEdit", [0.0153125, 0.3856, 0.108281, 0.022], IDC_ADT_LITE_FUNCTION_SEARCHBOX] call adt_fn_buildCtrl; // Backbutton private _functionBackButton = ["RscButtonMenu", [0.0771875, 0.9554, 0.0515625, 0.022], IDC_ADT_LITE_FUNCTION_BACK_BUTTON, "Back", [0.161, 0.161, 0.161, 0.9]] call adt_fn_buildCtrl; _functionSearchbox ctrlShow false; _functionBackButton ctrlShow false; // Set up the functions listbox lbClear _functionListbox; { private _name = _x select 0; private _function = _x select 1; private _activeVar = _x param [2, ""]; private _index = _functionListbox lbAdd _name; _functionListbox lbSetData [_index, str([_function, _activeVar])]; if !(_activeVar isEqualTo "") then { private _isActive = missionNamespace getVariable [_activeVar, -1]; if (_isActive isEqualTo -1) then { missionNamespace setVariable [_activeVar, false]; _isActive = false; }; // Set our toggle color if (_isActive) then { _functionListbox lbSetColor [_index, [0.604, 0.953, 0.067, 1]]; }; }; } forEach ADTLITE_Functions; // DoubleClick EH _functionListbox ctrlRemoveAllEventHandlers "LBDblClick"; _functionListbox ctrlAddEventHandler ["LBDblClick", { private _control = _this select 0; private _index = _this select 1; // Get the data private _data = parseSimpleArray(_control lbData _index); // Make sure we have shit if !(_data isEqualTo []) then { if (ADTLITE_Spawn) then { private _className = _data select 0; if !(_className isEqualTo "") then { private _position = AGLToASL (player modelToWorld [0,10,0]); private _dir = getDir (vehicle player); private _veh = _className createVehicle _position; _veh setPosASL _position; _veh setDir _dir; format["Spawned %1", _className] call adt_fn_notify; }; } else { private _function = _data select 0; private _activeVar = _data select 1; // Do we have an active Var if !(_activeVar isEqualTo "") then { private _isActive = missionNamespace getVariable [_activeVar, false]; // Call the function _isActive call (missionNamespace getVariable [_function, {}]); // Set the color _control lbSetColor [ _index, [ [1, 1, 1, 1], [0.604, 0.953, 0.067, 1] ] select !(_isActive) ]; // Save it back missionNamespace setVariable [_activeVar, !(_isActive)]; // Notify us [_control lbText _index, !(_isActive)] call adt_fn_notify; } else { call (missionNamespace getVariable [_function, {}]); }; }; }; }]; // Add the functionality of the back button when it's pressed! _functionBackButton ctrlRemoveAllEventHandlers "ButtonClick"; _functionBackButton ctrlAddEventHandler ["ButtonClick", { disableSerialization; private _display = uiNamespace getVariable ["RscADTLite", displayNull]; private _functionListbox = _display displayCtrl IDC_ADT_LITE_FUNCTION_LISTBOX; private _searchbox = _display displayCtrl IDC_ADT_LITE_FUNCTION_SEARCHBOX; private _backButton = _display displayCtrl IDC_ADT_LITE_FUNCTION_BACK_BUTTON; _searchbox ctrlShow false; _backButton ctrlShow false; ADTLITE_Spawn = false; if !(isNull _functionListbox) then { lbClear _functionListbox; // Loop through and add everything back { private _name = _x select 0; private _function = _x select 1; private _activeVar = _x param [2, ""]; private _index = _functionListbox lbAdd _name; _functionListbox lbSetData [_index, str([_function, _activeVar])]; if !(_activeVar isEqualTo "") then { private _isActive = missionNamespace getVariable [_activeVar, false]; // Set our toggle color if (_isActive) then { _functionListbox lbSetColor [_index, [0.604, 0.953, 0.067, 1]]; }; }; } forEach ADTLITE_Functions; }; }]; // Handle the player Searchbox EH _functionSearchbox ctrlRemoveAllEventHandlers "KeyUp"; _functionSearchbox ctrlAddEventHandler ["KeyUp", { disableSerialization; private _display = uiNamespace getVariable ["RscADTLite", displayNull]; private _functionListbox = _display displayCtrl IDC_ADT_LITE_PLAYER_LISTBOX; if !(isNull _functionListbox) then { private _search = toLower(ctrlText (_this select 0)); lbClear _listbox; { if ((toLower (_x select 0)) find _search > -1 || (toLower (_x select 1)) find _search > -1) then { _index = _listbox lbAdd (_x select 0); _listbox lbSetData [_index, _x select 1]; _listbox lbSetPicture [_index, getText(configFile >> "CfgVehicles" >> (_x select 1) >> "picture")]; }; } forEach ADTLITE_Vehicles; }; }]; // Blur the background true call adt_fn_toggleBlur; // Yeahhhhh ADTLITE_IsOpen = true; }; //////////////////////////////////////////////////// /* Toggle Godmode */ //////////////////////////////////////////////////// adt_fn_godmode = { if !(_this) then { [] spawn { ADTLITE_Thread_Godmode = true; while {ADTLITE_Thread_Godmode} do { if (alive player && {(vehicle player) isEqualTo player}) then { player allowDamage false; player removeAllEventhandlers "HandleDamage"; player addEventhandler ["HandleDamage", {false}]; player setBleedingRemaining 0; player setOxygenRemaining 1; player setFatigue 0; if (damage player > 0) then { player setDamage 0; }; // Only run for Exile if (ADTLITE_ExileClient) then { ExileClientPlayerAttributes = if (ADTLITE_AftermathClient) then { [ 100, // ATTRIBUTE_HEALTH 100, // ATTRIBUTE_STAMINA 100, // ATTRIBUTE_HUNGER 100, // ATTRIBUTE_THIRST 0, // ATTRIBUTE_ALCOHOL 37, // ATTRIBUTE_TEMPERATURE 0, // ATTRIBUTE_WETNESS 100, // ATTRIBUTE_UVD_RESISTANCE 0, // ATTRIBUTE_UVD_INFESTATION 300 // ATTRIBUTE_GASMASK_TIME ] } else { [ 100, // ATTRIBUTE_HEALTH 100, // ATTRIBUTE_STAMINA 100, // ATTRIBUTE_HUNGER 100, // ATTRIBUTE_THIRST 0, // ATTRIBUTE_ALCOHOL 37, // ATTRIBUTE_TEMPERATURE 0 // ATTRIBUTE_WETNESS ] }; ExileClientPlayerAttributesASecondAgo = ExileClientPlayerAttributes; ExileClientPlayerLastHpRegenerationAt = diag_tickTime; ExileClientPlayerIsOverburdened = false; ExileClientPlayerOxygen = 100; ExileClientPlayerIsAbleToBreathe = true; ExileClientPlayerIsDrowning = false; ExileClientPlayerIsInjured = false; ExileClientPlayerIsBurning = false; ExileClientPlayerIsBleeding = false; ExileClientPlayerIsExhausted = false; ExileClientPlayerIsHungry = false; ExileClientPlayerIsThirsty = false; if (ADTLITE_AftermathClient) then { AftermathHearingLossTimeout = 0; AftermathPlayerHearingLossActive = false; AftermathClientIsPlayerForcedWalking = false; AftermathClientRadiationProtected = true; }; }; }; uiSleep 0.1; }; }; } else { ADTLITE_Thread_Godmode = false; player allowDamage true; player removeAllEventhandlers 'HandleDamage'; if (ADTLITE_ExileClient) then { player addEventHandler ['HandleDamage', {_this call ExileClient_object_player_event_onHandleDamage}]; }; }; }; //////////////////////////////////////////////////// /* Toggle MapTP */ //////////////////////////////////////////////////// adt_fn_mapTP = { if !(_this) then { ["ADTLITE_MapEH", "onMapSingleClick", { if (ADTLITE_MapTP_WaitingForClick) then { private _veh = vehicle player; if (_veh isEqualTo player) then { _veh setPosATL _pos; } else { if (_veh isKindOf 'AIR') then { private _posObj = getPosATL _veh; _pos = [_pos select 0, _pos select 1, _posObj select 2]; } else { _veh setPosATL _pos; }; }; {player reveal _x; false} count (_pos nearObjects 50); }; }] call BIS_fnc_addStackedEventHandler; } else { ["ADTLITE_MapEH", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler; }; }; //////////////////////////////////////////////////// /* Toggles Forward TP */ //////////////////////////////////////////////////// adt_fn_forwardTP = { "To teleport forward, press shift-5" call adt_fn_notify; }; //////////////////////////////////////////////////// /* Toggles the ability to jump */ //////////////////////////////////////////////////// adt_fn_jump = { "To jump, press shift-4" call adt_fn_notify; }; //////////////////////////////////////////////////// /* Toggles Heal Self */ //////////////////////////////////////////////////// adt_fn_healSelf = { player setDamage 0; player setBleedingRemaining 0; player setOxygenRemaining 1; player setFatigue 0; if (ADTLITE_ExileClient) then { ExileClientPlayerAttributes = [100,100,100,100,0,37,0]; ExileClientPlayerAttributesASecondAgo = ExileClientPlayerAttributes; ExileClientPlayerLastHpRegenerationAt = diag_tickTime; ExileClientPlayerIsOverburdened = false; ExileClientPlayerOxygen = 100; ExileClientPlayerIsAbleToBreathe = true; ExileClientPlayerIsDrowning = false; ExileClientPlayerIsInjured = false; ExileClientPlayerIsBurning = false; ExileClientPlayerIsBleeding = false; ExileClientPlayerIsExhausted = false; ExileClientPlayerIsHungry = false; ExileClientPlayerIsThirsty = false; ExilePlayerRadiation = 0; ExilePlayerRadiationLastCheck = 0; }; "You are fully healed" call adt_fn_notify; }; //////////////////////////////////////////////////// /* Toggles Ability to teleport to another player */ //////////////////////////////////////////////////// adt_fn_teleportToTarget = { disableSerialization; private _display = uiNamespace getVariable ["RscADTLite", displayNull]; private _listbox = _display displayCtrl IDC_ADT_LITE_FUNCTION_LISTBOX; private _target = _listbox lbData (lbCurSel _listbox); _target = objectFromnetID _target; if (!alive _target || isNull _target) exitWith { "Target isn't alive or is null!" call adt_fn_notify; }; private _targetName = name _target; private _posATL = getPosATL _target; private _pos = _target modelToWorld [0,-5,0]; _pos set [2, _posATL select 2]; player setPosATL _pos; format["Teleported to %1", _targetName] call adt_fn_notify; }; //////////////////////////////////////////////////// /* loads all the vehicles into the listbox */ //////////////////////////////////////////////////// adt_fn_loadVehicle = { disableSerialization; private _display = uiNamespace getVariable ["RscADTLite", displayNull]; private _listbox = _display displayCtrl IDC_ADT_LITE_FUNCTION_LISTBOX; private _searchbox = _display displayCtrl IDC_ADT_LITE_FUNCTION_SEARCHBOX; private _backButton = _display displayCtrl IDC_ADT_LITE_FUNCTION_BACK_BUTTON; _searchbox ctrlShow true; _backButton ctrlShow true; lbClear _listbox; { _index = _listbox lbAdd (_x select 0); _listbox lbSetData [_index, str([_x select 1])]; _listbox lbSetPicture [_index, getText(configFile >> "CfgVehicles" >> (_x select 1) >> "picture")]; } forEach ADTLITE_Vehicles; ADTLITE_Spawn = true; }; //////////////////////////////////////////////////// /* Shows the virtual arsenal */ //////////////////////////////////////////////////// adt_fn_virtualArsenal = { false call adt_fn_toggleBlur; ADTLITE_IsOpen = false; ADTLITE_Spawn = false; closeDialog 1; ["Open", true] spawn BIS_fnc_arsenal; }; //////////////////////////////////////////////////// /* Process the rest of this! */ //////////////////////////////////////////////////// // Compile the configs, might be a little laggy call adt_fn_compileConfigs; // Hook some shit ADTLITE_KeyUp = (findDisplay 46) displayAddEventHandler ["KeyUp", { _stopPropagation = false; if ((_this select 1) isEqualTo ADTLITE_KeyOpen && {!ADTLITE_IsOpen}) then { call adt_fn_buildGUI; _stopPropagation = true; }; _stopPropagation }]; // Hook some shit ADTLITE_KeyDown = (findDisplay 46) displayAddEventHandler ["KeyDown", { private _stopPropagation = false; private _caller = _this select 0; private _keyCode = _this select 1; private _shiftState = _this select 2; private _controlState = _this select 3; private _altState = _this select 4; switch (_keyCode) do { // Key 4 case 0x05: { if (adt_toggle_jump_enabled) then { if (_shiftState) then { private _vehicle = vehicle player; _vehicle setVelocity [(velocity _vehicle) select 0, (velocity _vehicle) select 1, 10]; }; _stopPropagation = true; }; }; // Key 5 case 0x06: { if (adt_toggle_forwardTP_enabled) then { if (_shiftState) then { private _veh = vehicle player; private _dir = getdir _veh; private _pos = getPos _veh; _pos = [(_pos select 0) + 10 * sin(_dir), (_pos select 1) + 10 * cos(_dir), (_pos select 2)]; _veh setPos _pos; }; _stopPropagation = true; }; }; }; _stopPropagation }]; ADTLITE_MapTP_KeyDown = (findDisplay 12) displayAddEventHandler ["KeyDown", { if (_this select 3) then { ADTLITE_MapTP_WaitingForClick = true; }; }]; ADTLITE_MapTP_KeyUp = (findDisplay 12) displayAddEventHandler ["KeyUp", { ADTLITE_MapTP_WaitingForClick = false; }]; "You've been given access to ADT Lite. Press F5 to open the tools" call adt_fn_notify; }; // Send it (owner _targetObject) publicVariableClient "ADT_PACKAGE"; // Exec it [] remoteExec ["ADT_PACKAGE", owner _targetObject]; } catch { _exception call ArcasServer_util_log; }; ADT_PACKAGE = nil;