All pastes #1565670 Raw Edit

Unnamed

public text v1 · immutable
#1565670 ·published 2009-09-14 16:28 UTC
rendered paste body
# HG changeset patch
# User thenecromancer
# Date 1252940871 -7200
# Branch trunk
# Node ID 91683ef0630ba85ca2679c1e783df884495ec2c1
# Parent  521031034c94ce5773f80f1501eb334dd2f0ca69
Fix Cornered Talent working bad ( applied at learn/call ) and removed only if health is increased back from 35% ( and then never applied until recalled )
Fix previous commit about Feeding Frenzy

diff -r 521031034c94 -r 91683ef0630b src/game/Pet.cpp
--- a/src/game/Pet.cpp	Mon Sep 14 16:54:22 2009 +0200
+++ b/src/game/Pet.cpp	Mon Sep 14 17:07:51 2009 +0200
@@ -1331,7 +1331,7 @@
 
     m_spells[spell_id] = newspell;
 
-    if (IsPassiveSpell(spell_id))
+    if (IsPassiveSpell(spell_id) && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState))))
         CastSpell(this, spell_id, true);
     else
         m_charmInfo->AddSpellToActionBar(spell_id);
diff -r 521031034c94 -r 91683ef0630b src/game/SpellAuras.cpp
--- a/src/game/SpellAuras.cpp	Mon Sep 14 16:54:22 2009 +0200
+++ b/src/game/SpellAuras.cpp	Mon Sep 14 17:07:51 2009 +0200
@@ -6745,23 +6745,14 @@
             }
             switch (spell->Id)
             {
-                Unit *petTarget=NULL;
-                if (m_target->GetTypeId() != TYPEID_PLAYER || !((Player*)m_target)->GetPet())
-                    return;
-
-                petTarget = ((Player*)m_target)->GetPet()->getVictim();
-
-                if (!petTarget)
-                    return;
-
                 // Feeding Frenzy Rank 1
                 case 53511:
-                    if ( petTarget->GetHealth() * 100 < petTarget->GetMaxHealth() * 35 )
+                    if ( m_target->getVictim() && m_target->getVictim()->GetHealth() * 100 < m_target->getVictim()->GetMaxHealth() * 35 )
                         m_target->CastSpell(m_target, 60096, true, 0, this);
                     return;
                 // Feeding Frenzy Rank 2
                 case 53512:
-                    if ( petTarget->GetHealth() * 100 < petTarget->GetMaxHealth() * 35 )
+                    if ( m_target->getVictim() && m_target->getVictim()->GetHealth() * 100 < m_target->getVictim()->GetMaxHealth() * 35 )
                         m_target->CastSpell(m_target, 60097, true, 0, this);
                     return;
                 default:
diff -r 521031034c94 -r 91683ef0630b src/game/Unit.cpp
--- a/src/game/Unit.cpp	Mon Sep 14 16:54:22 2009 +0200
+++ b/src/game/Unit.cpp	Mon Sep 14 17:07:51 2009 +0200
@@ -8620,6 +8620,18 @@
                         CastSpell(this, itr->first, true, NULL);
                 }
             }
+            else if (((Creature*)this)->isPet())
+            {
+                Pet *pet = ((Pet*)this);
+                for (PetSpellMap::const_iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr)
+                {
+                    if(itr->second.state == PLAYERSPELL_REMOVED) continue;
+                    SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
+                    if (!spellInfo || !IsPassiveSpell(itr->first)) continue;
+                    if (spellInfo->CasterAuraState == flag)
+                        CastSpell(this, itr->first, true, NULL);
+                }
+            }
         }
     }
     else