AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
CharmInfo Struct Reference

#include "CharmInfo.h"

Public Member Functions

 CharmInfo (Unit *unit)
 
 ~CharmInfo ()
 
void RestoreState ()
 
uint32 GetPetNumber () const
 
void SetPetNumber (uint32 petnumber, bool statwindow)
 
void SetCommandState (CommandStates st)
 
CommandStates GetCommandState () const
 
bool HasCommandState (CommandStates state) const
 
void InitPossessCreateSpells ()
 
void InitCharmCreateSpells ()
 
void InitPetActionBar ()
 
void InitEmptyActionBar (bool withAttack=true)
 
bool AddSpellToActionBar (SpellInfo const *spellInfo, ActiveStates newstate=ACT_DECIDE, uint32 index=MAX_UNIT_ACTION_BAR_INDEX+1)
 
bool RemoveSpellFromActionBar (uint32 spell_id)
 
void LoadPetActionBar (const std::string &data)
 
void BuildActionBar (WorldPacket *data)
 
void SetSpellAutocast (SpellInfo const *spellInfo, bool state)
 
void SetActionBar (uint8 index, uint32 spellOrAction, ActiveStates type)
 
UnitActionBarEntry const * GetActionBarEntry (uint8 index) const
 
void ToggleCreatureAutocast (SpellInfo const *spellInfo, bool apply)
 
CharmSpellInfoGetCharmSpell (uint8 index)
 
GlobalCooldownMgrGetGlobalCooldownMgr ()
 
void SetIsCommandAttack (bool val)
 
bool IsCommandAttack ()
 
void SetIsCommandFollow (bool val)
 
bool IsCommandFollow ()
 
void SetIsAtStay (bool val)
 
bool IsAtStay ()
 
void SetIsFollowing (bool val)
 
bool IsFollowing ()
 
void SetIsReturning (bool val)
 
bool IsReturning ()
 
void SaveStayPosition (bool atCurrentPos)
 
void GetStayPosition (float &x, float &y, float &z)
 
void RemoveStayPosition ()
 
bool HasStayPosition ()
 
void SetForcedSpell (uint32 id)
 
int32 GetForcedSpell ()
 
void SetForcedTargetGUID (ObjectGuid guid=ObjectGuid::Empty)
 
ObjectGuid GetForcedTarget ()
 
void SetPlayerReactState (ReactStates s)
 
ReactStates GetPlayerReactState () const
 

Private Attributes

Unit_unit
 
UnitActionBarEntry PetActionBar [MAX_UNIT_ACTION_BAR_INDEX]
 
CharmSpellInfo _charmspells [4]
 
CommandStates _CommandState
 
uint32 _petnumber
 
ReactStates _oldReactState
 
bool _isCommandAttack
 
bool _isCommandFollow
 
bool _isAtStay
 
bool _isFollowing
 
bool _isReturning
 
int32 _forcedSpellId
 
ObjectGuid _forcedTargetGUID
 
float _stayX
 
float _stayY
 
float _stayZ
 
GlobalCooldownMgr _GlobalCooldownMgr
 

Detailed Description

Constructor & Destructor Documentation

◆ CharmInfo()

CharmInfo::CharmInfo ( Unit unit)
explicit
31 _isCommandAttack(false), _isCommandFollow(false), _isAtStay(false), _isFollowing(false), _isReturning(false),
32 _forcedSpellId(0), _stayX(0.0f), _stayY(0.0f), _stayZ(0.0f)
33{
34 for (uint8 i = 0; i < MAX_SPELL_CHARM; ++i)
35 _charmspells[i].SetActionAndType(0, ACT_DISABLED);
36
37 if (_unit->IsCreature())
38 {
41 }
42}
std::uint8_t uint8
Definition: Define.h:109
@ REACT_PASSIVE
Definition: Unit.h:548
@ COMMAND_FOLLOW
Definition: Unit.h:556
#define MAX_SPELL_CHARM
Definition: CharmInfo.h:23
@ ACT_DISABLED
Definition: CharmInfo.h:61
ReactStates GetReactState() const
Definition: Creature.h:98
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition: Creature.h:97
bool IsCreature() const
Definition: Object.h:201
Creature * ToCreature()
Definition: Object.h:202
float _stayY
Definition: CharmInfo.h:202
bool _isAtStay
Definition: CharmInfo.h:196
float _stayX
Definition: CharmInfo.h:201
float _stayZ
Definition: CharmInfo.h:203
bool _isCommandFollow
Definition: CharmInfo.h:195
CommandStates _CommandState
Definition: CharmInfo.h:188
int32 _forcedSpellId
Definition: CharmInfo.h:199
bool _isFollowing
Definition: CharmInfo.h:197
bool _isCommandAttack
Definition: CharmInfo.h:194
ReactStates _oldReactState
Definition: CharmInfo.h:192
bool _isReturning
Definition: CharmInfo.h:198
Unit * _unit
Definition: CharmInfo.h:185
uint32 _petnumber
Definition: CharmInfo.h:189
CharmSpellInfo _charmspells[4]
Definition: CharmInfo.h:187

References _charmspells, _oldReactState, _unit, ACT_DISABLED, Creature::GetReactState(), Object::IsCreature(), MAX_SPELL_CHARM, REACT_PASSIVE, Creature::SetReactState(), and Object::ToCreature().

◆ ~CharmInfo()

CharmInfo::~CharmInfo ( )
default

Member Function Documentation

◆ AddSpellToActionBar()

bool CharmInfo::AddSpellToActionBar ( SpellInfo const *  spellInfo,
ActiveStates  newstate = ACT_DECIDE,
uint32  index = MAX_UNIT_ACTION_BAR_INDEX + 1 
)
159{
160 uint32 spell_id = 0;
161 uint32 first_id = 0;
162
163 if (spellInfo)
164 {
165 spell_id = spellInfo->Id;
166 first_id = spellInfo->GetFirstRankSpell()->Id;
167 }
168
169 // new spell rank can be already listed
170 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
171 {
172 if (uint32 action = PetActionBar[i].GetAction())
173 {
174 if (PetActionBar[i].IsActionBarForSpell() && sSpellMgr->GetFirstSpellInChain(action) == first_id)
175 {
176 PetActionBar[i].SetAction(spell_id);
177 return true;
178 }
179 }
180 }
181
182 // or use empty slot in other case
183 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
184 {
185 if (!PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
186 {
187 if (i != index && index <= MAX_UNIT_ACTION_BAR_INDEX)
188 continue;
189
190 SetActionBar(i, spell_id, newstate == ACT_DECIDE ? spellInfo->IsAutocastable() ? ACT_DISABLED : ACT_PASSIVE : newstate);
191
192 if (_unit->GetCharmer() && _unit->GetCharmer()->IsPlayer())
193 {
194 if (Creature* creature = _unit->ToCreature())
195 {
196 // Processing this packet needs to be delayed
197 _unit->m_Events.AddEventAtOffset([creature, spell_id]()
198 {
199 if (uint32 cooldown = creature->GetSpellCooldown(spell_id))
200 {
201 WorldPacket data;
202 creature->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spell_id, cooldown);
203 if (creature->GetCharmer() && creature->GetCharmer()->IsPlayer())
204 {
205 creature->GetCharmer()->ToPlayer()->SendDirectMessage(&data);
206 }
207 }
208 }, 500ms);
209 }
210 }
211
212 return true;
213 }
214 }
215 return false;
216}
std::uint32_t uint32
Definition: Define.h:107
#define MAX_UNIT_ACTION_BAR_INDEX
Definition: CharmInfo.h:28
@ ACT_DECIDE
Definition: CharmInfo.h:65
@ ACT_PASSIVE
Definition: CharmInfo.h:60
#define sSpellMgr
Definition: SpellMgr.h:825
void AddEventAtOffset(BasicEvent *event, Milliseconds offset)
Definition: EventProcessor.h:107
Definition: Creature.h:46
bool IsPlayer() const
Definition: Object.h:197
void SetAction(uint32 action)
Definition: CharmInfo.h:117
void SetActionBar(uint8 index, uint32 spellOrAction, ActiveStates type)
Definition: CharmInfo.h:148
UnitActionBarEntry PetActionBar[MAX_UNIT_ACTION_BAR_INDEX]
Definition: CharmInfo.h:186
Unit * GetCharmer() const
Definition: Unit.cpp:10570
EventProcessor m_Events
Definition: Unit.h:1792

References _unit, ACT_DECIDE, ACT_DISABLED, ACT_PASSIVE, EventProcessor::AddEventAtOffset(), Unit::GetCharmer(), SpellInfo::GetFirstRankSpell(), SpellInfo::Id, SpellInfo::IsAutocastable(), Object::IsPlayer(), Unit::m_Events, MAX_UNIT_ACTION_BAR_INDEX, PetActionBar, UnitActionBarEntry::SetAction(), SetActionBar(), sSpellMgr, and Object::ToCreature().

Referenced by Pet::addSpell(), InitCharmCreateSpells(), and InitPossessCreateSpells().

◆ BuildActionBar()

void CharmInfo::BuildActionBar ( WorldPacket data)

◆ GetActionBarEntry()

UnitActionBarEntry const * CharmInfo::GetActionBarEntry ( uint8  index) const
inline

◆ GetCharmSpell()

CharmSpellInfo * CharmInfo::GetCharmSpell ( uint8  index)
inline
156{ return &(_charmspells[index]); }

References _charmspells.

Referenced by Player::CharmSpellInitialize(), and Creature::GetPetAutoSpellOnPos().

◆ GetCommandState()

CommandStates CharmInfo::GetCommandState ( ) const
inline

◆ GetForcedSpell()

int32 CharmInfo::GetForcedSpell ( )
inline

◆ GetForcedTarget()

ObjectGuid CharmInfo::GetForcedTarget ( )
inline
178{ return _forcedTargetGUID; }
ObjectGuid _forcedTargetGUID
Definition: CharmInfo.h:200

References _forcedTargetGUID.

Referenced by PetAI::UpdateAI().

◆ GetGlobalCooldownMgr()

GlobalCooldownMgr & CharmInfo::GetGlobalCooldownMgr ( )
inline

◆ GetPetNumber()

◆ GetPlayerReactState()

ReactStates CharmInfo::GetPlayerReactState ( ) const
inline
182{ return _oldReactState; }

References _oldReactState.

Referenced by Player::UpdateCharmedAI().

◆ GetStayPosition()

void CharmInfo::GetStayPosition ( float &  x,
float &  y,
float &  z 
)
354{
355 x = _stayX;
356 y = _stayY;
357 z = _stayZ;
358}

References _stayX, _stayY, and _stayZ.

Referenced by PetAI::HandleReturnMovement().

◆ HasCommandState()

bool CharmInfo::HasCommandState ( CommandStates  state) const
inline

◆ HasStayPosition()

bool CharmInfo::HasStayPosition ( )
368{
369 return _stayX && _stayY && _stayZ;
370}

References _stayX, _stayY, and _stayZ.

Referenced by PetAI::HandleReturnMovement().

◆ InitCharmCreateSpells()

void CharmInfo::InitCharmCreateSpells ( )
112{
114
115 if (_unit->IsPlayer()) // charmed players don't have spells
116 return;
117
118 for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i)
119 {
120 uint32 spellId = _unit->ToCreature()->m_spells[i];
121 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
122
123 if (!spellInfo)
124 {
126 continue;
127 }
128
129 if (spellInfo->IsPassive())
130 {
131 _unit->CastSpell(_unit, spellInfo, true);
133 }
134 else
135 {
137
138 ActiveStates newstate = ACT_PASSIVE;
139
140 if (!spellInfo->IsAutocastable())
141 newstate = ACT_PASSIVE;
142 else
143 {
144 if (spellInfo->NeedsExplicitUnitTarget())
145 {
146 newstate = ACT_ENABLED;
147 ToggleCreatureAutocast(spellInfo, true);
148 }
149 else
150 newstate = ACT_DISABLED;
151 }
152
153 AddSpellToActionBar(spellInfo, newstate);
154 }
155 }
156}
ActiveStates
Definition: CharmInfo.h:59
@ ACT_ENABLED
Definition: CharmInfo.h:62
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition: Creature.h:251
void SetActionAndType(uint32 action, ActiveStates type)
Definition: CharmInfo.h:107
void InitPetActionBar()
Definition: CharmInfo.cpp:52
bool AddSpellToActionBar(SpellInfo const *spellInfo, ActiveStates newstate=ACT_DECIDE, uint32 index=MAX_UNIT_ACTION_BAR_INDEX+1)
Definition: CharmInfo.cpp:158
void ToggleCreatureAutocast(SpellInfo const *spellInfo, bool apply)
Definition: CharmInfo.cpp:237
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1168
Definition: SpellInfo.h:316
bool IsAutocastable() const
Definition: SpellInfo.cpp:1102
bool IsPassive() const
Definition: SpellInfo.cpp:1097
bool NeedsExplicitUnitTarget() const
Definition: SpellInfo.cpp:1032

References _charmspells, _unit, ACT_DISABLED, ACT_ENABLED, ACT_PASSIVE, AddSpellToActionBar(), Unit::CastSpell(), InitPetActionBar(), SpellInfo::IsAutocastable(), SpellInfo::IsPassive(), Object::IsPlayer(), Creature::m_spells, MAX_SPELL_CHARM, SpellInfo::NeedsExplicitUnitTarget(), UnitActionBarEntry::SetActionAndType(), sSpellMgr, Object::ToCreature(), and ToggleCreatureAutocast().

Referenced by Guardian::InitStats(), and Unit::SetCharmedBy().

◆ InitEmptyActionBar()

void CharmInfo::InitEmptyActionBar ( bool  withAttack = true)
68{
69 if (withAttack)
71 else
75}
@ COMMAND_ATTACK
Definition: Unit.h:557
@ ACTION_BAR_INDEX_END
Definition: CharmInfo.h:55
@ ACTION_BAR_INDEX_START
Definition: CharmInfo.h:52
@ ACT_COMMAND
Definition: CharmInfo.h:63

References ACT_COMMAND, ACT_PASSIVE, ACTION_BAR_INDEX_END, ACTION_BAR_INDEX_START, COMMAND_ATTACK, and SetActionBar().

Referenced by InitPossessCreateSpells().

◆ InitPetActionBar()

void CharmInfo::InitPetActionBar ( )
53{
54 // the first 3 SpellOrActions are attack, follow and stay
57
58 // middle 4 SpellOrActions are spells/special attacks/abilities
61
62 // last 3 SpellOrActions are reactions
65}
@ ACTION_BAR_INDEX_PET_SPELL_START
Definition: CharmInfo.h:53
@ ACTION_BAR_INDEX_PET_SPELL_END
Definition: CharmInfo.h:54
@ ACT_REACTION
Definition: CharmInfo.h:64

References ACT_COMMAND, ACT_PASSIVE, ACT_REACTION, ACTION_BAR_INDEX_END, ACTION_BAR_INDEX_PET_SPELL_END, ACTION_BAR_INDEX_PET_SPELL_START, ACTION_BAR_INDEX_START, COMMAND_ATTACK, and SetActionBar().

Referenced by InitCharmCreateSpells(), and Pet::InitPetCreateSpells().

◆ InitPossessCreateSpells()

void CharmInfo::InitPossessCreateSpells ( )
78{
79 if (_unit->IsCreature())
80 {
81 // Adding switch until better way is found. Malcrom
82 // Adding entrys to this switch will prevent COMMAND_ATTACK being added to pet bar.
83 switch (_unit->GetEntry())
84 {
85 case 23575: // Mindless Abomination
86 case 24783: // Trained Rock Falcon
87 case 27664: // Crashin' Thrashin' Racer
88 case 40281: // Crashin' Thrashin' Racer
89 case 23109: // Vengeful Spirit
90 break;
91 default:
93 break;
94 }
95
96 for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
97 {
98 uint32 spellId = _unit->ToCreature()->m_spells[i];
99 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
100 if (spellInfo)
101 if (spellInfo->IsPassive())
102 _unit->CastSpell(_unit, spellInfo, true);
103
104 AddSpellToActionBar(spellInfo, ACT_PASSIVE, i);
105 }
106 }
107 else
109}
static constexpr uint32 MAX_CREATURE_SPELLS
Definition: Unit.h:45
uint32 GetEntry() const
Definition: Object.h:112
void InitEmptyActionBar(bool withAttack=true)
Definition: CharmInfo.cpp:67

References _unit, ACT_PASSIVE, AddSpellToActionBar(), Unit::CastSpell(), Object::GetEntry(), InitEmptyActionBar(), Object::IsCreature(), SpellInfo::IsPassive(), Creature::m_spells, MAX_CREATURE_SPELLS, sSpellMgr, and Object::ToCreature().

Referenced by Unit::SetCharmedBy().

◆ IsAtStay()

bool CharmInfo::IsAtStay ( )
378{
379 return _isAtStay;
380}

References _isAtStay.

Referenced by PetAI::HandleReturnMovement(), PetAI::SelectNextTarget(), and PetAI::UpdateAI().

◆ IsCommandAttack()

◆ IsCommandFollow()

bool CharmInfo::IsCommandFollow ( )
326{
327 return _isCommandFollow;
328}

References _isCommandFollow.

Referenced by PetAI::CanAttack().

◆ IsFollowing()

bool CharmInfo::IsFollowing ( )
388{
389 return _isFollowing;
390}

References _isFollowing.

Referenced by PetAI::HandleReturnMovement(), and PetAI::SelectNextTarget().

◆ IsReturning()

bool CharmInfo::IsReturning ( )

◆ LoadPetActionBar()

void CharmInfo::LoadPetActionBar ( const std::string &  data)
257{
258 std::vector<std::string_view> tokens = Acore::Tokenize(data, ' ', false);
259
260 if (tokens.size() != (ACTION_BAR_INDEX_END - ACTION_BAR_INDEX_START) * 2)
261 return; // non critical, will reset to default
262
263 auto iter = tokens.begin();
264 for (uint8 index = ACTION_BAR_INDEX_START; index < ACTION_BAR_INDEX_END; ++index)
265 {
266 Optional<uint8> type = Acore::StringTo<uint8>(*(iter++));
267 Optional<uint32> action = Acore::StringTo<uint32>(*(iter++));
268
269 if (!type || !action)
270 {
271 continue;
272 }
273
274 PetActionBar[index].SetActionAndType(*action, static_cast<ActiveStates>(*type));
275
276 // check correctness
277 if (PetActionBar[index].IsActionBarForSpell())
278 {
279 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(PetActionBar[index].GetAction());
280 if (!spellInfo)
281 {
282 SetActionBar(index, 0, ACT_PASSIVE);
283 }
284 else if (!spellInfo->IsAutocastable())
285 {
286 SetActionBar(index, PetActionBar[index].GetAction(), ACT_PASSIVE);
287 }
288 }
289 }
290}
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:24
std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
Definition: Tokenize.cpp:20

References ACT_PASSIVE, ACTION_BAR_INDEX_END, ACTION_BAR_INDEX_START, SpellInfo::IsAutocastable(), PetActionBar, UnitActionBarEntry::SetActionAndType(), SetActionBar(), sSpellMgr, and Acore::Tokenize().

Referenced by Pet::LoadPetFromDB().

◆ RemoveSpellFromActionBar()

bool CharmInfo::RemoveSpellFromActionBar ( uint32  spell_id)
219{
220 uint32 first_id = sSpellMgr->GetFirstSpellInChain(spell_id);
221
222 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
223 {
224 if (uint32 action = PetActionBar[i].GetAction())
225 {
226 if (PetActionBar[i].IsActionBarForSpell() && sSpellMgr->GetFirstSpellInChain(action) == first_id)
227 {
229 return true;
230 }
231 }
232 }
233
234 return false;
235}

References ACT_DISABLED, MAX_UNIT_ACTION_BAR_INDEX, PetActionBar, SetActionBar(), and sSpellMgr.

Referenced by Pet::removeSpell().

◆ RemoveStayPosition()

void CharmInfo::RemoveStayPosition ( )
361{
362 _stayX = 0.0f;
363 _stayY = 0.0f;
364 _stayZ = 0.0f;
365}

References _stayX, _stayY, and _stayZ.

Referenced by WorldSession::HandlePetActionHelper().

◆ RestoreState()

void CharmInfo::RestoreState ( )
47{
48 if (Creature* creature = _unit->ToCreature())
49 creature->SetReactState(_oldReactState);
50}

References _oldReactState, _unit, and Object::ToCreature().

Referenced by Unit::DeleteCharmInfo().

◆ SaveStayPosition()

void CharmInfo::SaveStayPosition ( bool  atCurrentPos)

At this point a new spline destination is enabled because of Unit::StopMoving()

331{
333 G3D::Vector3 stayPos = G3D::Vector3();
334
335 if (atCurrentPos)
336 {
337 float z = INVALID_HEIGHT;
339 stayPos = G3D::Vector3(_unit->GetPositionX(), _unit->GetPositionY(), z != INVALID_HEIGHT ? z : _unit->GetPositionZ());
340 }
341 else
342 stayPos = _unit->movespline->FinalDestination();
343
345 if (TransportBase* transport = _unit->GetDirectTransport())
346 transport->CalculatePassengerPosition(stayPos.x, stayPos.y, stayPos.z);
347
348 _stayX = stayPos.x;
349 _stayY = stayPos.y;
350 _stayZ = stayPos.z;
351}
#define INVALID_HEIGHT
Definition: Map.h:165
void UpdateAllowedPositionZ(float x, float y, float &z, float *groundZ=nullptr) const
Definition: Object.cpp:1554
float GetPositionZ() const
Definition: Position.h:119
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
Movement::MoveSpline * movespline
Definition: Unit.h:1818
TransportBase * GetDirectTransport() const
Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
Definition: Unit.cpp:18723
Definition: VehicleDefines.h:106
Vector3 FinalDestination() const
Definition: MoveSpline.h:120
bool onTransport
Definition: MoveSpline.h:127

References _stayX, _stayY, _stayZ, _unit, Movement::MoveSpline::FinalDestination(), Unit::GetDirectTransport(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), INVALID_HEIGHT, Unit::movespline, Movement::MoveSpline::onTransport, and WorldObject::UpdateAllowedPositionZ().

Referenced by WorldSession::HandlePetActionHelper(), and Pet::Update().

◆ SetActionBar()

void CharmInfo::SetActionBar ( uint8  index,
uint32  spellOrAction,
ActiveStates  type 
)
inline

◆ SetCommandState()

void CharmInfo::SetCommandState ( CommandStates  st)
inline

◆ SetForcedSpell()

void CharmInfo::SetForcedSpell ( uint32  id)
inline

◆ SetForcedTargetGUID()

void CharmInfo::SetForcedTargetGUID ( ObjectGuid  guid = ObjectGuid::Empty)
inline

◆ SetIsAtStay()

◆ SetIsCommandAttack()

◆ SetIsCommandFollow()

void CharmInfo::SetIsCommandFollow ( bool  val)

◆ SetIsFollowing()

void CharmInfo::SetIsFollowing ( bool  val)

◆ SetIsReturning()

◆ SetPetNumber()

void CharmInfo::SetPetNumber ( uint32  petnumber,
bool  statwindow 
)
248{
249 _petnumber = petnumber;
250 if (statwindow)
252 else
254}
@ UNIT_FIELD_PETNUMBER
Definition: UpdateFields.h:132
void SetUInt32Value(uint16 index, uint32 value)
Definition: Unit.cpp:21256

References _petnumber, _unit, Unit::SetUInt32Value(), and UNIT_FIELD_PETNUMBER.

Referenced by Unit::InitTamedPet(), Pet::LoadPetFromDB(), Unit::RemoveCharmedBy(), Unit::SetCharmedBy(), and Player::SummonPet().

◆ SetPlayerReactState()

void CharmInfo::SetPlayerReactState ( ReactStates  s)
inline

◆ SetSpellAutocast()

void CharmInfo::SetSpellAutocast ( SpellInfo const *  spellInfo,
bool  state 
)
299{
300 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
301 {
302 if (spellInfo->Id == PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
303 {
305 break;
306 }
307 }
308}
bool IsActionBarForSpell() const
Definition: CharmInfo.h:101
void SetType(ActiveStates type)
Definition: CharmInfo.h:112
uint32 GetAction() const
Definition: CharmInfo.h:100

References ACT_DISABLED, ACT_ENABLED, UnitActionBarEntry::GetAction(), SpellInfo::Id, UnitActionBarEntry::IsActionBarForSpell(), MAX_UNIT_ACTION_BAR_INDEX, PetActionBar, and UnitActionBarEntry::SetType().

Referenced by WorldSession::HandlePetSpellAutocastOpcode().

◆ ToggleCreatureAutocast()

void CharmInfo::ToggleCreatureAutocast ( SpellInfo const *  spellInfo,
bool  apply 
)

Member Data Documentation

◆ _charmspells

CharmSpellInfo CharmInfo::_charmspells[4]
private

◆ _CommandState

CommandStates CharmInfo::_CommandState
private

◆ _forcedSpellId

int32 CharmInfo::_forcedSpellId
private

Referenced by GetForcedSpell(), and SetForcedSpell().

◆ _forcedTargetGUID

ObjectGuid CharmInfo::_forcedTargetGUID
private

◆ _GlobalCooldownMgr

GlobalCooldownMgr CharmInfo::_GlobalCooldownMgr
private

Referenced by GetGlobalCooldownMgr().

◆ _isAtStay

bool CharmInfo::_isAtStay
private

Referenced by IsAtStay(), and SetIsAtStay().

◆ _isCommandAttack

bool CharmInfo::_isCommandAttack
private

◆ _isCommandFollow

bool CharmInfo::_isCommandFollow
private

◆ _isFollowing

bool CharmInfo::_isFollowing
private

Referenced by IsFollowing(), and SetIsFollowing().

◆ _isReturning

bool CharmInfo::_isReturning
private

Referenced by IsReturning(), and SetIsReturning().

◆ _oldReactState

ReactStates CharmInfo::_oldReactState
private

◆ _petnumber

uint32 CharmInfo::_petnumber
private

Referenced by GetPetNumber(), and SetPetNumber().

◆ _stayX

float CharmInfo::_stayX
private

◆ _stayY

float CharmInfo::_stayY
private

◆ _stayZ

float CharmInfo::_stayZ
private

◆ _unit

◆ PetActionBar