diff --git a/addons/help/XEH_postInit.sqf b/addons/help/XEH_postInit.sqf index 7b222be20..7f5d14457 100644 --- a/addons/help/XEH_postInit.sqf +++ b/addons/help/XEH_postInit.sqf @@ -8,11 +8,40 @@ if (!hasInterface) exitWith {}; private _unit = player; _unit createDiarySubject [QGVAR(docs), "CBA"]; - // add diary for scripted keybinds - private _keys = GVAR(keys); + // add diary for config & scripted keybinds + private _keys = []; + + private _config = configFile >> "CfgSettings" >> "CBA" >> "events"; + + { + private _addon = configName _x; + + private _addonKeys = [format ["%1:", _addon]]; + + { + private _action = configName _x; + + private _keybind = if (isNumber _x) then { + [getNumber _x, false, false, false] + } else { + [ + getNumber (_x >> "key"), + getNumber (_x >> "shift") > 0, + getNumber (_x >> "ctrl") > 0, + getNumber (_x >> "alt") > 0 + ] + }; + + private _keyName = _keybind call CBA_fnc_localizeKey; + + _addonKeys pushBack format [" %1: %2", _action, _keyName]; + } forEach configProperties [_x, "isNumber _x || isClass _x"]; + + _addonKeys pushBack "
"; + _keys pushBack (_addonKeys joinString "
"); + } forEach ("true" configClasses _config); private _addons = allVariables EGVAR(keybinding,addons); - _addons sort true; { (EGVAR(keybinding,addons) getVariable _x) params ["_addon", "_addonActions"]; @@ -22,7 +51,7 @@ if (!hasInterface) exitWith {}; _name = localize _name; }; - _keys = _keys + format ["%1:
", _name]; + private _addonKeys = [format ["%1:", _name]]; { (EGVAR(keybinding,actions) getVariable (_addon + "$" + _x)) params ["_displayName", "", "_keybinds"]; @@ -33,12 +62,18 @@ if (!hasInterface) exitWith {}; private _keyName = (_keybinds select {_x select 0 > DIK_ESCAPE} apply {_x call CBA_fnc_localizeKey}) joinString " "; - _keys = _keys + format [" %1: %2
", _displayName, _keyName]; + _addonKeys pushBack format [" %1: %2", _displayName, _keyName]; } forEach _addonActions; - _keys = _keys + "
"; + _addonKeys pushBack "
"; + _keys pushBack (_addonKeys joinString "
"); } forEach _addons; + // Get localized categories first, then sort + _keys sort true; + + _keys = _keys joinString ""; + // delete last line breaks _keys = _keys select [0, count _keys - 10]; diff --git a/addons/help/XEH_preInit.sqf b/addons/help/XEH_preInit.sqf index 1e4c3a98c..470af19c4 100644 --- a/addons/help/XEH_preInit.sqf +++ b/addons/help/XEH_preInit.sqf @@ -10,38 +10,4 @@ if (!hasInterface) exitWith { // bwc FUNC(help) = BIS_fnc_help; -// keys -private _keys = ""; - -private _config = configFile >> "CfgSettings" >> "CBA" >> "events"; - -{ - private _addon = configName _x; - - _keys = _keys + format ["%1:
", _addon]; - - { - private _action = configName _x; - - private _keybind = if (isNumber _x) then { - [getNumber _x, false, false, false] - } else { - [ - getNumber (_x >> "key"), - getNumber (_x >> "shift") > 0, - getNumber (_x >> "ctrl") > 0, - getNumber (_x >> "alt") > 0 - ] - }; - - private _keyName = _keybind call CBA_fnc_localizeKey; - - _keys = _keys + format [" %1: %2
", _action, _keyName]; - } forEach configProperties [_x, "isNumber _x || isClass _x"]; - - _keys = _keys + "
"; -} forEach ("true" configClasses _config); - -GVAR(keys) = _keys; - ADDON = true; diff --git a/addons/help/XEH_preStart.sqf b/addons/help/XEH_preStart.sqf index db4322040..1d53b0c3a 100644 --- a/addons/help/XEH_preStart.sqf +++ b/addons/help/XEH_preStart.sqf @@ -38,32 +38,39 @@ private _credits = []; _credits pushBack format ["%1%2 by %3", _name, _version, _author]; } forEach _addons; -_credits = (_credits arrayIntersect _credits) joinString "
"; +_credits = _credits arrayIntersect _credits; + +_credits sort true; + +_credits = _credits joinString "
"; uiNamespace setVariable [QGVAR(credits), compileFinal str _credits]; // mods -private _mods = "true" configClasses (configFile >> "CfgPatches") apply {configSourceMod _x}; -_mods = (_mods arrayIntersect _mods select {!isNumber (configfile >> "CfgMods" >> _x >> "appId")}) - [""]; +private _mods = ("true" configClasses (configFile >> "CfgPatches")) apply {configSourceMod _x}; +_mods = ((_mods arrayIntersect _mods) select {!isNumber (configfile >> "CfgMods" >> _x >> "appId")}) - [""]; _mods = _mods apply { - private _entry = configfile >> "CfgMods" >> _x; + (modParams [_x, ["name"]]) params ["_name"]; + if (_name == "") then { _name = _x }; - private _name = getText (_entry >> "name") call CBA_fnc_sanitizeHTML; + private _mod = _x call CBA_fnc_sanitizeHTML; + _name = _name call CBA_fnc_sanitizeHTML; + _name = format [" %1 - %2", _mod, _name]; + private _entry = configfile >> "CfgMods" >> _x; // _x may be "@CBA_A3" if (isClass _entry) then { - _x = format [" %1 - %2", configName _entry, _name]; - if (isText (_entry >> "description")) then { private _description = getText (_entry >> "description") call CBA_fnc_sanitizeHTML; - - _x = _x + format ["
%1
", _description]; + _name = _name + format ["
%1
", _description]; }; }; - _x + _name }; +_mods sort true; + _mods = _mods joinString "
"; uiNamespace setVariable [QGVAR(mods), compileFinal str _mods];