fixing beast lore Aura

This commit is contained in:
Evildead666 2015-05-04 16:27:29 +02:00
parent 2e8761f1b0
commit 99633ff791
2 changed files with 26 additions and 6 deletions

View File

@ -430,7 +430,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 */
@ -456,6 +456,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

View File

@ -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*/)