2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Used to execute the checkPBOs module without placing the module. Don't use this together with the module.
|
2015-05-28 18:49:30 +00:00
|
|
|
* Checks PBO versions and compares to the one running on server.
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
2015-05-28 18:49:30 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: Mode <NUMBER>
|
2015-09-18 11:09:40 +00:00
|
|
|
* 0 = Warn once
|
|
|
|
* 1 = Warn permanently
|
|
|
|
* 2 = Kick
|
|
|
|
* 1: Check all PBOs? (default: false) <BOOL>
|
2015-12-03 05:58:41 +00:00
|
|
|
* 2: Whitelist (default: "") <STRING>
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
2015-09-18 11:09:40 +00:00
|
|
|
* Return Value:
|
2015-05-28 18:49:30 +00:00
|
|
|
* None
|
2015-09-18 11:09:40 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [0, false, ""] call ace_common_fnc_checkPBOs
|
|
|
|
*
|
2015-09-18 11:09:40 +00:00
|
|
|
* Public: Yes
|
2015-01-11 16:42:31 +00:00
|
|
|
*/
|
|
|
|
|
2015-12-03 05:58:41 +00:00
|
|
|
params ["_mode", ["_checkAll", false], ["_whitelist", "", [""]]];
|
|
|
|
TRACE_3("params",_mode,_checkAll,_whitelist);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-12-03 05:58:41 +00:00
|
|
|
//lowercase and convert whiteList String into array of strings:
|
2024-03-07 21:08:13 +00:00
|
|
|
_whitelist = toLowerANSI _whitelist;
|
2015-12-03 05:58:41 +00:00
|
|
|
_whitelist = _whitelist splitString "[,""']";
|
|
|
|
TRACE_1("Array",_whitelist);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-05-28 18:49:30 +00:00
|
|
|
ACE_Version_CheckAll = _checkAll;
|
|
|
|
ACE_Version_Whitelist = _whitelist;
|
|
|
|
|
2015-08-13 05:31:29 +00:00
|
|
|
if (!_checkAll) exitWith {}; //ACE is checked by FUNC(checkFiles)
|
|
|
|
|
2015-05-28 18:49:30 +00:00
|
|
|
if (!isServer) then {
|
2015-09-18 11:09:40 +00:00
|
|
|
[{
|
|
|
|
if (isNil "ACE_Version_ClientErrors") exitWith {};
|
2015-05-28 18:49:30 +00:00
|
|
|
|
2015-09-18 11:09:40 +00:00
|
|
|
ACE_Version_ClientErrors params ["_missingAddon", "_missingAddonServer", "_oldVersionClient", "_oldVersionServer"];
|
2015-05-28 18:49:30 +00:00
|
|
|
|
2015-09-18 11:09:40 +00:00
|
|
|
(_this select 0) params ["_mode", "_checkAll", "_whitelist"];
|
2015-05-28 18:49:30 +00:00
|
|
|
|
|
|
|
// Display error message.
|
|
|
|
if (_missingAddon || {_missingAddonServer} || {_oldVersionClient} || {_oldVersionServer}) then {
|
2015-12-12 15:48:54 +00:00
|
|
|
private _text = "[ACE] Version mismatch:<br/><br/>";
|
|
|
|
private _error = format ["ACE version mismatch: %1: ", profileName];
|
2015-05-28 18:49:30 +00:00
|
|
|
|
|
|
|
if (_missingAddon) then {
|
|
|
|
_text = _text + "Detected missing addon on client<br/>";
|
|
|
|
_error = _error + "Missing file(s); ";
|
|
|
|
};
|
|
|
|
if (_missingAddonServer) then {
|
|
|
|
_text = _text + "Detected missing addon on server<br/>";
|
|
|
|
_error = _error + "Additional file(s); ";
|
|
|
|
};
|
|
|
|
if (_oldVersionClient) then {
|
|
|
|
_text = _text + "Detected old client version<br/>";
|
|
|
|
_error = _error + "Older version; ";
|
|
|
|
};
|
|
|
|
if (_oldVersionServer) then {
|
|
|
|
_text = _text + "Detected old server version<br/>";
|
|
|
|
_error = _error + "Newer version; ";
|
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2016-06-03 01:13:09 +00:00
|
|
|
//[QGVAR(systemChatGlobal), _error] call CBA_fnc_globalEvent;
|
2016-05-21 17:59:44 +00:00
|
|
|
|
2016-10-02 10:55:31 +00:00
|
|
|
ERROR(_error);
|
2015-05-28 18:49:30 +00:00
|
|
|
|
2015-06-15 18:23:16 +00:00
|
|
|
if (_mode < 2) then {
|
|
|
|
_text = composeText [lineBreak, parseText format ["<t align='center'>%1</t>", _text]];
|
2015-05-28 18:49:30 +00:00
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _rscLayer = "ACE_RscErrorHint" call BIS_fnc_rscLayer;
|
2015-06-15 18:23:16 +00:00
|
|
|
_rscLayer cutRsc ["ACE_RscErrorHint", "PLAIN", 0, true];
|
2015-05-28 18:49:30 +00:00
|
|
|
|
2015-06-15 18:23:16 +00:00
|
|
|
disableSerialization;
|
2015-12-12 15:48:54 +00:00
|
|
|
private _ctrlHint = uiNamespace getVariable "ACE_ctrlErrorHint";
|
2015-06-15 18:23:16 +00:00
|
|
|
_ctrlHint ctrlSetStructuredText _text;
|
2015-05-28 18:49:30 +00:00
|
|
|
|
2015-06-15 18:23:16 +00:00
|
|
|
if (_mode == 0) then {
|
2015-12-02 04:50:28 +00:00
|
|
|
[{
|
|
|
|
params ["_rscLayer"];
|
|
|
|
TRACE_2("Hiding Error message after 10 seconds",time,_rscLayer);
|
|
|
|
_rscLayer cutFadeOut 0.2;
|
2016-05-22 13:27:24 +00:00
|
|
|
}, [_rscLayer], 10] call CBA_fnc_waitAndExecute;
|
2015-06-15 18:23:16 +00:00
|
|
|
};
|
2015-05-28 18:49:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (_mode == 2) then {
|
2015-12-02 04:50:28 +00:00
|
|
|
[{alive player}, { // To be able to show list if using checkAll
|
|
|
|
params ["_text"];
|
|
|
|
TRACE_2("Player is alive, showing msg and exiting",time,_text);
|
|
|
|
_text = composeText [parseText format ["<t align='center'>%1</t>", _text]];
|
|
|
|
["[ACE] ERROR", _text, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
|
2016-05-22 13:27:24 +00:00
|
|
|
}, [_text]] call CBA_fnc_waitUntilAndExecute;
|
2015-05-28 18:49:30 +00:00
|
|
|
};
|
|
|
|
};
|
2015-09-18 11:09:40 +00:00
|
|
|
|
|
|
|
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
|
|
|
}, 1, [_mode, _checkAll, _whitelist]] call CBA_fnc_addPerFrameHandler;
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
2015-05-28 18:49:30 +00:00
|
|
|
if (_checkAll) then {
|
2015-09-21 19:25:18 +00:00
|
|
|
0 spawn COMPILE_FILE(scripts\checkVersionNumber); // @todo
|
2015-05-28 18:49:30 +00:00
|
|
|
};
|