2017-08-05 01:32:07 +00:00
|
|
|
/*
|
|
|
|
Original script by KiloSwiss
|
|
|
|
https://epochmod.com/forum/topic/32239-howto-get-available-weapons-mod-independent/
|
|
|
|
Modified and enhanced by GhostriderDbD
|
|
|
|
7/20/17
|
|
|
|
|
|
|
|
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
|
|
|
|
|
|
|
|
http://creativecommons.org/licenses/by-nc-sa/4.0/
|
|
|
|
*/
|
2017-10-19 02:12:47 +00:00
|
|
|
private["_process"];
|
2017-08-05 01:32:07 +00:00
|
|
|
_weaponsBase = [];
|
|
|
|
_knownWeapons = [];
|
2017-10-04 22:35:36 +00:00
|
|
|
#include "ExcludedClassNames\excludedWeapons.sqf"
|
2017-08-29 00:45:27 +00:00
|
|
|
|
2017-08-05 01:32:07 +00:00
|
|
|
|
|
|
|
_allWeaponRoots = ["Pistol","Rifle","Launcher"];
|
|
|
|
_allWeaponTypes = ["AssaultRifle","MachineGun","SniperRifle","Shotgun","Rifle","Pistol","SubmachineGun","Handgun","MissileLauncher","RocketLauncher","Throw","GrenadeCore"];
|
|
|
|
_addedBaseNames = [];
|
|
|
|
_allBannedWeapons = [];
|
|
|
|
_wpnAR = []; //Assault Rifles
|
|
|
|
_wpnARG = []; //Assault Rifles with GL
|
|
|
|
_wpnLMG = []; //Light Machine Guns
|
|
|
|
_wpnSMG = []; //Sub Machine Guns
|
|
|
|
_wpnDMR = []; //Designated Marksman Rifles
|
|
|
|
_wpnLauncher = [];
|
|
|
|
_wpnSniper = []; //Sniper rifles
|
|
|
|
_wpnHandGun = []; //HandGuns/Pistols
|
|
|
|
_wpnShotGun = []; //Shotguns
|
|
|
|
_wpnThrow = []; // throwables
|
|
|
|
_wpnUnknown = []; //Misc
|
|
|
|
_wpnUnderbarrel = [];
|
|
|
|
_wpnMagazines = [];
|
|
|
|
_wpnOptics = [];
|
|
|
|
_wpnPointers = [];
|
|
|
|
_wpnMuzzles = [];
|
2017-10-04 22:35:36 +00:00
|
|
|
_baseClasses = [];
|
2017-10-19 02:12:47 +00:00
|
|
|
processWeapon = false;
|
2017-08-05 01:32:07 +00:00
|
|
|
_wpList = (configFile >> "cfgWeapons") call BIS_fnc_getCfgSubClasses;
|
|
|
|
//_wpList sort true;
|
2017-10-19 02:12:47 +00:00
|
|
|
diag_log"//////////////////////////////////////////////////////////////";
|
|
|
|
diag_log" /// START OF RUN //////////////////////////////////////////";
|
|
|
|
|
2017-08-05 01:32:07 +00:00
|
|
|
{
|
|
|
|
_item = _x;
|
|
|
|
_isWeap = false;
|
2017-10-04 22:35:36 +00:00
|
|
|
_isWeapon = false;
|
2017-10-19 02:12:47 +00:00
|
|
|
processWeapon = false;
|
2017-08-05 01:32:07 +00:00
|
|
|
{
|
2017-10-04 22:35:36 +00:00
|
|
|
_isWeapon = (_item isKindOF [_x, configFile >> "CfgWeapons"]);
|
|
|
|
if (_isWeapon) exitWith {};
|
2017-08-05 01:32:07 +00:00
|
|
|
} forEach _allWeaponRoots;
|
2017-10-04 22:35:36 +00:00
|
|
|
|
|
|
|
if (_isWeapon && GRG_Root isEqualTo "") then
|
|
|
|
{
|
2017-10-19 02:12:47 +00:00
|
|
|
processWeapon = true;
|
2017-10-04 22:35:36 +00:00
|
|
|
};
|
|
|
|
if (_isWeapon && (count GRG_Root > 0)) then
|
|
|
|
{
|
|
|
|
_leftSTR = [toLower _x,count GRG_Root] call KRON_StrLeft;
|
2017-10-19 02:12:47 +00:00
|
|
|
processWeapon = ((toLower GRG_Root) isEqualTo _leftSTR);
|
|
|
|
_msg = format["weapons.sqf:: _leftSTR = %1 and processWeapon = %2",_leftSTR, processWeapon];
|
2017-10-04 22:35:36 +00:00
|
|
|
//systemChat _msg;
|
2017-10-19 02:12:47 +00:00
|
|
|
diag_log _msg;
|
2017-10-04 22:35:36 +00:00
|
|
|
};
|
2017-10-19 02:12:47 +00:00
|
|
|
if (_isWeapon && processWeapon) then
|
|
|
|
{
|
|
|
|
if (GRG_addIttemsMissingFromPricelistOnly) then
|
|
|
|
{
|
|
|
|
if(GRG_mod isEqualTo "Exile") then
|
|
|
|
{
|
|
|
|
if (isNumber (missionConfigFile >> "CfgExileArsenal" >> _x >> "price")) then
|
|
|
|
{
|
|
|
|
diag_log format["price for item %1 = %2 tabs",_x,getNumber(missionConfigFile >> "CfgExileArsenal" >> _x >> "price")];
|
|
|
|
processWeapon = false; // Item already listed and assumed to be included in both trader lists and price lists
|
|
|
|
diag_log format["Item %1 already has a price: Not processing item %1",_x];
|
|
|
|
} else {
|
|
|
|
diag_log format["price for item %1 = %2 tabs",_x,getNumber(missionConfigFile >> "CfgExileArsenal" >> _x >> "price")];
|
|
|
|
diag_log format["Item %1 has no price: processing item %1",_x];
|
|
|
|
processWeapon = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
if (GRG_mod isEqualTo "Epoch") then
|
|
|
|
{
|
|
|
|
if (isNumber (missionConfigFile >> "CfgPricing" >> _x >> "price")) then
|
|
|
|
{
|
|
|
|
processWeapon = false; // Item already listed and assumed to be included in both trader lists and price lists
|
|
|
|
|
|
|
|
} else {
|
|
|
|
processWeapon = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
if (_isWeapon && processWeapon) then
|
2017-10-04 22:35:36 +00:00
|
|
|
{
|
|
|
|
if ([toLower _x,"base"] call KRON_StrInStr || [toLower _x,"abstract"] call KRON_StrInStr) then
|
|
|
|
{
|
|
|
|
if !(_x in _baseClasses) then {_baseClasses pushBack _x};
|
2017-10-19 02:12:47 +00:00
|
|
|
processWeapon = false;
|
2017-10-04 22:35:36 +00:00
|
|
|
systemChat format["base class %1 ignored",_x];
|
|
|
|
};
|
|
|
|
};
|
2017-10-19 02:12:47 +00:00
|
|
|
diag_log format["for item %1, price of %2, root of %3, processWeapon = %4",_x, getNumber(missionConfigFile >> "CfgExileArsenal" >> _x >> "price"),[toLower _x,count GRG_Root] call KRON_StrLeft,processWeapon];
|
|
|
|
if (_isWeapon && processWeapon) then
|
2017-08-05 01:32:07 +00:00
|
|
|
{
|
2017-09-25 09:40:17 +00:00
|
|
|
//_msg = format["weapons classname extractor: _item = %1",_item];
|
|
|
|
//diag_log _msg;
|
|
|
|
//systemChat _msg;
|
2017-10-04 22:35:36 +00:00
|
|
|
if !(_item in _excludedWeapons) then
|
2017-09-25 09:40:17 +00:00
|
|
|
{
|
2017-10-04 22:35:36 +00:00
|
|
|
_excludedWeapons pushBack _item;
|
2017-08-05 01:32:07 +00:00
|
|
|
_itemType = _x call bis_fnc_itemType;
|
|
|
|
_itemCategory = _itemType select 1;
|
|
|
|
//diag_log format["pullWepClassNames:: _itemType = %1 || _itemCategory = %2",_itemType, _itemCategory];
|
2017-10-04 22:35:36 +00:00
|
|
|
if (((_itemType select 0) == "Weapon") && ((_itemType select 1) in _allWeaponTypes)) then
|
|
|
|
{
|
2017-08-05 01:32:07 +00:00
|
|
|
_baseName = _x call BIS_fnc_baseWeapon;
|
2017-10-04 22:35:36 +00:00
|
|
|
systemChat format["pullWepClassNames:: Processing for _baseName %3 || _itemType = %1 || _itemCategory = %2",_itemType, _itemCategory, _baseName];
|
|
|
|
if (!(_baseName in _addedBaseNames) && !(_baseName in _allBannedWeapons)) then
|
|
|
|
{
|
2017-08-05 01:32:07 +00:00
|
|
|
_addedBaseNames pushBack _baseName;
|
|
|
|
|
|
|
|
switch(_itemCategory)do{
|
|
|
|
case "AssaultRifle" :{
|
|
|
|
if(count getArray(configfile >> "cfgWeapons" >> _baseName >> "muzzles") > 1)then[{_wpnARG pushBack _baseName},{_wpnAR pushBack _baseName}];
|
|
|
|
};
|
|
|
|
case "MachineGun" :{_wpnLMG pushBack _baseName};
|
|
|
|
case "SubmachineGun" :{_wpnSMG pushBack _baseName};
|
|
|
|
case "Rifle" :{_wpnDMR pushBack _baseName};
|
|
|
|
case "SniperRifle" :{_wpnSniper pushBack _baseName};
|
|
|
|
case "Shotgun" :{_wpnShotGun pushBack _baseName};
|
|
|
|
case "Handgun" :{_wpnHandGun pushBack _baseName};
|
|
|
|
case "MissileLauncher" :{_wpnLauncher pushBack _baseName};
|
|
|
|
case "RocketLauncher" :{_wpnLauncher pushBack _baseName};
|
|
|
|
case "DMR" : {_wpnDMR pushBack _baseName};
|
|
|
|
case "Throw" : {_wpnThrow pushBack _baseName};
|
|
|
|
default{_wpnUnknown pushBack _baseName};
|
|
|
|
};
|
|
|
|
|
|
|
|
// Get options for magazines and attachments for that weapon and store these if they are not duplicates for items already listed.
|
|
|
|
_ammoChoices = getArray (configFile >> "CfgWeapons" >> _baseName >> "magazines");
|
|
|
|
{
|
|
|
|
if !(_x in _wpnMagazines) then {_wpnMagazines pushback _x};
|
|
|
|
}forEach _ammoChoices;
|
|
|
|
_optics = getArray (configfile >> "CfgWeapons" >> _baseName >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems");
|
|
|
|
{
|
|
|
|
if !(_x in _wpnOptics) then {_wpnOptics pushback _x};
|
|
|
|
}forEach _optics;
|
|
|
|
_pointers = getArray (configFile >> "CfgWeapons" >> _baseName >> "WeaponSlotsInfo" >> "PointerSlot" >> "compatibleItems");
|
|
|
|
{
|
|
|
|
if !(_x in _wpnPointers) then {_wpnPointers pushback _x};
|
|
|
|
}forEach _pointers;
|
|
|
|
_muzzles = getArray (configFile >> "CfgWeapons" >> _baseName >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems");
|
|
|
|
{
|
|
|
|
if !(_x in _wpnMuzzles) then {_wpnMuzzles pushback _x};
|
|
|
|
}forEach _muzzles;
|
|
|
|
_underbarrel = getArray (configFile >> "CfgWeapons" >> _baseName >> "WeaponSlotsInfo" >> "UnderBarrelSlot" >> "compatibleItems");
|
|
|
|
{
|
|
|
|
if !(_x in _wpnUnderbarrel) then {_wpnUnderbarrel pushback _x};
|
|
|
|
}forEach _underbarrel;
|
|
|
|
};
|
|
|
|
};
|
2017-09-25 09:40:17 +00:00
|
|
|
};
|
2017-08-05 01:32:07 +00:00
|
|
|
};
|
|
|
|
} foreach _wpList;
|
|
|
|
|
|
|
|
_clipboard = "";
|
|
|
|
|
|
|
|
if (GRG_mod == "Exile") then
|
|
|
|
{
|
|
|
|
_clipboard = _clipBoard + GRG_Exile_TraderItemLists_Header;
|
|
|
|
};
|
|
|
|
if (GRG_mod == "Epoch") then
|
|
|
|
{
|
|
|
|
_clipboard = _clipBoard + GRG_Epoch_ItemLists_Header;
|
|
|
|
};
|
|
|
|
|
2017-09-25 09:40:17 +00:00
|
|
|
{
|
|
|
|
_clipboard = _clipboard + format["%2%2// %1 %2%2",_x select 0, endl];
|
|
|
|
_temp = [_x select 1] call fn_generateItemList;
|
|
|
|
_clipBoard = _clipBoard + _temp;
|
|
|
|
} foreach
|
|
|
|
[
|
|
|
|
["Assault Rifles ",_wpnAR],
|
|
|
|
["Assault Rifles with GL",_wpnARG],
|
|
|
|
["LMGs",_wpnLMG],
|
|
|
|
[" SMGs ",_wpnSMG],
|
|
|
|
["Snipers ",_wpnSniper],
|
|
|
|
["DMRs ",_wpnDMR],
|
|
|
|
["Launchers ",_wpnLauncher],
|
|
|
|
["Handguns ",_wpnHandGun],
|
|
|
|
["Shotguns ",_wpnShotGun],
|
|
|
|
["Throwables ",_wpnThrow],
|
|
|
|
["Magazines ",_wpnMagazines],
|
|
|
|
["Optics ",_wpnOptics],
|
|
|
|
["Muzzles ",_wpnMuzzles],
|
|
|
|
["Pointers ",_wpnPointers],
|
|
|
|
["Underbarrel ",_wpnUnderbarrel],
|
|
|
|
["Unknown ",_wpnUnknown]
|
|
|
|
];
|
2017-08-05 01:32:07 +00:00
|
|
|
|
|
|
|
if (GRG_mod == "Exile") then
|
|
|
|
{
|
|
|
|
_clipboard = _clipBoard + GRG_Exile_Pricelist_Header;
|
|
|
|
};
|
|
|
|
if (GRG_mod == "Epoch") then
|
|
|
|
{
|
|
|
|
_clipboard = _clipBoard + GRG_Epoch_Pricelist_Header;
|
|
|
|
};
|
2017-09-25 09:40:17 +00:00
|
|
|
{
|
|
|
|
_clipboard = _clipboard + format["%2%2// %1 %2%2",_x select 0, endl];
|
|
|
|
_temp = [_x select 1] call fn_generatePriceList;
|
|
|
|
_clipBoard = _clipBoard + _temp;
|
|
|
|
} foreach
|
|
|
|
[
|
|
|
|
["Assault Rifles ",_wpnAR],
|
|
|
|
["Assault Rifles with GL",_wpnARG],
|
|
|
|
["LMGs",_wpnLMG],
|
|
|
|
[" SMGs ",_wpnSMG],
|
|
|
|
["Snipers ",_wpnSniper],
|
|
|
|
["DMRs ",_wpnDMR],
|
|
|
|
["Launchers ",_wpnLauncher],
|
|
|
|
["Handguns ",_wpnHandGun],
|
|
|
|
["Shotguns ",_wpnShotGun],
|
|
|
|
["Throwables ",_wpnThrow],
|
|
|
|
["Magazines ",_wpnMagazines],
|
|
|
|
["Optics ",_wpnOptics],
|
|
|
|
["Muzzles ",_wpnMuzzles],
|
|
|
|
["Pointers ",_wpnPointers],
|
|
|
|
["Underbarrel ",_wpnUnderbarrel],
|
|
|
|
["Unknown ",_wpnUnknown]
|
|
|
|
];
|
2017-08-05 01:32:07 +00:00
|
|
|
|
|
|
|
if (GRG_mod == "Exile") then
|
|
|
|
{
|
|
|
|
_clipboard = _clipBoard + GRG_Exile_Loottable_Header;
|
|
|
|
};
|
|
|
|
if (GRG_mod == "Epoch") then
|
|
|
|
{
|
|
|
|
_clipboard = _clipBoard + GRG_Epoch_Loottable_Header;
|
|
|
|
};
|
2017-09-25 09:40:17 +00:00
|
|
|
{
|
|
|
|
_clipboard = _clipboard + format["%2%2// %1 %2%2",_x select 0, endl];
|
|
|
|
_temp = [_x select 1] call fn_generateLootTableEntries;
|
|
|
|
_clipBoard = _clipBoard + _temp;
|
|
|
|
} foreach
|
|
|
|
[
|
|
|
|
["Assault Rifles ",_wpnAR],
|
|
|
|
["Assault Rifles with GL",_wpnARG],
|
|
|
|
["LMGs",_wpnLMG],
|
|
|
|
[" SMGs ",_wpnSMG],
|
|
|
|
["Snipers ",_wpnSniper],
|
|
|
|
["DMRs ",_wpnDMR],
|
|
|
|
["Launchers ",_wpnLauncher],
|
|
|
|
["Handguns ",_wpnHandGun],
|
|
|
|
["Shotguns ",_wpnShotGun],
|
|
|
|
["Throwables ",_wpnThrow],
|
|
|
|
["Magazines ",_wpnMagazines],
|
|
|
|
["Optics ",_wpnOptics],
|
|
|
|
["Muzzles ",_wpnMuzzles],
|
|
|
|
["Pointers ",_wpnPointers],
|
|
|
|
["Underbarrel ",_wpnUnderbarrel],
|
|
|
|
["Unknown ",_wpnUnknown]
|
|
|
|
];
|
2017-08-05 01:32:07 +00:00
|
|
|
copyToClipboard _clipBoard;
|
2017-10-04 22:35:36 +00:00
|
|
|
systemChat "All Weapons Processws and results copied to clipboard";
|
2017-08-05 01:32:07 +00:00
|
|
|
hint format["Weapons Config Extractor Run complete%1Output copied to clipboard%1Paste it into a text editor to acces",endl];
|