diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 38c5bc5a9..b9ce2442a 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1782,6 +1782,18 @@ bool Creature::IsVisibleInGridForPlayer(Player* pl) const return false; } +void Creature::SendAIReaction(AiReaction reactionType) +{ + WorldPacket data(SMSG_AI_REACTION, 12); + + data << uint64(GetGUID()); + data << uint32(reactionType); + + ((WorldObject*)this)->SendMessageToSet(&data, true); + + sLog.outDebug("WORLD: Sent SMSG_AI_REACTION, type %u.", reactionType); +} + void Creature::CallAssistance() { if( !m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed()) diff --git a/src/game/Creature.h b/src/game/Creature.h index 1e2f01076..b4f335cc9 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -619,6 +619,8 @@ class MANGOS_DLL_SPEC Creature : public Unit float GetAttackDistance(Unit const* pl) const; + void SendAIReaction(AiReaction reactionType); + void DoFleeToGetAssistance(); void CallForHelp(float fRadius); void CallAssistance(); diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index cbb57c7eb..72a4210dd 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -2368,8 +2368,8 @@ enum PetDiet enum AiReaction { AI_REACTION_UNK1 = 1, - AI_REACTION_AGGRO = 2, - AI_REACTION_UNK3 = 3, + AI_REACTION_AGGRO = 2, // trigger aggro sound to play, if defined in dbc + AI_REACTION_UNK3 = 3, // seen happen at polymorph, possible when AI not in control of self? AI_REACTION_UNK4 = 4 }; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e37f8b3df..ca150950f 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7690,13 +7690,9 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) m_attacking = victim; m_attacking->_addAttacker(this); - if(GetTypeId()==TYPEID_UNIT) + if (GetTypeId() == TYPEID_UNIT) { - WorldPacket data(SMSG_AI_REACTION, 12); - data << uint64(GetGUID()); - data << uint32(AI_REACTION_AGGRO); // Aggro sound - ((WorldObject*)this)->SendMessageToSet(&data, true); - + ((Creature*)this)->SendAIReaction(AI_REACTION_AGGRO); ((Creature*)this)->CallAssistance(); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b860100e6..bc0b0e076 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8621" + #define REVISION_NR "8622" #endif // __REVISION_NR_H__