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 |
|
|
|
29 |
|
|
#include "enums/simpletypes/beingid.h" |
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 |
|
|
|
45 |
|
|
class CharServerHandler notfinal |
46 |
|
|
{ |
47 |
|
|
public: |
48 |
|
|
A_DELETE_COPY(CharServerHandler) |
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 |
|
|
|
106 |
|
|
/** The list of available characters. */ |
107 |
|
|
static Net::Characters mCharacters; |
108 |
|
|
|
109 |
|
|
static CharSelectDialog *mCharSelectDialog; |
110 |
|
|
static CharCreateDialog *mCharCreateDialog; |
111 |
|
|
|
112 |
|
|
/** The selected character. */ |
113 |
|
|
static Net::Character *mSelectedCharacter; |
114 |
|
|
|
115 |
|
|
static void updateCharSelectDialog(); |
116 |
|
|
static void unlockCharSelectDialog(); |
117 |
|
|
|
118 |
|
|
protected: |
119 |
|
77 |
CharServerHandler() |
120 |
|
77 |
{ |
121 |
|
77 |
mCharacters.clear(); |
122 |
|
77 |
mSelectedCharacter = nullptr; |
123 |
|
77 |
mCharSelectDialog = nullptr; |
124 |
|
77 |
mCharCreateDialog = nullptr; |
125 |
|
77 |
} |
126 |
|
|
}; |
127 |
|
|
|
128 |
|
|
} // namespace Net |
129 |
|
|
|
130 |
|
|
extern Net::CharServerHandler *charServerHandler; |
131 |
|
|
|
132 |
|
|
#endif // NET_CHARSERVERHANDLER_H |