All pastes #905715 Raw Edit

Mine

public text v1 · immutable
·published 2008-02-15 23:46 UTC
rendered paste body
Index: game/Spell.cpp
===================================================================
--- game/Spell.cpp	(revision 5224)
+++ game/Spell.cpp	(working copy)
@@ -1867,7 +1867,8 @@
 
     if(m_targets.getUnitTargetGUID())
     {
-        if(!m_targets.getUnitTarget() || !m_targets.getUnitTarget()->isAlive())
+        if(!m_targets.getUnitTarget() || !m_targets.getUnitTarget()->isAlive() ||
+			(!m_targets.getUnitTarget()->isVisibleForOrDetect(m_caster,false) && m_spellState != SPELL_STATE_DELAYED))
         {
             if(m_autoRepeat)
             {
@@ -1876,7 +1877,7 @@
                 return;
             }
 
-            if(!m_targets.getUnitTarget())
+            if(!m_targets.getUnitTarget() || (!m_targets.getUnitTarget()->isVisibleForOrDetect(m_caster,false) && m_spellState != SPELL_STATE_DELAYED))
             {
                 cancel();
                 return;
Index: game/SpellAuras.cpp
===================================================================
--- game/SpellAuras.cpp	(revision 5224)
+++ game/SpellAuras.cpp	(working copy)
@@ -2347,7 +2361,7 @@
 {
     if(apply)
     {
-        m_target->m_stealthvalue = m_modifier.m_amount;
+        m_target->m_stealthvalue += m_modifier.m_amount;
 
         // drop flag at stealth in bg
         if(Real && m_target->GetTypeId()==TYPEID_PLAYER && ((Player*)m_target)->InBattleGround())
@@ -2390,7 +2404,7 @@
                 reallyRemove = false;                       // vanish it timed out, but we have stealth active as well
             if(reallyRemove)
             {
-                m_target->m_stealthvalue = 0;
+                m_target->m_stealthvalue -= m_modifier.m_amount;
                 m_target->RemoveFlag(UNIT_FIELD_BYTES_1, PLAYER_STATE_FLAG_CREEP);
 
                 // apply only if not in GM invisibility
Index: game/SpellEffects.cpp
===================================================================
--- game/SpellEffects.cpp	(revision 5224)
+++ game/SpellEffects.cpp	(working copy)
@@ -831,7 +831,7 @@
                 uint32 classspell = itr->first;
                 SpellEntry const *spellInfo = sSpellStore.LookupEntry(classspell);
 
-                if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && spellInfo->Id != 14185 && GetRecoveryTime(spellInfo) > 0)
+				if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && (spellInfo->SpellFamilyFlags & 0x26000000860LL))
                 {
                     ((Player*)m_caster)->RemoveSpellCooldown(classspell);
 
@@ -1365,6 +1365,49 @@
             m_caster->CastSpell(unitTarget, 31790, true);
             return;
         }
+		// Vanish
+		case 18461:
+		{
+			m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT);
+			m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOD_DECREASE_SPEED);
+			m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOD_STALKED);
+
+			if ( m_caster->GetTypeId() != TYPEID_PLAYER )
+				return;
+
+			uint32 spellId = 0;
+			const PlayerSpellMap& sp_list = ((Player *)m_caster)->GetSpellMap();
+			for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
+			{
+				if(itr->second->state == PLAYERSPELL_REMOVED) continue;
+				SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
+				if (!spellInfo) continue;
+
+				if ( spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE &&
+					spellInfo->SpellFamilyFlags & SPELLFAMILYFLAG_ROGUE_STEALTH )
+				{
+					spellId = spellInfo->Id;
+					break;
+				}
+			}
+
+			// Apparently some idiot that does not even know stealth spell
+			if (!spellId) 
+				return;
+
+			if(((Player *)m_caster)->HasSpellCooldown(spellId))
+			{
+				((Player *)m_caster)->RemoveSpellCooldown(spellId);
+				WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8+4));
+				data << uint32(spellId);
+				data << m_caster->GetGUID();
+				((Player *)m_caster)->GetSession()->SendPacket(&data);
+			}
+
+			m_caster->CastSpell(m_caster, spellId, true);
+			return;
+		}
+
     }
 
     // normal case
@@ -3667,11 +3714,6 @@
 
     unitTarget->CombatStop();
     unitTarget->getHostilRefManager().deleteReferences();   // stop all fighting
-    //Vanish allows to remove all threat and cast regular stealth so other spells can be used
-    if(m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && (m_spellInfo->SpellFamilyFlags & SPELLFAMILYFLAG_ROGUE_VANISH))
-    {
-        ((Player *)m_caster)->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT);
-    }
 }
 
 void Spell::EffectAddComboPoints(uint32 /*i*/)