1 |
|
|
/* |
2 |
|
|
* The ManaPlus Client |
3 |
|
|
* Copyright (C) 2004-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 RESOURCES_BEINGINFO_H |
25 |
|
|
#define RESOURCES_BEINGINFO_H |
26 |
|
|
|
27 |
|
|
#include "enums/being/targetcursorsize.h" |
28 |
|
|
|
29 |
|
|
#include "enums/resources/map/blocktype.h" |
30 |
|
|
|
31 |
|
|
#include "enums/simpletypes/beingtypeid.h" |
32 |
|
|
#include "enums/simpletypes/itemcolor.h" |
33 |
|
|
|
34 |
|
|
#include "resources/beingmenuitem.h" |
35 |
|
|
#include "resources/cursors.h" |
36 |
|
|
#include "resources/soundinfo.h" |
37 |
|
|
|
38 |
|
|
#include "resources/sprite/spritedisplay.h" |
39 |
|
|
|
40 |
|
|
struct Attack; |
41 |
|
|
|
42 |
|
|
class ItemColorData; |
43 |
|
|
|
44 |
|
|
typedef std::map<int, Attack*> Attacks; |
45 |
|
|
|
46 |
|
|
/** |
47 |
|
|
* Holds information about a certain type of monster. This includes the name |
48 |
|
|
* of the monster, the sprite to display and the sounds the monster makes. |
49 |
|
|
* |
50 |
|
|
* @see MonsterDB |
51 |
|
|
* @see NPCDB |
52 |
|
|
*/ |
53 |
|
|
class BeingInfo final |
54 |
|
|
{ |
55 |
|
|
public: |
56 |
|
|
static BeingInfo *unknown; |
57 |
|
|
static Attack *empty; |
58 |
|
|
|
59 |
|
|
BeingInfo(); |
60 |
|
|
|
61 |
|
|
A_DELETE_COPY(BeingInfo) |
62 |
|
|
|
63 |
|
|
~BeingInfo(); |
64 |
|
|
|
65 |
|
|
void setName(const std::string &name) |
66 |
|
|
{ mName = name; } |
67 |
|
|
|
68 |
|
|
const std::string &getName() const noexcept2 A_WARN_UNUSED |
69 |
|
|
{ return mName; } |
70 |
|
|
|
71 |
|
|
void setDisplay(const SpriteDisplay &display); |
72 |
|
|
|
73 |
|
|
const SpriteDisplay &getDisplay() const noexcept2 A_WARN_UNUSED |
74 |
|
|
{ return mDisplay; } |
75 |
|
|
|
76 |
|
|
void setTargetCursorSize(const std::string &size); |
77 |
|
|
|
78 |
|
|
void setTargetCursorSize(const TargetCursorSizeT &targetSize) |
79 |
|
|
{ mTargetCursorSize = targetSize; } |
80 |
|
|
|
81 |
|
|
void setHoverCursor(const std::string &name) |
82 |
|
|
{ return setHoverCursor(Cursors::stringToCursor(name)); } |
83 |
|
|
|
84 |
|
|
void setHoverCursor(const CursorT &cursor) |
85 |
|
|
{ mHoverCursor = cursor; } |
86 |
|
|
|
87 |
|
|
CursorT getHoverCursor() const noexcept2 A_WARN_UNUSED |
88 |
|
|
{ return mHoverCursor; } |
89 |
|
|
|
90 |
|
|
TargetCursorSizeT getTargetCursorSize() const noexcept2 A_WARN_UNUSED |
91 |
|
|
{ return mTargetCursorSize; } |
92 |
|
|
|
93 |
|
|
void addSound(const ItemSoundEvent::Type event, |
94 |
|
|
const std::string &filename, |
95 |
|
|
const int delay); |
96 |
|
|
|
97 |
|
|
const SoundInfo &getSound(const ItemSoundEvent::Type event) |
98 |
|
|
const A_WARN_UNUSED; |
99 |
|
|
|
100 |
|
|
void addAttack(const int id, |
101 |
|
|
const std::string &action, |
102 |
|
|
const std::string &skyAttack, |
103 |
|
|
const std::string &waterAttack, |
104 |
|
|
const std::string &rideAttack, |
105 |
|
|
const int effectId, |
106 |
|
|
const int hitEffectId, |
107 |
|
|
const int criticalHitEffectId, |
108 |
|
|
const int missEffectId, |
109 |
|
|
const std::string &missileParticle, |
110 |
|
|
const float missileZ, |
111 |
|
|
const float missileSpeed, |
112 |
|
|
const float missileDieDistance, |
113 |
|
|
const int missileLifeTime); |
114 |
|
|
|
115 |
|
|
const Attack *getAttack(const int id) const A_WARN_UNUSED; |
116 |
|
|
|
117 |
|
|
void setBlockWalkMask(const unsigned char mask) |
118 |
|
|
{ mBlockWalkMask = mask; } |
119 |
|
|
|
120 |
|
|
/** |
121 |
|
|
* Gets the way the being is blocked by other objects |
122 |
|
|
*/ |
123 |
|
|
unsigned char getBlockWalkMask() const noexcept2 A_WARN_UNUSED |
124 |
|
|
{ return mBlockWalkMask; } |
125 |
|
|
|
126 |
|
|
void setBlockType(const BlockTypeT &blockType) |
127 |
|
|
{ mBlockType = blockType; } |
128 |
|
|
|
129 |
|
|
BlockTypeT getBlockType() const noexcept2 A_WARN_UNUSED |
130 |
|
|
{ return mBlockType; } |
131 |
|
|
|
132 |
|
|
void setTargetOffsetX(const int n) |
133 |
|
|
{ mTargetOffsetX = n; } |
134 |
|
|
|
135 |
|
|
int getTargetOffsetX() const noexcept2 A_WARN_UNUSED |
136 |
|
|
{ return mTargetOffsetX; } |
137 |
|
|
|
138 |
|
|
void setTargetOffsetY(const int n) |
139 |
|
|
{ mTargetOffsetY = n; } |
140 |
|
|
|
141 |
|
|
int getTargetOffsetY() const noexcept2 A_WARN_UNUSED |
142 |
|
|
{ return mTargetOffsetY; } |
143 |
|
|
|
144 |
|
|
void setNameOffsetX(const int n) |
145 |
|
|
{ mNameOffsetX = n; } |
146 |
|
|
|
147 |
|
|
int getNameOffsetX() const noexcept2 A_WARN_UNUSED |
148 |
|
|
{ return mNameOffsetX; } |
149 |
|
|
|
150 |
|
|
void setNameOffsetY(const int n) |
151 |
|
|
{ mNameOffsetY = n; } |
152 |
|
|
|
153 |
|
|
int getNameOffsetY() const noexcept2 A_WARN_UNUSED |
154 |
|
|
{ return mNameOffsetY; } |
155 |
|
|
|
156 |
|
|
void setHpBarOffsetX(const int n) |
157 |
|
|
{ mHpBarOffsetX = n; } |
158 |
|
|
|
159 |
|
|
int getHpBarOffsetX() const noexcept2 A_WARN_UNUSED |
160 |
|
|
{ return mHpBarOffsetX; } |
161 |
|
|
|
162 |
|
|
void setHpBarOffsetY(const int n) |
163 |
|
|
{ mHpBarOffsetY = n; } |
164 |
|
|
|
165 |
|
|
int getHpBarOffsetY() const noexcept2 A_WARN_UNUSED |
166 |
|
|
{ return mHpBarOffsetY; } |
167 |
|
|
|
168 |
|
|
void setMaxHP(const int n) |
169 |
|
|
{ mMaxHP = n; } |
170 |
|
|
|
171 |
|
|
int getMaxHP() const noexcept2 A_WARN_UNUSED |
172 |
|
|
{ return mMaxHP; } |
173 |
|
|
|
174 |
|
|
bool isStaticMaxHP() const noexcept2 A_WARN_UNUSED |
175 |
|
|
{ return mStaticMaxHP; } |
176 |
|
|
|
177 |
|
|
void setStaticMaxHP(const bool n) |
178 |
|
|
{ mStaticMaxHP = n; } |
179 |
|
|
|
180 |
|
|
void setTargetSelection(const bool n) |
181 |
|
|
{ mTargetSelection = n; } |
182 |
|
|
|
183 |
|
|
bool isTargetSelection() const noexcept2 A_WARN_UNUSED |
184 |
|
|
{ return mTargetSelection; } |
185 |
|
|
|
186 |
|
|
int getSortOffsetY() const noexcept2 A_WARN_UNUSED |
187 |
|
|
{ return mSortOffsetY; } |
188 |
|
|
|
189 |
|
|
void setSortOffsetY(const int n) |
190 |
|
|
{ mSortOffsetY = n; } |
191 |
|
|
|
192 |
|
|
int getDeadSortOffsetY() const noexcept2 A_WARN_UNUSED |
193 |
|
|
{ return mDeadSortOffsetY; } |
194 |
|
|
|
195 |
|
|
void setDeadSortOffsetY(const int n) |
196 |
|
|
{ mDeadSortOffsetY = n; } |
197 |
|
|
|
198 |
|
|
BeingTypeId getAvatarId() const noexcept2 A_WARN_UNUSED |
199 |
|
|
{ return mAvatarId; } |
200 |
|
|
|
201 |
|
|
void setAvatarId(const BeingTypeId id) |
202 |
|
|
{ mAvatarId = id; } |
203 |
|
|
|
204 |
|
|
int getWidth() const noexcept2 A_WARN_UNUSED |
205 |
|
|
{ return mWidth; } |
206 |
|
|
|
207 |
|
|
int getHeight() const noexcept2 A_WARN_UNUSED |
208 |
|
|
{ return mHeight; } |
209 |
|
|
|
210 |
|
|
void setWidth(const int n) |
211 |
|
|
{ mWidth = n; } |
212 |
|
|
|
213 |
|
|
void setHeight(const int n) |
214 |
|
|
{ mHeight = n; } |
215 |
|
|
|
216 |
|
|
void setStartFollowDist(const int n) |
217 |
|
|
{ mStartFollowDist = n; } |
218 |
|
|
|
219 |
|
|
int getStartFollowDist() const noexcept2 A_WARN_UNUSED |
220 |
|
|
{ return mStartFollowDist; } |
221 |
|
|
|
222 |
|
|
void setFollowDist(const int n) |
223 |
|
|
{ mFollowDist = n; } |
224 |
|
|
|
225 |
|
|
int getFollowDist() const noexcept2 A_WARN_UNUSED |
226 |
|
|
{ return mFollowDist; } |
227 |
|
|
|
228 |
|
|
void setWalkSpeed(const int n) |
229 |
|
|
{ mWalkSpeed = n; } |
230 |
|
|
|
231 |
|
|
int getWalkSpeed() const noexcept2 A_WARN_UNUSED |
232 |
|
|
{ return mWalkSpeed; } |
233 |
|
|
|
234 |
|
|
void setWarpDist(const int n) |
235 |
|
|
{ mWarpDist = n; } |
236 |
|
|
|
237 |
|
|
int getWarpDist() const noexcept2 A_WARN_UNUSED |
238 |
|
|
{ return mWarpDist; } |
239 |
|
|
|
240 |
|
|
void setSitOffsetX(const int n) |
241 |
|
|
{ mSitOffsetX = n; } |
242 |
|
|
|
243 |
|
|
int getSitOffsetX() const noexcept2 A_WARN_UNUSED |
244 |
|
|
{ return mSitOffsetX; } |
245 |
|
|
|
246 |
|
|
void setSitOffsetY(const int n) |
247 |
|
|
{ mSitOffsetY = n; } |
248 |
|
|
|
249 |
|
|
int getSitOffsetY() const noexcept2 A_WARN_UNUSED |
250 |
|
|
{ return mSitOffsetY; } |
251 |
|
|
|
252 |
|
|
void setMoveOffsetX(const int n) |
253 |
|
|
{ mMoveOffsetX = n; } |
254 |
|
|
|
255 |
|
|
int getMoveOffsetX() const noexcept2 A_WARN_UNUSED |
256 |
|
|
{ return mMoveOffsetX; } |
257 |
|
|
|
258 |
|
|
void setMoveOffsetY(const int n) |
259 |
|
|
{ mMoveOffsetY = n; } |
260 |
|
|
|
261 |
|
|
int getMoveOffsetY() const noexcept2 A_WARN_UNUSED |
262 |
|
|
{ return mMoveOffsetY; } |
263 |
|
|
|
264 |
|
|
void setDeadOffsetX(const int n) |
265 |
|
|
{ mDeadOffsetX = n; } |
266 |
|
|
|
267 |
|
|
int getDeadOffsetX() const noexcept2 A_WARN_UNUSED |
268 |
|
|
{ return mDeadOffsetX; } |
269 |
|
|
|
270 |
|
|
void setDeadOffsetY(const int n) |
271 |
|
|
{ mDeadOffsetY = n; } |
272 |
|
|
|
273 |
|
|
int getDeadOffsetY() const noexcept2 A_WARN_UNUSED |
274 |
|
|
{ return mDeadOffsetY; } |
275 |
|
|
|
276 |
|
|
void setAttackOffsetX(const int n) |
277 |
|
|
{ mAttackOffsetX = n; } |
278 |
|
|
|
279 |
|
|
int getAttackOffsetX() const noexcept2 A_WARN_UNUSED |
280 |
|
|
{ return mAttackOffsetX; } |
281 |
|
|
|
282 |
|
|
void setAttackOffsetY(const int n) |
283 |
|
|
{ mAttackOffsetY = n; } |
284 |
|
|
|
285 |
|
|
int getAttackOffsetY() const noexcept2 A_WARN_UNUSED |
286 |
|
|
{ return mAttackOffsetY; } |
287 |
|
|
|
288 |
|
|
void setThinkTime(const int n) |
289 |
|
|
{ mThinkTime = n; } |
290 |
|
|
|
291 |
|
|
int getThinkTime() const noexcept2 A_WARN_UNUSED |
292 |
|
|
{ return mThinkTime; } |
293 |
|
|
|
294 |
|
|
void setDirectionType(const int n) |
295 |
|
|
{ mDirectionType = n; } |
296 |
|
|
|
297 |
|
|
int getDirectionType() const noexcept2 A_WARN_UNUSED |
298 |
|
|
{ return mDirectionType; } |
299 |
|
|
|
300 |
|
|
void setSitDirectionType(const int n) |
301 |
|
|
{ mSitDirectionType = n; } |
302 |
|
|
|
303 |
|
|
int getSitDirectionType() const noexcept2 A_WARN_UNUSED |
304 |
|
|
{ return mSitDirectionType; } |
305 |
|
|
|
306 |
|
|
void setDeadDirectionType(const int n) |
307 |
|
|
{ mDeadDirectionType = n; } |
308 |
|
|
|
309 |
|
|
int getDeadDirectionType() const noexcept2 A_WARN_UNUSED |
310 |
|
|
{ return mDeadDirectionType; } |
311 |
|
|
|
312 |
|
|
void setAttackDirectionType(const int n) |
313 |
|
|
{ mAttackDirectionType = n; } |
314 |
|
|
|
315 |
|
|
int getAttackDirectionType() const noexcept2 A_WARN_UNUSED |
316 |
|
|
{ return mAttackDirectionType; } |
317 |
|
|
|
318 |
|
|
void setAllowDelete(const bool b) |
319 |
|
|
{ mAllowDelete = b; } |
320 |
|
|
|
321 |
|
|
int getAllowDelete() const noexcept2 A_WARN_UNUSED |
322 |
|
|
{ return static_cast<int>(mAllowDelete); } |
323 |
|
|
|
324 |
|
|
void setAllowEquipment(const bool b) |
325 |
|
|
{ mAllowEquipment = b; } |
326 |
|
|
|
327 |
|
|
bool getAllowEquipment() const noexcept2 A_WARN_UNUSED |
328 |
|
|
{ return mAllowEquipment; } |
329 |
|
|
|
330 |
|
|
void setQuickActionEffectId(const int n) |
331 |
|
|
{ mQuickActionEffectId = n; } |
332 |
|
|
|
333 |
|
|
int getQuickActionEffectId() const noexcept2 A_WARN_UNUSED |
334 |
|
|
{ return mQuickActionEffectId; } |
335 |
|
|
|
336 |
|
|
void setColorsList(const std::string &name); |
337 |
|
|
|
338 |
|
|
std::string getColor(const ItemColor idx) const A_WARN_UNUSED; |
339 |
|
|
|
340 |
|
|
void addMenu(const std::string &name, const std::string &command); |
341 |
|
|
|
342 |
|
|
const STD_VECTOR<BeingMenuItem> &getMenu() const A_CONST; |
343 |
|
|
|
344 |
|
|
void setString(const int idx, |
345 |
|
|
const std::string &value) |
346 |
|
|
{ mStrings[idx] = value; } |
347 |
|
|
|
348 |
|
|
std::string getString(const int idx) const A_WARN_UNUSED; |
349 |
|
|
|
350 |
|
|
std::string getCurrency() const A_WARN_UNUSED |
351 |
|
|
{ return mCurrency; } |
352 |
|
|
|
353 |
|
|
void setCurrency(const std::string &name) |
354 |
|
|
{ mCurrency = name; } |
355 |
|
|
|
356 |
|
|
static void init(); |
357 |
|
|
|
358 |
|
|
static void clear(); |
359 |
|
|
|
360 |
|
|
private: |
361 |
|
|
SpriteDisplay mDisplay; |
362 |
|
|
std::string mName; |
363 |
|
|
TargetCursorSizeT mTargetCursorSize; |
364 |
|
|
CursorT mHoverCursor; |
365 |
|
|
ItemSoundEvents mSounds; |
366 |
|
|
Attacks mAttacks; |
367 |
|
|
STD_VECTOR<BeingMenuItem> mMenu; |
368 |
|
|
std::map<int, std::string> mStrings; |
369 |
|
|
std::string mCurrency; |
370 |
|
|
unsigned char mBlockWalkMask; |
371 |
|
|
BlockTypeT mBlockType; |
372 |
|
|
const std::map <ItemColor, ItemColorData> *mColors; |
373 |
|
|
int mTargetOffsetX; |
374 |
|
|
int mTargetOffsetY; |
375 |
|
|
int mNameOffsetX; |
376 |
|
|
int mNameOffsetY; |
377 |
|
|
int mHpBarOffsetX; |
378 |
|
|
int mHpBarOffsetY; |
379 |
|
|
int mMaxHP; |
380 |
|
|
int mSortOffsetY; |
381 |
|
|
int mDeadSortOffsetY; |
382 |
|
|
BeingTypeId mAvatarId; |
383 |
|
|
int mWidth; |
384 |
|
|
int mHeight; |
385 |
|
|
int mStartFollowDist; |
386 |
|
|
int mFollowDist; |
387 |
|
|
int mWarpDist; |
388 |
|
|
int mWalkSpeed; |
389 |
|
|
int mSitOffsetX; |
390 |
|
|
int mSitOffsetY; |
391 |
|
|
int mMoveOffsetX; |
392 |
|
|
int mMoveOffsetY; |
393 |
|
|
int mDeadOffsetX; |
394 |
|
|
int mDeadOffsetY; |
395 |
|
|
int mAttackOffsetX; |
396 |
|
|
int mAttackOffsetY; |
397 |
|
|
int mThinkTime; |
398 |
|
|
int mDirectionType; |
399 |
|
|
int mSitDirectionType; |
400 |
|
|
int mDeadDirectionType; |
401 |
|
|
int mAttackDirectionType; |
402 |
|
|
int mQuickActionEffectId; |
403 |
|
|
bool mStaticMaxHP; |
404 |
|
|
bool mTargetSelection; |
405 |
|
|
bool mAllowDelete; |
406 |
|
|
bool mAllowEquipment; |
407 |
|
|
}; |
408 |
|
|
|
409 |
|
|
typedef std::map<BeingTypeId, BeingInfo*> BeingInfos; |
410 |
|
|
typedef BeingInfos::iterator BeingInfoIterator; |
411 |
|
|
|
412 |
|
|
#endif // RESOURCES_BEINGINFO_H |