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

#include "Unit.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)
 
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
15724 _isCommandAttack(false), _isCommandFollow(false), _isAtStay(false), _isFollowing(false), _isReturning(false),
15725 _forcedSpellId(0), _stayX(0.0f), _stayY(0.0f), _stayZ(0.0f)
15726{
15727 for (uint8 i = 0; i < MAX_SPELL_CHARM; ++i)
15728 _charmspells[i].SetActionAndType(0, ACT_DISABLED);
15729
15730 if (_unit->GetTypeId() == TYPEID_UNIT)
15731 {
15734 }
15735}
std::uint8_t uint8
Definition: Define.h:110
@ TYPEID_UNIT
Definition: ObjectGuid.h:37
#define MAX_SPELL_CHARM
Definition: Unit.h:157
@ REACT_PASSIVE
Definition: Unit.h:1023
@ COMMAND_FOLLOW
Definition: Unit.h:1031
@ ACT_DISABLED
Definition: Unit.h:1014
void SetReactState(ReactStates st)
Definition: Creature.h:89
ReactStates GetReactState() const
Definition: Creature.h:90
TypeID GetTypeId() const
Definition: Object.h:121
Creature * ToCreature()
Definition: Object.h:197
float _stayY
Definition: Unit.h:1171
bool _isAtStay
Definition: Unit.h:1165
float _stayX
Definition: Unit.h:1170
float _stayZ
Definition: Unit.h:1172
bool _isCommandFollow
Definition: Unit.h:1164
CommandStates _CommandState
Definition: Unit.h:1157
int32 _forcedSpellId
Definition: Unit.h:1168
bool _isFollowing
Definition: Unit.h:1166
bool _isCommandAttack
Definition: Unit.h:1163
ReactStates _oldReactState
Definition: Unit.h:1161
bool _isReturning
Definition: Unit.h:1167
Unit * _unit
Definition: Unit.h:1154
uint32 _petnumber
Definition: Unit.h:1158
CharmSpellInfo _charmspells[4]
Definition: Unit.h:1156

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

◆ ~CharmInfo()

CharmInfo::~CharmInfo ( )
15738{
15739}

Member Function Documentation

◆ AddSpellToActionBar()

bool CharmInfo::AddSpellToActionBar ( SpellInfo const *  spellInfo,
ActiveStates  newstate = ACT_DECIDE 
)
15861{
15862 uint32 spell_id = spellInfo->Id;
15863 uint32 first_id = spellInfo->GetFirstRankSpell()->Id;
15864
15865 // new spell rank can be already listed
15866 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
15867 {
15868 if (uint32 action = PetActionBar[i].GetAction())
15869 {
15870 if (PetActionBar[i].IsActionBarForSpell() && sSpellMgr->GetFirstSpellInChain(action) == first_id)
15871 {
15872 PetActionBar[i].SetAction(spell_id);
15873 return true;
15874 }
15875 }
15876 }
15877
15878 // or use empty slot in other case
15879 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
15880 {
15881 if (!PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
15882 {
15883 SetActionBar(i, spell_id, newstate == ACT_DECIDE ? spellInfo->IsAutocastable() ? ACT_DISABLED : ACT_PASSIVE : newstate);
15884
15885 if (_unit->GetCharmer() && _unit->GetCharmer()->IsPlayer())
15886 {
15887 if (Creature* creature = _unit->ToCreature())
15888 {
15889 // Processing this packet needs to be delayed
15890 _unit->m_Events.AddEventAtOffset([creature, spell_id]()
15891 {
15892 if (uint32 cooldown = creature->GetSpellCooldown(spell_id))
15893 {
15894 WorldPacket data;
15895 creature->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spell_id, cooldown);
15896 if (creature->GetCharmer() && creature->GetCharmer()->IsPlayer())
15897 {
15898 creature->GetCharmer()->ToPlayer()->SendDirectMessage(&data);
15899 }
15900 }
15901 }, 500ms);
15902 }
15903 }
15904
15905 return true;
15906 }
15907 }
15908 return false;
15909}
std::uint32_t uint32
Definition: Define.h:108
#define MAX_UNIT_ACTION_BAR_INDEX
Definition: Unit.h:1091
@ ACT_DECIDE
Definition: Unit.h:1018
@ ACT_PASSIVE
Definition: Unit.h:1013
#define sSpellMgr
Definition: SpellMgr.h:818
void AddEventAtOffset(BasicEvent *event, Milliseconds offset)
Definition: EventProcessor.h:109
Definition: Creature.h:46
bool IsPlayer() const
Definition: Object.h:194
void SetAction(uint32 action)
Definition: Unit.h:1065
void SetActionBar(uint8 index, uint32 spellOrAction, ActiveStates type)
Definition: Unit.h:1117
UnitActionBarEntry PetActionBar[MAX_UNIT_ACTION_BAR_INDEX]
Definition: Unit.h:1155
Unit * GetCharmer() const
Definition: Unit.cpp:10568
EventProcessor m_Events
Definition: Unit.h:2094

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)
15986{
15987 for (uint32 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
15988 *data << uint32(PetActionBar[i].packedData);
15989}

References MAX_UNIT_ACTION_BAR_INDEX, and PetActionBar.

Referenced by Player::CharmSpellInitialize(), Player::PetSpellInitialize(), and Player::PossessSpellInitialize().

◆ GetActionBarEntry()

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

◆ GetCharmSpell()

CharmSpellInfo * CharmInfo::GetCharmSpell ( uint8  index)
inline
1125{ 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
1147{ return _forcedTargetGUID; }
ObjectGuid _forcedTargetGUID
Definition: Unit.h:1169

References _forcedTargetGUID.

Referenced by PetAI::UpdateAI().

◆ GetGlobalCooldownMgr()

GlobalCooldownMgr & CharmInfo::GetGlobalCooldownMgr ( )
inline

◆ GetPetNumber()

◆ GetPlayerReactState()

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

References _oldReactState.

Referenced by Player::UpdateCharmedAI().

◆ GetStayPosition()

void CharmInfo::GetStayPosition ( float &  x,
float &  y,
float &  z 
)
20541{
20542 x = _stayX;
20543 y = _stayY;
20544 z = _stayZ;
20545}

References _stayX, _stayY, and _stayZ.

Referenced by PetAI::HandleReturnMovement().

◆ HasCommandState()

bool CharmInfo::HasCommandState ( CommandStates  state) const
inline

◆ HasStayPosition()

bool CharmInfo::HasStayPosition ( )
20555{
20556 return _stayX && _stayY && _stayZ;
20557}

References _stayX, _stayY, and _stayZ.

Referenced by PetAI::HandleReturnMovement().

◆ InitCharmCreateSpells()

void CharmInfo::InitCharmCreateSpells ( )
15809{
15811
15812 if (_unit->GetTypeId() == TYPEID_PLAYER) // charmed players don't have spells
15813 {
15814 //InitEmptyActionBar();
15815 return;
15816 }
15817
15818 //InitPetActionBar();
15819
15820 for (uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
15821 {
15822 uint32 spellId = _unit->ToCreature()->m_spells[x];
15823 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
15824
15825 if (!spellInfo)
15826 {
15828 continue;
15829 }
15830
15831 if (spellInfo->IsPassive())
15832 {
15833 _unit->CastSpell(_unit, spellInfo, true);
15835 }
15836 else
15837 {
15839
15840 ActiveStates newstate = ACT_PASSIVE;
15841
15842 if (!spellInfo->IsAutocastable())
15843 newstate = ACT_PASSIVE;
15844 else
15845 {
15846 if (spellInfo->NeedsExplicitUnitTarget())
15847 {
15848 newstate = ACT_ENABLED;
15849 ToggleCreatureAutocast(spellInfo, true);
15850 }
15851 else
15852 newstate = ACT_DISABLED;
15853 }
15854
15855 AddSpellToActionBar(spellInfo, newstate);
15856 }
15857 }
15858}
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
ActiveStates
Definition: Unit.h:1012
@ ACT_ENABLED
Definition: Unit.h:1015
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition: Creature.h:242
void SetActionAndType(uint32 action, ActiveStates type)
Definition: Unit.h:1055
bool AddSpellToActionBar(SpellInfo const *spellInfo, ActiveStates newstate=ACT_DECIDE)
Definition: Unit.cpp:15860
void InitPetActionBar()
Definition: Unit.cpp:15747
void ToggleCreatureAutocast(SpellInfo const *spellInfo, bool apply)
Definition: Unit.cpp:15930
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:1169
Definition: SpellInfo.h:314
bool IsAutocastable() const
Definition: SpellInfo.cpp:1087
bool IsPassive() const
Definition: SpellInfo.cpp:1082
bool NeedsExplicitUnitTarget() const
Definition: SpellInfo.cpp:1017

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

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

◆ InitEmptyActionBar()

void CharmInfo::InitEmptyActionBar ( bool  withAttack = true)
15763{
15764 if (withAttack)
15766 else
15768 for (uint32 x = ACTION_BAR_INDEX_START + 1; x < ACTION_BAR_INDEX_END; ++x)
15770}
@ ACTION_BAR_INDEX_END
Definition: Unit.h:1088
@ ACTION_BAR_INDEX_START
Definition: Unit.h:1085
@ COMMAND_ATTACK
Definition: Unit.h:1032
@ ACT_COMMAND
Definition: Unit.h:1016

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

Referenced by InitPossessCreateSpells().

◆ InitPetActionBar()

void CharmInfo::InitPetActionBar ( )
15748{
15749 // the first 3 SpellOrActions are attack, follow and stay
15752
15753 // middle 4 SpellOrActions are spells/special attacks/abilities
15756
15757 // last 3 SpellOrActions are reactions
15760}
@ ACTION_BAR_INDEX_PET_SPELL_START
Definition: Unit.h:1086
@ ACTION_BAR_INDEX_PET_SPELL_END
Definition: Unit.h:1087
@ ACT_REACTION
Definition: Unit.h:1017

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 ( )
15773{
15774 if (_unit->GetTypeId() == TYPEID_UNIT)
15775 {
15776 // Adding switch until better way is found. Malcrom
15777 // Adding entrys to this switch will prevent COMMAND_ATTACK being added to pet bar.
15778 switch (_unit->GetEntry())
15779 {
15780 case 23575: // Mindless Abomination
15781 case 24783: // Trained Rock Falcon
15782 case 27664: // Crashin' Thrashin' Racer
15783 case 40281: // Crashin' Thrashin' Racer
15784 case 23109: // Vengeful Spirit
15785 break;
15786 default:
15788 break;
15789 }
15790
15791 for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
15792 {
15793 uint32 spellId = _unit->ToCreature()->m_spells[i];
15794 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
15795 if (spellInfo)
15796 {
15797 if (spellInfo->IsPassive())
15798 _unit->CastSpell(_unit, spellInfo, true);
15799 else
15800 AddSpellToActionBar(spellInfo, ACT_PASSIVE);
15801 }
15802 }
15803 }
15804 else
15806}
static constexpr uint32 MAX_CREATURE_SPELLS
Definition: Unit.h:153
uint32 GetEntry() const
Definition: Object.h:109
void InitEmptyActionBar(bool withAttack=true)
Definition: Unit.cpp:15762

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

Referenced by Unit::SetCharmedBy().

◆ IsAtStay()

bool CharmInfo::IsAtStay ( )
20565{
20566 return _isAtStay;
20567}

References _isAtStay.

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

◆ IsCommandAttack()

◆ IsCommandFollow()

bool CharmInfo::IsCommandFollow ( )
20513{
20514 return _isCommandFollow;
20515}

References _isCommandFollow.

Referenced by PetAI::CanAttack().

◆ IsFollowing()

bool CharmInfo::IsFollowing ( )
20575{
20576 return _isFollowing;
20577}

References _isFollowing.

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

◆ IsReturning()

bool CharmInfo::IsReturning ( )

◆ LoadPetActionBar()

void CharmInfo::LoadPetActionBar ( const std::string &  data)
15950{
15951 std::vector<std::string_view> tokens = Acore::Tokenize(data, ' ', false);
15952
15953 if (tokens.size() != (ACTION_BAR_INDEX_END - ACTION_BAR_INDEX_START) * 2)
15954 return; // non critical, will reset to default
15955
15956 auto iter = tokens.begin();
15957 for (uint8 index = ACTION_BAR_INDEX_START; index < ACTION_BAR_INDEX_END; ++index)
15958 {
15959 Optional<uint8> type = Acore::StringTo<uint8>(*(iter++));
15960 Optional<uint32> action = Acore::StringTo<uint32>(*(iter++));
15961
15962 if (!type || !action)
15963 {
15964 continue;
15965 }
15966
15967 PetActionBar[index].SetActionAndType(*action, static_cast<ActiveStates>(*type));
15968
15969 // check correctness
15970 if (PetActionBar[index].IsActionBarForSpell())
15971 {
15972 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(PetActionBar[index].GetAction());
15973 if (!spellInfo)
15974 {
15975 SetActionBar(index, 0, ACT_PASSIVE);
15976 }
15977 else if (!spellInfo->IsAutocastable())
15978 {
15979 SetActionBar(index, PetActionBar[index].GetAction(), ACT_PASSIVE);
15980 }
15981 }
15982 }
15983}
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)
15912{
15913 uint32 first_id = sSpellMgr->GetFirstSpellInChain(spell_id);
15914
15915 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
15916 {
15917 if (uint32 action = PetActionBar[i].GetAction())
15918 {
15919 if (PetActionBar[i].IsActionBarForSpell() && sSpellMgr->GetFirstSpellInChain(action) == first_id)
15920 {
15922 return true;
15923 }
15924 }
15925 }
15926
15927 return false;
15928}

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

Referenced by Pet::removeSpell().

◆ RemoveStayPosition()

void CharmInfo::RemoveStayPosition ( )
20548{
20549 _stayX = 0.0f;
20550 _stayY = 0.0f;
20551 _stayZ = 0.0f;
20552}

References _stayX, _stayY, and _stayZ.

Referenced by WorldSession::HandlePetActionHelper().

◆ RestoreState()

void CharmInfo::RestoreState ( )
15742{
15743 if (Creature* creature = _unit->ToCreature())
15744 creature->SetReactState(_oldReactState);
15745}

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

20518{
20520 G3D::Vector3 stayPos = G3D::Vector3();
20521
20522 if (atCurrentPos)
20523 {
20524 float z = INVALID_HEIGHT;
20526 stayPos = G3D::Vector3(_unit->GetPositionX(), _unit->GetPositionY(), z != INVALID_HEIGHT ? z : _unit->GetPositionZ());
20527 }
20528 else
20529 stayPos = _unit->movespline->FinalDestination();
20530
20532 if (TransportBase* transport = _unit->GetDirectTransport())
20533 transport->CalculatePassengerPosition(stayPos.x, stayPos.y, stayPos.z);
20534
20535 _stayX = stayPos.x;
20536 _stayY = stayPos.y;
20537 _stayZ = stayPos.z;
20538}
#define INVALID_HEIGHT
Definition: Map.h:164
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:2440
TransportBase * GetDirectTransport() const
Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
Definition: Unit.cpp:18935
Definition: VehicleDefines.h:107
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
1102{ _CommandState = st; }

References _CommandState.

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

◆ SetForcedSpell()

void CharmInfo::SetForcedSpell ( uint32  id)
inline

◆ SetForcedTargetGUID()

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

◆ SetIsAtStay()

void CharmInfo::SetIsAtStay ( bool  val)

◆ SetIsCommandAttack()

void CharmInfo::SetIsCommandAttack ( bool  val)

◆ SetIsCommandFollow()

void CharmInfo::SetIsCommandFollow ( bool  val)

◆ SetIsFollowing()

void CharmInfo::SetIsFollowing ( bool  val)

◆ SetIsReturning()

void CharmInfo::SetIsReturning ( bool  val)

◆ SetPetNumber()

void CharmInfo::SetPetNumber ( uint32  petnumber,
bool  statwindow 
)
15941{
15942 _petnumber = petnumber;
15943 if (statwindow)
15945 else
15947}
@ UNIT_FIELD_PETNUMBER
Definition: UpdateFields.h:132
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650

References _petnumber, _unit, Object::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
1150{ _oldReactState = s; }

References _oldReactState.

Referenced by WorldSession::HandlePetActionHelper().

◆ SetSpellAutocast()

void CharmInfo::SetSpellAutocast ( SpellInfo const *  spellInfo,
bool  state 
)
15992{
15993 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
15994 {
15995 if (spellInfo->Id == PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
15996 {
15998 break;
15999 }
16000 }
16001}
bool IsActionBarForSpell() const
Definition: Unit.h:1049
void SetType(ActiveStates type)
Definition: Unit.h:1060
uint32 GetAction() const
Definition: Unit.h:1048

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 
)
15931{
15932 if (spellInfo->IsPassive())
15933 return;
15934
15935 for (uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
15936 if (spellInfo->Id == _charmspells[x].GetAction())
15938}

References _charmspells, ACT_DISABLED, ACT_ENABLED, UnitActionBarEntry::GetAction(), SpellInfo::Id, SpellInfo::IsPassive(), MAX_SPELL_CHARM, and UnitActionBarEntry::SetType().

Referenced by WorldSession::HandlePetSpellAutocastOpcode(), and InitCharmCreateSpells().

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