Jump to content

[patch/dev][spell=1462]Beast Lore


Guest virusav

Recommended Posts

Spell http://www.wowhead.com/spell=1462 should display the details of the NPC or a player in the forms of animals just for the caster.

Patch (copy http://paste2.org/p/1238101):

diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 2dfa981..728555e 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -637,17 +637,45 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *
                    *data << (m_uint32Values[index] & ~UNIT_FLAG_NOT_SELECTABLE);
                }
                // hide lootable animation for unallowed players
-                else if (index == UNIT_DYNAMIC_FLAGS && GetTypeId() == TYPEID_UNIT)
+                else if (index == UNIT_DYNAMIC_FLAGS)
                {
-                    if (!target->isAllowedToLoot((Creature*)this))
-                        *data << (m_uint32Values[index] & ~(UNIT_DYNFLAG_LOOTABLE | UNIT_DYNFLAG_TAPPED_BY_PLAYER));
-                    else
+                    uint32 appendValue = m_uint32Values[index];
+
+                    // checking SPELL_AURA_EMPATHY and caster
+                    if (((Unit*)this)->isAlive())
                    {
-                        // flag only for original loot recipent
-                        if (target->GetObjectGuid() == ((Creature*)this)->GetLootRecipientGuid())
-                            *data << m_uint32Values[index];
+                        bool bIsEmpathy = false;
+                        bool bIsCaster = false;
+                        Unit::AuraList const& mAuraEmpathy = ((Unit*)this)->GetAurasByType(SPELL_AURA_EMPATHY);
+                        for(Unit::AuraList::const_iterator i = mAuraEmpathy.begin(); i != mAuraEmpathy.end(); ++i)
+                        {
+                            bIsEmpathy = true;
+                            if ((*i)->GetCasterGuid() == target->GetObjectGuid())
+                            {
+                                bIsCaster = true;
+                                break;
+                            }
+                        }
+                        if (bIsEmpathy && !bIsCaster)
+                            appendValue &= ~UNIT_DYNFLAG_SPECIALINFO;
+                    }
+
+                    if (GetTypeId() == TYPEID_UNIT)
+                    {
+                        if (!target->isAllowedToLoot((Creature*)this))
+                            *data << (appendValue & ~(UNIT_DYNFLAG_LOOTABLE | UNIT_DYNFLAG_TAPPED_BY_PLAYER));
                        else
-                            *data << (m_uint32Values[index] & ~(UNIT_DYNFLAG_TAPPED | UNIT_DYNFLAG_TAPPED_BY_PLAYER));
+                        {
+                            // flag only for original loot recipent
+                            if (target->GetObjectGuid() == ((Creature*)this)->GetLootRecipientGuid())
+                                *data << appendValue;
+                            else
+                                *data << (appendValue & ~(UNIT_DYNFLAG_TAPPED | UNIT_DYNFLAG_TAPPED_BY_PLAYER));
+                        }
+                    }
+                    else
+                    {
+                        *data << appendValue;
                    }
                }
                else
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index bcedb01..dc89c6c 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -3066,6 +3066,14 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)

    Unit *target = GetTarget();

+    // remove SPELL_AURA_EMPATHY
+    Unit::AuraList const& mAuraEmpathy = target->GetAurasByType(SPELL_AURA_EMPATHY);
+    for(Unit::AuraList::const_iterator i = mAuraEmpathy.begin(); i != mAuraEmpathy.end(); ++i)
+    {
+        target->RemoveAurasByCasterSpell((*i)->GetId(), (*i)->GetCasterGUID());
+        i = mAuraEmpathy.begin();
+    }
+
    SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(form);
    if (!ssEntry)
    {
@@ -6475,12 +6483,10 @@ void Aura::HandleShapeshiftBoosts(bool apply)

void Aura::HandleAuraEmpathy(bool apply, bool /*Real*/)
{
-    if(GetTarget()->GetTypeId() != TYPEID_UNIT)
+    if (GetTarget()->GetTypeId() != TYPEID_UNIT && GetTarget()->GetTypeId() != TYPEID_PLAYER)
        return;

-    CreatureInfo const * ci = ObjectMgr::GetCreatureTemplate(GetTarget()->GetEntry());
-    if(ci && ci->type == CREATURE_TYPE_BEAST)
-        GetTarget()->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply);
+    GetTarget()->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply);
}

void Aura::HandleAuraUntrackable(bool apply, bool /*Real*/) 

Creature Type Mask = 0x00000001 (BEAST)
Skill (Id 50) "Beast Mastery"

Questions:

1. Why when you hover on a player in the forms of cats, bears, etc. damage and armor show 0, but the resistance did not appear? Where is the handling of this moment?

2. How can we determine the forms of the NPC / player, which can cast a spell, so when you change form to remove it if necessary?

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use