aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/Creature.cpp12
-rw-r--r--src/game/Creature.h2
-rw-r--r--src/game/SharedDefines.h4
-rw-r--r--src/game/Unit.cpp6
4 files changed, 17 insertions, 7 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 9dcfce82601..c31906d110f 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -2094,6 +2094,18 @@ Unit* Creature::SelectNearestTarget(float dist) const
return target;
}
+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 d1c08bb13e2..3a8338c1c67 100644
--- a/src/game/Creature.h
+++ b/src/game/Creature.h
@@ -640,6 +640,8 @@ class TRINITY_DLL_SPEC Creature : public Unit
bool canStartAttack(Unit const* u, bool force) const;
float GetAttackDistance(Unit const* pl) const;
+ void SendAIReaction(AiReaction reactionType);
+
Unit* SelectNearestTarget(float dist = 0) const;
void DoFleeToGetAssistance();
void CallForHelp(float fRadius);
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index 476fed4c345..8b5fb0888fe 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -2449,8 +2449,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 4f3e90bf507..117c64d61de 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -8616,11 +8616,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
victim->SetInCombatWith(this);
AddThreat(victim, 0.0f);
- 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();
}