(for very Old Bug) My Archer Hasterner fix for DOL:)

A place to submit .patch fixes for the DOL SVN

Moderator: Developer Team

(for very Old Bug) My Archer Hasterner fix for DOL:)

Postby elcotek » Wed Feb 02, 2011 8:12 pm

Here its a Fix for the very old Bug on Bowclasses with not lose Hasterner Speed Effects, after shot with Bows on Targets!

(It is my art of WORK on Codes, sorry:) :mrgreen:
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! :wink:
Attachments
Archer Hastener Bugfix.patch
(4.2 KiB) Downloaded 23 times
Brotherland Final RvR/PvE/ToA http://brotherland.phpbb8.de/
User avatar
elcotek
Server Representative
 
Posts: 179
Joined: Mon May 12, 2008 9:28 pm
Website: http://brotherland-2.de
Location: Germany

Re: (for very Old Bug) My Archer Hasterner fix for DOL:)

Postby geshi » Fri Mar 04, 2011 3:13 am

Thanks man :)
geshi
Contributor
 
Posts: 1826
Joined: Tue Oct 21, 2008 9:16 pm

Re: (for very Old Bug) My Archer Hasterner fix for DOL:)

Postby Graveen » Fri Mar 04, 2011 9:21 am

Thank you !

Hum, i'll review effectively, this 'll not go as is in svn ;)
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France


Return to “%s” DOL Code Contributions

Who is online

Users browsing this forum: No registered users and 0 guests