TrinityCore
Loading...
Searching...
No Matches
PetDefines.h
Go to the documentation of this file.
1
/*
2
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3
*
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License as published by the
6
* Free Software Foundation; either version 2 of the License, or (at your
7
* option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
* You should have received a copy of the GNU General Public License along
15
* with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef TRINITYCORE_PET_DEFINES_H
19
#define TRINITYCORE_PET_DEFINES_H
20
21
#include "
Define.h
"
22
#include "
Optional.h
"
23
#include <array>
24
#include <string>
25
#include <vector>
26
27
enum
ReactStates
:
uint8
;
28
29
enum
PetType
:
uint8
30
{
31
SUMMON_PET
= 0,
32
HUNTER_PET
= 1,
33
MAX_PET_TYPE
= 4
34
};
35
36
#define MAX_PET_STABLES 4
37
38
// stored in character_pet.slot
39
enum
PetSaveMode
:
int8
40
{
41
PET_SAVE_AS_DELETED
= -1,
// not saved in fact
42
PET_SAVE_AS_CURRENT
= 0,
// in current slot (with player)
43
PET_SAVE_FIRST_STABLE_SLOT
= 1,
44
PET_SAVE_LAST_STABLE_SLOT
=
MAX_PET_STABLES
,
// last in DB stable slot index (including), all higher have same meaning as PET_SAVE_NOT_IN_SLOT
45
PET_SAVE_NOT_IN_SLOT
= 100
// for avoid conflict with stable size grow will use 100
46
};
47
48
enum
HappinessState
49
{
50
UNHAPPY
= 1,
51
CONTENT
= 2,
52
HAPPY
= 3
53
};
54
55
enum
PetSpellState
56
{
57
PETSPELL_UNCHANGED
= 0,
58
PETSPELL_CHANGED
= 1,
59
PETSPELL_NEW
= 2,
60
PETSPELL_REMOVED
= 3
61
};
62
63
enum
PetSpellType
64
{
65
PETSPELL_NORMAL
= 0,
66
PETSPELL_FAMILY
= 1,
67
PETSPELL_TALENT
= 2
68
};
69
70
enum class
PetActionFeedback
:
uint8
71
{
72
None
= 0,
73
Dead
= 1,
74
NoTarget
= 2,
75
InvalidTarget
= 3,
76
NoPath
= 4
77
};
78
79
enum
PetAction
:
int32
80
{
81
PET_ACTION_SPECIAL_SPELL
= 0,
82
PET_ACTION_ATTACK
= 1
83
};
84
85
#define PET_FOLLOW_DIST 1.0f
86
#define PET_FOLLOW_ANGLE float(M_PI/2)
87
88
class
PetStable
89
{
90
public
:
91
struct
PetInfo
92
{
93
PetInfo
() { }
94
95
std::string
Name
;
96
std::string
ActionBar
;
97
uint32
PetNumber
= 0;
98
uint32
CreatureId
= 0;
99
uint32
DisplayId
= 0;
100
uint32
Experience
= 0;
101
uint32
Health
= 0;
102
uint32
Mana
= 0;
103
uint32
Happiness
= 0;
104
uint32
LastSaveTime
= 0;
105
uint32
CreatedBySpellId
= 0;
106
uint8
Level
= 0;
107
ReactStates
ReactState
=
ReactStates
(0);
108
PetType
Type
=
MAX_PET_TYPE
;
109
bool
WasRenamed
=
false
;
110
};
111
112
Optional<PetInfo>
CurrentPet
;
// PET_SAVE_AS_CURRENT
113
std::array<Optional<PetInfo>,
MAX_PET_STABLES
>
StabledPets
;
// PET_SAVE_FIRST_STABLE_SLOT - PET_SAVE_LAST_STABLE_SLOT
114
uint32
MaxStabledPets
= 0;
115
std::vector<PetInfo>
UnslottedPets
;
// PET_SAVE_NOT_IN_SLOT
116
117
PetInfo
const
*
GetUnslottedHunterPet
()
const
118
{
119
return
UnslottedPets
.size() == 1 &&
UnslottedPets
[0].
Type
==
HUNTER_PET
? &
UnslottedPets
[0] :
nullptr
;
120
}
121
};
122
123
#endif
Define.h
uint8
uint8_t uint8
Definition
Define.h:135
int8
int8_t int8
Definition
Define.h:131
int32
int32_t int32
Definition
Define.h:129
uint32
uint32_t uint32
Definition
Define.h:133
Optional.h
Optional
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition
Optional.h:25
PetSpellState
PetSpellState
Definition
PetDefines.h:56
PETSPELL_NEW
@ PETSPELL_NEW
Definition
PetDefines.h:59
PETSPELL_UNCHANGED
@ PETSPELL_UNCHANGED
Definition
PetDefines.h:57
PETSPELL_CHANGED
@ PETSPELL_CHANGED
Definition
PetDefines.h:58
PETSPELL_REMOVED
@ PETSPELL_REMOVED
Definition
PetDefines.h:60
MAX_PET_STABLES
#define MAX_PET_STABLES
Definition
PetDefines.h:36
PetSaveMode
PetSaveMode
Definition
PetDefines.h:40
PET_SAVE_FIRST_STABLE_SLOT
@ PET_SAVE_FIRST_STABLE_SLOT
Definition
PetDefines.h:43
PET_SAVE_LAST_STABLE_SLOT
@ PET_SAVE_LAST_STABLE_SLOT
Definition
PetDefines.h:44
PET_SAVE_AS_DELETED
@ PET_SAVE_AS_DELETED
Definition
PetDefines.h:41
PET_SAVE_NOT_IN_SLOT
@ PET_SAVE_NOT_IN_SLOT
Definition
PetDefines.h:45
PET_SAVE_AS_CURRENT
@ PET_SAVE_AS_CURRENT
Definition
PetDefines.h:42
PetActionFeedback
PetActionFeedback
Definition
PetDefines.h:71
PetActionFeedback::Dead
@ Dead
PetActionFeedback::None
@ None
PetActionFeedback::InvalidTarget
@ InvalidTarget
PetActionFeedback::NoPath
@ NoPath
PetActionFeedback::NoTarget
@ NoTarget
PetAction
PetAction
Definition
PetDefines.h:80
PET_ACTION_ATTACK
@ PET_ACTION_ATTACK
Definition
PetDefines.h:82
PET_ACTION_SPECIAL_SPELL
@ PET_ACTION_SPECIAL_SPELL
Definition
PetDefines.h:81
PetType
PetType
Definition
PetDefines.h:30
SUMMON_PET
@ SUMMON_PET
Definition
PetDefines.h:31
HUNTER_PET
@ HUNTER_PET
Definition
PetDefines.h:32
MAX_PET_TYPE
@ MAX_PET_TYPE
Definition
PetDefines.h:33
PetSpellType
PetSpellType
Definition
PetDefines.h:64
PETSPELL_TALENT
@ PETSPELL_TALENT
Definition
PetDefines.h:67
PETSPELL_NORMAL
@ PETSPELL_NORMAL
Definition
PetDefines.h:65
PETSPELL_FAMILY
@ PETSPELL_FAMILY
Definition
PetDefines.h:66
HappinessState
HappinessState
Definition
PetDefines.h:49
HAPPY
@ HAPPY
Definition
PetDefines.h:52
CONTENT
@ CONTENT
Definition
PetDefines.h:51
UNHAPPY
@ UNHAPPY
Definition
PetDefines.h:50
ReactStates
ReactStates
Definition
UnitDefines.h:407
PetStable
Definition
PetDefines.h:89
PetStable::MaxStabledPets
uint32 MaxStabledPets
Definition
PetDefines.h:114
PetStable::GetUnslottedHunterPet
PetInfo const * GetUnslottedHunterPet() const
Definition
PetDefines.h:117
PetStable::StabledPets
std::array< Optional< PetInfo >, MAX_PET_STABLES > StabledPets
Definition
PetDefines.h:113
PetStable::CurrentPet
Optional< PetInfo > CurrentPet
Definition
PetDefines.h:112
PetStable::UnslottedPets
std::vector< PetInfo > UnslottedPets
Definition
PetDefines.h:115
PetStable::PetInfo
Definition
PetDefines.h:92
PetStable::PetInfo::PetInfo
PetInfo()
Definition
PetDefines.h:93
PetStable::PetInfo::Mana
uint32 Mana
Definition
PetDefines.h:102
PetStable::PetInfo::Happiness
uint32 Happiness
Definition
PetDefines.h:103
PetStable::PetInfo::CreatedBySpellId
uint32 CreatedBySpellId
Definition
PetDefines.h:105
PetStable::PetInfo::Health
uint32 Health
Definition
PetDefines.h:101
PetStable::PetInfo::CreatureId
uint32 CreatureId
Definition
PetDefines.h:98
PetStable::PetInfo::WasRenamed
bool WasRenamed
Definition
PetDefines.h:109
PetStable::PetInfo::Level
uint8 Level
Definition
PetDefines.h:106
PetStable::PetInfo::DisplayId
uint32 DisplayId
Definition
PetDefines.h:99
PetStable::PetInfo::ReactState
ReactStates ReactState
Definition
PetDefines.h:107
PetStable::PetInfo::Name
std::string Name
Definition
PetDefines.h:95
PetStable::PetInfo::Type
PetType Type
Definition
PetDefines.h:108
PetStable::PetInfo::Experience
uint32 Experience
Definition
PetDefines.h:100
PetStable::PetInfo::PetNumber
uint32 PetNumber
Definition
PetDefines.h:97
PetStable::PetInfo::LastSaveTime
uint32 LastSaveTime
Definition
PetDefines.h:104
PetStable::PetInfo::ActionBar
std::string ActionBar
Definition
PetDefines.h:96
server
game
Entities
Pet
PetDefines.h
Generated on Sun May 10 2026 02:30:14 for TrinityCore by
1.9.8