(It is my art of WORK on Codes, sorry:)
- Code: Select all
Index: DOLSharp/trunk/GameServer/spells/SpeedEnhancementSpellHandler.cs
===================================================================
--- DOLSharp/trunk/GameServer/spells/SpeedEnhancementSpellHandler.cs (revision 2798)
+++ DOLSharp/trunk/GameServer/spells/SpeedEnhancementSpellHandler.cs (working copy)
@@ -23,6 +23,8 @@
using System.Collections;
using DOL.GS.Effects;
using DOL.Events;
namespace DOL.GS.Spells
{
@@ -95,7 +97,10 @@
GameEventMgr.AddHandler(effect.Owner, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(OnAttack));
GameEventMgr.AddHandler(effect.Owner, GameLivingEvent.AttackFinished, new DOLEventHandler(OnAttack));
GameEventMgr.AddHandler(effect.Owner, GameLivingEvent.CastFinished, new DOLEventHandler(OnAttack));
- if (player != null)
+ GameEventMgr.AddHandler(effect.Owner, GameLivingEvent.AttackFinished, new DOLEventHandler(OnAttacka));
+ GameEventMgr.AddHandler(effect.Owner, GameLivingEvent.CastFinished, new DOLEventHandler(OnAttacka));
+ if (player != null)
GameEventMgr.AddHandler(player, GamePlayerEvent.StealthStateChanged, new DOLEventHandler(OnStealthStateChanged));
}
@@ -111,7 +116,10 @@
GamePlayer player = effect.Owner as GamePlayer;
GameEventMgr.RemoveHandler(effect.Owner, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(OnAttack));
GameEventMgr.RemoveHandler(effect.Owner, GameLivingEvent.AttackFinished, new DOLEventHandler(OnAttack));
- if (player != null)
+ GameEventMgr.AddHandler(effect.Owner, GameLivingEvent.AttackFinished, new DOLEventHandler(OnAttacka));
+ GameEventMgr.AddHandler(effect.Owner, GameLivingEvent.CastFinished, new DOLEventHandler(OnAttacka));
+ if (player != null)
GameEventMgr.RemoveHandler(player, GamePlayerEvent.StealthStateChanged, new DOLEventHandler(OnStealthStateChanged));
effect.Owner.BuffBonusMultCategory1.Remove((int)eProperty.MaxSpeed, this);
@@ -162,8 +170,8 @@
CastingEventArgs castFinished = arguments as CastingEventArgs;
AttackData ad = null;
ISpellHandler sp = null;
-
- if (attackedByEnemy != null)
+
+ if (attackedByEnemy != null)
{
ad = attackedByEnemy.AttackData;
}
@@ -175,10 +183,10 @@
{
sp = castFinished.SpellHandler;
ad = castFinished.LastAttackData;
- }
-
+
// Speed should drop if the player casts an offensive spell
- if (sp == null && ad == null)
+ }
+ if (sp == null && ad == null)
{
return;
}
@@ -194,9 +202,45 @@
GameSpellEffect speed = SpellHandler.FindEffectOnTarget(living, this);
if (speed != null)
speed.Cancel(false);
- }
+ }
+ /// <summary>
+ /// Handles Archery Attacks on Targets
+ /// </summary>
+ /// <param name="e"></param>
+ /// <param name="sender"></param>
+ /// <param name="arguments"></param>
+
+ private void OnAttacka(DOLEvent e, object sender, EventArgs arguments)
+ {
+ GameLiving living = sender as GameLiving;
+ if (living == null) return;
+ AttackFinishedEventArgs attackFinished = arguments as AttackFinishedEventArgs;
+ CastingEventArgs castFinished = arguments as CastingEventArgs;
+ AttackData adv = null;
+ ISpellHandler spv = null;
+ if (attackFinished != null)
+ {
+ adv = attackFinished.AttackData;
+ }
+ else if (castFinished != null)
+ {
+ spv = castFinished.SpellHandler;
+ adv = castFinished.LastAttackData;
+ }
+ if (spv == null && adv == null)
+ {
+ return;
+ }
+ if (living != null && spv is Archery == true)
+ {
+ GameSpellEffect speeda = SpellHandler.FindEffectOnTarget(living, this);
+ if (speeda != null)
+ speeda.Cancel(false);
+ }
+ }
+
+ /// <summary>
/// Handles stealth state changes
/// </summary>
/// <param name="e"></param>
Index: DOLSharp/trunk/GameServer/spells/SpellHandler.cs
Have FUN with DOL!
