SEGS  0.6.1-develop [d2cac982]
Super Entity Game Server
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 - 2019 SEGS Team (see AUTHORS.md)
5  * This software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details.
6  */
7 
8 #pragma once
9 #include "LinkLevelEvent.h"
10 #include "BitStream.h"
11 //#include "GameLink.h"
12 //#include "CRUDP_Protocol/CRUD_Link.h"
14 #include "Servers/InternalEvents.h"
15 
16 // GameEvents make use of some of the event Data defined in GameDBSyncEvents
18 #include <QtCore/QString>
19 #include <array>
20 
21 namespace SEGSEvents
22 {
24 
26 
28 {
41 };
42 
43 // [[ev_def:type]]
45 {
46 public:
47  MapServerAddrRequest() : GameLinkEvent(GameEventTypes::evMapServerAddrRequest)
48  {
49 
50  }
51  void serializeto(BitStream &bs) const override
52  {
53  bs.StorePackedBits(1,3); //opcode
54  }
55  void serializefrom(BitStream &src) override
56  {
57  m_character_index = src.GetPackedBits(1);
58  m_map_server_ip = src.GetPackedBits(1);
59  m_mapnumber = src.GetPackedBits(1);
60  src.GetString(m_char_name);
61 
62  }
63  // [[ev_def:field]]
64  uint32_t m_map_server_ip;
65  // [[ev_def:field]]
67  // [[ev_def:field]]
68  uint32_t m_mapnumber;
69  // [[ev_def:field]]
70  QString m_char_name;
71 
73 };
74 
75 // [[ev_def:type]]
77 {
78 public:
80  {
82  }
83  void serializefrom(BitStream &src) override
84  {
85  unused1 = src.GetPackedBits(1);
86  unused2 = src.GetPackedBits(1);
87  uint32_t ipaddr = src.GetPackedBits(1);
88  unused3 = src.GetPackedBits(1);
89  uint16_t port = src.GetPackedBits(1);
90  unused4 = src.GetPackedBits(1);
91  m_map_cookie = src.GetPackedBits(1);
92  m_address.set(port,ntohl(ipaddr));
93  }
94  void serializeto(BitStream &tgt) const override
95  {
96  uint32_t ipaddr = htonl(m_address.get_ip_address());
97  uint16_t port = m_address.get_port_number();
98  tgt.StorePackedBits(1,4); //opcode
99  tgt.StorePackedBits(1,unused1);
100  tgt.StorePackedBits(1,unused2);
101  tgt.StorePackedBits(1,ipaddr);
102  tgt.StorePackedBits(1,unused3);
103  tgt.StorePackedBits(1,port);
104  tgt.StorePackedBits(1,unused4);
105  tgt.StorePackedBits(1,m_map_cookie); // this should be 0 if there was an error ( like "InvalidName" )
106  }
107  // [[ev_def:field]]
108  uint8_t unused1;
109  // [[ev_def:field]]
110  uint8_t unused2;
111  // [[ev_def:field]]
112  uint8_t unused3;
113  // [[ev_def:field]]
114  uint8_t unused4;
115  // [[ev_def:field]]
116  ACE_INET_Addr m_address;
120  // [[ev_def:field]]
121  uint32_t m_map_cookie;
123 };
124 
125 // [[ev_def:type]]
127 {
128 public:
130  {}
131  DeleteCharacter(EventProcessor *evsrc,uint8_t idx,const QString &name) : GameLinkEvent(GameEventTypes::evDeleteCharacter,evsrc),m_index(idx),m_char_name(name)
132  {}
133  void serializeto(BitStream &bs) const override
134  {
135  bs.StorePackedBits(1,4); // opcode
136  bs.StorePackedBits(1,m_index);
137  bs.StoreString(m_char_name);
138  }
139  void serializefrom(BitStream &bs) override
140  {
141  m_index=bs.GetPackedBits(1);
142  bs.GetString(m_char_name);
143  }
144  // [[ev_def:field]]
145  uint8_t m_index;
146  // [[ev_def:field]]
147  QString m_char_name;
149 };
150 
151 // [[ev_def:type]]
153 {
154 public:
156  {
157  }
158  void serializeto(BitStream &bs) const override;
159  void serializefrom(BitStream &bs) override;
160  // [[ev_def:field]]
161  uint8_t m_index;
163 };
164 
165 // [[ev_def:type]]
167 {
168 public:
170  {}
172  {
173  m_index=idx;
174  m_data=gad;
175  }
176  void serializeto(BitStream &bs) const override;
177  void serializefrom(BitStream &bs) override;
178  // [[ev_def:field]]
179  uint8_t m_index;
180  // [[ev_def:field]]
183 };
184 
185 // [[ev_def:type]]
187 {
188 public:
190  {}
191  void serializeto( BitStream &tgt ) const override;
192  void serializefrom( BitStream &src ) override;
193  void dependent_dump() const;
195 
196 
197  // [[ev_def:field]]
198  uint32_t m_build_date;
199  // [[ev_def:field]]
200  QString currentVersion;
201  // [[ev_def:field]]
202  std::array<uint8_t,16> clientInfo;
203  // [[ev_def:field]]
204  uint32_t authID;
205  // [[ev_def:field]]
206  uint32_t authCookie;
207  // [[ev_def:field]]
208  QString accountName;
209  // [[ev_def:field]]
210  bool localMapServer;
211 };
212 
213 // [[ev_def:type]]
215 {
216 public:
218  {}
219  void serializeto( BitStream &tgt ) const override;
220  void serializefrom( BitStream &src ) override;
221 
222  // [[ev_def:field]]
223  uint32_t m_unknown_new;
224  // [[ev_def:field]]
225  std::array<uint8_t,16> m_clientinfo;
226  // [[ev_def:field]]
229 };
230 
231 // [[ev_def:type]]
233 {
234 public:
236  {}
237  GameEntryError(EventProcessor *evsrc,const QString &erstr):GameLinkEvent(GameEventTypes::evGameEntryError,evsrc),m_error(erstr)
238  {}
239  void serializeto( BitStream &tgt ) const override;
240  void serializefrom( BitStream &src ) override;
241  // [[ev_def:field]]
242  QString m_error;
244 };
245 
246 // [[ev_def:type]]
248 {
249 public:
251  {}
252  void serializeto( BitStream &tgt ) const override;
253  void serializefrom( BitStream &) override {}
255 };
256 
257 
258 // [[ev_def:type]]
260 {
261 public:
264 };
265 } // end of SEGSEvents namespace
Definition: InternalEvents.h:43
GameAccountResponseData m_data
Definition: GameEvents.h:227
Definition: GameEvents.h:36
Definition: GameEvents.h:126
Definition: GameEvents.h:31
ACE_INET_Addr m_address
Definition: GameEvents.h:116
uint16_t m_character_index
Definition: GameEvents.h:66
uint32_t m_map_cookie
Definition: GameEvents.h:121
void serializefrom(BitStream &src) override
Definition: GameEvents.h:55
Definition: GameEvents.h:39
uint32_t m_mapnumber
Definition: GameEvents.h:68
void serializefrom(BitStream &bs) override
Definition: GameEvents.h:139
QString m_char_name
Definition: GameEvents.h:147
Definition: GameEvents.h:152
int32_t GetPackedBits(uint32_t minbits)
Definition: BitStream.cpp:290
Definition: GameEvents.h:76
QString m_char_name
Definition: GameEvents.h:70
Definition: seq_definitions.h:23
Definition: BitStream.h:34
void serializeto(BitStream &bs) const override
Definition: GameEvents.h:51
uint8_t unused2
Definition: GameEvents.h:110
GameEntryError()
Definition: GameEvents.h:235
CRUD_EventTypes
Definition: CRUD_Events.h:19
Definition: LinkLevelEvent.h:13
Definition: GameEvents.h:214
GameEntryError(EventProcessor *evsrc, const QString &erstr)
Definition: GameEvents.h:237
UpdateServer()
Definition: GameEvents.h:189
uint8_t unused4
Definition: GameEvents.h:114
Definition: GameEvents.h:33
Definition: GameEvents.h:259
#define END_EVENTS(enum_name, cnt)
Definition: SEGSEvent.h:24
void StorePackedBits(uint32_t nBits, uint32_t dataBits)
Definition: BitStream.cpp:161
Definition: GameEvents.h:38
DeleteAcknowledged()
Definition: GameEvents.h:250
uint8_t m_index
Definition: GameEvents.h:145
Definition: GameEvents.h:35
MapServerAddrResponse()
Definition: GameEvents.h:79
void serializeto(BitStream &bs) const override
Definition: GameEvents.h:133
uint32_t m_map_server_ip
Definition: GameEvents.h:64
DeleteCharacter()
Definition: GameEvents.h:129
Definition: GameEvents.h:166
GameEventTypes
Definition: GameEvents.h:27
void serializefrom(BitStream &src) override
Definition: GameEvents.h:83
void StoreString(const char *str)
Definition: BitStream.cpp:204
void serializefrom(BitStream &) override
Definition: GameEvents.h:253
ServerReconfigured()
Definition: GameEvents.h:262
Definition: GameEvents.h:30
void serializeto(BitStream &tgt) const override
Definition: GameEvents.h:94
uint8_t unused3
Definition: GameEvents.h:112
QString m_error
Definition: GameEvents.h:242
#define EVENT_IMPL(name)
Definition: SEGSEvent.h:77
uint8_t m_index
Definition: GameEvents.h:161
Definition: GameEvents.h:186
void GetString(QString &str)
Retrieves a null-terminated C-style string from the bit stream.
Definition: BitStream.cpp:331
CharacterResponse(EventProcessor *src, uint8_t idx, const GameAccountResponseData &gad)
Definition: GameEvents.h:171
Definition: GameEvents.h:34
uint8_t m_index
Definition: GameEvents.h:179
#define BEGINE_EVENTS(enum_name, parent_class)
Definition: SEGSEvent.h:20
uint32_t m_unknown_new
Definition: GameEvents.h:223
std::array< uint8_t, 16 > m_clientinfo
Definition: GameEvents.h:225
Definition: GameEvents.h:247
Definition: EventProcessor.h:22
MapServerAddrRequest()
Definition: GameEvents.h:47
uint8_t unused1
Definition: GameEvents.h:108
EventSrc * src() const
Definition: SEGSEvent.h:65
UpdateCharacter()
Definition: GameEvents.h:155
Definition: GameEvents.h:32
GameAccountResponseData m_data
Definition: GameEvents.h:181
Definition: GameEvents.h:232
CharacterSlots()
Definition: GameEvents.h:217
Definition: GameDBSyncEvents.h:163
Definition: GameEvents.h:37
DeleteCharacter(EventProcessor *evsrc, uint8_t idx, const QString &name)
Definition: GameEvents.h:131
CharacterResponse()
Definition: GameEvents.h:169
Definition: GameEvents.h:44