DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ConnectErrorScriptModule.c
Go to the documentation of this file.
2{
3 UNKNOWN = -1, // -1 must always be UNKNOWN
4 OK = 0, // 0 must always be OK
5
6 ALREADY_CONNECTING, // Already joining a server
7 ALREADY_CONNECTING_THIS, // Already joining this exact server
8}
9
11{
13 {
14 SetCategory(ErrorCategory.ConnectErrorScript);
15 }
17 override void InitOptionalVariables()
18 {
19 super.InitOptionalVariables();
20
21 m_Header = "#server_browser_connecting_failed";
22#ifndef NO_GUI
24#endif
25 }
26
27 override void FillErrorDataMap()
28 {
29 super.FillErrorDataMap();
30
31 InsertDialogueErrorProperties(EConnectErrorScript.ALREADY_CONNECTING, "#STR_script_already_connecting", DBT_YESNOCANCEL, DBB_NO);
32 InsertDialogueErrorProperties(EConnectErrorScript.ALREADY_CONNECTING_THIS, "#STR_script_already_connecting_this");
33 }
34
35 override void OnEvent(EventType eventTypeId, Param params)
36 {
37 switch (eventTypeId)
38 {
40#ifndef NO_GUI
41 g_Game.GetUIManager().CloseSpecificDialog(m_LastErrorThrown);
42#endif
43 break;
44
45 default:
46 break;
47 }
48 }
49}
50
52{
53 override bool OnModalResult(Widget w, int x, int y, int code, int result)
54 {
55 super.OnModalResult(w, x, y, code, result);
56
57 int error = ErrorModuleHandler.GetCodeFromError(code);
58 switch ( error )
59 {
60 case EConnectErrorScript.ALREADY_CONNECTING:
61 {
62 switch ( result )
63 {
64 case DBB_YES:
65 g_Game.DisconnectSessionForce();
66 g_Game.DisconnectSessionScript();
68 break;
69 case DBB_CANCEL:
70 g_Game.DisconnectSessionForce();
71 g_Game.DisconnectSessionScript();
72 break;
73
74 default:
75 break;
76 }
77 break;
78 }
79
80 default:
81 break;
82 }
83
84 return true;
85 }
86}
override void InitOptionalVariables()
override void OnEvent(EventType eventTypeId, Param params)
Handles VON-related events.
enum EConnectErrorScript ConnectErrorScriptModule()
override void FillErrorDataMap()
DayZGame g_Game
Definition DayZGame.c:3654
class ErrorHandlerModule m_Header
This is where to input logic and extend functionality of ErrorHandlerModule.
void ErrorHandlerModuleScript()
Constructor, by default calls the function that will fill the ErrorDataMap.
protected ref UIScriptedMenu m_UIHandler
Optional: The UI the handler might generally use
void InsertDialogueErrorProperties(int code, string message, int dialogButtonType=DBT_OK, int defaultButton=DBB_OK, int dialogMeaningType=DMT_EXCLAMATION, bool displayAdditionalInfo=true)
Insert an error with Dialogue as handling, using the Optional Variables.
protected int m_LastErrorThrown
Holds the last thrown error in this module, defaults to 0.
ErrorCategory
ErrorCategory - To decide what ErrorHandlerModule needs to be called and easily identify where it cam...
Icon x
Icon y
override bool OnModalResult(Widget w, int x, int y, int code, int result)
The error handler itself, for managing and distributing errors to modules Manages the ErrorHandlerMod...
static proto int GetCodeFromError(int errorCode)
Returns the code of the error.
static void LoadMPPrivilege()
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
const EventType MPSessionPlayerReadyEventTypeID
no params
Definition gameplay.c:468
TypeID EventType
Definition EnWidgets.c:54