diff --git a/src/game/Object/Object.cpp b/src/game/Object/Object.cpp index 96fbbf65..023a4f2e 100644 --- a/src/game/Object/Object.cpp +++ b/src/game/Object/Object.cpp @@ -436,7 +436,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u else if (index == UNIT_DYNAMIC_FLAGS && GetTypeId() == TYPEID_UNIT) { uint32 send_value = m_uint32Values[index]; - + /* Initiate pointer to creature so we can check loot */ if (Creature* my_creature = (Creature*)this) /* If the creature is NOT fully looted */ @@ -462,6 +462,22 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u if (send_value & UNIT_DYNFLAG_TAPPED && is_tapped) { send_value = send_value & ~UNIT_DYNFLAG_TAPPED; } + // Checking SPELL_AURA_EMPATHY and caster + if (send_value & UNIT_DYNFLAG_SPECIALINFO && ((Unit*)this)->IsAlive()) + { + bool bIsEmpathy = false; + bool bIsCaster = false; + Unit::AuraList const& mAuraEmpathy = ((Unit*)this)->GetAurasByType(SPELL_AURA_EMPATHY); + for (Unit::AuraList::const_iterator itr = mAuraEmpathy.begin(); !bIsCaster && itr != mAuraEmpathy.end(); ++itr) + { + bIsEmpathy = true; // Empathy by aura set + if ((*itr)->GetCasterGuid() == target->GetObjectGuid()) + bIsCaster = true; // target is the caster of an empathy aura + } + if (bIsEmpathy && !bIsCaster) // Empathy by aura, but target is not the caster + send_value &= ~UNIT_DYNFLAG_SPECIALINFO; + } + *data << send_value; } else diff --git a/src/game/WorldHandlers/SpellAuras.cpp b/src/game/WorldHandlers/SpellAuras.cpp index 1198f2c1..b126bdae 100644 --- a/src/game/WorldHandlers/SpellAuras.cpp +++ b/src/game/WorldHandlers/SpellAuras.cpp @@ -1507,6 +1507,10 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) Powers PowerType = POWER_MANA; Unit* target = GetTarget(); + // remove SPELL_AURA_EMPATHY + target->RemoveSpellsCausingAura(SPELL_AURA_EMPATHY); + + switch (form) { case FORM_CAT: @@ -4108,12 +4112,12 @@ void Aura::HandleShapeshiftBoosts(bool apply) void Aura::HandleAuraEmpathy(bool apply, bool /*Real*/) { - if (GetTarget()->GetTypeId() != TYPEID_UNIT) - { return; } + Unit* target = GetTarget(); - CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(GetTarget()->GetEntry()); - if (ci && ci->CreatureType == CREATURE_TYPE_BEAST) - { GetTarget()->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply); } + // This aura is expected to only work with CREATURE_TYPE_BEAST or players + CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(target->GetEntry()); + if (target->GetTypeId() == TYPEID_PLAYER || (target->GetTypeId() == TYPEID_UNIT && ci && ci->CreatureType == CREATURE_TYPE_BEAST)) + target->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply); } void Aura::HandleAuraUntrackable(bool apply, bool /*Real*/)