• Страница 1 из 1
  • 1
Модератор форума: Dimitro  
[P]Заклинания с Spell_effect_interrupt_cast
attle
Безумно влюбленный
Общие сведения:
- Заклинания с SPELL_EFFECT_INTERRUPT_CAST работают должным образом в настоящее время и блокировки школы прервал заклинание установленное время. Выпуск № 47.
Благодаря MesoX за указание о проверках и TrinityCore например.

Code

From 15d6a45cf9f6f97c90db14ffed48a768ff63f1e9 Mon Sep 17 00:00:00 2001
From: Neo_mat <neomat.github@gmail.com>
Date: Wed, 7 Dec 2011 18:15:15 +0400
Subject: [PATCH] General: Spells with SPELL_EFFECT_INTERRUPT_CAST are working
  properly now and locking out the school of casted for the
  set duration. Issue #47.

---
  src/arcemu-world/SpellEffects.cpp |   73 +++++++++++++------------------------
  1 files changed, 26 insertions(+), 47 deletions(-)

diff --git a/src/arcemu-world/SpellEffects.cpp b/src/arcemu-world/SpellEffects.cpp
index e38af2d..a8ecdfb 100644
--- a/src/arcemu-world/SpellEffects.cpp
+++ b/src/arcemu-world/SpellEffects.cpp
@@ -3722,57 +3722,36 @@ void Spell::SpellEffectInterruptCast(uint32 i) // Interrupt Cast
                 }
         }
   
-       uint32 school = 0;
-       uint32 prevtype = 0;
-       if(unitTarget->GetCurrentSpell())
-       {
-               prevtype = unitTarget->GetCurrentSpell()->GetProto()->PreventionType;
-
-               if((GetProto()->InterruptFlags & CAST_INTERRUPT_ON_INTERRUPT_SCHOOL) && (prevtype == PREVENTION_TYPE_SILENCE))
-               {
-                       school = unitTarget->GetCurrentSpell()->GetProto()->School;
-               }
-
-               unitTarget->GetCurrentSpell()->cancel();
-       }
-
-       if(school)//prevent from casts in this school
-       {
-               int32 duration = GetDuration();
-               if(unitTarget->IsPlayer())
-               {
-                       int32 DurationModifier = TO< Player* >(unitTarget)->MechanicDurationPctMod[MECHANIC_INTERRUPTED];
-                       if(DurationModifier >= - 100)
-                    duration = (duration * (100 + DurationModifier)) / 100;
-               }
-
-               unitTarget->SchoolCastPrevent[school] = duration + getMSTime();
-
-               if(unitTarget->IsPlayer())
+       Spell *TargetSpell = unitTarget->GetCurrentSpell(); // Get target's casting spell
+       if(TargetSpell)
+       {
+               uint32 school = TargetSpell->GetProto()->School; // Get target's casting spell school
+               int32 duration = GetDuration(); // Duration of school lockout
+
+               // Check for CastingTime (to prevent interrupting instant casts), PreventionType
+               // and InterruptFlags of target's casting spell
+               if(school
+                       && (TargetSpell->getState() == SPELL_STATE_CASTING
+                       || (TargetSpell->getState() == SPELL_STATE_PREPARING && TargetSpell->GetProto()->CastingTimeIndex > 0.0f))
+                       && TargetSpell->GetProto()->PreventionType == PREVENTION_TYPE_SILENCE
+                       && ((TargetSpell->GetProto()->InterruptFlags & CAST_INTERRUPT_ON_INTERRUPT_SCHOOL)
+                       || (TargetSpell->GetProto()->ChannelInterruptFlags & CHANNEL_INTERRUPT_ON_4 )))
                 {
-                       TO_PLAYER(unitTarget)->SendPreventSchoolCast(school, duration);
-               }
-       }
-       else if((GetProto()->InterruptFlags & CAST_INTERRUPT_ON_INTERRUPT_ALL) && (prevtype == PREVENTION_TYPE_SILENCE))
-       {
-               int32 duration = GetDuration();
-
-               if(unitTarget->IsPlayer())
-               {
-                       // Check for interruption reducing talents
-                       int32 DurationModifier = TO< Player* >(unitTarget)->MechanicDurationPctMod[MECHANIC_INTERRUPTED];
-
-                       if(DurationModifier >= - 100)
-                    duration = (duration * (100 + DurationModifier)) / 100;
-               }
-
-               for(uint8 j = 0; j < 7; j++)
-               {
-                       unitTarget->SchoolCastPrevent[j] = duration;
                         if(unitTarget->IsPlayer())
                         {
-                    TO_PLAYER(unitTarget)->SendPreventSchoolCast(j, duration);
+                    // Check for interruption reducing talents
+                    int32 DurationModifier = TO< Player* >(unitTarget)->MechanicDurationPctMod[MECHANIC_INTERRUPTED];
+                    if(DurationModifier >= - 100)
+                    duration = (duration * (100 + DurationModifier)) / 100;
+
+                    // Prevent player from casting in that school
+                    TO_PLAYER(unitTarget)->SendPreventSchoolCast(school, duration);
                         }
+                       else
+                    // Prevent unit from casting in that school
+                    unitTarget->SchoolCastPrevent[school] = duration + getMSTime();
+
+                       TargetSpell->cancel(); // Interrupt the spell cast
                 }
         }
  }
--  
1.7.7.1.msysgit.0
зарабатывай деньги тут!
Зарегистрируйся втопе, введи промо код 8845 и получи от меня 4500 поинтов
Втопе - Бесплатная программа для накрутки ВКонтакте, Твиттер, Инстаграм.
А я Никита, писаю сидя.
Сообщение # 1 написано 14.02.2012 в 20:38
  • Страница 1 из 1
  • 1
Поиск: