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
15802 _isCommandAttack(false), _isCommandFollow(false), _isAtStay(false), _isFollowing(false), _isReturning(false),
15803 _forcedSpellId(0), _stayX(0.0f), _stayY(0.0f), _stayZ(0.0f)
15804{
15805 for (uint8 i = 0; i < MAX_SPELL_CHARM; ++i)
15806 _charmspells[i].SetActionAndType(0, ACT_DISABLED);
15807
15808 if (_unit->GetTypeId() == TYPEID_UNIT)
15809 {
15812 }
15813}
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:1035
@ COMMAND_FOLLOW
Definition: Unit.h:1043
@ ACT_DISABLED
Definition: Unit.h:1026
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:1183
bool _isAtStay
Definition: Unit.h:1177
float _stayX
Definition: Unit.h:1182
float _stayZ
Definition: Unit.h:1184
bool _isCommandFollow
Definition: Unit.h:1176
CommandStates _CommandState
Definition: Unit.h:1169
int32 _forcedSpellId
Definition: Unit.h:1180
bool _isFollowing
Definition: Unit.h:1178
bool _isCommandAttack
Definition: Unit.h:1175
ReactStates _oldReactState
Definition: Unit.h:1173
bool _isReturning
Definition: Unit.h:1179
Unit * _unit
Definition: Unit.h:1166
uint32 _petnumber
Definition: Unit.h:1170
CharmSpellInfo _charmspells[4]
Definition: Unit.h:1168

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 ( )
15816{
15817}

Member Function Documentation

◆ AddSpellToActionBar()

bool CharmInfo::AddSpellToActionBar ( SpellInfo const *  spellInfo,
ActiveStates  newstate = ACT_DECIDE 
)
15939{
15940 uint32 spell_id = spellInfo->Id;
15941 uint32 first_id = spellInfo->GetFirstRankSpell()->Id;
15942
15943 // new spell rank can be already listed
15944 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
15945 {
15946 if (uint32 action = PetActionBar[i].GetAction())
15947 {
15948 if (PetActionBar[i].IsActionBarForSpell() && sSpellMgr->GetFirstSpellInChain(action) == first_id)
15949 {
15950 PetActionBar[i].SetAction(spell_id);
15951 return true;
15952 }
15953 }
15954 }
15955
15956 // or use empty slot in other case
15957 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
15958 {
15959 if (!PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
15960 {
15961 SetActionBar(i, spell_id, newstate == ACT_DECIDE ? spellInfo->IsAutocastable() ? ACT_DISABLED : ACT_PASSIVE : newstate);
15962
15963 if (_unit->GetCharmer() && _unit->GetCharmer()->IsPlayer())
15964 {
15965 if (Creature* creature = _unit->ToCreature())
15966 {
15967 // Processing this packet needs to be delayed
15968 _unit->m_Events.AddEventAtOffset([creature, spell_id]()
15969 {
15970 if (uint32 cooldown = creature->GetSpellCooldown(spell_id))
15971 {
15972 WorldPacket data;
15973 creature->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spell_id, cooldown);
15974 if (creature->GetCharmer() && creature->GetCharmer()->IsPlayer())
15975 {
15976 creature->GetCharmer()->ToPlayer()->SendDirectMessage(&data);
15977 }
15978 }
15979 }, 500ms);
15980 }
15981 }
15982
15983 return true;
15984 }
15985 }
15986 return false;
15987}
std::uint32_t uint32
Definition: Define.h:108
#define MAX_UNIT_ACTION_BAR_INDEX
Definition: Unit.h:1103
@ ACT_DECIDE
Definition: Unit.h:1030
@ ACT_PASSIVE
Definition: Unit.h:1025
#define sSpellMgr
Definition: SpellMgr.h:825
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:1077
void SetActionBar(uint8 index, uint32 spellOrAction, ActiveStates type)
Definition: Unit.h:1129
UnitActionBarEntry PetActionBar[MAX_UNIT_ACTION_BAR_INDEX]
Definition: Unit.h:1167
Unit * GetCharmer() const
Definition: Unit.cpp:10599
EventProcessor m_Events
Definition: Unit.h:2106

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)
16064{
16065 for (uint32 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
16066 *data << uint32(PetActionBar[i].packedData);
16067}

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
1137{ 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
1159{ return _forcedTargetGUID; }
ObjectGuid _forcedTargetGUID
Definition: Unit.h:1181

References _forcedTargetGUID.

Referenced by PetAI::UpdateAI().

◆ GetGlobalCooldownMgr()

GlobalCooldownMgr & CharmInfo::GetGlobalCooldownMgr ( )
inline

◆ GetPetNumber()

◆ GetPlayerReactState()

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

References _oldReactState.

Referenced by Player::UpdateCharmedAI().

◆ GetStayPosition()

void CharmInfo::GetStayPosition ( float &  x,
float &  y,
float &  z 
)
20627{
20628 x = _stayX;
20629 y = _stayY;
20630 z = _stayZ;
20631}

References _stayX, _stayY, and _stayZ.

Referenced by PetAI::HandleReturnMovement().

◆ HasCommandState()

bool CharmInfo::HasCommandState ( CommandStates  state) const
inline

◆ HasStayPosition()

bool CharmInfo::HasStayPosition ( )
20641{
20642 return _stayX && _stayY && _stayZ;
20643}

References _stayX, _stayY, and _stayZ.

Referenced by PetAI::HandleReturnMovement().

◆ InitCharmCreateSpells()

void CharmInfo::InitCharmCreateSpells ( )
15887{
15889
15890 if (_unit->GetTypeId() == TYPEID_PLAYER) // charmed players don't have spells
15891 {
15892 //InitEmptyActionBar();
15893 return;
15894 }
15895
15896 //InitPetActionBar();
15897
15898 for (uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
15899 {
15900 uint32 spellId = _unit->ToCreature()->m_spells[x];
15901 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
15902
15903 if (!spellInfo)
15904 {
15906 continue;
15907 }
15908
15909 if (spellInfo->IsPassive())
15910 {
15911 _unit->CastSpell(_unit, spellInfo, true);
15913 }
15914 else
15915 {
15917
15918 ActiveStates newstate = ACT_PASSIVE;
15919
15920 if (!spellInfo->IsAutocastable())
15921 newstate = ACT_PASSIVE;
15922 else
15923 {
15924 if (spellInfo->NeedsExplicitUnitTarget())
15925 {
15926 newstate = ACT_ENABLED;
15927 ToggleCreatureAutocast(spellInfo, true);
15928 }
15929 else
15930 newstate = ACT_DISABLED;
15931 }
15932
15933 AddSpellToActionBar(spellInfo, newstate);
15934 }
15935 }
15936}
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
ActiveStates
Definition: Unit.h:1024
@ ACT_ENABLED
Definition: Unit.h:1027
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition: Creature.h:242
void SetActionAndType(uint32 action, ActiveStates type)
Definition: Unit.h:1067
bool AddSpellToActionBar(SpellInfo const *spellInfo, ActiveStates newstate=ACT_DECIDE)
Definition: Unit.cpp:15938
void InitPetActionBar()
Definition: Unit.cpp:15825
void ToggleCreatureAutocast(SpellInfo const *spellInfo, bool apply)
Definition: Unit.cpp:16008
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)
15841{
15842 if (withAttack)
15844 else
15846 for (uint32 x = ACTION_BAR_INDEX_START + 1; x < ACTION_BAR_INDEX_END; ++x)
15848}
@ ACTION_BAR_INDEX_END
Definition: Unit.h:1100
@ ACTION_BAR_INDEX_START
Definition: Unit.h:1097
@ COMMAND_ATTACK
Definition: Unit.h:1044
@ ACT_COMMAND
Definition: Unit.h:1028

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

Referenced by InitPossessCreateSpells().

◆ InitPetActionBar()

void CharmInfo::InitPetActionBar ( )
15826{
15827 // the first 3 SpellOrActions are attack, follow and stay
15830
15831 // middle 4 SpellOrActions are spells/special attacks/abilities
15834
15835 // last 3 SpellOrActions are reactions
15838}
@ ACTION_BAR_INDEX_PET_SPELL_START
Definition: Unit.h:1098
@ ACTION_BAR_INDEX_PET_SPELL_END
Definition: Unit.h:1099
@ ACT_REACTION
Definition: Unit.h:1029

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 ( )
15851{
15852 if (_unit->GetTypeId() == TYPEID_UNIT)
15853 {
15854 // Adding switch until better way is found. Malcrom
15855 // Adding entrys to this switch will prevent COMMAND_ATTACK being added to pet bar.
15856 switch (_unit->GetEntry())
15857 {
15858 case 23575: // Mindless Abomination
15859 case 24783: // Trained Rock Falcon
15860 case 27664: // Crashin' Thrashin' Racer
15861 case 40281: // Crashin' Thrashin' Racer
15862 case 23109: // Vengeful Spirit
15863 break;
15864 default:
15866 break;
15867 }
15868
15869 for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
15870 {
15871 uint32 spellId = _unit->ToCreature()->m_spells[i];
15872 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
15873 if (spellInfo)
15874 {
15875 if (spellInfo->IsPassive())
15876 _unit->CastSpell(_unit, spellInfo, true);
15877 else
15878 AddSpellToActionBar(spellInfo, ACT_PASSIVE);
15879 }
15880 }
15881 }
15882 else
15884}
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:15840

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 ( )
20651{
20652 return _isAtStay;
20653}

References _isAtStay.

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

◆ IsCommandAttack()

◆ IsCommandFollow()

bool CharmInfo::IsCommandFollow ( )
20599{
20600 return _isCommandFollow;
20601}

References _isCommandFollow.

Referenced by PetAI::CanAttack().

◆ IsFollowing()

bool CharmInfo::IsFollowing ( )
20661{
20662 return _isFollowing;
20663}

References _isFollowing.

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

◆ IsReturning()

bool CharmInfo::IsReturning ( )

◆ LoadPetActionBar()

void CharmInfo::LoadPetActionBar ( const std::string &  data)
16028{
16029 std::vector<std::string_view> tokens = Acore::Tokenize(data, ' ', false);
16030
16031 if (tokens.size() != (ACTION_BAR_INDEX_END - ACTION_BAR_INDEX_START) * 2)
16032 return; // non critical, will reset to default
16033
16034 auto iter = tokens.begin();
16035 for (uint8 index = ACTION_BAR_INDEX_START; index < ACTION_BAR_INDEX_END; ++index)
16036 {
16037 Optional<uint8> type = Acore::StringTo<uint8>(*(iter++));
16038 Optional<uint32> action = Acore::StringTo<uint32>(*(iter++));
16039
16040 if (!type || !action)
16041 {
16042 continue;
16043 }
16044
16045 PetActionBar[index].SetActionAndType(*action, static_cast<ActiveStates>(*type));
16046
16047 // check correctness
16048 if (PetActionBar[index].IsActionBarForSpell())
16049 {
16050 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(PetActionBar[index].GetAction());
16051 if (!spellInfo)
16052 {
16053 SetActionBar(index, 0, ACT_PASSIVE);
16054 }
16055 else if (!spellInfo->IsAutocastable())
16056 {
16057 SetActionBar(index, PetActionBar[index].GetAction(), ACT_PASSIVE);
16058 }
16059 }
16060 }
16061}
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)
15990{
15991 uint32 first_id = sSpellMgr->GetFirstSpellInChain(spell_id);
15992
15993 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
15994 {
15995 if (uint32 action = PetActionBar[i].GetAction())
15996 {
15997 if (PetActionBar[i].IsActionBarForSpell() && sSpellMgr->GetFirstSpellInChain(action) == first_id)
15998 {
16000 return true;
16001 }
16002 }
16003 }
16004
16005 return false;
16006}

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

Referenced by Pet::removeSpell().

◆ RemoveStayPosition()

void CharmInfo::RemoveStayPosition ( )
20634{
20635 _stayX = 0.0f;
20636 _stayY = 0.0f;
20637 _stayZ = 0.0f;
20638}

References _stayX, _stayY, and _stayZ.

Referenced by WorldSession::HandlePetActionHelper().

◆ RestoreState()

void CharmInfo::RestoreState ( )
15820{
15821 if (Creature* creature = _unit->ToCreature())
15822 creature->SetReactState(_oldReactState);
15823}

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

20604{
20606 G3D::Vector3 stayPos = G3D::Vector3();
20607
20608 if (atCurrentPos)
20609 {
20610 float z = INVALID_HEIGHT;
20612 stayPos = G3D::Vector3(_unit->GetPositionX(), _unit->GetPositionY(), z != INVALID_HEIGHT ? z : _unit->GetPositionZ());
20613 }
20614 else
20615 stayPos = _unit->movespline->FinalDestination();
20616
20618 if (TransportBase* transport = _unit->GetDirectTransport())
20619 transport->CalculatePassengerPosition(stayPos.x, stayPos.y, stayPos.z);
20620
20621 _stayX = stayPos.x;
20622 _stayY = stayPos.y;
20623 _stayZ = stayPos.z;
20624}
#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:2452
TransportBase * GetDirectTransport() const
Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
Definition: Unit.cpp:19015
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
1114{ _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 
)
16019{
16020 _petnumber = petnumber;
16021 if (statwindow)
16023 else
16025}
@ 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
1162{ _oldReactState = s; }

References _oldReactState.

Referenced by WorldSession::HandlePetActionHelper().

◆ SetSpellAutocast()

void CharmInfo::SetSpellAutocast ( SpellInfo const *  spellInfo,
bool  state 
)
16070{
16071 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
16072 {
16073 if (spellInfo->Id == PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
16074 {
16076 break;
16077 }
16078 }
16079}
bool IsActionBarForSpell() const
Definition: Unit.h:1061
void SetType(ActiveStates type)
Definition: Unit.h:1072
uint32 GetAction() const
Definition: Unit.h:1060

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 
)
16009{
16010 if (spellInfo->IsPassive())
16011 return;
16012
16013 for (uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
16014 if (spellInfo->Id == _charmspells[x].GetAction())
16016}

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