ManaPlus
beinginfo.h
Go to the documentation of this file.
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 
28 
30 
33 
35 #include "resources/cursors.h"
36 #include "resources/soundinfo.h"
37 
39 
40 struct Attack;
41 
42 class ItemColorData;
43 
44 typedef std::map<int, Attack*> Attacks;
45 
54 {
55  public:
56  static BeingInfo *unknown;
57  static Attack *empty;
58 
59  BeingInfo();
60 
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 
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 
88  { return mHoverCursor; }
89 
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 
124  { return mBlockWalkMask; }
125 
126  void setBlockType(const BlockTypeT &blockType)
127  { mBlockType = blockType; }
128 
130  { return mBlockType; }
131 
132  void setTargetOffsetX(const int n)
133  { mTargetOffsetX = n; }
134 
136  { return mTargetOffsetX; }
137 
138  void setTargetOffsetY(const int n)
139  { mTargetOffsetY = n; }
140 
142  { return mTargetOffsetY; }
143 
144  void setNameOffsetX(const int n)
145  { mNameOffsetX = n; }
146 
148  { return mNameOffsetX; }
149 
150  void setNameOffsetY(const int n)
151  { mNameOffsetY = n; }
152 
154  { return mNameOffsetY; }
155 
156  void setHpBarOffsetX(const int n)
157  { mHpBarOffsetX = n; }
158 
160  { return mHpBarOffsetX; }
161 
162  void setHpBarOffsetY(const int n)
163  { mHpBarOffsetY = n; }
164 
166  { return mHpBarOffsetY; }
167 
168  void setMaxHP(const int n)
169  { mMaxHP = n; }
170 
172  { return mMaxHP; }
173 
175  { return mStaticMaxHP; }
176 
177  void setStaticMaxHP(const bool n)
178  { mStaticMaxHP = n; }
179 
180  void setTargetSelection(const bool n)
181  { mTargetSelection = n; }
182 
184  { return mTargetSelection; }
185 
187  { return mSortOffsetY; }
188 
189  void setSortOffsetY(const int n)
190  { mSortOffsetY = n; }
191 
193  { return mDeadSortOffsetY; }
194 
195  void setDeadSortOffsetY(const int n)
196  { mDeadSortOffsetY = n; }
197 
199  { return mAvatarId; }
200 
201  void setAvatarId(const BeingTypeId id)
202  { mAvatarId = id; }
203 
205  { return mWidth; }
206 
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 
220  { return mStartFollowDist; }
221 
222  void setFollowDist(const int n)
223  { mFollowDist = n; }
224 
226  { return mFollowDist; }
227 
228  void setWalkSpeed(const int n)
229  { mWalkSpeed = n; }
230 
232  { return mWalkSpeed; }
233 
234  void setWarpDist(const int n)
235  { mWarpDist = n; }
236 
238  { return mWarpDist; }
239 
240  void setSitOffsetX(const int n)
241  { mSitOffsetX = n; }
242 
244  { return mSitOffsetX; }
245 
246  void setSitOffsetY(const int n)
247  { mSitOffsetY = n; }
248 
250  { return mSitOffsetY; }
251 
252  void setMoveOffsetX(const int n)
253  { mMoveOffsetX = n; }
254 
256  { return mMoveOffsetX; }
257 
258  void setMoveOffsetY(const int n)
259  { mMoveOffsetY = n; }
260 
262  { return mMoveOffsetY; }
263 
264  void setDeadOffsetX(const int n)
265  { mDeadOffsetX = n; }
266 
268  { return mDeadOffsetX; }
269 
270  void setDeadOffsetY(const int n)
271  { mDeadOffsetY = n; }
272 
274  { return mDeadOffsetY; }
275 
276  void setAttackOffsetX(const int n)
277  { mAttackOffsetX = n; }
278 
280  { return mAttackOffsetX; }
281 
282  void setAttackOffsetY(const int n)
283  { mAttackOffsetY = n; }
284 
286  { return mAttackOffsetY; }
287 
288  void setThinkTime(const int n)
289  { mThinkTime = n; }
290 
292  { return mThinkTime; }
293 
294  void setDirectionType(const int n)
295  { mDirectionType = n; }
296 
298  { return mDirectionType; }
299 
300  void setSitDirectionType(const int n)
301  { mSitDirectionType = n; }
302 
304  { return mSitDirectionType; }
305 
306  void setDeadDirectionType(const int n)
307  { mDeadDirectionType = n; }
308 
310  { return mDeadDirectionType; }
311 
312  void setAttackDirectionType(const int n)
313  { mAttackDirectionType = n; }
314 
316  { return mAttackDirectionType; }
317 
318  void setAllowDelete(const bool b)
319  { mAllowDelete = b; }
320 
322  { return static_cast<int>(mAllowDelete); }
323 
324  void setAllowEquipment(const bool b)
325  { mAllowEquipment = b; }
326 
328  { return mAllowEquipment; }
329 
330  void setQuickActionEffectId(const int n)
331  { mQuickActionEffectId = n; }
332 
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:
362  std::string mName;
367  STD_VECTOR<BeingMenuItem> mMenu;
368  std::map<int, std::string> mStrings;
369  std::string mCurrency;
370  unsigned char mBlockWalkMask;
372  const std::map <ItemColor, ItemColorData> *mColors;
379  int mMaxHP;
383  int mWidth;
384  int mHeight;
407 };
408 
409 typedef std::map<BeingTypeId, BeingInfo*> BeingInfos;
410 typedef BeingInfos::iterator BeingInfoIterator;
411 
412 #endif // RESOURCES_BEINGINFO_H
BeingInfos::iterator BeingInfoIterator
Definition: beinginfo.h:410
std::map< BeingTypeId, BeingInfo * > BeingInfos
Definition: beinginfo.h:409
std::map< int, Attack * > Attacks
Definition: beinginfo.h:42
int BeingTypeId
Definition: beingtypeid.h:30
BlockType ::T BlockTypeT
Definition: blocktype.h:41
bool mStaticMaxHP
Definition: beinginfo.h:403
void addSound(const ItemSoundEvent::Type event, const std::string &filename, const int delay)
Definition: beinginfo.cpp:154
void setSitDirectionType(const int n)
Definition: beinginfo.h:300
int mSitOffsetY
Definition: beinginfo.h:390
int mHpBarOffsetY
Definition: beinginfo.h:378
int mQuickActionEffectId
Definition: beinginfo.h:402
int mFollowDist
Definition: beinginfo.h:386
int getSortOffsetY() const
Definition: beinginfo.h:186
void setBlockWalkMask(const unsigned char mask)
Definition: beinginfo.h:117
void setString(const int idx, const std::string &value)
Definition: beinginfo.h:344
int mWidth
Definition: beinginfo.h:383
void setNameOffsetX(const int n)
Definition: beinginfo.h:144
void setHpBarOffsetX(const int n)
Definition: beinginfo.h:156
BeingTypeId getAvatarId() const
Definition: beinginfo.h:198
int mMoveOffsetX
Definition: beinginfo.h:391
void setHoverCursor(const std::string &name)
Definition: beinginfo.h:81
CursorT getHoverCursor() const
Definition: beinginfo.h:87
void setBlockType(const BlockTypeT &blockType)
Definition: beinginfo.h:126
bool mAllowDelete
Definition: beinginfo.h:405
int getHpBarOffsetY() const
Definition: beinginfo.h:165
bool isStaticMaxHP() const
Definition: beinginfo.h:174
int getHeight() const
Definition: beinginfo.h:207
void setDeadDirectionType(const int n)
Definition: beinginfo.h:306
int getWidth() const
Definition: beinginfo.h:204
int mSitOffsetX
Definition: beinginfo.h:389
int getAllowDelete() const
Definition: beinginfo.h:321
int mDeadSortOffsetY
Definition: beinginfo.h:381
int mDeadOffsetY
Definition: beinginfo.h:394
int mStartFollowDist
Definition: beinginfo.h:385
std::string getCurrency() const
Definition: beinginfo.h:350
SpriteDisplay mDisplay
Definition: beinginfo.h:361
void setDeadOffsetY(const int n)
Definition: beinginfo.h:270
int mSitDirectionType
Definition: beinginfo.h:399
void setFollowDist(const int n)
Definition: beinginfo.h:222
void setAttackOffsetX(const int n)
Definition: beinginfo.h:276
TargetCursorSizeT getTargetCursorSize() const
Definition: beinginfo.h:90
void setTargetSelection(const bool n)
Definition: beinginfo.h:180
int mWalkSpeed
Definition: beinginfo.h:388
void setCurrency(const std::string &name)
Definition: beinginfo.h:353
int getTargetOffsetY() const
Definition: beinginfo.h:141
void setQuickActionEffectId(const int n)
Definition: beinginfo.h:330
void setDeadOffsetX(const int n)
Definition: beinginfo.h:264
int mNameOffsetY
Definition: beinginfo.h:376
int mHpBarOffsetX
Definition: beinginfo.h:377
int getDeadOffsetX() const
Definition: beinginfo.h:267
std::map< int, std::string > mStrings
Definition: beinginfo.h:368
int mNameOffsetX
Definition: beinginfo.h:375
int getQuickActionEffectId() const
Definition: beinginfo.h:333
void setColorsList(const std::string &name)
Definition: beinginfo.cpp:234
void setName(const std::string &name)
Definition: beinginfo.h:65
int getDeadSortOffsetY() const
Definition: beinginfo.h:192
std::vector< BeingMenuItem > mMenu
Definition: beinginfo.h:367
int getSitOffsetX() const
Definition: beinginfo.h:243
void setSitOffsetX(const int n)
Definition: beinginfo.h:240
void setDisplay(const SpriteDisplay &display)
Definition: beinginfo.cpp:127
void setAllowEquipment(const bool b)
Definition: beinginfo.h:324
const std::map< ItemColor, ItemColorData > * mColors
Definition: beinginfo.h:372
void addAttack(const int id, const std::string &action, const std::string &skyAttack, const std::string &waterAttack, const std::string &rideAttack, const int effectId, const int hitEffectId, const int criticalHitEffectId, const int missEffectId, const std::string &missileParticle, const float missileZ, const float missileSpeed, const float missileDieDistance, const int missileLifeTime)
Definition: beinginfo.cpp:186
unsigned char mBlockWalkMask
Definition: beinginfo.h:370
int mAttackOffsetX
Definition: beinginfo.h:395
int mWarpDist
Definition: beinginfo.h:387
int mMaxHP
Definition: beinginfo.h:379
int mAttackDirectionType
Definition: beinginfo.h:401
const std::string & getName() const
Definition: beinginfo.h:68
void setTargetOffsetY(const int n)
Definition: beinginfo.h:138
std::string mName
Definition: beinginfo.h:362
void setDeadSortOffsetY(const int n)
Definition: beinginfo.h:195
void setSortOffsetY(const int n)
Definition: beinginfo.h:189
CursorT mHoverCursor
Definition: beinginfo.h:364
int getSitDirectionType() const
Definition: beinginfo.h:303
void setSitOffsetY(const int n)
Definition: beinginfo.h:246
void setAvatarId(const BeingTypeId id)
Definition: beinginfo.h:201
int getSitOffsetY() const
Definition: beinginfo.h:249
void setNameOffsetY(const int n)
Definition: beinginfo.h:150
int mSortOffsetY
Definition: beinginfo.h:380
int getAttackOffsetX() const
Definition: beinginfo.h:279
void setDirectionType(const int n)
Definition: beinginfo.h:294
unsigned char getBlockWalkMask() const
Definition: beinginfo.h:123
int mDeadOffsetX
Definition: beinginfo.h:393
int getFollowDist() const
Definition: beinginfo.h:225
int getMoveOffsetY() const
Definition: beinginfo.h:261
int getAttackDirectionType() const
Definition: beinginfo.h:315
int mHeight
Definition: beinginfo.h:384
int getTargetOffsetX() const
Definition: beinginfo.h:135
void setAllowDelete(const bool b)
Definition: beinginfo.h:318
void setStartFollowDist(const int n)
Definition: beinginfo.h:216
int mMoveOffsetY
Definition: beinginfo.h:392
void setStaticMaxHP(const bool n)
Definition: beinginfo.h:177
int mTargetOffsetY
Definition: beinginfo.h:374
int mTargetOffsetX
Definition: beinginfo.h:373
int getDirectionType() const
Definition: beinginfo.h:297
void setHoverCursor(const CursorT &cursor)
Definition: beinginfo.h:84
std::string getString(const int idx) const
Definition: beinginfo.cpp:264
bool isTargetSelection() const
Definition: beinginfo.h:183
int mAttackOffsetY
Definition: beinginfo.h:396
void setMoveOffsetY(const int n)
Definition: beinginfo.h:258
void addMenu(const std::string &name, const std::string &command)
Definition: beinginfo.cpp:254
int getThinkTime() const
Definition: beinginfo.h:291
const SpriteDisplay & getDisplay() const
Definition: beinginfo.h:73
int getMaxHP() const
Definition: beinginfo.h:171
void setHpBarOffsetY(const int n)
Definition: beinginfo.h:162
int getWarpDist() const
Definition: beinginfo.h:237
void setAttackOffsetY(const int n)
Definition: beinginfo.h:282
int mDirectionType
Definition: beinginfo.h:398
const std::vector< BeingMenuItem > & getMenu() const A_CONST
Definition: beinginfo.cpp:259
int getNameOffsetY() const
Definition: beinginfo.h:153
static void init()
Definition: beinginfo.cpp:223
const SoundInfo & getSound(const ItemSoundEvent::Type event) const
Definition: beinginfo.cpp:165
int getHpBarOffsetX() const
Definition: beinginfo.h:159
std::string mCurrency
Definition: beinginfo.h:369
void setThinkTime(const int n)
Definition: beinginfo.h:288
int getDeadOffsetY() const
Definition: beinginfo.h:273
bool mAllowEquipment
Definition: beinginfo.h:406
static Attack * empty
Definition: beinginfo.h:57
void setWalkSpeed(const int n)
Definition: beinginfo.h:228
bool getAllowEquipment() const
Definition: beinginfo.h:327
static void clear()
Definition: beinginfo.cpp:217
int getAttackOffsetY() const
Definition: beinginfo.h:285
BlockTypeT mBlockType
Definition: beinginfo.h:371
BlockTypeT getBlockType() const
Definition: beinginfo.h:129
static BeingInfo * unknown
Definition: beinginfo.h:56
int mThinkTime
Definition: beinginfo.h:397
ItemSoundEvents mSounds
Definition: beinginfo.h:365
int mDeadDirectionType
Definition: beinginfo.h:400
bool mTargetSelection
Definition: beinginfo.h:404
int getMoveOffsetX() const
Definition: beinginfo.h:255
void setWidth(const int n)
Definition: beinginfo.h:210
std::string getColor(const ItemColor idx) const
Definition: beinginfo.cpp:242
const Attack * getAttack(const int id) const
Definition: beinginfo.cpp:180
void setMaxHP(const int n)
Definition: beinginfo.h:168
BeingTypeId mAvatarId
Definition: beinginfo.h:382
Attacks mAttacks
Definition: beinginfo.h:366
int getStartFollowDist() const
Definition: beinginfo.h:219
void setTargetCursorSize(const TargetCursorSizeT &targetSize)
Definition: beinginfo.h:78
void setWarpDist(const int n)
Definition: beinginfo.h:234
void setHeight(const int n)
Definition: beinginfo.h:213
TargetCursorSizeT mTargetCursorSize
Definition: beinginfo.h:363
void setTargetOffsetX(const int n)
Definition: beinginfo.h:132
int getNameOffsetX() const
Definition: beinginfo.h:147
int getWalkSpeed() const
Definition: beinginfo.h:231
void setTargetCursorSize(const std::string &size)
Definition: beinginfo.cpp:132
void setAttackDirectionType(const int n)
Definition: beinginfo.h:312
void setMoveOffsetX(const int n)
Definition: beinginfo.h:252
int getDeadDirectionType() const
Definition: beinginfo.h:309
Cursor ::T CursorT
Definition: cursor.h:44
uint16_t ItemColor
Definition: itemcolor.h:30
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define noexcept2
Definition: localconsts.h:50
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
CursorT stringToCursor(const std::string &name)
Definition: cursors.cpp:60
int size()
Definition: emotedb.cpp:306
std::map< ItemSoundEvent::Type, SoundInfoVect * > ItemSoundEvents
Definition: soundinfo.h:50
Definition: attack.h:30
TargetCursorSize ::T TargetCursorSizeT