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;
}
}
}
}