<commit_before>/*
=======================================================================================================================

	downloadData - script to download data from a laptop and because of this complete a task (as example)

	File:		downloadData.sqf
	Author:		T-800a

=======================================================================================================================
*/

T8_varFileSize = 165072;  								// Filesize ... smaller files will take shorter time to download!

T8_varTLine01 = "Download cancelled!";				// download aborted
T8_varTLine02 = "Download already in progress by someone else!";			// download already in progress by someone else
T8_varTLine03 = "Download started!";					// download started
T8_varTLine04 = "Download finished! $25,000 added to your inventory!";				// download finished
T8_varTLine05 = "##  Hack Bank Accounts  ##";				// line for the addaction

T8_varDiagAbort = false;
T8_varDownSucce = false;

downloadActionId = nil;


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

if (isDedicated) exitWith {};

"AddLaptopHandler" addPublicVariableEventHandler {
	private [  "_cDT" ];
	_laptop = _this select 1;
	_cDT = _laptop getVariable [ "Done", false ];
	if ( _cDT ) exitWith {};
	if(isNil "downloadActionId") then {
		downloadActionId = _laptop addAction [ T8_varTLine05, { call T8_fnc_ActionLaptop; }, [], 10, true, false ];
	};
};

T8_fnc_abortActionLaptop =
{
	if ( T8_varDownSucce ) then 
	{
		// hint "DEBUG - DONE";
		T8_varDiagAbort = false;
		T8_varDownSucce = false;		
	
	} else { 
		player sideChat T8_varTLine01; 
		T8_varDiagAbort = true; 
		T8_varDownSucce = false; 
	};
};

"RemoveLaptopHandler" addPublicVariableEventHandler
{
	_laptop = _this select 1;
	_laptop removeAction downloadActionId;
	downloadActionId = nil;
};


T8_fnc_ActionLaptop =
{
	private [ "_laptop", "_caller", "_id", "_cIU","_totalMoney","_fivePercent" ];
	_laptop = _this select 0;
	_caller = _this select 1;
	_id = _this select 2;
	
	
	
	_cIU = _laptop getVariable [ "InUse", false ];
	if ( _cIU ) exitWith { player sideChat T8_varTLine02; };
	
	player sideChat T8_varTLine03;
	
	T8_varDiagAbort = false;
	
	_laptop setVariable [ "InUse", true, true ];
		
	[ _laptop, _id] spawn 
	{
		private [ "_laptop", "_id", "_newFile", "_dlRate" ];
		
		_laptop		= _this select 0;
		_id			= _this select 1;
		
		_newFile = 0;
		
		createDialog "T8_DataDownloadDialog";
		
		sleep 0.5;
		ctrlSetText [ 8001, "Connecting ..." ];
		sleep 0.5;
		ctrlSetText [ 8001, "Connected:" ];		
		ctrlSetText [ 8003, format [ "%1 kb", T8_varFileSize ] ];		
		ctrlSetText [ 8004, format [ "%1 kb", _newFile ] ];		
		
		while { !T8_varDiagAbort && alive player && (player getVariable ["FAR_isUnconscious", 0] == 0)} do
		{
			_dlRate = 1000 + random 400;
			_newFile = _newFile + _dlRate;

			if ( _newFile > T8_varFileSize ) then 
			{
				_dlRate = 0;		
				_newFile = T8_varFileSize;
				ctrlSetText [ 8001, "Download finished!" ];	
				T8_varDiagAbort = true;
				T8_varDownSucce = true;
				
				_laptop setVariable [ "Done", true, true ];
				
				//After mission success
		_totalMoney = 0;
	{    
			if (isPlayer _x)  then {    
			_bmoney = _x getVariable ["bmoney",0];
			if ( _bmoney > 0 ) then { //might as well check for zero's
			_fivePercent = round(0.05*_bmoney);
			_x setVariable [ "bmoney", (_bmoney - _fivePercent), true ];
			_totalMoney = _totalMoney + _fivePercent;
		}
	}
} forEach playableUnits;

		player setVariable ["cmoney", (player getVariable ["cmoney", 0]) + _totalMoney, true];
				
			};
			
			ctrlSetText [ 8002, format [ "%1 kb/s", _dlRate ] ];		
			ctrlSetText [ 8004, format [ "%1 kb", _newFile ] ];				
			
			sleep 1;
		};
		
		T8_varDiagAbort = false;
		
		closeDialog 0;
<commit_msg>Added Minimum Reward<commit_after>/*
=======================================================================================================================
	downloadData - script to download data from a laptop and because of this complete a task (as example)
	File:		downloadData.sqf
	Author:		T-800a
=======================================================================================================================
*/

T8_varFileSize = 165072;  								// Filesize ... smaller files will take shorter time to download!

T8_varTLine01 = "Download cancelled!";				// download aborted
T8_varTLine02 = "Download already in progress by someone else!";			// download already in progress by someone else
T8_varTLine03 = "Download started!";					// download started
T8_varTLine04 = "Download finished! $25,000 added to your inventory!";				// download finished
T8_varTLine05 = "##  Hack Player Bank Accounts  ##";				// line for the addaction

T8_varDiagAbort = false;
T8_varDownSucce = false;

downloadActionId = nil;


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

if (isDedicated) exitWith {};

"AddLaptopHandler" addPublicVariableEventHandler {
	private [  "_cDT" ];
	_laptop = _this select 1;
	_cDT = _laptop getVariable [ "Done", false ];
	if ( _cDT ) exitWith {};
	if(isNil "downloadActionId") then {
		downloadActionId = _laptop addAction [ T8_varTLine05, { call T8_fnc_ActionLaptop; }, [], 10, true, false ];
	};
};

T8_fnc_abortActionLaptop =
{
	if ( T8_varDownSucce ) then 
	{
		// hint "DEBUG - DONE";
		T8_varDiagAbort = false;
		T8_varDownSucce = false;		
	
	} else { 
		player sideChat T8_varTLine01; 
		T8_varDiagAbort = true; 
		T8_varDownSucce = false; 
	};
};

"RemoveLaptopHandler" addPublicVariableEventHandler
{
	_laptop = _this select 1;
	_laptop removeAction downloadActionId;
	downloadActionId = nil;
};


T8_fnc_ActionLaptop =
{
	private [ "_laptop", "_caller", "_id", "_cIU","_totalMoney","_fivePercent" ];
	_laptop = _this select 0;
	_caller = _this select 1;
	_id = _this select 2;
	
	
	
	_cIU = _laptop getVariable [ "InUse", false ];
	if ( _cIU ) exitWith { player sideChat T8_varTLine02; };
	
	player sideChat T8_varTLine03;
	
	T8_varDiagAbort = false;
	
	_laptop setVariable [ "InUse", true, true ];
		
	[ _laptop, _id] spawn 
	{
		private [ "_laptop", "_id", "_newFile", "_dlRate" ];
		
		_laptop		= _this select 0;
		_id			= _this select 1;
		
		_newFile = 0;
		
		createDialog "T8_DataDownloadDialog";
		
		sleep 0.5;
		ctrlSetText [ 8001, "Connecting ..." ];
		sleep 0.5;
		ctrlSetText [ 8001, "Connected:" ];		
		ctrlSetText [ 8003, format [ "%1 kb", T8_varFileSize ] ];		
		ctrlSetText [ 8004, format [ "%1 kb", _newFile ] ];		
		
		while { !T8_varDiagAbort && alive player && (player getVariable ["FAR_isUnconscious", 0] == 0)} do
		{
			_dlRate = 1000 + random 400;
			_newFile = _newFile + _dlRate;

			if ( _newFile > T8_varFileSize ) then 
			{
				_dlRate = 0;		
				_newFile = T8_varFileSize;
				ctrlSetText [ 8001, "Download finished!" ];	
				T8_varDiagAbort = true;
				T8_varDownSucce = true;
				
				_laptop setVariable [ "Done", true, true ];
				
	
	//After mission success
		_totalMoney = 0;
		{    
			if (isPlayer _x)  then {    
			_bmoney = _x getVariable ["bmoney",0];
			if ( _bmoney > 0 ) then { //might as well check for zero's
			_fivePercent = round(0.05*_bmoney);
			_x setVariable [ "bmoney", (_bmoney - _fivePercent), true ];
			_totalMoney = _totalMoney + _fivePercent;
		}
			}
		} forEach playableUnits;

			
			if (_totalMoney > 25000) then {
			player setVariable ["cmoney", (player getVariable ["cmoney", 0]) + _totalMoney, true];
			}
		else 	{
			player setVariable ["cmoney", (player getVariable ["cmoney", 0]) + 25000, true];	
				};
			};
			
			ctrlSetText [ 8002, format [ "%1 kb/s", _dlRate ] ];		
			ctrlSetText [ 8004, format [ "%1 kb", _newFile ] ];				
			
			sleep 1;
		};
		
		T8_varDiagAbort = false;
		
		closeDialog 0;

{'fraction_non_alphanumeric': 0.200562444075163, 'fraction_numerical': 0.03361881631087818, 'mean_word_length': 3.1265822784810124, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 38, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4097025', 'n_tokens_mistral': 3185, 'n_tokens_neox': 2616, 'n_words': 667}