Public feed #891109

Anonym

public text v1 · immutable
Raw Edit
·published 2008-02-04 11:12 UTC
rendered paste body
Index: src/game/Player.cpp
===================================================================
--- src/game/Player.cpp	(revision 5136)
+++ src/game/Player.cpp	(working copy)
@@ -13782,17 +13782,20 @@
     AuraMap const& auras = GetAuras();
     for(AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
     {
-        // skip all auras from spell that apply at cast SPELL_AURA_MOD_SHAPESHIFT or SPELL_AURA_MOD_STEALTH auras.
-        // or need a shapeshift
         SpellEntry const *spellInfo = itr->second->GetSpellProto();
+
+        //skip all auras from spells that are passive or need a shapeshift
+        if (itr->second->IsPassive() || itr->second->IsRemovedOnShapeLost())
+            continue;
+
         uint8 i;
+        // or apply at cast SPELL_AURA_MOD_SHAPESHIFT or SPELL_AURA_MOD_STEALTH auras
         for (i = 0; i < 3; i++)
             if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_SHAPESHIFT ||
-            spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_STEALTH ||
-            spellInfo->Stances)
+                spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_STEALTH)
                 break;
 
-        if (i == 3 && !itr->second->IsPassive())
+        if (i == 3)
         {
             CharacterDatabase.PExecute("DELETE FROM `character_aura` WHERE `guid` = '%u' and `spell` = '%u' and  `effect_index`= '%u'",GetGUIDLow(),(uint32)(*itr).second->GetId(), (uint32)(*itr).second->GetEffIndex());
             CharacterDatabase.PExecute("INSERT INTO `character_aura` (`guid`,`caster_guid`,`spell`,`effect_index`,`amount`,`maxduration`,`remaintime`,`remaincharges`) "
Index: src/game/SpellAuras.cpp
===================================================================
--- src/game/SpellAuras.cpp	(revision 5136)
+++ src/game/SpellAuras.cpp	(working copy)
@@ -305,7 +305,7 @@
 m_procCharges(0), m_spellmod(NULL), m_spellId(spellproto->Id), m_effIndex(eff), m_caster_guid(0), m_target(target),
 m_timeCla(1000), m_castItemGuid(castItem?castItem->GetGUID():0), m_auraSlot(MAX_AURAS),
 m_positive(false), m_permanent(false), m_isPeriodic(false), m_isTrigger(false), m_isAreaAura(false), m_isPersistent(false),
-m_periodicTimer(0), m_PeriodicEventId(0), m_updated(false), m_removeOnDeath(false),m_fearMoveAngle(0)
+m_periodicTimer(0), m_PeriodicEventId(0), m_updated(false), m_removeOnDeath(false),m_fearMoveAngle(0), m_isRemovedOnShapeLost(true)
 {
     assert(target);
 
@@ -393,6 +393,9 @@
     }
     else
         m_procCharges = -1;
+
+    m_isRemovedOnShapeLost = (m_caster_guid==m_target->GetGUID() && m_spellProto->Stances &&
+                            !(m_spellProto->AttributesEx2 & 0x80000) && !(m_spellProto->Attributes & 0x10000));
 }
 
 Aura::~Aura()
@@ -3886,7 +3889,7 @@
                 if(itr->second->state == PLAYERSPELL_REMOVED) continue;
                 if(itr->first==spellId || itr->first==spellId2) continue;
                 SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
-                if (!spellInfo || !IsPassiveSpell(itr->first)) continue;
+                if (!spellInfo || !(spellInfo->Attributes & ((1<<6) | (1<<7)))) continue;
                 if (spellInfo->Stances & (1<<form))
                     m_target->CastSpell(m_target, itr->first, true, NULL, this);
             }
@@ -3918,17 +3921,14 @@
         Unit::AuraMap& tAuras = m_target->GetAuras();
         for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
         {
-            // not removed at form lost
-            if(itr->second->GetModifier()->m_auraname==SPELL_AURA_RETAIN_COMBO_POINTS)
+            if (itr->second->IsRemovedOnShapeLost())
             {
-                ++itr;
-                continue;
+                m_target->RemoveAura(itr);
             }
-
-            if (itr->second->GetSpellProto()->Stances & uint32(1<<form))
-                m_target->RemoveAura(itr);
             else
+            {
                 ++itr;
+            }
         }
     }
 
Index: src/game/SpellAuras.h
===================================================================
--- src/game/SpellAuras.h	(revision 5136)
+++ src/game/SpellAuras.h	(working copy)
@@ -240,6 +240,7 @@
         bool IsPassive() const { return m_isPassive; }
         bool IsPersistent() const { return m_isPersistent; }
         bool IsDeathPersistent() const { return m_isDeathPersist; }
+        bool IsRemovedOnShapeLost() const { return m_isRemovedOnShapeLost; }
 
         virtual void Update(uint32 diff);
         void ApplyModifier(bool apply, bool Real = false);
@@ -283,6 +284,7 @@
         bool m_isPassive;
         bool m_isPersistent;
         bool m_isDeathPersist;
+        bool m_isRemovedOnShapeLost;
 
         int32 m_periodicTimer;
         uint32 m_PeriodicEventId;