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
15818 _isCommandAttack(false), _isCommandFollow(false), _isAtStay(false), _isFollowing(false), _isReturning(false),
15819 _forcedSpellId(0), _stayX(0.0f), _stayY(0.0f), _stayZ(0.0f)
15820{
15821 for (uint8 i = 0; i < MAX_SPELL_CHARM; ++i)
15822 _charmspells[i].SetActionAndType(0, ACT_DISABLED);
15823
15824 if (_unit->GetTypeId() == TYPEID_UNIT)
15825 {
15828 }
15829}
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:90
ReactStates GetReactState() const
Definition: Creature.h:91
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 ( )
15832{
15833}

Member Function Documentation

◆ AddSpellToActionBar()

bool CharmInfo::AddSpellToActionBar ( SpellInfo const *  spellInfo,
ActiveStates  newstate = ACT_DECIDE 
)
15955{
15956 uint32 spell_id = spellInfo->Id;
15957 uint32 first_id = spellInfo->GetFirstRankSpell()->Id;
15958
15959 // new spell rank can be already listed
15960 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
15961 {
15962 if (uint32 action = PetActionBar[i].GetAction())
15963 {
15964 if (PetActionBar[i].IsActionBarForSpell() && sSpellMgr->GetFirstSpellInChain(action) == first_id)
15965 {
15966 PetActionBar[i].SetAction(spell_id);
15967 return true;
15968 }
15969 }
15970 }
15971
15972 // or use empty slot in other case
15973 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
15974 {
15975 if (!PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
15976 {
15977 SetActionBar(i, spell_id, newstate == ACT_DECIDE ? spellInfo->IsAutocastable() ? ACT_DISABLED : ACT_PASSIVE : newstate);
15978
15979 if (_unit->GetCharmer() && _unit->GetCharmer()->IsPlayer())
15980 {
15981 if (Creature* creature = _unit->ToCreature())
15982 {
15983 // Processing this packet needs to be delayed
15984 _unit->m_Events.AddEventAtOffset([creature, spell_id]()
15985 {
15986 if (uint32 cooldown = creature->GetSpellCooldown(spell_id))
15987 {
15988 WorldPacket data;
15989 creature->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spell_id, cooldown);
15990 if (creature->GetCharmer() && creature->GetCharmer()->IsPlayer())
15991 {
15992 creature->GetCharmer()->ToPlayer()->SendDirectMessage(&data);
15993 }
15994 }
15995 }, 500ms);
15996 }
15997 }
15998
15999 return true;
16000 }
16001 }
16002 return false;
16003}
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:108
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:10607
EventProcessor m_Events
Definition: Unit.h:2108

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)
16080{
16081 for (uint32 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
16082 *data << uint32(PetActionBar[i].packedData);
16083}

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 
)
20643{
20644 x = _stayX;
20645 y = _stayY;
20646 z = _stayZ;
20647}

References _stayX, _stayY, and _stayZ.

Referenced by PetAI::HandleReturnMovement().

◆ HasCommandState()

bool CharmInfo::HasCommandState ( CommandStates  state) const
inline

◆ HasStayPosition()

bool CharmInfo::HasStayPosition ( )
20657{
20658 return _stayX && _stayY && _stayZ;
20659}

References _stayX, _stayY, and _stayZ.

Referenced by PetAI::HandleReturnMovement().

◆ InitCharmCreateSpells()

void CharmInfo::InitCharmCreateSpells ( )
15903{
15905
15906 if (_unit->GetTypeId() == TYPEID_PLAYER) // charmed players don't have spells
15907 {
15908 //InitEmptyActionBar();
15909 return;
15910 }
15911
15912 //InitPetActionBar();
15913
15914 for (uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
15915 {
15916 uint32 spellId = _unit->ToCreature()->m_spells[x];
15917 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
15918
15919 if (!spellInfo)
15920 {
15922 continue;
15923 }
15924
15925 if (spellInfo->IsPassive())
15926 {
15927 _unit->CastSpell(_unit, spellInfo, true);
15929 }
15930 else
15931 {
15933
15934 ActiveStates newstate = ACT_PASSIVE;
15935
15936 if (!spellInfo->IsAutocastable())
15937 newstate = ACT_PASSIVE;
15938 else
15939 {
15940 if (spellInfo->NeedsExplicitUnitTarget())
15941 {
15942 newstate = ACT_ENABLED;
15943 ToggleCreatureAutocast(spellInfo, true);
15944 }
15945 else
15946 newstate = ACT_DISABLED;
15947 }
15948
15949 AddSpellToActionBar(spellInfo, newstate);
15950 }
15951 }
15952}
@ 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:244
void SetActionAndType(uint32 action, ActiveStates type)
Definition: Unit.h:1067
bool AddSpellToActionBar(SpellInfo const *spellInfo, ActiveStates newstate=ACT_DECIDE)
Definition: Unit.cpp:15954
void InitPetActionBar()
Definition: Unit.cpp:15841
void ToggleCreatureAutocast(SpellInfo const *spellInfo, bool apply)
Definition: Unit.cpp:16024
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:1090
bool IsPassive() const
Definition: SpellInfo.cpp:1085
bool NeedsExplicitUnitTarget() const
Definition: SpellInfo.cpp:1020

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)
15857{
15858 if (withAttack)
15860 else
15862 for (uint32 x = ACTION_BAR_INDEX_START + 1; x < ACTION_BAR_INDEX_END; ++x)
15864}
@ 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 ( )
15842{
15843 // the first 3 SpellOrActions are attack, follow and stay
15846
15847 // middle 4 SpellOrActions are spells/special attacks/abilities
15850
15851 // last 3 SpellOrActions are reactions
15854}
@ 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 ( )
15867{
15868 if (_unit->GetTypeId() == TYPEID_UNIT)
15869 {
15870 // Adding switch until better way is found. Malcrom
15871 // Adding entrys to this switch will prevent COMMAND_ATTACK being added to pet bar.
15872 switch (_unit->GetEntry())
15873 {
15874 case 23575: // Mindless Abomination
15875 case 24783: // Trained Rock Falcon
15876 case 27664: // Crashin' Thrashin' Racer
15877 case 40281: // Crashin' Thrashin' Racer
15878 case 23109: // Vengeful Spirit
15879 break;
15880 default:
15882 break;
15883 }
15884
15885 for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
15886 {
15887 uint32 spellId = _unit->ToCreature()->m_spells[i];
15888 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
15889 if (spellInfo)
15890 {
15891 if (spellInfo->IsPassive())
15892 _unit->CastSpell(_unit, spellInfo, true);
15893 else
15894 AddSpellToActionBar(spellInfo, ACT_PASSIVE);
15895 }
15896 }
15897 }
15898 else
15900}
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:15856

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 ( )
20667{
20668 return _isAtStay;
20669}

References _isAtStay.

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

◆ IsCommandAttack()

◆ IsCommandFollow()

bool CharmInfo::IsCommandFollow ( )
20615{
20616 return _isCommandFollow;
20617}

References _isCommandFollow.

Referenced by PetAI::CanAttack().

◆ IsFollowing()

bool CharmInfo::IsFollowing ( )
20677{
20678 return _isFollowing;
20679}

References _isFollowing.

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

◆ IsReturning()

bool CharmInfo::IsReturning ( )

◆ LoadPetActionBar()

void CharmInfo::LoadPetActionBar ( const std::string &  data)
16044{
16045 std::vector<std::string_view> tokens = Acore::Tokenize(data, ' ', false);
16046
16047 if (tokens.size() != (ACTION_BAR_INDEX_END - ACTION_BAR_INDEX_START) * 2)
16048 return; // non critical, will reset to default
16049
16050 auto iter = tokens.begin();
16051 for (uint8 index = ACTION_BAR_INDEX_START; index < ACTION_BAR_INDEX_END; ++index)
16052 {
16053 Optional<uint8> type = Acore::StringTo<uint8>(*(iter++));
16054 Optional<uint32> action = Acore::StringTo<uint32>(*(iter++));
16055
16056 if (!type || !action)
16057 {
16058 continue;
16059 }
16060
16061 PetActionBar[index].SetActionAndType(*action, static_cast<ActiveStates>(*type));
16062
16063 // check correctness
16064 if (PetActionBar[index].IsActionBarForSpell())
16065 {
16066 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(PetActionBar[index].GetAction());
16067 if (!spellInfo)
16068 {
16069 SetActionBar(index, 0, ACT_PASSIVE);
16070 }
16071 else if (!spellInfo->IsAutocastable())
16072 {
16073 SetActionBar(index, PetActionBar[index].GetAction(), ACT_PASSIVE);
16074 }
16075 }
16076 }
16077}
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)
16006{
16007 uint32 first_id = sSpellMgr->GetFirstSpellInChain(spell_id);
16008
16009 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
16010 {
16011 if (uint32 action = PetActionBar[i].GetAction())
16012 {
16013 if (PetActionBar[i].IsActionBarForSpell() && sSpellMgr->GetFirstSpellInChain(action) == first_id)
16014 {
16016 return true;
16017 }
16018 }
16019 }
16020
16021 return false;
16022}

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

Referenced by Pet::removeSpell().

◆ RemoveStayPosition()

void CharmInfo::RemoveStayPosition ( )
20650{
20651 _stayX = 0.0f;
20652 _stayY = 0.0f;
20653 _stayZ = 0.0f;
20654}

References _stayX, _stayY, and _stayZ.

Referenced by WorldSession::HandlePetActionHelper().

◆ RestoreState()

void CharmInfo::RestoreState ( )
15836{
15837 if (Creature* creature = _unit->ToCreature())
15838 creature->SetReactState(_oldReactState);
15839}

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

20620{
20622 G3D::Vector3 stayPos = G3D::Vector3();
20623
20624 if (atCurrentPos)
20625 {
20626 float z = INVALID_HEIGHT;
20628 stayPos = G3D::Vector3(_unit->GetPositionX(), _unit->GetPositionY(), z != INVALID_HEIGHT ? z : _unit->GetPositionZ());
20629 }
20630 else
20631 stayPos = _unit->movespline->FinalDestination();
20632
20634 if (TransportBase* transport = _unit->GetDirectTransport())
20635 transport->CalculatePassengerPosition(stayPos.x, stayPos.y, stayPos.z);
20636
20637 _stayX = stayPos.x;
20638 _stayY = stayPos.y;
20639 _stayZ = stayPos.z;
20640}
#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:2454
TransportBase * GetDirectTransport() const
Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
Definition: Unit.cpp:19031
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 
)
16035{
16036 _petnumber = petnumber;
16037 if (statwindow)
16039 else
16041}
@ 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 
)
16086{
16087 for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
16088 {
16089 if (spellInfo->Id == PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
16090 {
16092 break;
16093 }
16094 }
16095}
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 
)
16025{
16026 if (spellInfo->IsPassive())
16027 return;
16028
16029 for (uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
16030 if (spellInfo->Id == _charmspells[x].GetAction())
16032}

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