PvP combat

A place to submit .patch fixes for the DOL SVN

Moderator: Developer Team

PvP combat

Postby Yemla » Sun Sep 05, 2010 11:10 pm

Some pre-checks to keep some things likelive (While mezzed or Stunned you stay incombat and intell the effect expire it has the chance to start the tic down
In GamePlayer
Code: Select all
      public override long LastAttackedByEnemyTickPvE
      {
         set
         {
            bool wasInCombat = InCombat;
            base.LastAttackedByEnemyTickPvE = value;
            if (!wasInCombat && InCombat)
            {
               Out.SendUpdateMaxSpeed();
            }
                if (this.IsMezzed || this.IsStunned)
                {
                    ResetInCombatTimer();
                }
            ResetInCombatTimer();
         }
      }

      public override long LastAttackTickPvE
      {
         set
         {
            bool wasInCombat = InCombat;
            base.LastAttackTickPvE = value;
            if (!wasInCombat && InCombat)
            {
               Out.SendUpdateMaxSpeed();
            }
                if (this.IsMezzed || this.IsStunned)
                {
                    ResetInCombatTimer();
                }
            ResetInCombatTimer();
         }
      }
        public override long LastAttackedByEnemyTickPvP
        {
            set
            {
                bool wasInCombat = InCombat;
                base.LastAttackedByEnemyTickPvP = value;
                if (!wasInCombat && InCombat)
                {
                    Out.SendUpdateMaxSpeed();
                }
                if (this.IsMezzed || this.IsStunned)
                {
                    ResetInCombatTimer();
                }
                ResetInCombatTimer();
            }
        }

        public override long LastAttackTickPvP
        {
            set
            {
                bool wasInCombat = InCombat;
                base.LastAttackTickPvP = value;
                if (!wasInCombat && InCombat)
                {
                    Out.SendUpdateMaxSpeed();
                }
                if (this.IsMezzed || this.IsStunned)
                {
                    ResetInCombatTimer();
                }
                ResetInCombatTimer();
            }
        }
      protected void ResetInCombatTimer()
      {
         if (noCombatTimer == null)
         {
            noCombatTimer = new RegionTimer(this, new RegionTimerCallback(InCombatTimerExpired));
         }
         noCombatTimer.Stop();
         noCombatTimer.Start(11000);
      }
Yemla
Contributor
 
Posts: 215
Joined: Sat Feb 02, 2008 3:21 am
Website: http://www.facebook.com/J.D.Snelling
Location: California

Re: PvP combat

Postby mgX » Mon Sep 06, 2010 10:20 am

bool wasInCombat = InCombat;
if (!wasInCombat && InCombat)

Uhh.... Is it just me, or is there something wrong here?

I think you mean to check the last tick and compare it to the current tick, which would look like:
Code: Select all
      private bool wasInCombat;

      public override long LastAttackedByEnemyTickPvE
      {
         set
         {
            base.LastAttackedByEnemyTickPvE = value;
            if (!wasInCombat && InCombat)
            {
               Out.SendUpdateMaxSpeed();
            }
            if (this.IsMezzed || this.IsStunned)
            {
                ResetInCombatTimer();
            }
            ResetInCombatTimer();
            wasInCombat = InCombat;
         }
      }


I might mistake your intensions, but currently with 2 hours of sleep and 4 cups of coffee, your code looks a bit weird.
mgX
Inactive Staff Member
 
Posts: 235
Joined: Tue Jun 28, 2005 10:19 am
ICQ: 298828005
Yahoo Messenger: Insilopeh
Location: Denmark

Re: PvP combat

Postby Yemla » Mon Sep 06, 2010 4:37 pm

mgX wrote:bool wasInCombat = InCombat;
if (!wasInCombat && InCombat)

Uhh.... Is it just me, or is there something wrong here?


that was alrdy in the core that check for PvE check only, and i copy pasted for PvP check...not gonna argue what it was for at the time lol...but hell if you have a method better than the current SVN, x} w.e works bahaha...

i was just adding
Code: Select all
           if (this.IsMezzed || this.IsStunned)
            {
                ResetInCombatTimer();
            }


to keep players in combat as long as there mezzed or stunned
Yemla
Contributor
 
Posts: 215
Joined: Sat Feb 02, 2008 3:21 am
Website: http://www.facebook.com/J.D.Snelling
Location: California

Re: PvP combat

Postby mgX » Mon Sep 06, 2010 8:29 pm

Oh... Well the problem is that you set

bool wasInCombat = InCombat;

and then check

if (!wasInCombat && InCombat)

which wont ever be true, since you just set them to be equal one another... That is unless

base.LastAttackTickPvE = value;

does some voodoomagic, and since i havent checked it, i cant be sure. Nevertheless it looks strange...
mgX
Inactive Staff Member
 
Posts: 235
Joined: Tue Jun 28, 2005 10:19 am
ICQ: 298828005
Yahoo Messenger: Insilopeh
Location: Denmark


Return to “%s” DOL Code Contributions

Who is online

Users browsing this forum: No registered users and 1 guest