a3_vemf_reloaded/exile_vemf_reloaded/sqf/checkLoot.sqf

66 lines
2.1 KiB
Plaintext
Raw Normal View History

2016-04-13 20:32:39 +00:00
/*
Author: IT07
Description:
checks the VEMF loot table for invalid classnames. Reports to RPT if invalid classes found.
Params:
none
Returns:
nothing
*/
2016-07-02 14:24:53 +00:00
if ("validateLoot" call VEMFr_fnc_config isEqualTo 1) then
2016-04-13 20:32:39 +00:00
{ // _validateLoot is enabled, go ahead...
2016-07-02 14:24:53 +00:00
if ("debugMode" call VEMFr_fnc_config < 1) then
2016-04-13 20:32:39 +00:00
{
2016-05-10 12:18:49 +00:00
["CheckLoot", 0, "Failed to validate loot: no output allowed in RPT"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-04-13 20:32:39 +00:00
} else
{
2016-05-10 12:18:49 +00:00
["CheckLoot", 1, "Validating loot tables..."] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-07-02 14:24:53 +00:00
_bin = [];
2016-04-13 20:32:39 +00:00
_mags = [];
_cfgMags = "_mags pushBack (configName _x); true" configClasses (configFile >> "cfgMagazines");
_weapons = [];
_cfgWeapons = "_weapons pushBack (configName _x); true" configClasses (configFile >> "cfgWeapons");
_bags = [];
_cfgBags = "getText (_x >> 'vehicleClass') isEqualTo 'Backpacks'" configClasses (configFile >> "cfgVehicles");
{
_bags pushBack (configName _x);
} forEach _cfgBags;
2016-07-02 14:24:53 +00:00
_aiGear = [["aiGear"],["aiUniforms","aiVests","aiRifles","aiBackpacks","aiLaunchers","aiPistols"]] call VEMFr_fnc_config;
2016-04-13 20:32:39 +00:00
{
{
if not((_x in _mags) OR (_x in _weapons) OR (_x in _bags)) then
{
2016-07-02 14:24:53 +00:00
_bin pushBack _x;
2016-04-13 20:32:39 +00:00
};
} forEach _x;
} forEach _aiGear;
2016-07-02 14:24:53 +00:00
_loot = [["crateLoot"],["primaryWeaponLoot","secondaryWeaponLoot","magazinesLoot","attachmentsLoot","itemsLoot","vestsLoot","headGearLoot","backpacksLoot"]] call VEMFr_fnc_config;
2016-04-13 20:32:39 +00:00
{
{
_class = _x select 0;
if not((_class in _mags) OR (_class in _weapons) OR (_class in _bags)) then
{
2016-07-02 14:24:53 +00:00
_bin pushBack _x;
2016-04-13 20:32:39 +00:00
};
} forEach _x;
} forEach _loot;
2016-07-02 14:24:53 +00:00
if (count _bin isEqualTo 0) then
2016-04-13 20:32:39 +00:00
{
2016-05-10 12:18:49 +00:00
["CheckLoot", 1, "Loot tables are all valid :)"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-04-16 11:11:18 +00:00
} else
{
2016-07-02 14:24:53 +00:00
["CheckLoot", 0, format["Invalid classes found in loot! | %1", _bin]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-04-13 20:32:39 +00:00
};
};
};