This commit is contained in:
IT07 2016-07-06 22:56:26 +02:00
parent 1ff0058ec7
commit 2d859b372d
9 changed files with 0 additions and 609 deletions

View File

@ -1,31 +0,0 @@
/*
Author: IT07
Description:
checks for players within given distance of given location/position
Params:
_this select 0: POSITION - center of area to check around
_this select 1: SCALAR - radius around the position to check for players
Returns:
BOOL - true if player(s) found
*/
private ["_found","_pos","_rad"];
// By default, we assume that there are no players close. The distance check below should prove otherwise if there are players close
_found = false;
params [["_pos",[],[[]]], ["_rad",-1,[0]]];
if (((count _pos) isEqualTo 3) AND (_rad > -1)) then
{
{
if (isPlayer _x AND speed _x < 250) then
{
private ["_isClose"];
_isClose = if ((position _x distance _pos) < _rad) then { true } else { false };
if _isClose then { _found = true };
};
} forEach allPlayers;
};
_found

View File

@ -1,104 +0,0 @@
/*
Author: IT07
Description:
gets config value of given var from VEMF config OR cfgPath
Params:
method 1:
_this: STRING - SINGLE config value to get from root of CfgVemfReloaded
method 2:
_this select 0: ARRAY of STRINGS - MULTIPLE config values to get from root of VEMFconfig
method 3:
_this select 0: ARRAY of STRINGS - config path to get value from. Example: "root","subclass"
_this select 1: ARRAY of STRINGS - MULTIPLE config values to get from given path
Returns:
ARRAY - Result
*/
private["_r","_check","_v"];
_r = [];
_check =
{
if (isNumber _cfg) then
{
_v = getNumber _cfg
} else
{
if (isText _cfg) then
{
_v = getText _cfg
} else
{
if (isArray _cfg) then
{
_v = getArray _cfg
};
};
};
};
if (_this isEqualType "") then
{
private ["_cfg"];
if (isNull (configFile >> "CfgVemfReloadedOverrides" >> _this)) then
{
_cfg = configFile >> "CfgVemfReloaded" >> _this;
} else
{
_cfg = configFile >> "CfgVemfReloadedOverrides" >> _this;
};
call _check;
if not isNil "_v" then
{
_r = _v;
};
};
if (_this isEqualType []) then
{
if (_this isEqualTypeArray [[],[]]) then
{
private ["_path","_build"];
_path = _this select 0;
_build =
{
{
_cfg = _cfg >> _x;
} forEach _path;
};
private ["_cfg"];
{
_cfg = configFile >> "CfgVemfReloadedOverrides";
call _build;
_cfg = _cfg >> _x;
if (isNull _cfg) then
{
_cfg = configFile >> "CfgVemfReloaded";
call _build;
_cfg = _cfg >> _x;
};
call _check;
if not isNil "_v" then
{
_r pushBack _v
};
} forEach (_this select 1);
};
if (_this isEqualTypeArray [[]]) then
{
private ["_cfg"];
{
_cfg = configFile >> "CfgVemfReloadedOverrides" >> _x;
if (isNull _cfg) then
{
_cfg = configFile >> "CfgVemfReloaded" >> _x;
};
call _check;
_r pushBack _v;
} forEach (_this select 0);
};
};
_r

View File

@ -1,65 +0,0 @@
/*
Author: IT07
Description:
selects a headless client with least (VEMFr) load
Params:
None
Returns:
OBJECT - the headless client
*/
private ["_hasLowest"];
if (("headLessClientSupport" call VEMFr_fnc_getSetting) isEqualTo 1) then
{ // Ok, Headless Clients enabled. let us continue
private ["_hcList","_ingameHCs"];
_hcList = "headLessClientNames" call VEMFr_fnc_getSetting;
// We have the names now, check if any of them is actually ingame
_ingameHCs = [];
{
if (side _x isEqualTo sideLogic AND _x in _hcList) then
{
_ingameHCs pushBack [_x, name _x];
};
} forEach allPlayers;
if (count _ingameHCs > 0) then
{ // At least 1 of given headless clients is ingame, lets check their load
private ["_globalLoad","_lowestLoad","_hasLowest"];
_globalLoad = uiNamespace getVariable "VEMFrHcLoad";
_lowestLoad = 99999;
_hasLowest = "";
private ["_load"];
{ // Find the lowest load number
_load = _x select 1;
if (_load < _lowestLoad) then
{
_lowestLoad = _load;
_hasLowest = _x select 0;
};
} forEach _globalLoad;
private ["_index"];
// HC with lowest load found, add +1 to its current load
_index = _globalLoad find [_hasLowest, _lowestLoad];
if (_index > -1) then
{
_globalLoad set [_index,[_hasLowest, _lowestLoad +1]]
};
} else
{
["fn_headlessClient", 0, "Unable to find any ingame Headless Client(s)"] spawn VEMFr_fnc_log;
};
} else
{
["fn_headLessClient", 0, "Can not run. headLessClientSupport is not enabled"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
// Lowest load found, send it
if not isNil "_hasLowest" then
{
_hasLowest
} else
{
["fn_headlessClient", 0, "Unable to find HC with lowest load..."] spawn VEMFr_fnc_log;
};

View File

@ -1,46 +0,0 @@
/*
Author: IT07
Description:
places mines around given position within given radius
Params:
_this select 0: POSITION - center of area to place mines around
_this select 1: SCALAR - the minimum distance
_this select 2: SCALAR - the maximum distance (must be higher than minimum of course)
_this select 3: STRING - exact config name of mission
Returns:
ARRAY - array containing all mine objects
*/
scopeName "main";
private ["_ok","_pos","_min","_max","_mineSetting","_missionName","_settings","_mineSetting","_amount"];
_ok = false;
params [["_pos",[],[[]]], ["_min",-1,[0]], ["_max",-1,[0]], ["_missionName", "", [""]]];
_settings = [[_missionName],["mines","minesAmount"]] call VEMFr_fnc_getSetting;
_settings params ["_mineSetting","_amount"];
if ((_missionName in ("missionList" call VEMFr_fnc_getSetting)) AND (_mineSetting > 0) AND ((count _pos) isEqualTo 3) AND (_min > -1) AND (_max > _min) AND (_amount > -1)) then
{
private ["_mineTypes"];
if (_mineSetting isEqualTo 1) then { _mineTypes = ["ATMine"] };
if (_mineSetting isEqualTo 2) then { _mineTypes = ["APERSMine"] };
if (_mineSetting isEqualTo 3) then { _mineTypes = ["ATMine","APERSMine"] };
if (_mineSetting < 1 OR _mineSetting > 3) then
{
["fn_placeMines", 0, "Invalid mines mode!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
breakOut "main"
};
_mines = [];
["fn_placeMines", 1, format["Placing %1 mines at %2", _amount, _pos]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
for "_m" from 1 to _amount do
{
private ["_mine"];
_mine = createMine [selectRandom _mineTypes, ([_pos, _min, _max, 2, 0, 20, 0] call BIS_fnc_findSafePos), [], 0];
uiSleep 0.1;
_mines pushBack _mine;
};
_ok = [_mines];
};
_ok

View File

@ -1,33 +0,0 @@
/*
Author: IT07
Description:
checks if player count is above or equal to given number. If no number given, default of 1 will be used.
Params:
none
Returns:
ARRAY - [false if current player count is below minimum, true if (more than OR equalTo) minimum]
*/
private ["_ok"];
_ok = false;
if (_this isEqualType []) then
{
private ["_minimum"];
_minimum = param [0, 1, [0]];
_players = 0;
{
if (isPlayer _x) then
{
_players = _players + 1;
};
} forEach allPlayers;
if (_players >= _minimum) then
{
_ok = true
};
};
_ok

View File

@ -1,47 +0,0 @@
/*
Author: VAMPIRE, rebooted by IT07
Description:
fn_waitForMissionDone - waits for mission to be done
Params:
_this select 0: STRING - name of mission location
_this select 1: POSITION - center of area to be waiting for
_this select 2: ARRAY - array of units to check for
_this select 3: SCALAR - radius around center to check for players
Returns:
BOOL - true when mission is done
*/
private ["_complete","_missionName","_pos","_unitArr","_rad"];
_complete = false;
params [["_missionName","",[""]], ["_pos",[],[[]]], ["_unitArr",[],[[]]], ["_rad",0,[0]]];
if (count _pos isEqualTo 3) then
{
if (count _unitArr > 0) then
{
private ["_unitCount","_killed","_killToComplete"];
_unitCount = count _unitArr;
_killed = [];
_killToComplete = round(("killPercentage" call VEMFr_fnc_getSetting)/100*_unitCount);
if (_rad > 0) then
{
while {not _complete} do
{
_kiaCount = 0;
{
if (damage _x isEqualTo 1 OR isNull _x) then
{
_kiaCount = _kiaCount + 1;
};
} forEach _unitArr;
if (_kiaCount >= _killToComplete) exitWith { _complete = true };
uiSleep 4;
};
["waitForMissionDone", 1, format["mission in %1 has been completed!", _missionName]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
};
};
_complete

View File

@ -1,100 +0,0 @@
/*
Author: IT07
Description:
handles giving respect to players after killing AI
Params:
_this select 0: OBJECT - the AI that was killed
_this select 1: OBJECT - the killer (must be a player)
*/
params [["_target",objNull,[objNull]], ["_killer",objNull,[objNull]]];
_respectReward = "respectReward" call VEMFr_fnc_getSetting;
if (_respectReward > 0) then
{
_message = [[]];
_killMsg = selectRandom ["AI WACKED","AI CLIPPED","AI DISABLED","AI DISQUALIFIED","AI WIPED","AI ERASED","AI LYNCHED","AI WRECKED","AI NEUTRALIZED","AI SNUFFED","AI WASTED","AI ZAPPED"];
(_message select 0) pushBack [_killMsg,_respectReward];
_dist = _target distance _killer;
private ["_distanceOk"];
if (_dist < 2500) then
{
scopeName "below2500";
if (_dist <= 5) then
{
(_message select 0) pushBack ["CQB Master", 25];
_distanceOk = true;
_distanceOk breakOut "below2500";
};
if (_dist <= 10) then
{
(_message select 0) pushBack ["Close one", 15];
_distanceOk = true;
_distanceOk breakOut "below2500";
};
if (_dist <= 50) then
{
(_message select 0) pushBack ["Danger close", 15];
_distanceOk = true;
_distanceOk breakOut "below2500";
};
if (_dist <= 100) then
{
(_message select 0) pushBack ["Lethal aim", 20];
_distanceOk = true;
_distanceOk breakOut "below2500";
};
if (_dist <= 200) then
{
(_message select 0) pushBack ["Deadly.", 25];
_distanceOk = true;
_distanceOk breakOut "below2500";
};
if (_dist <= 500) then
{
(_message select 0) pushBack ["Niiiiice.", 30];
_distanceOk = true;
_distanceOk breakOut "below2500";
};
if (_dist <= 1000) then
{
(_message select 0) pushBack ["Dat distance...", 45];
_distanceOk = true;
_distanceOk breakOut "below2500";
};
if (_dist <= 2000) then
{
(_message select 0) pushBack ["Danger far.", 50];
_distanceOk = true;
_distanceOk breakOut "below2500";
};
if (_dist > 2000) then
{
(_message select 0) pushBack [format["hax? %1m!!!", round _dist], 65];
_distanceOk = true;
_distanceOk breakOut "below2500";
};
};
if _distanceOk then
{
_curRespect = _killer getVariable ["ExileScore", nil];
if not(isNil "_curRespect") then
{
_respectToGive = (((_message select 0) select 1) select 1);
_newRespect = _curRespect + _respectToGive + _respectReward;
_killer setVariable ["ExileScore", _newRespect];
ExileClientPlayerScore = _newRespect;
(owner _killer) publicVariableClient "ExileClientPlayerScore";
ExileClientPlayerScore = nil;
[_killer, "showFragRequest", _message] call ExileServer_system_network_send_to;
format["setAccountMoneyAndRespect:%1:%2:%3", _killer getVariable ["ExileMoney", 0], _newRespect, (getPlayerUID _killer)] call ExileServer_system_database_query_fireAndForget;
} else
{
["fn_aiKilled", 0, format["Failed to get respect from %1 (%2)", name _killer, _killer]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
} else
{
["handleKillMessage", 0, format["There is something wrong with the kill distance (%1)", _dist]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
breakOut "outer"; // Stop doing anything after this line
};
};

View File

@ -1,97 +0,0 @@
/*
Author: IT07
Description:
handles giving respect to players after killing AI
Params:
_this select 0: OBJECT - the AI that was killed
_this select 1: OBJECT - the killer (must be a player)
*/
params [
["_t", objNull, [objNull]],
["_k", objNull, [objNull]]
];
_rw = "respectReward" call VEMFr_fnc_config;
if (_rw > 0) then
{
_arr = [[]];
(_arr select 0) pushBack [(selectRandom ["AI WACKED","AI CLIPPED","AI DISABLED","AI DISQUALIFIED","AI WIPED","AI ERASED","AI LYNCHED","AI WRECKED","AI NEUTRALIZED","AI SNUFFED","AI WASTED","AI ZAPPED"]), _rw];
_dist = _t distance _k;
private ["_ok"];
if (_dist < 2500) then
{
scopeName "below2500";
if (_dist <= 5) then
{
(_arr select 0) pushBack ["CQB Master", 25];
_ok = true;
_ok breakOut "below2500";
};
if (_dist <= 10) then
{
(_arr select 0) pushBack ["Close one", 15];
_ok = true;
_ok breakOut "below2500";
};
if (_dist <= 50) then
{
(_arr select 0) pushBack ["Danger close", 15];
_ok = true;
_ok breakOut "below2500";
};
if (_dist <= 100) then
{
(_arr select 0) pushBack ["Lethal aim", 20];
_ok = true;
_ok breakOut "below2500";
};
if (_dist <= 200) then
{
(_arr select 0) pushBack ["Deadly.", 25];
_ok = true;
_ok breakOut "below2500";
};
if (_dist <= 500) then
{
(_arr select 0) pushBack ["Niiiiice.", 30];
_ok = true;
_ok breakOut "below2500";
};
if (_dist <= 1000) then
{
(_arr select 0) pushBack ["Dat distance...", 45];
_ok = true;
_ok breakOut "below2500";
};
if (_dist <= 2000) then
{
(_arr select 0) pushBack ["Danger far.", 50];
_ok = true;
_ok breakOut "below2500";
};
if (_dist > 2000) then
{
(_arr select 0) pushBack [format["hax? %1m!!!", round _dist], 65];
_ok = true;
_ok breakOut "below2500";
};
};
if _ok then
{
_crRspct = _k getVariable ["ExileScore", nil];
_rspctTGv = (((_arr select 0) select 1) select 1);
_nwRspct = _crRspct + _rspctTGv + _rw;
_k setVariable ["ExileScore", _nwRspct];
ExileClientPlayerScore = _nwRspct;
(owner _k) publicVariableClient "ExileClientPlayerScore";
ExileClientPlayerScore = nil;
[_k, "showFragRequest", _arr] call ExileServer_system_network_send_to;
format["setAccountMoneyAndRespect:%1:%2:%3", _k getVariable ["ExileMoney", 0], _nwRspct, (getPlayerUID _k)] call ExileServer_system_database_query_fireAndForget;
} else
{
["handleKillMessage", 0, format["There is something wrong with the kill distance (%1)", _dist]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
breakOut "outer"; // Stop doing anything after this line
};
};

View File

@ -1,86 +0,0 @@
/*
Author: IT07
Description:
handles the transfer of ownership to another given unit/client/object.
Will transfer complete group to the same (new) owner.
Params:
_this select 0: GROUP - the group of which the ownership should be transfered
Returns:
nothing
*/
_toTransfer = param [0, grpNull, [grpNull]];
if not isNull _toTransfer then
{
private ["_hcEnabled","_forceClients"];
// Check if HC is enabled
_hcEnabled = "headLessClientSupport" call VEMFr_fnc_getSetting;
_forceClients = uiNamespace getVariable ["VEMFr_forceAItoClients", nil];
if not(isNil "_forceClients") then
{
if _forceClients then
{
_hcEnabled = -1;
};
};
private ["_to"];
if (_hcEnabled isEqualTo 1) then
{ // Gather the Headless Client(s)
private ["_hcClients"];
_hcClients = [];
{
if (typeOf _x isEqualTo "HeadlessClient_F") then // it is an HC
{
_hcClients pushBack [_x, owner _x];
};
} forEach allPlayers;
if (count _hcClients > 0) then
{
_to = call VEMFr_fnc_headlessClient; // Select a random hc
} else
{
uiNamespace setVariable ["VEMFr_forceAItoClients", true];
};
} else // If Headlessclient setting is not enabled
{
if ([1] call VEMFr_fnc_playerCount) then
{
private ["_closest"];
_closest = [0,0,0];
{
if (isPlayer _x) then
{
private ["_leaderPos","_dist"];
_leaderPos = position (leader _toTransfer);
_dist = _leaderPos distance (position _x);
if (_dist < (_leaderPos distance _closest)) then
{ // Find the closest player
private ["_closest"];
_closest = position _x;
_to = _x;
};
};
} forEach allPlayers;
};
};
};
if not isNil "_to" then
{
_transfer = _toTransfer setGroupOwner (owner _to);
_load = uiNamespace getVariable ["VEMFrHcLoad", nil];
if not isNil "_load" then
{
_index = _load find _to;
if (_index > -1) then
{
_load set [_index, ((_load select _index) select 1) + 1];
} else
{
_load pushBack [_to, 1];
};
};
};