aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNay <dnpd.dd@gmail.com>2011-10-01 16:57:10 +0100
committerNay <dnpd.dd@gmail.com>2011-10-01 16:57:10 +0100
commit8373e6c32e5fa2c565567fb394f9e4671252226d (patch)
tree9c83e2ba50b745b8ff87f2b6f8957e62e3b1a00d /src
parent5cf96935422a912f9f9aa413deab0d4a4dd8b003 (diff)
Core/Creature: Do not attack non-combat pets.
Fixes an issue where non-combat pets were aggroing other creatures
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp5
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.cpp4
2 files changed, 8 insertions, 1 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 253ac6c9155..0b77dd03e87 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -462,8 +462,11 @@ void SmartAI::EnterEvadeMode()
void SmartAI::MoveInLineOfSight(Unit* who)
{
- if (!who) return;
+ if (!who)
+ return;
+
GetScript()->OnMoveInLineOfSight(who);
+
if (me->HasReactState(REACT_PASSIVE) || AssistPlayerInCombat(who))
return;
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 7a86136b3a8..d1f8f55e27d 100755
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -1411,6 +1411,10 @@ bool Creature::canStartAttack(Unit const* who, bool force) const
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE))
return false;
+
+ // Do not attack non-combat pets
+ if (who->GetTypeId() == TYPEID_UNIT && who->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET)
+ return false;
if (!canFly() && (GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE + m_CombatDistance))
//|| who->IsControlledByPlayer() && who->IsFlying()))