ManaPlus
charserverhandler.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef NET_CHARSERVERHANDLER_H
25 #define NET_CHARSERVERHANDLER_H
26 
27 #include "enums/being/gender.h"
28 
30 
31 #include "net/characters.h"
32 
33 #include "utils/vector.h"
34 
35 #include <string>
36 
37 class CharCreateDialog;
38 class CharSelectDialog;
39 
40 namespace Net
41 {
42 
43 struct Character;
44 
46 {
47  public:
49 
50  virtual ~CharServerHandler()
51  { }
52 
53  virtual void setCharSelectDialog(CharSelectDialog *const window)
54  const = 0;
55 
56  virtual void setCharCreateDialog(CharCreateDialog *const window)
57  const = 0;
58 
59  virtual void requestCharacters() const = 0;
60 
61  virtual void chooseCharacter(Net::Character *const character)
62  const = 0;
63 
64  virtual void newCharacter(const std::string &name,
65  const int slot,
66  const GenderT gender,
67  const int hairstyle,
68  const int hairColor,
69  const unsigned char race,
70  const uint16_t look,
71  const STD_VECTOR<int> &stats) const = 0;
72 
73  virtual void deleteCharacter(Net::Character *const character,
74  const std::string &email) const = 0;
75 
76  virtual void renameCharacter(const BeingId id,
77  const std::string &newName) const = 0;
78 
79  virtual void switchCharacter() const = 0;
80 
81  virtual unsigned int baseSprite() const A_WARN_UNUSED = 0;
82 
83  virtual unsigned int hairSprite() const A_WARN_UNUSED = 0;
84 
85  virtual unsigned int hatSprite() const A_WARN_UNUSED = 0;
86 
87  virtual unsigned int maxSprite() const A_WARN_UNUSED = 0;
88 
89  virtual void clear() const = 0;
90 
91  virtual void setNewPincode(const BeingId accountId,
92  const std::string &pin) const = 0;
93 
94  virtual void sendCheckPincode(const BeingId accountId,
95  const std::string &pin) const = 0;
96 
97  virtual void changePincode(const BeingId accountId,
98  const std::string &oldPin,
99  const std::string &newPin) const = 0;
100 
101  virtual void changeSlot(const int oldSlot,
102  const int newSlot) const = 0;
103 
104  virtual void ping() const = 0;
105 
108 
111 
114 
115  static void updateCharSelectDialog();
116  static void unlockCharSelectDialog();
117 
118  protected:
120  {
121  mCharacters.clear();
122  mSelectedCharacter = nullptr;
123  mCharSelectDialog = nullptr;
124  mCharCreateDialog = nullptr;
125  }
126 };
127 
128 } // namespace Net
129 
131 
132 #endif // NET_CHARSERVERHANDLER_H
int BeingId
Definition: beingid.h:30
Net::CharServerHandler * charServerHandler
Definition: net.cpp:85
virtual void chooseCharacter(Net::Character *const character) const =0
static void unlockCharSelectDialog()
virtual void renameCharacter(const BeingId id, const std::string &newName) const =0
virtual void setCharCreateDialog(CharCreateDialog *const window) const =0
static void updateCharSelectDialog()
virtual void clear() const =0
virtual unsigned int baseSprite() const =0
static Net::Character * mSelectedCharacter
virtual void changeSlot(const int oldSlot, const int newSlot) const =0
virtual void setCharSelectDialog(CharSelectDialog *const window) const =0
virtual unsigned int hairSprite() const =0
virtual void newCharacter(const std::string &name, const int slot, const GenderT gender, const int hairstyle, const int hairColor, const unsigned char race, const uint16_t look, const std::vector< int > &stats) const =0
virtual void setNewPincode(const BeingId accountId, const std::string &pin) const =0
virtual void ping() const =0
virtual unsigned int hatSprite() const =0
static CharSelectDialog * mCharSelectDialog
virtual void sendCheckPincode(const BeingId accountId, const std::string &pin) const =0
static Net::Characters mCharacters
virtual void requestCharacters() const =0
virtual void switchCharacter() const =0
virtual void changePincode(const BeingId accountId, const std::string &oldPin, const std::string &newPin) const =0
virtual void deleteCharacter(Net::Character *const character, const std::string &email) const =0
virtual unsigned int maxSprite() const =0
static CharCreateDialog * mCharCreateDialog
Gender ::T GenderT
Definition: gender.h:35
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define notfinal
Definition: localconsts.h:261
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
std::list< Character * > Characters
Definition: character.h:61