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
#define MAX_SPELL_CHARM
Definition: CharmInfo.h:24
@ ACT_DISABLED
Definition: CharmInfo.h:62
@ REACT_PASSIVE
Definition: Unit.h:548
@ COMMAND_FOLLOW
Definition: Unit.h:556
ReactStates GetReactState() const
Definition: Creature.h:95
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition: Creature.h:94
bool IsCreature() const
Definition: Object.h:204
Creature * ToCreature()
Definition: Object.h:205
float _stayY
Definition: CharmInfo.h:204
bool _isAtStay
Definition: CharmInfo.h:198
float _stayX
Definition: CharmInfo.h:203
float _stayZ
Definition: CharmInfo.h:205
bool _isCommandFollow
Definition: CharmInfo.h:197
CommandStates _CommandState
Definition: CharmInfo.h:190
int32 _forcedSpellId
Definition: CharmInfo.h:201
bool _isFollowing
Definition: CharmInfo.h:199
bool _isCommandAttack
Definition: CharmInfo.h:196
ReactStates _oldReactState
Definition: CharmInfo.h:194
bool _isReturning
Definition: CharmInfo.h:200
Unit * _unit
Definition: CharmInfo.h:187
uint32 _petnumber
Definition: CharmInfo.h:191
CharmSpellInfo _charmspells[4]
Definition: CharmInfo.h:189

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 
)
146{
147 uint32 spell_id = 0;
148 uint32 first_id = 0;
149 bool autocastable = false;
150
151 if (spellInfo)
152 {
153 spell_id = spellInfo->Id;
154 first_id = spellInfo->GetFirstRankSpell()->Id;
155 if (spellInfo->IsAutocastable())
156 autocastable = true;
157 }
158
159 // new spell rank can be already listed
160 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
161 {
162 if (uint32 action = PetActionBar[i].GetAction())
163 {
164 if (PetActionBar[i].IsActionBarForSpell() && sSpellMgr->GetFirstSpellInChain(action) == first_id)
165 {
166 PetActionBar[i].SetAction(spell_id);
167 return true;
168 }
169 }
170 }
171
172 // or use empty slot in other case
173 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
174 {
175 if (!PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
176 {
177 if (i != index && index <= MAX_UNIT_ACTION_BAR_INDEX)
178 continue;
179
180 if (!spell_id && index == ACTION_BAR_INDEX_START)
182 else
183 SetActionBar(i, spell_id, newstate == ACT_DECIDE ? autocastable ? ACT_DISABLED : ACT_PASSIVE : newstate);
184
185 if (_unit->GetCharmer() && _unit->GetCharmer()->IsPlayer())
186 {
187 if (Creature* creature = _unit->ToCreature())
188 {
189 // Processing this packet needs to be delayed
190 _unit->m_Events.AddEventAtOffset([creature, spell_id]()
191 {
192 if (uint32 cooldown = creature->GetSpellCooldown(spell_id))
193 {
194 WorldPacket data;
195 creature->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spell_id, cooldown);
196 if (creature->GetCharmer() && creature->GetCharmer()->IsPlayer())
197 {
198 creature->GetCharmer()->ToPlayer()->SendDirectMessage(&data);
199 }
200 }
201 }, 500ms);
202 }
203 }
204
205 return true;
206 }
207 }
208 return false;
209}
std::uint32_t uint32
Definition: Define.h:107
#define sSpellMgr
Definition: SpellMgr.h:825
#define MAX_UNIT_ACTION_BAR_INDEX
Definition: CharmInfo.h:29
@ ACTION_BAR_INDEX_START
Definition: CharmInfo.h:53
@ ACT_DECIDE
Definition: CharmInfo.h:66
@ ACT_COMMAND
Definition: CharmInfo.h:64
@ ACT_PASSIVE
Definition: CharmInfo.h:61
@ COMMAND_ATTACK
Definition: Unit.h:557
void AddEventAtOffset(BasicEvent *event, Milliseconds offset)
Definition: EventProcessor.h:107
Definition: Creature.h:43
bool IsPlayer() const
Definition: Object.h:200
EventProcessor m_Events
Definition: Object.h:642
void SetAction(uint32 action)
Definition: CharmInfo.h:119
void SetActionBar(uint8 index, uint32 spellOrAction, ActiveStates type)
Definition: CharmInfo.h:150
UnitActionBarEntry PetActionBar[MAX_UNIT_ACTION_BAR_INDEX]
Definition: CharmInfo.h:188
Unit * GetCharmer() const
Definition: Unit.cpp:10608

References _unit, ACT_COMMAND, ACT_DECIDE, ACT_DISABLED, ACT_PASSIVE, ACTION_BAR_INDEX_START, EventProcessor::AddEventAtOffset(), COMMAND_ATTACK, Unit::GetCharmer(), SpellInfo::GetFirstRankSpell(), SpellInfo::Id, SpellInfo::IsAutocastable(), Object::IsPlayer(), WorldObject::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
158{ 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
180{ return _forcedTargetGUID; }
ObjectGuid _forcedTargetGUID
Definition: CharmInfo.h:202

References _forcedTargetGUID.

Referenced by PetAI::UpdateAI().

◆ GetGlobalCooldownMgr()

GlobalCooldownMgr & CharmInfo::GetGlobalCooldownMgr ( )
inline

◆ GetPetNumber()

◆ GetPlayerReactState()

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

References _oldReactState.

Referenced by Player::UpdateCharmedAI().

◆ GetStayPosition()

void CharmInfo::GetStayPosition ( float &  x,
float &  y,
float &  z 
)
347{
348 x = _stayX;
349 y = _stayY;
350 z = _stayZ;
351}

References _stayX, _stayY, and _stayZ.

Referenced by PetAI::HandleReturnMovement().

◆ HasCommandState()

bool CharmInfo::HasCommandState ( CommandStates  state) const
inline

◆ HasStayPosition()

bool CharmInfo::HasStayPosition ( )
361{
362 return _stayX && _stayY && _stayZ;
363}

References _stayX, _stayY, and _stayZ.

Referenced by PetAI::HandleReturnMovement().

◆ InitCharmCreateSpells()

void CharmInfo::InitCharmCreateSpells ( )
99{
101
102 if (_unit->IsPlayer()) // charmed players don't have spells
103 return;
104
105 for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i)
106 {
107 uint32 spellId = _unit->ToCreature()->m_spells[i];
108 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
109
110 if (!spellInfo)
111 {
113 continue;
114 }
115
116 if (spellInfo->IsPassive())
117 {
118 _unit->CastSpell(_unit, spellInfo, true);
120 }
121 else
122 {
124
125 ActiveStates newstate = ACT_PASSIVE;
126
127 if (!spellInfo->IsAutocastable())
128 newstate = ACT_PASSIVE;
129 else
130 {
131 if (spellInfo->NeedsExplicitUnitTarget())
132 {
133 newstate = ACT_ENABLED;
134 ToggleCreatureAutocast(spellInfo, true);
135 }
136 else
137 newstate = ACT_DISABLED;
138 }
139
140 AddSpellToActionBar(spellInfo, newstate);
141 }
142 }
143}
ActiveStates
Definition: CharmInfo.h:60
@ ACT_ENABLED
Definition: CharmInfo.h:63
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition: Creature.h:250
void SetActionAndType(uint32 action, ActiveStates type)
Definition: CharmInfo.h:109
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:145
void ToggleCreatureAutocast(SpellInfo const *spellInfo, bool apply)
Definition: CharmInfo.cpp:230
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:1167
Definition: SpellInfo.h:316
bool IsAutocastable() const
Definition: SpellInfo.cpp:1103
bool IsPassive() const
Definition: SpellInfo.cpp:1098
bool NeedsExplicitUnitTarget() const
Definition: SpellInfo.cpp:1033

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)

◆ 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:54
@ ACTION_BAR_INDEX_PET_SPELL_END
Definition: CharmInfo.h:55
@ ACT_REACTION
Definition: CharmInfo.h:65

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 InitEmptyActionBar(false);
82
83 for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
84 {
85 uint32 spellId = _unit->ToCreature()->m_spells[i];
86 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
87 if (spellInfo)
88 if (spellInfo->IsPassive())
89 _unit->CastSpell(_unit, spellInfo, true);
90
91 AddSpellToActionBar(spellInfo, ACT_PASSIVE, i);
92 }
93 }
94 else
96}
static constexpr uint32 MAX_CREATURE_SPELLS
Definition: Unit.h:45
void InitEmptyActionBar(bool withAttack=true)
Definition: CharmInfo.cpp:67

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

Referenced by Unit::SetCharmedBy().

◆ IsAtStay()

bool CharmInfo::IsAtStay ( )
371{
372 return _isAtStay;
373}

References _isAtStay.

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

◆ IsCommandAttack()

◆ IsCommandFollow()

bool CharmInfo::IsCommandFollow ( )
319{
320 return _isCommandFollow;
321}

References _isCommandFollow.

Referenced by PetAI::CanAttack().

◆ IsFollowing()

bool CharmInfo::IsFollowing ( )
381{
382 return _isFollowing;
383}

References _isFollowing.

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

◆ IsReturning()

bool CharmInfo::IsReturning ( )

◆ LoadPetActionBar()

void CharmInfo::LoadPetActionBar ( const std::string &  data)
250{
251 std::vector<std::string_view> tokens = Acore::Tokenize(data, ' ', false);
252
253 if (tokens.size() != (ACTION_BAR_INDEX_END - ACTION_BAR_INDEX_START) * 2)
254 return; // non critical, will reset to default
255
256 auto iter = tokens.begin();
257 for (uint8 index = ACTION_BAR_INDEX_START; index < ACTION_BAR_INDEX_END; ++index)
258 {
259 Optional<uint8> type = Acore::StringTo<uint8>(*(iter++));
260 Optional<uint32> action = Acore::StringTo<uint32>(*(iter++));
261
262 if (!type || !action)
263 {
264 continue;
265 }
266
267 PetActionBar[index].SetActionAndType(*action, static_cast<ActiveStates>(*type));
268
269 // check correctness
270 if (PetActionBar[index].IsActionBarForSpell())
271 {
272 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(PetActionBar[index].GetAction());
273 if (!spellInfo)
274 {
275 SetActionBar(index, 0, ACT_PASSIVE);
276 }
277 else if (!spellInfo->IsAutocastable())
278 {
279 SetActionBar(index, PetActionBar[index].GetAction(), ACT_PASSIVE);
280 }
281 }
282 }
283}
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)
212{
213 uint32 first_id = sSpellMgr->GetFirstSpellInChain(spell_id);
214
215 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
216 {
217 if (uint32 action = PetActionBar[i].GetAction())
218 {
219 if (PetActionBar[i].IsActionBarForSpell() && sSpellMgr->GetFirstSpellInChain(action) == first_id)
220 {
222 return true;
223 }
224 }
225 }
226
227 return false;
228}

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

Referenced by Pet::removeSpell().

◆ RemoveStayPosition()

void CharmInfo::RemoveStayPosition ( )
354{
355 _stayX = 0.0f;
356 _stayY = 0.0f;
357 _stayZ = 0.0f;
358}

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()

324{
326 G3D::Vector3 stayPos = G3D::Vector3();
327
328 if (atCurrentPos)
329 {
330 float z = INVALID_HEIGHT;
332 stayPos = G3D::Vector3(_unit->GetPositionX(), _unit->GetPositionY(), z != INVALID_HEIGHT ? z : _unit->GetPositionZ());
333 }
334 else
335 stayPos = _unit->movespline->FinalDestination();
336
338 if (TransportBase* transport = _unit->GetDirectTransport())
339 transport->CalculatePassengerPosition(stayPos.x, stayPos.y, stayPos.z);
340
341 _stayX = stayPos.x;
342 _stayY = stayPos.y;
343 _stayZ = stayPos.z;
344}
#define INVALID_HEIGHT
Definition: Map.h:163
void UpdateAllowedPositionZ(float x, float y, float &z, float *groundZ=nullptr) const
Definition: Object.cpp:1565
float GetPositionZ() const
Definition: Position.h:118
float GetPositionX() const
Definition: Position.h:116
float GetPositionY() const
Definition: Position.h:117
Movement::MoveSpline * movespline
Definition: Unit.h:1979
TransportBase * GetDirectTransport() const
Definition: Unit.cpp:18767
Definition: VehicleDefines.h:130
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 
)
241{
242 _petnumber = petnumber;
243 if (statwindow)
245 else
247}
@ UNIT_FIELD_PETNUMBER
Definition: UpdateFields.h:132
void SetUInt32Value(uint16 index, uint32 value)
Definition: Unit.cpp:21316

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 
)
292{
293 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
294 {
295 if (spellInfo->Id == PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
296 {
298 break;
299 }
300 }
301}
bool IsActionBarForSpell() const
Definition: CharmInfo.h:103
void SetType(ActiveStates type)
Definition: CharmInfo.h:114
uint32 GetAction() const
Definition: CharmInfo.h:102

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