-
Notifications
You must be signed in to change notification settings - Fork 20
/
Client.h
103 lines (72 loc) · 2.61 KB
/
Client.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#pragma once
#include "DatabaseIO.h"
class CClientEvents;
class CPacketController;
class BinaryWriter;
class BinaryReader;
typedef struct DungeonDesc_s DungeonDesc_t;
class CClient : public CKillable, public CLockable
{
friend class CClientEvents;
public:
CClient(SOCKADDR_IN *, WORD slot, struct AccountInformation_t &accountInfo);
~CClient();
void Think();
void ThinkOutbound();
void WorldThink();
BOOL CheckAccount(const char *);
BOOL CheckAddress(SOCKADDR_IN *);
const char *GetAccount(); //The client's account name.
const char *GetDescription(); //The status text to display for this client.
void SetArrayPos(DWORD arrayPos) { m_ArrayPos = arrayPos; }
DWORD GetArrayPos() { return m_ArrayPos; }
WORD GetSlot(); // The client's assigned RecipientID.
SOCKADDR_IN* GetHostAddress(); // The client's address.
void SetLoginData(DWORD dwUnixTime, DWORD dwPortalStamp, DWORD dwCellStamp);
void IncomingBlob(BlobPacket_s *blob, double recvTime);
void ProcessMessage(BYTE *data, DWORD length, WORD);
void SendNetMessage(BinaryWriter*, WORD group, BOOL game_event = 0, BOOL del = 1);
void SendNetMessage(void *data, DWORD length, WORD group, BOOL game_event = 0);
CPacketController *GetPacketController() { return m_pPC; }
CClientEvents *GetEvents() { return m_pEvents; }
int GetAccessLevel();
void SetAccessLevel(unsigned int access); // does not save
const AccountInformation_t &GetAccountInfo();
const std::list<CharacterDesc_t> &GetCharacters();
bool HasCharacter(DWORD character_weenie_id);
DWORD IncCharacterInstanceTS(DWORD character_weenie_id);
private:
void UpdateLoginScreen();
// Non-world events.
void EnterWorld();
void ExitWorld();
void DeleteCharacter(BinaryReader *);
void CreateCharacter(BinaryReader *);
void SendLandblock(DWORD dwFileID);
void SendLandblockInfo(DWORD dwFileID);
void SendLandcell(DWORD dwFileID);
//
BOOL CheckNameValidity(const char *name, int access, std::string &resultName);
// This is a dumbly separated way of parsing methods. Change this.
CClientEvents *m_pEvents;
// This handles parts of the network layer.
CPacketController *m_pPC;
struct CL_ClientVars_t
{
WORD slot; // Assigned RecipientID
SOCKADDR_IN addr; // Socket address
std::string account; // Account name
// These are sent by the client
DWORD ClientLoginUnixTime = 0;
DWORD PortalStamp = 0;
DWORD CellStamp = 0;
double fLoginTime = 0.0;
bool bInitDats = false;
bool bNeedChars = true;
bool bInWorld = false;
} m_vars;
AccountInformation_t m_AccountInfo;
std::list<CharacterDesc_t> m_Characters;
std::list<CharacterDesc_t> m_CharactersSent;
DWORD m_ArrayPos = 0;
};