SEGS  0.6.1-develop [3e741b81]
Super Entity Game Server
GameDBSyncHandler.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 
10 #include "GameDBSyncContext.h"
11 #include "EventProcessor.h"
12 
13 #include <QThreadStorage>
14 
15 namespace SEGSEvents
16 {
17 struct CharacterUpdateMessage;
18 struct CostumeUpdateMessage;
19 struct GuiUpdateMessage;
20 struct OptionsUpdateMessage;
21 struct KeybindsUpdateMessage;
22 struct SetClientOptionsMessage;
23 struct PlayerUpdateMessage;
24 struct GameAccountRequest;
25 struct RemoveCharacterRequest;
26 struct WouldNameDuplicateRequest;
27 struct CreateNewCharacterRequest;
28 struct GetEntityRequest;
29 struct GetEntityByNameRequest;
30 struct EmailCreateRequest;
31 struct EmailCreateResponse;
32 struct EmailMarkAsReadMessage;
33 struct EmailUpdateOnCharDeleteMessage;
34 struct EmailRemoveMessage;
35 struct GetEmailRequest;
36 struct GetEmailsRequest;
37 struct FillEmailRecipientIdRequest;
38 }
39 
40 class GameDBSyncHandler final : public EventProcessor
41 {
44  QThreadStorage<GameDbSyncContext> m_db_context;
45  // EventProcessor interface
46 protected:
47  bool per_thread_startup() override;
48  void dispatch(SEGSEvents::Event*ev) override;
49  void serialize_from(std::istream &is) override;
50  void serialize_to(std::ostream &is) override;
51  void on_character_update(SEGSEvents::CharacterUpdateMessage *msg);
52  void on_costume_update(SEGSEvents::CostumeUpdateMessage *msg);
53  void on_player_update(SEGSEvents::PlayerUpdateMessage* msg);
54  void on_client_options_update(SEGSEvents::SetClientOptionsMessage* msg);
55  void on_account_request(SEGSEvents::GameAccountRequest *msg);
56  void on_character_remove(SEGSEvents::RemoveCharacterRequest *msg);
57  void on_check_name_clash(SEGSEvents::WouldNameDuplicateRequest *ev);
58  void on_create_new_char(SEGSEvents::CreateNewCharacterRequest *ev);
59  void on_get_entity(SEGSEvents::GetEntityRequest *ev);
60  void on_get_entity_by_name(SEGSEvents::GetEntityByNameRequest *ev);
61 
62  // email stuff
63  void on_email_create(SEGSEvents::EmailCreateRequest *ev);
64  void on_email_mark_as_read(SEGSEvents::EmailMarkAsReadMessage *msg);
65  void on_email_update_on_char_delete(SEGSEvents::EmailUpdateOnCharDeleteMessage *msg);
66  void on_email_remove(SEGSEvents::EmailRemoveMessage *msg);
67  void on_get_email(SEGSEvents::GetEmailRequest* ev);
68  void on_get_emails(SEGSEvents::GetEmailsRequest *ev);
69  void on_fill_email_recipient_id(SEGSEvents::FillEmailRecipientIdRequest *ev);
70 
71  // This is an unique ID that links this DB with it's Game Server
72  uint8_t m_id;
73 public:
75  GameDBSyncHandler(uint8_t id);
76 };
uint8_t m_id
Definition: GameDBSyncHandler.h:72
Definition: GameDBSyncHandler.h:40
Definition: SEGSEvent.h:35
Definition: LinkLevelEvent.h:13
Definition: EventProcessor.h:22
#define IMPL_ID(EventProcessorChildType)
Definition: EventProcessor.h:44