What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

WoWMovement.Move Issue ??

the main issue i think im having is i need to know who im about to target, and how many enemys around me, which will cause a loop in object manager
not all list building is bad, as long as its not constantly being done. just consider that pvp is moving so fast by the time your done building the list chances are its already invalid.

i wouldnt think about who your about to target at all, its best to think about it for what its going to do in the moment.
ok i got a target what are we going to do to it?
At what point do i move onto another target (if at all)?
Do i need to do something if my target gets too close?
If im dieing what do i do?


and just work on making the code as simple as possible. if its simple not only is it easy to process, but its easy to fix bugs in and modify.
 
the main issue i think im having is i need to know who im about to target, and how many enemys around me, which will cause a loop in object manager

The lists are only being "built" because you order it by health percent. The ones you don't order (EnemyAllianceFlagCarrier and EnemyHordeFlagCarrier) only iterate until a single unit that satisfies all the conditions has been found (this is due to deferred execution). You can turn the ones you order into O(n) loops instead of O(n^2), if you only iterate through the list once and store the one with the lowest health. I doubt the slow thing is ordering the units though. :)
 
Thanks for that input main,

Come to think of it I really do not need orderby I would help tho,
Also I got this email as soon as I woke up, and I had a massive idea

Basically I'm in Australia, and u guys in dif country's made me think about the latency of wow
I have from 300-800 ping.

Now in my casting code I have .sleepforlagduration

Now I really am sure this has something to do with results
 
Last edited:
wow, i think i found that my issue was SleepForLagDuration

that is running my WHOLE code also.

Code:
[PVPDruid By SwInY] StrafeTimer: MS[465]
[PVPDruid By SwInY] StrafeTimer: MS[589]
[PVPDruid By SwInY] StrafeTimer: MS[399]
[PVPDruid By SwInY] StrafeTimer: MS[667]
[PVPDruid By SwInY] StrafeTimer: MS[780]
[PVPDruid By SwInY] StrafeTimer: MS[261]
[PVPDruid By SwInY] StrafeTimer: MS[727]
[PVPDruid By SwInY] StrafeTimer: MS[583]
[PVPDruid By SwInY] StrafeTimer: MS[474]
[PVPDruid By SwInY] StrafeTimer: MS[270]
[PVPDruid By SwInY] StrafeTimer: MS[1719]
[PVPDruid By SwInY] StrafeTimer: MS[811]
[PVPDruid By SwInY] StrafeTimer: MS[263]
[PVPDruid By SwInY] StrafeTimer: MS[718]
[PVPDruid By SwInY] StrafeTimer: MS[657]
[PVPDruid By SwInY] StrafeTimer: MS[450]
[PVPDruid By SwInY] StrafeTimer: MS[266]
[PVPDruid By SwInY] StrafeTimer: MS[735]
[PVPDruid By SwInY] StrafeTimer: MS[457]
[PVPDruid By SwInY] StrafeTimer: MS[467]
[PVPDruid By SwInY] StrafeTimer: MS[261]
[PVPDruid By SwInY] StrafeTimer: MS[663]
[PVPDruid By SwInY] StrafeTimer: MS[602]
[PVPDruid By SwInY] StrafeTimer: MS[472]
[PVPDruid By SwInY] StrafeTimer: MS[265]
[PVPDruid By SwInY] StrafeTimer: MS[649]
[PVPDruid By SwInY] StrafeTimer: MS[599]
[PVPDruid By SwInY] StrafeTimer: MS[398]
[PVPDruid By SwInY] StrafeTimer: MS[608]
[PVPDruid By SwInY] StrafeTimer: MS[404]
[PVPDruid By SwInY] StrafeTimer: MS[388]
[PVPDruid By SwInY] StrafeTimer: MS[789]
[PVPDruid By SwInY] StrafeTimer: MS[274]
[PVPDruid By SwInY] StrafeTimer: MS[718]
[PVPDruid By SwInY] StrafeTimer: MS[466]
[PVPDruid By SwInY] StrafeTimer: MS[577]
[PVPDruid By SwInY] StrafeTimer: MS[401]
 
Straight back to this issue now.

Its not moving, or locks up still even with timers,
Keep getting

[10:20:19 AM:437] Flushing timed movement. Direction: StrafeRight
[10:20:19 AM:437] Flushing timed movement. Direction: StrafeLeft


Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using Styx;
using Styx.Combat.CombatRoutine;
using Styx.Helpers;
using Styx.Logic;
using Styx.Logic.Combat;
using Styx.Logic.Pathing;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;
using HBPVPDruid.Misc;

namespace HBPVPDruid.Movment
{
    public static class Movement
    {
        private static LocalPlayer Me { get { return ObjectManager.Me; } }
        private static bool JumpLeft = false;   // Jumpleft = true; Jumpleft = false = right
        private static bool RandomJump = true; // Random jump every now and then
        private static Stopwatch StrafeTimer = new Stopwatch(); // We use a timer instead of thread.sleep so we can still do stuff, I.E Cast

        public static void Pulse(WoWPlayer Player)
        {
            //if (Me.IsMoving) return;
            if (Me.IsCasting) return;
            if (Me.Stunned) return;
            if (Player.HasAura("Insect Swarm") && Player.HasAura("Moonfire")) return;
            if (Misc.Misc.EnemysAroundMe > Config.NumberEnemysBeforeStarfire) return;

            // So we can still cast while we move
            if (StrafeTimer.IsRunning == false) StrafeTimer.Start();
            if (!CheckStrafeTimer) return;

            StrafeTimer.Stop();
            StrafeTimer.Reset();
            WoWMovement.MoveStop();

            // Add more than strafe later
            DoRandomStrafe();
        }


        public static void DoRandomStrafe()
        {
            // Get which way to strafe,
            WoWMovement.MovementDirection WayToStrafe;  // Create Var
            WayToStrafe = WoWMovement.MovementDirection.StrafeRight; // Set to default right
            if (JumpLeft == true) WayToStrafe = WoWMovement.MovementDirection.StrafeLeft; // if left set to left

            // Ok now lets strafe, If all good throw in a jump if we want to
            WoWMovement.Move(WayToStrafe);
            //DoRandomJump();
            StrafeTimer.Start();

            if (WayToStrafe == WoWMovement.MovementDirection.StrafeLeft) Misc.Misc.DebugLog("[Movement] Strafing Left");
            if (WayToStrafe == WoWMovement.MovementDirection.StrafeRight) Misc.Misc.DebugLog("[Movement] Strafing Right");

            // One lined this shit so looks neater for now.
            if (JumpLeft == true) { JumpLeft = false; } else { JumpLeft = true; }
        }

        /// <summary>
        /// True if over the timer limit
        /// </summary>
        private static bool CheckStrafeTimer
        {
            get
            {
                Misc.Misc.slog("StrafeTimer: MS[{0}]", StrafeTimer.ElapsedMilliseconds);
                if (StrafeTimer.ElapsedMilliseconds > 300) return true;
                return false;
            }
        }

        /// <summary>
        /// will 1/3 Randomly jump
        /// </summary>
        private static void DoRandomJump()
        {
            if (ShouldIRandomJump)
            {
                Misc.Misc.DebugLog("[Movement]: Randomly Jumping");
                WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend);
            }
        }

        /// <summary>
        /// Determines if it should jump or not
        /// </summary>
        private static bool ShouldIRandomJump
        {
            get
            {
                // 1/3 change of jumping seems good.
                Random num = new Random();
                int numb = num.Next(0, 3);

                if (numb == 1) return true;
                return false;
            }
        }

    }
}
 
Last edited:
Back
Top