LoginServer.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. EQ2Emulator is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. EQ2Emulator is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with EQ2Emulator. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef LOGINSERVER_H
  17. #define LOGINSERVER_H
  18. #include "../common/servertalk.h"
  19. #include "../common/linked_list.h"
  20. #include "../common/timer.h"
  21. #include "../common/queue.h"
  22. #include "../common/Mutex.h"
  23. #include "../common/TCPConnection.h"
  24. #include <deque>
  25. #include "MutexMap.h"
  26. #ifdef WIN32
  27. void AutoInitLoginServer(void *tmp);
  28. #else
  29. void *AutoInitLoginServer(void *tmp);
  30. #endif
  31. bool InitLoginServer();
  32. class LoginServer{
  33. public:
  34. LoginServer(const char* iAddress = 0, int16 iPort = 5999);
  35. ~LoginServer();
  36. bool Process();
  37. bool Connect(const char* iAddress = 0, int16 iPort = 0);
  38. bool ConnectToUpdateServer(const char* iAddress = 0, int16 iPort = 0);
  39. void SendInfo();
  40. void SendStatus();
  41. void GetLatestTables();
  42. void SendPacket(ServerPacket* pack) { tcpc->SendPacket(pack); }
  43. int8 GetState() { return tcpc->GetState(); }
  44. bool Connected() { return tcpc->Connected(); }
  45. void SendFilterNameResponse ( int8 resp , int32 acct_id , int32 char_id );
  46. void SendDeleteCharacter ( CharacterTimeStamp_Struct* cts );
  47. int32 DetermineCharacterLoginRequest ( UsertoWorldRequest_Struct* utwr );
  48. void InitLoginServerVariables();
  49. sint16 minLockedStatus;
  50. sint16 maxPlayers;
  51. sint16 minGameFullStatus;
  52. void SendImmediateEquipmentUpdatesForChar(int32 char_id);
  53. bool CanReconnect() { return pTryReconnect; }
  54. private:
  55. bool try_auto_update;
  56. bool pTryReconnect;
  57. TCPConnection* tcpc;
  58. int32 LoginServerIP;
  59. int32 UpdateServerIP;
  60. int16 LoginServerPort;
  61. uchar* data_waiting;
  62. MutexMap<int32, LoginZoneUpdate>* zone_updates;
  63. MutexMap<int32, LoginEquipmentUpdate>* loginEquip_updates;
  64. int32 last_checked_time;
  65. Timer* statusupdate_timer;
  66. };
  67. #endif