[committed] RA - Charge

A place to submit .patch fixes for the DOL SVN

Moderator: Developer Team

[committed] RA - Charge

Postby -Shawn- » Fri Aug 06, 2010 1:13 am

current
Code: Select all
using System.Reflection;
using DOL.GS;
using DOL.GS.PacketHandler;
using DOL.GS.Effects;
using DOL.Database;

namespace DOL.GS.RealmAbilities
{
   public class ChargeAbility : TimedRealmAbility
   {
      public const int DURATION = 15;

      public ChargeAbility(DBAbility dba, int level) : base(dba, level) { }

      public override void Execute(GameLiving living)
      {
         if (living == null) return;
         if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;

         /* 0_o
         if (player.IsSpeedWarped)
         {
            player.Out.SendMessage("You cannot use this ability while speed warped!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
            return;
         }*/

         if (living.TempProperties.getProperty("Charging", false)
            || living.EffectList.CountOfType(typeof(SpeedOfSoundEffect)) > 0
            || living.EffectList.CountOfType(typeof(ArmsLengthEffect)) > 0
            || living.EffectList.CountOfType(typeof(ChargeEffect)) > 0)
         {
            if (living is GamePlayer)
               ((GamePlayer)living).Out.SendMessage("You already an effect of that type!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
            return;
         }
         ChargeEffect charge = (ChargeEffect)living.EffectList.GetOfType(typeof(ChargeEffect));
         if (charge != null)
            charge.Cancel(false);
         if (living is GamePlayer)
            ((GamePlayer)living).Out.SendUpdateMaxSpeed();

         new ChargeEffect().Start(living);
         DisableSkill(living);
      }

      public override int GetReUseDelay(int level)
      {
         switch (level)
         {
            case 1: return 900;
            case 2: return 300;
            case 3: return 90;
         }
         return 600;
      }

        public override bool CheckRequirement(GamePlayer player)
        {
            return player.Level >= 45;
        }
   }
}


mine

Code: Select all
using System.Reflection;
using DOL.GS;
using DOL.GS.PacketHandler;
using DOL.GS.Effects;
using DOL.Database;

namespace DOL.GS.RealmAbilities
{
   public class ChargeAbility : TimedRealmAbility
   {
      public const int DURATION = 15;

      public ChargeAbility(DBAbility dba, int level) : base(dba, level) { }
        public bool CheckPreconditions(GameLiving living, long bitmask)
       {          
             lock (living.EffectList)
             {
                foreach (IGameEffect effect in living.EffectList)
                {
                    if (effect is GameSpellEffect)
                    {
                        GameSpellEffect oEffect = (GameSpellEffect)effect;
                        if (oEffect.Spell.SpellType.ToLower().IndexOf("speeddecrease") != -1 && oEffect.Spell.Value != 99)
                        {           
                           GamePlayer player = living as GamePlayer;
                           if(player!=null) player.Out.SendMessage("You may not use this ability while snared!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                            return true;
                        }
                    }
                }
            }
             return base.CheckPreconditions(living, bitmask);
       }

      public override void Execute(GameLiving living)
      {
         if (living == null) return;
         if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;

         /* 0_o
         if (player.IsSpeedWarped)
         {
            player.Out.SendMessage("You cannot use this ability while speed warped!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
            return;
         }*/

         if (living.TempProperties.getProperty("Charging", false)
            || living.EffectList.CountOfType(typeof(SpeedOfSoundEffect)) > 0
            || living.EffectList.CountOfType(typeof(ArmsLengthEffect)) > 0
            || living.EffectList.CountOfType(typeof(ChargeEffect)) > 0)
         {
            if (living is GamePlayer)
               ((GamePlayer)living).Out.SendMessage("You already an effect of that type!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
            return;
         }
         ChargeEffect charge = (ChargeEffect)living.EffectList.GetOfType(typeof(ChargeEffect));
         if (charge != null)
            charge.Cancel(false);
         if (living is GamePlayer)
            ((GamePlayer)living).Out.SendUpdateMaxSpeed();

         new ChargeEffect().Start(living);
         DisableSkill(living);
      }

      public override int GetReUseDelay(int level)
      {
         switch (level)
         {
            case 1: return 900;
            case 2: return 300;
            case 3: return 90;
         }
         return 600;
      }

        public override bool CheckRequirement(GamePlayer player)
        {
            return player.Level >= 45;
        }
   }
}



added a check for snare ( like live) if player is snared then he will not be able to use the charge ability also i wasnt sure if i should of added


Code: Select all
   if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;


to the snare check i added (taken from bolstering roar handler)
viewtopic.php?f=6&t=14984

Sky is the limit.
-Shawn-
DOL Devotee
 
Posts: 305
Joined: Tue Nov 24, 2009 1:47 am
Location: New York

Re: RA - Charge

Postby Graveen » Fri Aug 06, 2010 6:31 am

Shawn, can you create a diff from the curent SVN please ?
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

Re: RA - Charge

Postby -Shawn- » Fri Aug 06, 2010 7:30 am

again yes = )
viewtopic.php?f=6&t=14984

Sky is the limit.
-Shawn-
DOL Devotee
 
Posts: 305
Joined: Tue Nov 24, 2009 1:47 am
Location: New York

Re: RA - Charge

Postby -Shawn- » Fri Aug 06, 2010 7:40 am

=0 its the same code


Code: Select all
using System.Reflection;
using DOL.GS;
using DOL.GS.PacketHandler;
using DOL.GS.Effects;
using DOL.Database;

namespace DOL.GS.RealmAbilities
{
   public class ChargeAbility : TimedRealmAbility
   {
      public const int DURATION = 15;

      public ChargeAbility(DBAbility dba, int level) : base(dba, level) { }

      public override void Execute(GameLiving living)
      {
         if (living == null) return;
         if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;

         /* 0_o
         if (player.IsSpeedWarped)
         {
            player.Out.SendMessage("You cannot use this ability while speed warped!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
            return;
         }*/

         if (living.TempProperties.getProperty("Charging", false)
            || living.EffectList.CountOfType(typeof(SpeedOfSoundEffect)) > 0
            || living.EffectList.CountOfType(typeof(ArmsLengthEffect)) > 0
            || living.EffectList.CountOfType(typeof(ChargeEffect)) > 0)
         {
            if (living is GamePlayer)
               ((GamePlayer)living).Out.SendMessage("You already an effect of that type!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
            return;
         }

         ChargeEffect charge = (ChargeEffect)living.EffectList.GetOfType(typeof(ChargeEffect));
         if (charge != null)
            charge.Cancel(false);
         if (living is GamePlayer)
            ((GamePlayer)living).Out.SendUpdateMaxSpeed();

         new ChargeEffect().Start(living);
         DisableSkill(living);
      }

      public override int GetReUseDelay(int level)
      {
         switch (level)
         {
            case 1: return 900;
            case 2: return 300;
            case 3: return 90;
         }
         return 600;
      }

        public override bool CheckRequirement(GamePlayer player)
        {
            return player.Level >= 45;
        }
   }
}



^ current svn


Code: Select all
using System.Reflection;
using DOL.GS;
using DOL.GS.PacketHandler;
using DOL.GS.Effects;
using DOL.Database;

namespace DOL.GS.RealmAbilities
{
   public class ChargeAbility : TimedRealmAbility
   {
      public const int DURATION = 15;

      public ChargeAbility(DBAbility dba, int level) : base(dba, level) { }
        public bool CheckPreconditions(GameLiving living, long bitmask)
        {
            lock (living.EffectList)
            {
                foreach (IGameEffect effect in living.EffectList)
                {
                    if (effect is GameSpellEffect)
                    {
                        GameSpellEffect oEffect = (GameSpellEffect)effect;
                        if (oEffect.Spell.SpellType.ToLower().IndexOf("speeddecrease") != -1 && oEffect.Spell.Value != 99)
                        {
                            GamePlayer player = living as GamePlayer;
                            if (player != null) player.Out.SendMessage("You may not use this ability while snared!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                            return true;
                        }
                    }
                }
            }
            return base.CheckPreconditions(living, bitmask);
        }
      public override void Execute(GameLiving living)
      {
         if (living == null) return;
         if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;

         /* 0_o
         if (player.IsSpeedWarped)
         {
            player.Out.SendMessage("You cannot use this ability while speed warped!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
            return;
         }*/

         if (living.TempProperties.getProperty("Charging", false)
            || living.EffectList.CountOfType(typeof(SpeedOfSoundEffect)) > 0
            || living.EffectList.CountOfType(typeof(ArmsLengthEffect)) > 0
            || living.EffectList.CountOfType(typeof(ChargeEffect)) > 0)
         {
            if (living is GamePlayer)
               ((GamePlayer)living).Out.SendMessage("You already an effect of that type!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
            return;
         }

         ChargeEffect charge = (ChargeEffect)living.EffectList.GetOfType(typeof(ChargeEffect));
         if (charge != null)
            charge.Cancel(false);
         if (living is GamePlayer)
            ((GamePlayer)living).Out.SendUpdateMaxSpeed();

         new ChargeEffect().Start(living);
         DisableSkill(living);
      }

      public override int GetReUseDelay(int level)
      {
         switch (level)
         {
            case 1: return 900;
            case 2: return 300;
            case 3: return 90;
         }
         return 600;
      }

        public override bool CheckRequirement(GamePlayer player)
        {
            return player.Level >= 45;
        }
   }
}


^^ current svn mine
viewtopic.php?f=6&t=14984

Sky is the limit.
-Shawn-
DOL Devotee
 
Posts: 305
Joined: Tue Nov 24, 2009 1:47 am
Location: New York

Re: RA - Charge

Postby stephenxpimentel » Fri Aug 06, 2010 2:41 pm

Lets have some fun.
stephenxpimentel
Contributor
 
Posts: 1300
Joined: Wed Sep 19, 2007 5:09 pm

Re: RA - Charge

Postby -Shawn- » Fri Aug 06, 2010 9:33 pm

charge patch file
Attachments
chargepatch.patch
(1.62 KiB) Downloaded 14 times
viewtopic.php?f=6&t=14984

Sky is the limit.
-Shawn-
DOL Devotee
 
Posts: 305
Joined: Tue Nov 24, 2009 1:47 am
Location: New York

Re: RA - Charge

Postby -Shawn- » Sun Aug 08, 2010 7:53 am

yeah just getting use to patch files : P
viewtopic.php?f=6&t=14984

Sky is the limit.
-Shawn-
DOL Devotee
 
Posts: 305
Joined: Tue Nov 24, 2009 1:47 am
Location: New York

Re: RA - Charge

Postby Graveen » Sun Aug 08, 2010 10:38 pm

hum, charge can't be launched when snared ? or only when rooted ?

The key is rather to extend CheckPreConditions(), and insert IsRooted in the loop, but this is much more refactoring.
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

Re: RA - Charge

Postby -Shawn- » Mon Aug 09, 2010 1:04 am

charge cant be used when the person is snared, but the player can use it when hes rooted
viewtopic.php?f=6&t=14984

Sky is the limit.
-Shawn-
DOL Devotee
 
Posts: 305
Joined: Tue Nov 24, 2009 1:47 am
Location: New York

Re: RA - Charge

Postby Graveen » Mon Aug 09, 2010 7:25 am

Can you post a screenshot with the message issued when trying to charge when snared ?

TY ;)
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

Re: RA - Charge

Postby -Shawn- » Mon Aug 09, 2010 6:42 pm

hm this will be annoying lol anyone wanna help me do this on pendragon? i can make a skald and someone can make a merc or something : P
viewtopic.php?f=6&t=14984

Sky is the limit.
-Shawn-
DOL Devotee
 
Posts: 305
Joined: Tue Nov 24, 2009 1:47 am
Location: New York

Re: RA - Charge

Postby -Shawn- » Sat Oct 09, 2010 8:08 pm

viewtopic.php?f=6&t=14984

Sky is the limit.
-Shawn-
DOL Devotee
 
Posts: 305
Joined: Tue Nov 24, 2009 1:47 am
Location: New York

Re: RA - Charge

Postby Graveen » Sat Oct 09, 2010 8:48 pm

oh nice Shawn, tyvm !
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

Re: RA - Charge

Postby Graveen » Sun Oct 10, 2010 8:02 pm

Accepted, soon in SVN, thank you !
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 1 guest