GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/resources/beinginfo.h Lines: 0 80 0.0 %
Date: 2017-11-29 Branches: 0 4 0.0 %

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