1 |
|
|
/* |
2 |
|
|
* The ManaPlus Client |
3 |
|
|
* Copyright (C) 2009 The Mana World Development Team |
4 |
|
|
* Copyright (C) 2011-2019 The ManaPlus Developers |
5 |
|
|
* Copyright (C) 2009-2021 Andrei Karas |
6 |
|
|
* |
7 |
|
|
* This file is part of The ManaPlus Client. |
8 |
|
|
* |
9 |
|
|
* This program is free software; you can redistribute it and/or modify |
10 |
|
|
* it under the terms of the GNU General Public License as published by |
11 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
12 |
|
|
* any later version. |
13 |
|
|
* |
14 |
|
|
* This program is distributed in the hope that it will be useful, |
15 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 |
|
|
* GNU General Public License for more details. |
18 |
|
|
* |
19 |
|
|
* You should have received a copy of the GNU General Public License |
20 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
21 |
|
|
*/ |
22 |
|
|
|
23 |
|
|
#ifndef TEXTCOMMAND_H |
24 |
|
|
#define TEXTCOMMAND_H |
25 |
|
|
|
26 |
|
|
#include "enums/commandtarget.h" |
27 |
|
|
#ifdef TMWA_SUPPORT |
28 |
|
|
#include "enums/magicschool.h" |
29 |
|
|
#include "enums/textcommandtype.h" |
30 |
|
|
#endif |
31 |
|
|
|
32 |
|
|
#include <string> |
33 |
|
|
|
34 |
|
|
#include "localconsts.h" |
35 |
|
|
|
36 |
|
|
class Image; |
37 |
|
|
|
38 |
|
|
/** |
39 |
|
|
* Represents one or more instances of a certain item type. |
40 |
|
|
*/ |
41 |
|
|
class TextCommand final |
42 |
|
|
{ |
43 |
|
|
public: |
44 |
|
|
#ifdef TMWA_SUPPORT |
45 |
|
|
/** |
46 |
|
|
* Constructor. |
47 |
|
|
*/ |
48 |
|
|
TextCommand(const int id, |
49 |
|
|
const std::string &symbol, |
50 |
|
|
const std::string &command, |
51 |
|
|
const std::string &comment, |
52 |
|
|
const CommandTargetT type, |
53 |
|
|
const std::string &icon, |
54 |
|
|
const unsigned int basicLvl, |
55 |
|
|
const MagicSchoolT school, |
56 |
|
|
const unsigned int schoolLvl, |
57 |
|
|
const unsigned int mana); |
58 |
|
|
#endif // TMWA_SUPPORT |
59 |
|
|
|
60 |
|
|
/** |
61 |
|
|
* Constructor. |
62 |
|
|
*/ |
63 |
|
|
TextCommand(const int id, |
64 |
|
|
const std::string &symbol, |
65 |
|
|
const std::string &command, |
66 |
|
|
const std::string &comment, |
67 |
|
|
const CommandTargetT type, |
68 |
|
|
const std::string &icon); |
69 |
|
|
|
70 |
|
|
/** |
71 |
|
|
* Constructor. |
72 |
|
|
*/ |
73 |
|
|
explicit TextCommand(const int id); |
74 |
|
|
|
75 |
|
|
A_DELETE_COPY(TextCommand) |
76 |
|
|
|
77 |
|
|
/** |
78 |
|
|
* Destructor. |
79 |
|
|
*/ |
80 |
|
|
~TextCommand(); |
81 |
|
|
|
82 |
|
|
std::string getName() const noexcept2 A_WARN_UNUSED |
83 |
|
|
{ return mCommand; } |
84 |
|
|
|
85 |
|
|
std::string getCommand() const noexcept2 A_WARN_UNUSED |
86 |
|
2 |
{ return mCommand; } |
87 |
|
|
|
88 |
|
|
std::string getComment() const noexcept2 A_WARN_UNUSED |
89 |
|
2 |
{ return mComment; } |
90 |
|
|
|
91 |
|
|
std::string getSymbol() const noexcept2 A_WARN_UNUSED |
92 |
|
2 |
{ return mSymbol; } |
93 |
|
|
|
94 |
|
|
int getId() const noexcept2 A_WARN_UNUSED |
95 |
|
|
{ return mId; } |
96 |
|
|
|
97 |
|
|
CommandTargetT getTargetType() const noexcept2 A_WARN_UNUSED |
98 |
|
1 |
{ return mTargetType; } |
99 |
|
|
|
100 |
|
|
std::string getIcon() const noexcept2 A_WARN_UNUSED |
101 |
|
2 |
{ return mIcon; } |
102 |
|
|
|
103 |
|
|
#ifdef TMWA_SUPPORT |
104 |
|
|
unsigned int getMana() const noexcept2 A_WARN_UNUSED |
105 |
|
1 |
{ return mMana; } |
106 |
|
|
|
107 |
|
|
MagicSchoolT getSchool() const noexcept2 A_WARN_UNUSED |
108 |
|
1 |
{ return mSchool; } |
109 |
|
|
|
110 |
|
|
unsigned getBaseLvl() const noexcept2 A_WARN_UNUSED |
111 |
|
1 |
{ return mBaseLvl; } |
112 |
|
|
|
113 |
|
|
unsigned getSchoolLvl() const noexcept2 A_WARN_UNUSED |
114 |
|
1 |
{ return mSchoolLvl; } |
115 |
|
|
|
116 |
|
|
void setMana(const unsigned int mana) |
117 |
|
|
{ mMana = mana; } |
118 |
|
|
|
119 |
|
|
void setSchool(const MagicSchoolT school) |
120 |
|
|
{ mSchool = school; } |
121 |
|
|
|
122 |
|
|
void setBaseLvl(const unsigned int baseLvl) |
123 |
|
|
{ mBaseLvl = baseLvl; } |
124 |
|
|
|
125 |
|
|
void setSchoolLvl(const unsigned int schoolLvl) |
126 |
|
|
{ mSchoolLvl = schoolLvl; } |
127 |
|
|
|
128 |
|
|
TextCommandTypeT getCommandType() const noexcept2 A_WARN_UNUSED |
129 |
|
2 |
{ return mCommandType; } |
130 |
|
|
|
131 |
|
|
void setCommandType(const TextCommandTypeT commandType) |
132 |
|
|
{ mCommandType = commandType; } |
133 |
|
|
#endif // TMWA_SUPPORT |
134 |
|
|
|
135 |
|
|
void setCommand(const std::string &command) |
136 |
|
|
{ mCommand = command; } |
137 |
|
|
|
138 |
|
|
void setComment(const std::string &comment) |
139 |
|
|
{ mComment = comment; } |
140 |
|
|
|
141 |
|
|
void setSymbol(const std::string &symbol) |
142 |
|
|
{ mSymbol = symbol; } |
143 |
|
|
|
144 |
|
|
void setId(const int id) |
145 |
|
|
{ mId = id; } |
146 |
|
|
|
147 |
|
|
void setTargetType(const CommandTargetT targetType) |
148 |
|
|
{ mTargetType = targetType; } |
149 |
|
|
|
150 |
|
|
void setIcon(const std::string &icon) |
151 |
|
|
{ mIcon = icon; loadImage(); } |
152 |
|
|
|
153 |
|
|
bool isEmpty() const noexcept2 A_WARN_UNUSED |
154 |
|
|
{ return mCommand.empty() && mSymbol.empty(); } |
155 |
|
|
|
156 |
|
|
Image *getImage() const noexcept2 A_WARN_UNUSED |
157 |
|
|
{ return mImage; } |
158 |
|
|
|
159 |
|
|
private: |
160 |
|
|
void loadImage(); |
161 |
|
|
|
162 |
|
|
protected: |
163 |
|
|
std::string mCommand; |
164 |
|
|
std::string mComment; |
165 |
|
|
std::string mSymbol; |
166 |
|
|
CommandTargetT mTargetType; |
167 |
|
|
std::string mIcon; |
168 |
|
|
int mId; |
169 |
|
|
#ifdef TMWA_SUPPORT |
170 |
|
|
unsigned int mMana; |
171 |
|
|
MagicSchoolT mSchool; |
172 |
|
|
unsigned mBaseLvl; |
173 |
|
|
unsigned mSchoolLvl; |
174 |
|
|
TextCommandTypeT mCommandType; |
175 |
|
|
#endif // TMWA_SUPPORT |
176 |
|
|
|
177 |
|
|
Image *mImage; |
178 |
|
|
}; |
179 |
|
|
|
180 |
|
|
#endif // TEXTCOMMAND_H |