connecterrorclientmodule.c 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. enum EConnectErrorClient
  2. {
  3. UNKNOWN = -1, // -1 must always be UNKNOWN
  4. OK = 0, // 0 must always be OK
  5. SERVER_UNREACHABLE, // Could not connect to server because it is not reachable (offline, restarting, ..)
  6. ALREADY_CONNECTING, // Client is already attempting to join a server
  7. ERROR_MSG_SHOWED, // Indicates there is an error on screen that has yet to be confirmed
  8. INCORRECT_CLIENT_STATE, // The client is already connected or is connecting to a server
  9. INVALID_SESSION, // The guid of the session is empty
  10. VERSION_MISMATCH, // Mismatch between server and client version
  11. VERSION_MISMATCH_RB, // Client build is lower than "requiredBuild" (server config)
  12. VERSION_MISMATCH_AB, // Client build is higher than "allowedBuild" (server config)
  13. DLC_CHECK_FAILED, // Client does not have required DLC
  14. EMPTY_PASSWORD, // Player input an empty password
  15. PASSWORD, // Server is password protected
  16. BE_LICENCE, // Server is using BE and it has not yet been agreed to
  17. };
  18. class ConnectErrorClientModule : ErrorHandlerModuleScript
  19. {
  20. void ConnectErrorClientModule()
  21. {
  22. SetCategory(ErrorCategory.ConnectErrorClient);
  23. }
  24. override void InitOptionalVariables()
  25. {
  26. super.InitOptionalVariables();
  27. m_Header = "#server_browser_connecting_failed";
  28. }
  29. override void FillErrorDataMap()
  30. {
  31. super.FillErrorDataMap();
  32. InsertDialogueErrorProperties(EConnectErrorClient.SERVER_UNREACHABLE, "#STR_server_unreachable");
  33. InsertDialogueErrorProperties(EConnectErrorClient.ALREADY_CONNECTING, "#STR_already_connecting");
  34. InsertDialogueErrorProperties(EConnectErrorClient.ERROR_MSG_SHOWED, "#STR_error_msg_showed");
  35. InsertDialogueErrorProperties(EConnectErrorClient.INCORRECT_CLIENT_STATE, "#STR_incorrect_client_state");
  36. InsertDialogueErrorProperties(EConnectErrorClient.INVALID_SESSION, "#STR_invalid_session");
  37. InsertDialogueErrorProperties(EConnectErrorClient.VERSION_MISMATCH, "#multi_server_not_compatible_message");
  38. InsertDialogueErrorProperties(EConnectErrorClient.VERSION_MISMATCH_RB, "#multi_server_not_compatible_message");
  39. InsertDialogueErrorProperties(EConnectErrorClient.VERSION_MISMATCH_AB, "#multi_server_not_compatible_message");
  40. InsertDialogueErrorProperties(EConnectErrorClient.DLC_CHECK_FAILED, "#mod_detail_info_warning");
  41. InsertDialogueErrorProperties(EConnectErrorClient.EMPTY_PASSWORD, "#STR_empty_password");
  42. InsertErrorProperties(EConnectErrorClient.PASSWORD);
  43. InsertErrorProperties(EConnectErrorClient.BE_LICENCE);
  44. }
  45. #ifndef NO_GUI
  46. override void OnEvent(EventType eventTypeId, Param params)
  47. {
  48. switch (eventTypeId)
  49. {
  50. case MPSessionPlayerReadyEventTypeID:
  51. g_Game.GetUIManager().CloseSpecificDialog(m_LastErrorThrown);
  52. break;
  53. default:
  54. break;
  55. }
  56. }
  57. #endif
  58. }
  59. /*class ConnectErrorClientModuleUI : UIScriptedMenu
  60. {
  61. override bool OnModalResult(Widget w, int x, int y, int code, int result)
  62. {
  63. super.OnModalResult(w, x, y, code, result);
  64. int error = ErrorModuleHandler.GetCodeFromError(code);
  65. switch ( error )
  66. {
  67. default:
  68. break;
  69. }
  70. return true;
  71. }
  72. }*/