connecterrorservermodule.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. enum EConnectErrorServer
  2. {
  3. UNKNOWN = -1, // -1 must always be UNKNOWN
  4. OK = 0, // 0 must always be OK
  5. WRONG_PASSWORD, // User entered wrong password
  6. WRONG_VERSION, // Server and client do not have the same build while "forceSameBuild" is true
  7. CONNECT_ERROR, // Unknown error
  8. SESSION_FULL, // Server is full
  9. FILE_PATCHING, // Bad file patching
  10. ALREADY_CONNECTED, // Client is already connected
  11. HOST_ADDRESS, // Was unable to resolve host address
  12. NET_CHANNEL, // Client failed to create NetChannel
  13. CONNECT, // Connecting itself has failed
  14. REQUEST_PLAYER, // Failed to request player
  15. CREATE_PLAYER, // Failed to create player
  16. TIMEOUT, // Packages timed out
  17. UID, // Failed to find uid
  18. NET_CHANNEL_SERVER, // Server failed to create NetChannel
  19. ACTIVATE, // Failed to activate session
  20. SERVER_LOCKED, // Server is locked by admin
  21. SERVER_SHUTDOWN, // Server is shutting down soon
  22. BUILD_SMALLER, // Client has a build smaller than the Server
  23. BUILD_GREATER, // Client has a build greater than the Server
  24. VERSION_SMALLER, // Client has a version smaller than the Server
  25. VERSION_GREATER, // Client has a version greater than the Server
  26. EQUAL_MOD, // Server and Client do not have equal mods while "equalModRequired" is true
  27. CLIENT_DIAG, // Client is using Diag exe while Server is not
  28. SERVER_DIAG, // Server is using Diag exe while Client is not
  29. NO_DEVICE_ID, // Client has not acquired device id
  30. };
  31. class ConnectErrorServerModule : ErrorHandlerModuleScript
  32. {
  33. void ConnectErrorServerModule()
  34. {
  35. SetCategory(ErrorCategory.ConnectErrorServer);
  36. }
  37. override void InitOptionalVariables()
  38. {
  39. super.InitOptionalVariables();
  40. m_Header = "#server_browser_connecting_failed";
  41. }
  42. override void FillErrorDataMap()
  43. {
  44. super.FillErrorDataMap();
  45. InsertDialogueErrorProperties(EConnectErrorServer.WRONG_PASSWORD, "#server_browser_wrong_password");
  46. InsertDialogueErrorProperties(EConnectErrorServer.WRONG_VERSION, "#server_browser_wrong_version");
  47. InsertDialogueErrorProperties(EConnectErrorServer.CONNECT_ERROR, "#server_browser_wrong_connect_error");
  48. InsertDialogueErrorProperties(EConnectErrorServer.SESSION_FULL, "#server_browser_session_full");
  49. InsertDialogueErrorProperties(EConnectErrorServer.FILE_PATCHING, "#server_browser_bad_file_patching");
  50. InsertDialogueErrorProperties(EConnectErrorServer.ALREADY_CONNECTED, "#STR_already_connected");
  51. InsertDialogueErrorProperties(EConnectErrorServer.HOST_ADDRESS, "#STR_host_address");
  52. InsertDialogueErrorProperties(EConnectErrorServer.NET_CHANNEL, "#STR_net_channel");
  53. InsertDialogueErrorProperties(EConnectErrorServer.CONNECT, "#STR_connect");
  54. InsertDialogueErrorProperties(EConnectErrorServer.REQUEST_PLAYER, "#STR_request_player");
  55. InsertDialogueErrorProperties(EConnectErrorServer.CREATE_PLAYER, "#STR_create_player");
  56. InsertDialogueErrorProperties(EConnectErrorServer.TIMEOUT, "#STR_timeout");
  57. InsertDialogueErrorProperties(EConnectErrorServer.UID, "#STR_UID");
  58. InsertDialogueErrorProperties(EConnectErrorServer.NET_CHANNEL_SERVER, "#STR_net_channel_server");
  59. InsertDialogueErrorProperties(EConnectErrorServer.ACTIVATE, "#STR_activate");
  60. InsertDialogueErrorProperties(EConnectErrorServer.SERVER_LOCKED, "#STR_MP_SESSION_LOCKED");
  61. InsertDialogueErrorProperties(EConnectErrorServer.SERVER_SHUTDOWN, "#STR_shutdown_server");
  62. InsertDialogueErrorProperties(EConnectErrorServer.BUILD_SMALLER, "#STR_build_smaller"+"\n"+"#STR_PLEASE_UPDATE");
  63. InsertDialogueErrorProperties(EConnectErrorServer.BUILD_GREATER, "#STR_build_greater"+"\n"+"#STR_PLEASE_WAIT");
  64. InsertDialogueErrorProperties(EConnectErrorServer.VERSION_SMALLER, "#STR_version_smaller"+"\n"+"#STR_PLEASE_UPDATE");
  65. InsertDialogueErrorProperties(EConnectErrorServer.VERSION_GREATER, "#STR_version_greater"+"\n"+"#STR_PLEASE_WAIT");
  66. InsertDialogueErrorProperties(EConnectErrorServer.EQUAL_MOD, "#STR_equal_mod");
  67. InsertDialogueErrorProperties(EConnectErrorServer.CLIENT_DIAG, "#STR_client_diag");
  68. InsertDialogueErrorProperties(EConnectErrorServer.SERVER_DIAG, "#STR_server_diag");
  69. InsertDialogueErrorProperties(EConnectErrorServer.NO_DEVICE_ID, "#STR_no_device_id");
  70. }
  71. override void OnEvent(EventType eventTypeId, Param params)
  72. {
  73. switch (eventTypeId)
  74. {
  75. case MPSessionPlayerReadyEventTypeID:
  76. #ifndef NO_GUI
  77. g_Game.GetUIManager().CloseSpecificDialog(m_LastErrorThrown);
  78. #endif
  79. break;
  80. default:
  81. break;
  82. }
  83. }
  84. }
  85. /*class ConnectErrorServerModuleUI : UIScriptedMenu
  86. {
  87. override bool OnModalResult(Widget w, int x, int y, int code, int result)
  88. {
  89. super.OnModalResult(w, x, y, code, result);
  90. int error = ErrorModuleHandler.GetCodeFromError(code);
  91. switch ( error )
  92. {
  93. default:
  94. break;
  95. }
  96. return true;
  97. }
  98. }*/