Clone of PhatAC @ https://github.com/floaterxk/PhatAC

Client.h 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #pragma once
  2. class CClientEvents;
  3. class CPacketController;
  4. class BinaryWriter;
  5. class BinaryReader;
  6. typedef struct DungeonDesc_s DungeonDesc_t;
  7. class CClient : public CKillable
  8. {
  9. friend class CClientEvents;
  10. public:
  11. CClient(SOCKADDR_IN *, WORD slot, char *account, int accessLevel);
  12. ~CClient();
  13. void Think();
  14. void ThinkOutbound();
  15. void WorldThink();
  16. BOOL CheckAccount(const char *);
  17. BOOL CheckAddress(SOCKADDR_IN *);
  18. const char* GetAccount(); //The client's account name.
  19. const char* GetDescription(); //The status text to display for this client.
  20. WORD GetIndex(); //The client's assigned RecipientID.
  21. SOCKADDR_IN* GetHostAddress(); //The client's address.
  22. void SetLoginData(DWORD dwUnixTime, DWORD dwPortalStamp, DWORD dwCellStamp);
  23. void IncomingBlob(BlobPacket_s *);
  24. void ProcessMessage(BYTE *data, DWORD length, WORD);
  25. void SendNetMessage(BinaryWriter*, WORD group, BOOL game_event = 0, BOOL del = 1);
  26. void SendNetMessage(void *data, DWORD length, WORD group, BOOL game_event = 0);
  27. CClientEvents* GetEvents() { return m_pEvents; }
  28. int GetAccessLevel();
  29. private:
  30. void UpdateLoginScreen();
  31. // Non-world events.
  32. void EnterWorld();
  33. void ExitWorld();
  34. void CreateCharacter(BinaryReader *);
  35. void SendLandblock(DWORD dwFileID);
  36. void SendLandcell(DWORD dwFileID);
  37. //
  38. BOOL CheckNameValidity(const char *name);
  39. // This is a dumbly separated way of parsing methods. Change this.
  40. CClientEvents *m_pEvents;
  41. // This handles parts of the network layer.
  42. CPacketController *m_pPC;
  43. struct CL_ClientVars_t
  44. {
  45. WORD slot; //The client's assigned RecipientID.
  46. SOCKADDR_IN addr; //The client's socket address.
  47. std::string account; //The client's account name.
  48. //WARNING: These are controlled by the client.
  49. DWORD unixtime; //The client's unix timestamp at login.
  50. DWORD portalstamp;//The client's portal.dat version.
  51. DWORD cellstamp; //The client's cell.dat version.
  52. //Server controlled variables.
  53. double logintime; //The high-frequency time the client connected.
  54. BOOL initdats; //Has the client's dat files been updated?
  55. BOOL needchars; //Does the client need a character list update?
  56. BOOL inworld; //Is the client in the world, or not?
  57. } m_vars;
  58. int m_AccessLevel;
  59. };