Skip to content

Instantly share code, notes, and snippets.

@ConnorAU
Last active April 17, 2020 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ConnorAU/b300cbe076c95e0e7286b1d9c64944d0 to your computer and use it in GitHub Desktop.
Save ConnorAU/b300cbe076c95e0e7286b1d9c64944d0 to your computer and use it in GitHub Desktop.
/*
Author: Karel Moricky
Description:
Export list of addons for Community Wiki
https://community.bistudio.com/wiki/Category:Arma_3:_Assets
Parameter(s):
0: ARRAY of STRINGs - list of CfgPatches classes
Returns:
BOOL
*/
startloadingscreen [""];
_patches = _this param [1,[],[[]]];
_patches = +_patches;
{
_patches set [_foreachindex,tolower _x];
} foreach _patches;
_allPatches = count _patches == 0;
_br = tostring [13,10];
_product = productversion select 0;
_productShort = productversion select 1;
_ammoMagazines = [];
{
_magazineCfg = _x;
_magazine = configname _x;
if (getnumber (_x >> "scope") > 0) then {
_ammo = gettext (_x >> "ammo");
_ammoID = _ammoMagazines find _ammo;
if (_ammoID < 0) then {
_ammoID = count _ammoMagazines;
_ammoMagazines set [_ammoID,_ammo];
_ammoMagazines set [_ammoID + 1,[]];
};
_magazines = _ammoMagazines select (_ammoID + 1);
if !(_ammo in _magazines) then {
_magazines set [count _magazines,tolower _magazine];
};
};
} foreach ((configfile >> "cfgmagazines") call bis_fnc_returnchildren);
_text = format ["{{Template:%1 Assets}}<br />",_product] + _br;
_text = _text + "{| class=""wikitable sortable"" border=""1"" style=""border-collapse:collapse; font-size:80%;"" cellpadding=""3px""" + _br;
_text = _text + "! Class<br />" + _br;
_text = _text + "! Used by<br />" + _br;
{
_class = configname _x;
if (_allPatches || (tolower _class) in _patches) then {
_textMagazines = "";
_ammoID = _ammoMagazines find _class;
if (_ammoID >= 0) then {
_magazines = _ammoMagazines select (_ammoID + 1);
{
_textMagazines = _textMagazines + _br + format [":[[%1 CfgMagazines#%2|%2]]",_product,configName(configFile >> "CfgMagazines" >> _x)];
} foreach _magazines;
};
_text = _text + "|-" + _br;
_text = _text + "| " + format ["<span id=""%1"" >'''%1'''</span>",_class] + _br;
_text = _text + "| " + _textMagazines + _br;
};
} foreach ((configfile >> "CfgAmmo") call bis_fnc_returnchildren);
_text = _text + "|}" + _br;
_text = _text + format [
"<small style=""color:grey;"">Generated by [[%1]] in [[%2]] version %3.%4 by ~~~~<br/>Function Source: %5</small>",
_fnc_scriptName,
productversion select 0,
(productversion select 2) * 0.01,
productversion select 3,
"https://gist.github.com/ConnorAU/b300cbe076c95e0e7286b1d9c64944d0"
] + _br;
_text = _text + format ["{{Template:%1 Assets}}",_product] + _br;
_text = _text + format ["[[Category:%1: Assets]]",_product] + _br;
_text = _text + format ["[[Category:%1: Editing]]",_product] + _br;
copytoclipboard _text;
endloadingscreen;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment