9
3

net.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. EQ2Emulator: Everquest II Server Emulator
  3. Copyright (C) 2007 EQ2EMulator Development Team (http://www.eq2emulator.net)
  4. This file is part of EQ2Emulator.
  5. */
  6. #ifdef WIN32
  7. #define WIN32_LEAN_AND_MEAN
  8. #include <windows.h>
  9. #include <winsock.h>
  10. #else
  11. #include <sys/socket.h>
  12. #include <netinet/in.h>
  13. #include <arpa/inet.h>
  14. #include <unistd.h>
  15. #endif
  16. //#include <netdb.h>
  17. #include <errno.h>
  18. #include <fcntl.h>
  19. #include "../common/types.h"
  20. void CatchSignal(int sig_num);
  21. enum eServerMode { Standalone, Master, Slave, Mesh };
  22. class NetConnection
  23. {
  24. public:
  25. NetConnection() {
  26. port = 5999;
  27. listening_socket = 0;
  28. memset(masteraddress, 0, sizeof(masteraddress));
  29. uplinkport = 0;
  30. memset(uplinkaccount, 0, sizeof(uplinkaccount));
  31. memset(uplinkpassword, 0, sizeof(uplinkpassword));
  32. LoginMode = Standalone;
  33. Uplink_WrongVersion = false;
  34. numclients = 0;
  35. numservers = 0;
  36. allowAccountCreation = true;
  37. // full support = 0x7CFF
  38. // 1 << 12 (-4096) = missing echoes of faydwer, disables Fae and Arasai (black portraits) and kelethin as starting city
  39. // 1 << 13 (-8192) = disables sarnak (black portraits) and gorowyn as starting city
  40. expansionFlag = 0x7CFF; // 0x4CF5
  41. /* dword_1ECBA18 operand for race flag packs (sublevel 0,1,2?) -- (sublevel -1) controls starting zones omission 0xEE vs 0xCF (CF misses halas)
  42. 1 = city of qeynos
  43. 2 = city of freeport
  44. 4 = city of kelethin
  45. 8 = city of neriak
  46. 16 = gorowyn
  47. 32 = new halas
  48. 64 = queens colony
  49. 128 = outpost overlord
  50. */
  51. citiesFlag = 0xFF;
  52. // sub_level 0xFFFFFFFF = blacks out all portraits for class alignments, considered non membership
  53. // sub_level > 0 = class alignments still required, but portraits are viewable and race selectable
  54. // sub_level = 2 membership, you can 'create characters on time locked servers' vs standard
  55. // sub_level = 0 forces popup on close to web browser
  56. defaultSubscriptionLevel = 0xFFFFFFFF;
  57. // disable extra races FAE(16) ARASAI (17) SARNAK (18) -- with 4096/8192 flags, no visibility of portraits
  58. enabledRaces = 0xFFFF; // 0xCFFF
  59. }
  60. void UpdateWindowTitle(char* iNewTitle = 0);
  61. bool Init();
  62. void ListenNewClients();
  63. void HitKey(int keyhit);
  64. char address[1024];
  65. int32 numclients;
  66. int32 numservers;
  67. int16 GetPort() { return port; }
  68. void SetPort(int16 in_port) { port = in_port; }
  69. eServerMode GetLoginMode() { return LoginMode; }
  70. bool ReadLoginConfig();
  71. char* GetMasterAddress() { return masteraddress; }
  72. int16 GetUplinkPort() { if (uplinkport != 0) return uplinkport; else return port; }
  73. char* GetUplinkAccount() { return uplinkaccount; }
  74. char* GetUplinkPassword() { return uplinkpassword; }
  75. bool IsAllowingAccountCreation() { return allowAccountCreation; }
  76. int32 GetExpansionFlag() { return expansionFlag; }
  77. int8 GetCitiesFlag() { return citiesFlag; }
  78. int32 GetDefaultSubscriptionLevel() { return defaultSubscriptionLevel; }
  79. int32 GetEnabledRaces() { return enabledRaces; }
  80. void WelcomeHeader();
  81. protected:
  82. friend class LWorld;
  83. bool Uplink_WrongVersion;
  84. private:
  85. int16 port;
  86. int listening_socket;
  87. char masteraddress[300];
  88. int16 uplinkport;
  89. char uplinkaccount[300];
  90. char uplinkpassword[300];
  91. eServerMode LoginMode;
  92. bool allowAccountCreation;
  93. int32 expansionFlag;
  94. int8 citiesFlag;
  95. int32 defaultSubscriptionLevel;
  96. int32 enabledRaces;
  97. };