SEGS  0.4.2
Super Entity Game Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GameEvents.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2018 SEGS Team (see Authors.txt)
5  * This software is licensed! (See License.txt for details)
6  */
7 
8 #pragma once
9 #include "LinkLevelEvent.h"
10 #include "BitStream.h"
11 #include "GameLink.h"
14 #include "Servers/InternalEvents.h"
15 
16 #include <QtCore/QString>
17 
19 
21 
23 {
24 public:
26  EVENT_DECL(evUpdateServer, 0)
27  EVENT_DECL(evMapAddrRequest, 1)
28  EVENT_DECL(evDeleteCharacter, 2)
29  EVENT_DECL(evUpdateCharacter, 3)
30  EVENT_DECL(evGameEntryError, 4)
31  EVENT_DECL(evCharacterSlots, 5)
32  EVENT_DECL(evCharacterResponse, 6)
33  EVENT_DECL(evMapAddrResponse, 7)
34  EVENT_DECL(evDeleteAcknowledged,8)
35 
36  EVENT_DECL(evUnknownEvent,16)
37 
38  EVENT_DECL(evServerReconfigured,100)
39  END_EVENTS(102)
40 };
41 
43 {
44 public:
46  {
47 
48  }
49  void serializeto(BitStream &bs) const override
50  {
51  bs.StorePackedBits(1,3); //opcode
52  }
53  void serializefrom(BitStream &src) override
54  {
57  m_mapnumber = src.GetPackedBits(1);
59 
60  }
61  uint32_t m_map_server_ip;
63  uint32_t m_mapnumber;
64  QString m_char_name;
65 };
66 
68 {
69 public:
71  {
73  }
74  void serializefrom(BitStream &src) override
75  {
76  unused1 = src.GetPackedBits(1);
77  unused2 = src.GetPackedBits(1);
78  uint32_t ipaddr = src.GetPackedBits(1);
79  unused3 = src.GetPackedBits(1);
80  uint16_t port = src.GetPackedBits(1);
81  unused4 = src.GetPackedBits(1);
82  m_map_cookie = src.GetPackedBits(1);
83  m_address.set(port,ntohl(ipaddr));
84  }
85  void serializeto(BitStream &tgt) const override
86  {
87  uint32_t ipaddr = htonl(m_address.get_ip_address());
88  uint16_t port = m_address.get_port_number();
89  tgt.StorePackedBits(1,4); //opcode
90  tgt.StorePackedBits(1,unused1);
91  tgt.StorePackedBits(1,unused2);
92  tgt.StorePackedBits(1,ipaddr);
93  tgt.StorePackedBits(1,unused3);
94  tgt.StorePackedBits(1,port);
95  tgt.StorePackedBits(1,unused4);
96  tgt.StorePackedBits(1,m_map_cookie); // this should be 0 if there was an error ( like "InvalidName" )
97  }
98  uint8_t unused1;
99  uint8_t unused2;
100  uint8_t unused3;
101  uint8_t unused4;
102  ACE_INET_Addr m_address;
103  // 0 - Name already taken.
104  // 1 - Problem detected in the game database system
105  uint32_t m_map_cookie;
106 };
107 
109 {
110 public:
112  {}
113  DeleteCharacter(EventProcessor *evsrc,uint8_t idx,const QString &name) : GameLinkEvent(GameEventTypes::evDeleteCharacter,evsrc),m_index(idx),m_char_name(name)
114  {}
115  void serializeto(BitStream &bs) const override
116  {
117  bs.StorePackedBits(1,4); // opcode
118  bs.StorePackedBits(1,m_index);
120  }
121  void serializefrom(BitStream &bs) override
122  {
123  m_index=bs.GetPackedBits(1);
125  }
126  uint8_t m_index;
127  QString m_char_name;
128 };
129 
131 {
132 public:
134  {
135  }
136  void serializeto(BitStream &bs) const override;
137  void serializefrom(BitStream &bs) override;
138  uint8_t m_index;
139 };
140 
142 {
143 public:
145  {}
147  {
148  m_index=idx;
149  m_data=gad;
150  }
152  void serializeto(BitStream &bs) const override;
153  void serializefrom(BitStream &bs) override;
154  uint8_t m_index;
156 };
157 
159 {
160 public:
162  {}
163  void serializeto( BitStream &tgt ) const override;
164  void serializefrom( BitStream &src ) override;
165  void dependent_dump() const;
166 
167 
168  uint32_t m_build_date;
169  QString currentVersion;
170  uint8_t clientInfo[16];
171  uint32_t authID, authCookie;
172  QString accountName;
174 };
175 
177 {
178 public:
179  CharacterSlots():GameLinkEvent(GameEventTypes::evCharacterSlots),m_data(nullptr)
180  {}
182  void serializeto( BitStream &tgt ) const override;
183  void serializefrom( BitStream &src ) override;
184 
185  uint32_t m_unknown_new;
186  uint8_t m_clientinfo[16];
188 };
189 
191 {
192 public:
194  {}
195  GameEntryError(EventProcessor *evsrc,const QString &erstr):GameLinkEvent(GameEventTypes::evGameEntryError,evsrc),m_error(erstr)
196  {}
197  void serializeto( BitStream &tgt ) const override;
198  void serializefrom( BitStream &src ) override;
199  QString m_error;
200 };
201 
203 {
204 public:
206  {}
207  void serializeto( BitStream &tgt ) const override;
208  void serializefrom( BitStream &) override {}
209 };
210 
212 {
213 public:
215  { }
216  void serializeto(BitStream &) const override { }
217  void serializefrom(BitStream &) override { }
218 };
219 
221 {
222 public:
224 };
void serializefrom(BitStream &src) override
Definition: GameEvents.cpp:75
void serializeto(BitStream &tgt) const override
Definition: GameEvents.cpp:80
void set_client(GameAccountResponseData *gad)
Definition: GameEvents.h:151
void dependent_dump() const
Definition: GameEvents.cpp:30
Definition: GameEvents.h:211
GameServerReconfigured()
Definition: GameEvents.h:223
Definition: GameEvents.h:158
uint8_t m_index
Definition: GameEvents.h:154
QString currentVersion
Definition: GameEvents.h:169
void serializefrom(BitStream &) override
Definition: GameEvents.h:217
GameAccountResponseData * m_data
Definition: GameEvents.h:155
uint8_t unused2
Definition: GameEvents.h:99
Definition: GameEvents.h:220
Definition: CRUD_Events.h:16
void serializeto(BitStream &bs) const override
Definition: GameEvents.cpp:100
uint8_t unused1
Definition: GameEvents.h:98
void serializeto(BitStream &) const override
Definition: GameEvents.h:216
Definition: GameEvents.h:108
#define BEGINE_EVENTS(parent_class)
Definition: SEGSEvent.h:17
QString m_char_name
Definition: GameEvents.h:64
void set_account_data(GameAccountResponseData *c)
Definition: GameEvents.h:181
int32_t GetPackedBits(uint32_t minbits)
Definition: BitStream.cpp:285
void serializefrom(BitStream &src) override
Definition: GameEvents.cpp:58
uint32_t authID
Definition: GameEvents.h:171
void serializeto(BitStream &tgt) const override
Definition: GameEvents.cpp:46
Definition: BitStream.h:30
uint32_t authCookie
Definition: GameEvents.h:171
#define END_EVENTS(cnt)
Definition: SEGSEvent.h:20
Definition: GameEvents.h:202
QString accountName
Definition: GameEvents.h:172
void serializeto(BitStream &bs) const override
Definition: GameEvents.h:49
void serializeto(BitStream &tgt) const override
Definition: GameEvents.cpp:137
GameAccountResponseData * m_data
Definition: GameEvents.h:187
void serializefrom(BitStream &bs) override
Definition: GameEvents.h:121
uint32_t m_build_date
Definition: GameEvents.h:168
CRUDLink_Event GameLinkEvent
Definition: GameEventFactory.h:11
void serializefrom(BitStream &bs) override
Definition: GameEvents.cpp:131
void serializeto(BitStream &tgt) const override
Definition: GameEvents.cpp:69
void StorePackedBits(uint32_t nBits, uint32_t dataBits)
Definition: BitStream.cpp:161
Definition: GameEvents.h:22
uint8_t m_index
Definition: GameEvents.h:138
Definition: GameDBSyncEvents.h:172
Definition: GameEvents.h:130
void StoreString(const char *str)
Definition: BitStream.cpp:204
MapServerAddrResponse()
Definition: GameEvents.h:70
bool localMapServer
Definition: GameEvents.h:173
uint8_t clientInfo[16]
Definition: GameEvents.h:170
UpdateCharacter()
Definition: GameEvents.h:133
void serializefrom(BitStream &src) override
Definition: GameEvents.h:53
uint32_t m_map_server_ip
Definition: GameEvents.h:61
ACE_INET_Addr m_address
Definition: GameEvents.h:102
GameUnknownRequest()
Definition: GameEvents.h:214
DeletionAcknowledged()
Definition: GameEvents.h:205
uint8_t unused4
Definition: GameEvents.h:101
void GetString(QString &str)
Retrieves a null-terminated C-style string from the bit stream.
Definition: BitStream.cpp:326
Definition: InternalEvents.h:39
void serializeto(BitStream &bs) const override
Definition: GameEvents.h:115
uint8_t m_index
Definition: GameEvents.h:126
uint16_t m_character_index
Definition: GameEvents.h:62
void serializeto(BitStream &tgt) const override
Definition: GameEvents.h:85
DeleteCharacter()
Definition: GameEvents.h:111
Definition: GameEvents.h:141
MapServerAddrRequest()
Definition: GameEvents.h:45
QString m_error
Definition: GameEvents.h:199
uint8_t m_clientinfo[16]
Definition: GameEvents.h:186
uint32_t m_unknown_new
Definition: GameEvents.h:185
QString m_char_name
Definition: GameEvents.h:127
Definition: GameEvents.h:176
Definition: EventProcessor.h:13
CharacterResponse(EventProcessor *src, uint8_t idx, GameAccountResponseData *gad)
Definition: GameEvents.h:146
void serializefrom(BitStream &bs) override
Definition: GameEvents.cpp:106
GameEntryError()
Definition: GameEvents.h:193
GameEntryError(EventProcessor *evsrc, const QString &erstr)
Definition: GameEvents.h:195
void serializeto(BitStream &bs) const override
Definition: GameEvents.cpp:111
uint8_t unused3
Definition: GameEvents.h:100
void serializefrom(BitStream &src) override
Definition: GameEvents.cpp:95
CharacterResponse()
Definition: GameEvents.h:144
uint32_t m_map_cookie
Definition: GameEvents.h:105
Definition: GameEvents.h:190
Definition: GameEvents.h:42
uint32_t m_mapnumber
Definition: GameEvents.h:63
CharacterSlots()
Definition: GameEvents.h:179
EventProcessor * src() const
Definition: SEGSEvent.h:62
void serializefrom(BitStream &src) override
Definition: GameEvents.h:74
UpdateServer()
Definition: GameEvents.h:161
Definition: GameEvents.h:67
void serializefrom(BitStream &) override
Definition: GameEvents.h:208
DeleteCharacter(EventProcessor *evsrc, uint8_t idx, const QString &name)
Definition: GameEvents.h:113
#define EVENT_DECL(name, cnt)
Definition: SEGSEvent.h:19