diff --git a/addons/common/XEH_PREP.hpp b/addons/common/XEH_PREP.hpp index 642f17282..02a9bd4f2 100644 --- a/addons/common/XEH_PREP.hpp +++ b/addons/common/XEH_PREP.hpp @@ -2,6 +2,7 @@ PREP(addIntel); PREP(callGlobalFnc); PREP(callReinforcements); PREP(crateFiller); +PREP(join); PREP(doFlakFire); PREP(noApiFunction); PREP(parseCsv); \ No newline at end of file diff --git a/addons/common/functions/fnc_join.sqf b/addons/common/functions/fnc_join.sqf new file mode 100644 index 000000000..05845409b --- /dev/null +++ b/addons/common/functions/fnc_join.sqf @@ -0,0 +1,32 @@ +#include "..\script_component.hpp" +/* + * Author: veteran29 + * Join a server. Meant to be used from main menu. + * Based on article from KillZonekid + * + * Arguments: + * 0: Spotlight tile control that was clicked + * 1: Server address + * 2: Server port + * + * Return Value: + * None + * + * Public: No + */ + +params ["_button", "_server", ["_port", 2302]]; + +// if no world is loaded missionNamespace will be empty +// copy logging function from uiNamespace +if (isNil "CBA_fnc_log") then { + CBA_fnc_log = uiNamespace getVariable "CBA_fnc_log"; +}; +// Disable Enchanced Multiplayer Menu for compatiblity with this script +uiNamespace setVariable ["EMM_multiplayerMenu_enabled", false]; + +INFO_2("Auto joining to %1:%2",_server,_port); + +connectToServer [_server, _port, "130"]; // 130 is the default password for the server + +nil \ No newline at end of file diff --git a/addons/spotlight_cup/CfgEventHandlers.hpp b/addons/spotlight_cup/CfgEventHandlers.hpp index be3c07d5a..000435aa8 100644 --- a/addons/spotlight_cup/CfgEventHandlers.hpp +++ b/addons/spotlight_cup/CfgEventHandlers.hpp @@ -1,15 +1,11 @@ -class Extended_PreStart_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); - }; +class RscDisplayPassword { + ADDON = QUOTE(with uiNamespace do {\ + [_this select 0] call COMPILE_SCRIPT(XEH_displayPassword);\ + }); }; -class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); - }; -}; -class Extended_PostInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); - }; + +class RscMsgBox { + ADDON = QUOTE(with uiNamespace do {\ + [_this select 0] call COMPILE_SCRIPT(XEH_msgBox);\ + }); }; \ No newline at end of file diff --git a/addons/spotlight_cup/CfgMainMenuSpotlight.hpp b/addons/spotlight_cup/CfgMainMenuSpotlight.hpp index aa4a80d07..a07f414bb 100644 --- a/addons/spotlight_cup/CfgMainMenuSpotlight.hpp +++ b/addons/spotlight_cup/CfgMainMenuSpotlight.hpp @@ -1,64 +1,11 @@ class CfgMainMenuSpotlight { // RscDisplayMain >> Spotlight works but is considered obsolete since SPOTREP #00064 class spotlight_cup { - text = QUOTE(Tactical Training Team - CUP Server); // Text displayed on the square button, converted to upper-case + text = CSTRING(text); // Text displayed on the square button, converted to upper-case textIsQuote = 0; // 1 to add quotation marks around the text picture = QPATHTOEF(common,data\ttt_logo_co.paa); // Square picture, ideally 512x512 //video = "\a3\Ui_f\Video\spotlight_1_Apex.ogv"; // Video played on mouse hover - action = QUOTE(call (uiNamespace getVariable QQFUNC(joinServer))); // Code called upon clicking, passed arguments are [] + action = QUOTE(ARR_3([_this,'game.tacticalteam.de',2322]) call (uiNamespace getVariable QQEFUNC(common,join))); actionText = CSTRING(joinHover); // Text displayed in top left corner of on-hover white frame - condition = "true"; // Condition for showing the spotlight + condition = QUOTE(true); // Condition for showing the spotlight }; - - //deactivate all other menus - delete ApexProtocol; - delete BootCamp; - delete EastWind; - - delete Orange_CampaignGerman; - delete Orange_Showcase_IDAP; - delete Orange_Showcase_LoW; - delete Orange_Campaign; - - delete Showcase_TankDestroyers; - - delete Tacops_Campaign_03; - delete Tacops_Campaign_02; - delete Tacops_Campaign_01; - - delete Tanks_Campaign_01; - - delete OldMan; - - delete Contact_Campaign; - - delete gm_campaign_01; - - delete SP_FD14; - - delete AoW_Showcase_AoW; - delete AoW_Showcase_Future; - - delete Extraction_lxWS; - delete Showcase_Alchemist_lxWS; - delete Showcase_VR_lxWS; - - delete vn_showcase_macv; - delete vn_showcase_macv_13; - delete vn_showcase_pavn; - delete vn_showcase_pavn_13; - delete vn_sogba; - - delete SPE_Arsenal; - delete SPE_Campagin_OperationCobra_04; - delete SPE_Coop_Der_Zahnarzt; - delete SPE_Faction_Showcase_GER; - delete SPE_Faction_Showcase_US; - delete SPE_Coop_Attack_on_Mortain; - delete SPE_Coop_Battle_of_St_Barthelemy; - delete SPE_Coop_Panzerkampfwagen; - delete SPE_Coop_Prizefighter; - - delete Scenario_TrainingDay_RF; - delete Scenario_FireSeason_RF; - delete Scenario_AirControl_RF; }; \ No newline at end of file diff --git a/addons/spotlight_cup/XEH_PREP.hpp b/addons/spotlight_cup/XEH_PREP.hpp deleted file mode 100644 index 22b8339c3..000000000 --- a/addons/spotlight_cup/XEH_PREP.hpp +++ /dev/null @@ -1 +0,0 @@ -PREP(joinServer); \ No newline at end of file diff --git a/addons/spotlight_cup/XEH_displayPassword.sqf b/addons/spotlight_cup/XEH_displayPassword.sqf new file mode 100644 index 000000000..36ddb9f3a --- /dev/null +++ b/addons/spotlight_cup/XEH_displayPassword.sqf @@ -0,0 +1,26 @@ +#include "script_component.hpp" +/* + * Author: veteran29 + * Handles initialization of password display. + * + * Arguments: + * 0: Server password prompt display + * + * Return Value: + * None + * + * Public: No + */ + +params ["_display"]; + +if !(uiNamespace getVariable [QGVAR(autoConfirm), true]) exitWith {INFO("Auto password confirm disabled")}; + +private _ctrlConfirm = _display displayCtrl IDC_OK; +private _ctrlPassword = _display displayCtrl IDC_PASSWORD; + +if (ctrlText _ctrlPassword == "") exitWith {}; + +ctrlActivate _ctrlConfirm; + +nil \ No newline at end of file diff --git a/addons/spotlight_cup/XEH_msgBox.sqf b/addons/spotlight_cup/XEH_msgBox.sqf new file mode 100644 index 000000000..f16474e47 --- /dev/null +++ b/addons/spotlight_cup/XEH_msgBox.sqf @@ -0,0 +1,22 @@ +#include "script_component.hpp" +/* + * Author: veteran29 + * Handle initialization of message box. Disables auto password confirm if wrong password was provided. + * + * Arguments: + * 0: RscMsgBox display [DISPLAY] + * + * Return Value: + * None + * + * Public: No + */ + +params ["_display"]; + +private _ctrlText = _display displayCtrl IDC_MSGBOX_TEXT; +if (ctrlText _ctrlText != localize "STR_Msg_MP_Password") exitWith {}; + +INFO("Invalid server password, disabling auto confirm"); + +uiNamespace setVariable [QGVAR(autoConfirm), false]; \ No newline at end of file diff --git a/addons/spotlight_cup/XEH_postInit.sqf b/addons/spotlight_cup/XEH_postInit.sqf deleted file mode 100644 index 84f252991..000000000 --- a/addons/spotlight_cup/XEH_postInit.sqf +++ /dev/null @@ -1 +0,0 @@ -#include "script_component.hpp" \ No newline at end of file diff --git a/addons/spotlight_cup/XEH_preInit.sqf b/addons/spotlight_cup/XEH_preInit.sqf deleted file mode 100644 index d7d59fe49..000000000 --- a/addons/spotlight_cup/XEH_preInit.sqf +++ /dev/null @@ -1,8 +0,0 @@ -#include "script_component.hpp" -ADDON = false; - -PREP_RECOMPILE_START; -#include "XEH_PREP.hpp" -PREP_RECOMPILE_END; - -ADDON = true; \ No newline at end of file diff --git a/addons/spotlight_cup/XEH_preStart.sqf b/addons/spotlight_cup/XEH_preStart.sqf deleted file mode 100644 index 7dca06689..000000000 --- a/addons/spotlight_cup/XEH_preStart.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#include "script_component.hpp" -#include "XEH_PREP.hpp" \ No newline at end of file diff --git a/addons/spotlight_cup/config.cpp b/addons/spotlight_cup/config.cpp index 59accf3a9..4eaa08096 100644 --- a/addons/spotlight_cup/config.cpp +++ b/addons/spotlight_cup/config.cpp @@ -5,19 +5,19 @@ class CfgPatches { // Meta information for editor name = COMPONENT_NAME; author = ECSTRING(main,TacticalTrainingTeam); - authors[] = {"Addi", "Andx"}; + authors[] = {"Addi", "Andx", "veteran29"}; url = ECSTRING(main,URL); // Minimum compatible version. When the game's version is lower, pop-up warning will appear when launching the game. Note: was disabled on purpose some time late into Arma 2: OA. requiredVersion = REQUIRED_VERSION; // Required addons, used for setting load order. (CfgPatches classname NOT PBO filename!) // When any of the addons are missing, a pop-up warning will appear when launching the game. - requiredAddons[] = {"ttt_common","CUP_Creatures_People_LoadOrder"}; + requiredAddons[] = {"cba_ui", "ttt_common","CUP_Creatures_People_LoadOrder"}; // List of objects (CfgVehicles classes) contained in the addon. Important also for Zeus content (units and groups) unlocking. units[] = {}; // List of weapons (CfgWeapons classes) contained in the addon. weapons[] = {}; - + // Optional. If this is 1, if any of requiredAddons[] entry is missing in your game the entire config will be ignored and return no error (but in rpt) so useful to make a compat Mod (Since Arma 3 2.14) skipWhenMissingDependencies = 1; VERSION_CONFIG; diff --git a/addons/spotlight_cup/functions/fnc_joinServer.sqf b/addons/spotlight_cup/functions/fnc_joinServer.sqf deleted file mode 100644 index e337a5ec3..000000000 --- a/addons/spotlight_cup/functions/fnc_joinServer.sqf +++ /dev/null @@ -1,101 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author: veteran29 - * Join ArmaForces server from main menu. - * Based on article from KillZonekid - * - * Arguments: - * 1: Spotlight tile control that was clicked - * - * Return Value: - * None - * - * Public: No - */ - -#define MULTI_SESSIONS_CTRL (findDisplay IDD_MULTIPLAYER displayCtrl IDC_MULTI_SESSIONS) - -params ["_button"]; - -// if no world is loaded missionNamespace will be empty -// copy logging function from uiNamespace -if (isNil "CBA_fnc_log") then { - CBA_fnc_log = uiNamespace getVariable "CBA_fnc_log"; -}; - -// Disable Enchanced Multiplayer Menu for compatiblity with this script -uiNamespace setVariable ["EMM_multiplayerMenu_enabled", false]; - -INFO("Auto joining to TTT CUP server"); - -GVAR(serverAddress) = "game.tacticalteam.de"; -GVAR(serverPort) = "2322"; -GVAR(joinTimeout) = diag_tickTime + 5; - -// "Click" server browser from main menu -ctrlActivate ((ctrlParent _button) displayCtrl IDC_MAIN_MULTIPLAYER); - -onEachFrame { - onEachFrame { - // Direct connect button - ctrlActivate (findDisplay IDD_MULTIPLAYER displayCtrl IDC_MULTI_TAB_DIRECT_CONNECT); - - onEachFrame { - // Fill server data - private _ctrlServerAddress = findDisplay IDD_IP_ADDRESS displayCtrl 2300; - _ctrlServerAddress controlsGroupCtrl IDC_IP_ADDRESS ctrlSetText GVAR(serverAddress); - _ctrlServerAddress controlsGroupCtrl IDC_IP_PORT ctrlSetText GVAR(serverPort); - ctrlActivate (_ctrlServerAddress controlsGroupCtrl IDC_OK); - - onEachFrame { - (MULTI_SESSIONS_CTRL lbData 0) call { - LOG_2("Joining - time: %1 - timeout: %2",diag_tickTime,GVAR(joinTimeout)); - - if (diag_tickTime > GVAR(joinTimeout)) then { - ERROR("Join timeout - no server"); - onEachFrame {}; - }; - - if (_this != "") then { - MULTI_SESSIONS_CTRL lbSetCurSel 0; - - onEachFrame { - INFO("Activating join button"); - ctrlActivate (findDisplay IDD_MULTIPLAYER displayCtrl IDC_MULTI_JOIN); - - onEachFrame { - if (diag_tickTime > GVAR(joinTimeout)) then { - WARNING("Join timeout"); - onEachFrame {}; - }; - - if (!isNull findDisplay IDD_PASSWORD) then { - INFO("Password prompt"); - private _ctrlPassword = findDisplay IDD_PASSWORD displayCtrl IDC_PASSWORD; - private _savedPassword = ctrlText _ctrlPassword; - - if(count _savedPassword > 0) then { - _ctrlPassword ctrlSetText _savedPassword; - ctrlActivate (findDisplay IDD_PASSWORD displayCtrl IDC_OK); - INFO("Saved password found, joining"); - onEachFrame {}; - } else { - INFO("No saved password, user interaction required"); - onEachFrame {}; - }; - }; - - if (getClientStateNumber >= 3) then { - INFO("Connection successful"); - onEachFrame {}; - }; - }; - }; - }; - }; - }; - }; - }; -}; - -nil \ No newline at end of file diff --git a/addons/spotlight_cup/readme.md b/addons/spotlight_cup/readme.md index d2aaed5f9..e7c877bfe 100644 --- a/addons/spotlight_cup/readme.md +++ b/addons/spotlight_cup/readme.md @@ -5,6 +5,7 @@ Setzt eine Kachel im Hauptmenü von Arma um direkt auf dem CUP-Server zu verbind ## Referenzen + ## Maintainer diff --git a/addons/spotlight_cup/script_component.hpp b/addons/spotlight_cup/script_component.hpp index 41b61ca97..e85fde162 100644 --- a/addons/spotlight_cup/script_component.hpp +++ b/addons/spotlight_cup/script_component.hpp @@ -5,3 +5,8 @@ #include "\z\ttt\addons\main\script_macros.hpp" #include "\a3\ui_f\hpp\defineResincl.inc" + +#define IDC_SERVERSTATUS_PASSWORD 1002 +#define IDC_SERVERSTATUS_LOGIN 1003 +#define IDC_SERVERSTATUS_MISSIONS 1004 +#define IDC_MSGBOX_TEXT 101 diff --git a/addons/spotlight_cup/stringtable.xml b/addons/spotlight_cup/stringtable.xml index 2a068def9..b39427bb3 100644 --- a/addons/spotlight_cup/stringtable.xml +++ b/addons/spotlight_cup/stringtable.xml @@ -5,5 +5,9 @@ Join server: Tactical Training Team - CUP Server beitreten: Tactical Training Team - CUP + + Tactical Training Team - CUP Server + Tactical Training Team - CUP Server + diff --git a/addons/spotlight_event/CfgEventHandlers.hpp b/addons/spotlight_event/CfgEventHandlers.hpp index be3c07d5a..000435aa8 100644 --- a/addons/spotlight_event/CfgEventHandlers.hpp +++ b/addons/spotlight_event/CfgEventHandlers.hpp @@ -1,15 +1,11 @@ -class Extended_PreStart_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); - }; +class RscDisplayPassword { + ADDON = QUOTE(with uiNamespace do {\ + [_this select 0] call COMPILE_SCRIPT(XEH_displayPassword);\ + }); }; -class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); - }; -}; -class Extended_PostInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); - }; + +class RscMsgBox { + ADDON = QUOTE(with uiNamespace do {\ + [_this select 0] call COMPILE_SCRIPT(XEH_msgBox);\ + }); }; \ No newline at end of file diff --git a/addons/spotlight_event/CfgMainMenuSpotlight.hpp b/addons/spotlight_event/CfgMainMenuSpotlight.hpp index 1598f5eb6..3241e3103 100644 --- a/addons/spotlight_event/CfgMainMenuSpotlight.hpp +++ b/addons/spotlight_event/CfgMainMenuSpotlight.hpp @@ -1,10 +1,10 @@ class CfgMainMenuSpotlight { // RscDisplayMain >> Spotlight works but is considered obsolete since SPOTREP #00064 class spotlight_event { - text = QUOTE(Tactical Training Team - Event Server); // Text displayed on the square button, converted to upper-case + text = CSTRING(text); // Text displayed on the square button, converted to upper-case textIsQuote = 0; // 1 to add quotation marks around the text picture = QPATHTOEF(common,data\ttt_logo_co.paa); // Square picture, ideally 512x512 //video = "\a3\Ui_f\Video\spotlight_1_Apex.ogv"; // Video played on mouse hover - action = QUOTE(call (uiNamespace getVariable QQFUNC(joinServer))); + action = QUOTE(ARR_3([_this,'game.tacticalteam.de',2382]) call (uiNamespace getVariable QQEFUNC(common,join))); actionText = CSTRING(joinHover); // Text displayed in top left corner of on-hover white frame condition = QUOTE(true); // Condition for showing the spotlight }; diff --git a/addons/spotlight_event/XEH_PREP.hpp b/addons/spotlight_event/XEH_PREP.hpp deleted file mode 100644 index 22b8339c3..000000000 --- a/addons/spotlight_event/XEH_PREP.hpp +++ /dev/null @@ -1 +0,0 @@ -PREP(joinServer); \ No newline at end of file diff --git a/addons/spotlight_event/XEH_displayPassword.sqf b/addons/spotlight_event/XEH_displayPassword.sqf new file mode 100644 index 000000000..36ddb9f3a --- /dev/null +++ b/addons/spotlight_event/XEH_displayPassword.sqf @@ -0,0 +1,26 @@ +#include "script_component.hpp" +/* + * Author: veteran29 + * Handles initialization of password display. + * + * Arguments: + * 0: Server password prompt display + * + * Return Value: + * None + * + * Public: No + */ + +params ["_display"]; + +if !(uiNamespace getVariable [QGVAR(autoConfirm), true]) exitWith {INFO("Auto password confirm disabled")}; + +private _ctrlConfirm = _display displayCtrl IDC_OK; +private _ctrlPassword = _display displayCtrl IDC_PASSWORD; + +if (ctrlText _ctrlPassword == "") exitWith {}; + +ctrlActivate _ctrlConfirm; + +nil \ No newline at end of file diff --git a/addons/spotlight_event/XEH_msgBox.sqf b/addons/spotlight_event/XEH_msgBox.sqf new file mode 100644 index 000000000..f16474e47 --- /dev/null +++ b/addons/spotlight_event/XEH_msgBox.sqf @@ -0,0 +1,22 @@ +#include "script_component.hpp" +/* + * Author: veteran29 + * Handle initialization of message box. Disables auto password confirm if wrong password was provided. + * + * Arguments: + * 0: RscMsgBox display [DISPLAY] + * + * Return Value: + * None + * + * Public: No + */ + +params ["_display"]; + +private _ctrlText = _display displayCtrl IDC_MSGBOX_TEXT; +if (ctrlText _ctrlText != localize "STR_Msg_MP_Password") exitWith {}; + +INFO("Invalid server password, disabling auto confirm"); + +uiNamespace setVariable [QGVAR(autoConfirm), false]; \ No newline at end of file diff --git a/addons/spotlight_event/XEH_postInit.sqf b/addons/spotlight_event/XEH_postInit.sqf deleted file mode 100644 index 84f252991..000000000 --- a/addons/spotlight_event/XEH_postInit.sqf +++ /dev/null @@ -1 +0,0 @@ -#include "script_component.hpp" \ No newline at end of file diff --git a/addons/spotlight_event/XEH_preInit.sqf b/addons/spotlight_event/XEH_preInit.sqf deleted file mode 100644 index d7d59fe49..000000000 --- a/addons/spotlight_event/XEH_preInit.sqf +++ /dev/null @@ -1,8 +0,0 @@ -#include "script_component.hpp" -ADDON = false; - -PREP_RECOMPILE_START; -#include "XEH_PREP.hpp" -PREP_RECOMPILE_END; - -ADDON = true; \ No newline at end of file diff --git a/addons/spotlight_event/XEH_preStart.sqf b/addons/spotlight_event/XEH_preStart.sqf deleted file mode 100644 index 7dca06689..000000000 --- a/addons/spotlight_event/XEH_preStart.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#include "script_component.hpp" -#include "XEH_PREP.hpp" \ No newline at end of file diff --git a/addons/spotlight_event/config.cpp b/addons/spotlight_event/config.cpp index 60dcc4401..f2ff73216 100644 --- a/addons/spotlight_event/config.cpp +++ b/addons/spotlight_event/config.cpp @@ -5,14 +5,14 @@ class CfgPatches { // Meta information for editor name = COMPONENT_NAME; author = ECSTRING(main,TacticalTrainingTeam); - authors[] = {"Addi", "Andx"}; + authors[] = {"Addi", "Andx", "veteran29"}; url = ECSTRING(main,URL); // Minimum compatible version. When the game's version is lower, pop-up warning will appear when launching the game. Note: was disabled on purpose some time late into Arma 2: OA. requiredVersion = REQUIRED_VERSION; // Required addons, used for setting load order. (CfgPatches classname NOT PBO filename!) // When any of the addons are missing, a pop-up warning will appear when launching the game. - requiredAddons[] = {"ttt_common"}; + requiredAddons[] = {"cba_ui", "ttt_common"}; // List of objects (CfgVehicles classes) contained in the addon. Important also for Zeus content (units and groups) unlocking. units[] = {}; // List of weapons (CfgWeapons classes) contained in the addon. diff --git a/addons/spotlight_event/functions/fnc_joinServer.sqf b/addons/spotlight_event/functions/fnc_joinServer.sqf deleted file mode 100644 index 2fcf0a0b2..000000000 --- a/addons/spotlight_event/functions/fnc_joinServer.sqf +++ /dev/null @@ -1,101 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author: veteran29 - * Join ArmaForces server from main menu. - * Based on article from KillZonekid - * - * Arguments: - * 1: Spotlight tile control that was clicked - * - * Return Value: - * None - * - * Public: No - */ - -#define MULTI_SESSIONS_CTRL (findDisplay IDD_MULTIPLAYER displayCtrl IDC_MULTI_SESSIONS) - -params ["_button"]; - -// if no world is loaded missionNamespace will be empty -// copy logging function from uiNamespace -if (isNil "CBA_fnc_log") then { - CBA_fnc_log = uiNamespace getVariable "CBA_fnc_log"; -}; - -// Disable Enchanced Multiplayer Menu for compatiblity with this script -uiNamespace setVariable ["EMM_multiplayerMenu_enabled", false]; - -INFO("Auto joining to TTT Event server"); - -GVAR(serverAddress) = "game.tacticalteam.de"; -GVAR(serverPort) = "2382"; -GVAR(joinTimeout) = diag_tickTime + 5; - -// "Click" server browser from main menu -ctrlActivate ((ctrlParent _button) displayCtrl IDC_MAIN_MULTIPLAYER); - -onEachFrame { - onEachFrame { - // Direct connect button - ctrlActivate (findDisplay IDD_MULTIPLAYER displayCtrl IDC_MULTI_TAB_DIRECT_CONNECT); - - onEachFrame { - // Fill server data - private _ctrlServerAddress = findDisplay IDD_IP_ADDRESS displayCtrl 2300; - _ctrlServerAddress controlsGroupCtrl IDC_IP_ADDRESS ctrlSetText GVAR(serverAddress); - _ctrlServerAddress controlsGroupCtrl IDC_IP_PORT ctrlSetText GVAR(serverPort); - ctrlActivate (_ctrlServerAddress controlsGroupCtrl IDC_OK); - - onEachFrame { - (MULTI_SESSIONS_CTRL lbData 0) call { - LOG_2("Joining - time: %1 - timeout: %2",diag_tickTime,GVAR(joinTimeout)); - - if (diag_tickTime > GVAR(joinTimeout)) then { - ERROR("Join timeout - no server"); - onEachFrame {}; - }; - - if (_this != "") then { - MULTI_SESSIONS_CTRL lbSetCurSel 0; - - onEachFrame { - INFO("Activating join button"); - ctrlActivate (findDisplay IDD_MULTIPLAYER displayCtrl IDC_MULTI_JOIN); - - onEachFrame { - if (diag_tickTime > GVAR(joinTimeout)) then { - WARNING("Join timeout"); - onEachFrame {}; - }; - - if (!isNull findDisplay IDD_PASSWORD) then { - INFO("Password prompt"); - private _ctrlPassword = findDisplay IDD_PASSWORD displayCtrl IDC_PASSWORD; - private _savedPassword = ctrlText _ctrlPassword; - - if(count _savedPassword > 0) then { - _ctrlPassword ctrlSetText _savedPassword; - ctrlActivate (findDisplay IDD_PASSWORD displayCtrl IDC_OK); - INFO("Saved password found, joining"); - onEachFrame {}; - } else { - INFO("No saved password, user interaction required"); - onEachFrame {}; - }; - }; - - if (getClientStateNumber >= 3) then { - INFO("Connection successful"); - onEachFrame {}; - }; - }; - }; - }; - }; - }; - }; - }; -}; - -nil \ No newline at end of file diff --git a/addons/spotlight_event/functions/script_component.hpp b/addons/spotlight_event/functions/script_component.hpp deleted file mode 100644 index 4e2d4738f..000000000 --- a/addons/spotlight_event/functions/script_component.hpp +++ /dev/null @@ -1 +0,0 @@ -#include "..\script_component.hpp" \ No newline at end of file diff --git a/addons/spotlight_event/script_component.hpp b/addons/spotlight_event/script_component.hpp index 29c57fbea..b9d74385a 100644 --- a/addons/spotlight_event/script_component.hpp +++ b/addons/spotlight_event/script_component.hpp @@ -5,3 +5,8 @@ #include "\z\ttt\addons\main\script_macros.hpp" #include "\a3\ui_f\hpp\defineResincl.inc" + +#define IDC_SERVERSTATUS_PASSWORD 1002 +#define IDC_SERVERSTATUS_LOGIN 1003 +#define IDC_SERVERSTATUS_MISSIONS 1004 +#define IDC_MSGBOX_TEXT 101 diff --git a/addons/spotlight_event/stringtable.xml b/addons/spotlight_event/stringtable.xml index 87265ad7c..123b6c1be 100644 --- a/addons/spotlight_event/stringtable.xml +++ b/addons/spotlight_event/stringtable.xml @@ -5,5 +5,9 @@ Join server: Tactical Training Team - EVENT Server beitreten: Tactical Training Team - EVENT + + Tactical Training Team - Event Server + Tactical Training Team - Event Server + diff --git a/addons/spotlight_rhs/CfgEventHandlers.hpp b/addons/spotlight_rhs/CfgEventHandlers.hpp index be3c07d5a..000435aa8 100644 --- a/addons/spotlight_rhs/CfgEventHandlers.hpp +++ b/addons/spotlight_rhs/CfgEventHandlers.hpp @@ -1,15 +1,11 @@ -class Extended_PreStart_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); - }; +class RscDisplayPassword { + ADDON = QUOTE(with uiNamespace do {\ + [_this select 0] call COMPILE_SCRIPT(XEH_displayPassword);\ + }); }; -class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); - }; -}; -class Extended_PostInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); - }; + +class RscMsgBox { + ADDON = QUOTE(with uiNamespace do {\ + [_this select 0] call COMPILE_SCRIPT(XEH_msgBox);\ + }); }; \ No newline at end of file diff --git a/addons/spotlight_rhs/CfgMainMenuSpotlight.hpp b/addons/spotlight_rhs/CfgMainMenuSpotlight.hpp index bbe957a6f..b3127127a 100644 --- a/addons/spotlight_rhs/CfgMainMenuSpotlight.hpp +++ b/addons/spotlight_rhs/CfgMainMenuSpotlight.hpp @@ -1,11 +1,11 @@ class CfgMainMenuSpotlight { // RscDisplayMain >> Spotlight works but is considered obsolete since SPOTREP #00064 class spotlight_rhs { - text = QUOTE(Tactical Training Team - RHS Server); // Text displayed on the square button, converted to upper-case + text = CSTRING(text); // Text displayed on the square button, converted to upper-case textIsQuote = 0; // 1 to add quotation marks around the text picture = QPATHTOEF(common,data\ttt_logo_co.paa); // Square picture, ideally 512x512 //video = "\a3\Ui_f\Video\spotlight_1_Apex.ogv"; // Video played on mouse hover - action = QUOTE(call (uiNamespace getVariable QQFUNC(joinServer))); // Code called upon clicking, passed arguments are [] + action = QUOTE(ARR_3([_this,'game.tacticalteam.de',2332]) call (uiNamespace getVariable QQEFUNC(common,join))); actionText = CSTRING(joinHover); // Text displayed in top left corner of on-hover white frame - condition = "true"; // Condition for showing the spotlight + condition = QUOTE(true); // Condition for showing the spotlight }; }; \ No newline at end of file diff --git a/addons/spotlight_rhs/XEH_PREP.hpp b/addons/spotlight_rhs/XEH_PREP.hpp deleted file mode 100644 index 22b8339c3..000000000 --- a/addons/spotlight_rhs/XEH_PREP.hpp +++ /dev/null @@ -1 +0,0 @@ -PREP(joinServer); \ No newline at end of file diff --git a/addons/spotlight_rhs/XEH_displayPassword.sqf b/addons/spotlight_rhs/XEH_displayPassword.sqf new file mode 100644 index 000000000..36ddb9f3a --- /dev/null +++ b/addons/spotlight_rhs/XEH_displayPassword.sqf @@ -0,0 +1,26 @@ +#include "script_component.hpp" +/* + * Author: veteran29 + * Handles initialization of password display. + * + * Arguments: + * 0: Server password prompt display + * + * Return Value: + * None + * + * Public: No + */ + +params ["_display"]; + +if !(uiNamespace getVariable [QGVAR(autoConfirm), true]) exitWith {INFO("Auto password confirm disabled")}; + +private _ctrlConfirm = _display displayCtrl IDC_OK; +private _ctrlPassword = _display displayCtrl IDC_PASSWORD; + +if (ctrlText _ctrlPassword == "") exitWith {}; + +ctrlActivate _ctrlConfirm; + +nil \ No newline at end of file diff --git a/addons/spotlight_rhs/XEH_msgBox.sqf b/addons/spotlight_rhs/XEH_msgBox.sqf new file mode 100644 index 000000000..f16474e47 --- /dev/null +++ b/addons/spotlight_rhs/XEH_msgBox.sqf @@ -0,0 +1,22 @@ +#include "script_component.hpp" +/* + * Author: veteran29 + * Handle initialization of message box. Disables auto password confirm if wrong password was provided. + * + * Arguments: + * 0: RscMsgBox display [DISPLAY] + * + * Return Value: + * None + * + * Public: No + */ + +params ["_display"]; + +private _ctrlText = _display displayCtrl IDC_MSGBOX_TEXT; +if (ctrlText _ctrlText != localize "STR_Msg_MP_Password") exitWith {}; + +INFO("Invalid server password, disabling auto confirm"); + +uiNamespace setVariable [QGVAR(autoConfirm), false]; \ No newline at end of file diff --git a/addons/spotlight_rhs/XEH_postInit.sqf b/addons/spotlight_rhs/XEH_postInit.sqf deleted file mode 100644 index 84f252991..000000000 --- a/addons/spotlight_rhs/XEH_postInit.sqf +++ /dev/null @@ -1 +0,0 @@ -#include "script_component.hpp" \ No newline at end of file diff --git a/addons/spotlight_rhs/XEH_preInit.sqf b/addons/spotlight_rhs/XEH_preInit.sqf deleted file mode 100644 index d7d59fe49..000000000 --- a/addons/spotlight_rhs/XEH_preInit.sqf +++ /dev/null @@ -1,8 +0,0 @@ -#include "script_component.hpp" -ADDON = false; - -PREP_RECOMPILE_START; -#include "XEH_PREP.hpp" -PREP_RECOMPILE_END; - -ADDON = true; \ No newline at end of file diff --git a/addons/spotlight_rhs/XEH_preStart.sqf b/addons/spotlight_rhs/XEH_preStart.sqf deleted file mode 100644 index 7dca06689..000000000 --- a/addons/spotlight_rhs/XEH_preStart.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#include "script_component.hpp" -#include "XEH_PREP.hpp" \ No newline at end of file diff --git a/addons/spotlight_rhs/config.cpp b/addons/spotlight_rhs/config.cpp index c69f67c4a..b8e271f90 100644 --- a/addons/spotlight_rhs/config.cpp +++ b/addons/spotlight_rhs/config.cpp @@ -5,19 +5,19 @@ class CfgPatches { // Meta information for editor name = COMPONENT_NAME; author = ECSTRING(main,TacticalTrainingTeam); - authors[] = {"Addi", "Andx"}; + authors[] = {"Addi", "Andx", "veteran29"}; url = ECSTRING(main,URL); // Minimum compatible version. When the game's version is lower, pop-up warning will appear when launching the game. Note: was disabled on purpose some time late into Arma 2: OA. requiredVersion = REQUIRED_VERSION; // Required addons, used for setting load order. (CfgPatches classname NOT PBO filename!) // When any of the addons are missing, a pop-up warning will appear when launching the game. - requiredAddons[] = {"ttt_common","rhsusf_main_loadorder"}; + requiredAddons[] = {"cba_ui", "ttt_common","rhsusf_main_loadorder"}; // List of objects (CfgVehicles classes) contained in the addon. Important also for Zeus content (units and groups) unlocking. units[] = {}; // List of weapons (CfgWeapons classes) contained in the addon. weapons[] = {}; - + // Optional. If this is 1, if any of requiredAddons[] entry is missing in your game the entire config will be ignored and return no error (but in rpt) so useful to make a compat Mod (Since Arma 3 2.14) skipWhenMissingDependencies = 1; VERSION_CONFIG; diff --git a/addons/spotlight_rhs/functions/fnc_joinServer.sqf b/addons/spotlight_rhs/functions/fnc_joinServer.sqf deleted file mode 100644 index 99a1081e3..000000000 --- a/addons/spotlight_rhs/functions/fnc_joinServer.sqf +++ /dev/null @@ -1,101 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author: veteran29 - * Join ArmaForces server from main menu. - * Based on article from KillZonekid - * - * Arguments: - * 1: Spotlight tile control that was clicked - * - * Return Value: - * None - * - * Public: No - */ - -#define MULTI_SESSIONS_CTRL (findDisplay IDD_MULTIPLAYER displayCtrl IDC_MULTI_SESSIONS) - -params ["_button"]; - -// if no world is loaded missionNamespace will be empty -// copy logging function from uiNamespace -if (isNil "CBA_fnc_log") then { - CBA_fnc_log = uiNamespace getVariable "CBA_fnc_log"; -}; - -// Disable Enchanced Multiplayer Menu for compatiblity with this script -uiNamespace setVariable ["EMM_multiplayerMenu_enabled", false]; - -INFO("Auto joining to TTT RHS server"); - -GVAR(serverAddress) = "game.tacticalteam.de"; -GVAR(serverPort) = "2332"; -GVAR(joinTimeout) = diag_tickTime + 5; - -// "Click" server browser from main menu -ctrlActivate ((ctrlParent _button) displayCtrl IDC_MAIN_MULTIPLAYER); - -onEachFrame { - onEachFrame { - // Direct connect button - ctrlActivate (findDisplay IDD_MULTIPLAYER displayCtrl IDC_MULTI_TAB_DIRECT_CONNECT); - - onEachFrame { - // Fill server data - private _ctrlServerAddress = findDisplay IDD_IP_ADDRESS displayCtrl 2300; - _ctrlServerAddress controlsGroupCtrl IDC_IP_ADDRESS ctrlSetText GVAR(serverAddress); - _ctrlServerAddress controlsGroupCtrl IDC_IP_PORT ctrlSetText GVAR(serverPort); - ctrlActivate (_ctrlServerAddress controlsGroupCtrl IDC_OK); - - onEachFrame { - (MULTI_SESSIONS_CTRL lbData 0) call { - LOG_2("Joining - time: %1 - timeout: %2",diag_tickTime,GVAR(joinTimeout)); - - if (diag_tickTime > GVAR(joinTimeout)) then { - ERROR("Join timeout - no server"); - onEachFrame {}; - }; - - if (_this != "") then { - MULTI_SESSIONS_CTRL lbSetCurSel 0; - - onEachFrame { - INFO("Activating join button"); - ctrlActivate (findDisplay IDD_MULTIPLAYER displayCtrl IDC_MULTI_JOIN); - - onEachFrame { - if (diag_tickTime > GVAR(joinTimeout)) then { - WARNING("Join timeout"); - onEachFrame {}; - }; - - if (!isNull findDisplay IDD_PASSWORD) then { - INFO("Password prompt"); - private _ctrlPassword = findDisplay IDD_PASSWORD displayCtrl IDC_PASSWORD; - private _savedPassword = ctrlText _ctrlPassword; - - if(count _savedPassword > 0) then { - _ctrlPassword ctrlSetText _savedPassword; - ctrlActivate (findDisplay IDD_PASSWORD displayCtrl IDC_OK); - INFO("Saved password found, joining"); - onEachFrame {}; - } else { - INFO("No saved password, user interaction required"); - onEachFrame {}; - }; - }; - - if (getClientStateNumber >= 3) then { - INFO("Connection successful"); - onEachFrame {}; - }; - }; - }; - }; - }; - }; - }; - }; -}; - -nil \ No newline at end of file diff --git a/addons/spotlight_rhs/readme.md b/addons/spotlight_rhs/readme.md index 1ee15bee6..4581e97b8 100644 --- a/addons/spotlight_rhs/readme.md +++ b/addons/spotlight_rhs/readme.md @@ -5,6 +5,7 @@ Setzt eine Kachel im Hauptmenü von Arma um direkt auf dem RHS-Server zu verbind ## Referenzen + ## Maintainer diff --git a/addons/spotlight_rhs/script_component.hpp b/addons/spotlight_rhs/script_component.hpp index c3fa8ce32..cc00205ee 100644 --- a/addons/spotlight_rhs/script_component.hpp +++ b/addons/spotlight_rhs/script_component.hpp @@ -5,3 +5,8 @@ #include "\z\ttt\addons\main\script_macros.hpp" #include "\a3\ui_f\hpp\defineResincl.inc" + +#define IDC_SERVERSTATUS_PASSWORD 1002 +#define IDC_SERVERSTATUS_LOGIN 1003 +#define IDC_SERVERSTATUS_MISSIONS 1004 +#define IDC_MSGBOX_TEXT 101 diff --git a/addons/spotlight_rhs/stringtable.xml b/addons/spotlight_rhs/stringtable.xml index 41d7133e9..77ef18259 100644 --- a/addons/spotlight_rhs/stringtable.xml +++ b/addons/spotlight_rhs/stringtable.xml @@ -5,5 +5,9 @@ Join server: Tactical Training Team - RHS Server beitreten: Tactical Training Team - RHS + + Tactical Training Team - RHS Server + Tactical Training Team - RHS Server +