public WoWPlayer(WoWPlayer other) { this.Position = other.position; this.rPlayer = other.rPlayer; this.UnitType = other.UnitType; this.Guid = other.Guid; this.BaseAddress = other.BaseAddress; }
public void SetPositions(WoWPlayer other) { this.position = other.position; this.rotation = other.rotation; this.rPlayer.RelativeRadarPosToPlayer = new Vector2( -RadarObject.RadarZoom * (other.position.Y - Game1.mainPlayer.Position.Y), -RadarObject.RadarZoom * (other.position.X - Game1.mainPlayer.Position.X)); this.rPlayer.RadarRot = -(other.rotation + (float)Math.PI / 2); this.MovingInfo = other.MovingInfo; }
//protected bool RotateTowards(WoWUnit PlayerUnit, WoWUnit TargetUnit, double RotationThreshhold, bool DisableForward) { // return RotateTowards(PlayerUnit, TargetUnit.Position, RotationThreshhold, DisableForward); //} public static bool WalkingTowards(WoWPlayer PlayerUnit, Vector2 mTargetPosition, double mPositionThreshold) { if (Vector2.Distance(new Vector2(PlayerUnit.Position.X, PlayerUnit.Position.Y), mTargetPosition) < mPositionThreshold) { SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_UP, PlayerUnit.MovingInfo.IsMovingForward, ref PlayerUnit.MovingInfo.myforward, PlayerUnit.WindowTitle); return true; } else { SendKey.KeyDown(ConstController.WindowsVirtualKey.VK_UP, !PlayerUnit.MovingInfo.IsMovingForward, ref PlayerUnit.MovingInfo.myforward, PlayerUnit.WindowTitle); return false; } }
public bool ConnectToMainWoW(string windowTitle) { GameEnabled = false; radarctrl = new RadarControl(); mainwow = new WoWConnection(windowTitle); if (!mainwow.TryToConnect()) { throw new Exception(); } mainPlayer = new WoWPlayer(mainwow.Connection.ReadUInt64((uint)mainwow.Connection.MainModule.BaseAddress + MemoryOffsets.GlobalInfoPlayerGUID)); GameEnabled = true; return true; }
public static bool RotateTowards(WoWPlayer PlayerUnit, Vector2 TargetUnitPos, double RotationThreshhold, bool DisableForward) { double mydiff = Angles.AngleDiff(Angles.Calculateangle(TargetUnitPos, PlayerUnit.Position), PlayerUnit.Rotation); if ((Math.Abs(mydiff) < RotationThreshhold)) { SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_LEFT, PlayerUnit.MovingInfo.IsTurningLeft, ref PlayerUnit.MovingInfo.myleft, PlayerUnit.WindowTitle); SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_RIGHT, PlayerUnit.MovingInfo.IsTurningRight, ref PlayerUnit.MovingInfo.myright, PlayerUnit.WindowTitle); return true; } else if (mydiff < 0) { if (DisableForward) { SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_UP, PlayerUnit.MovingInfo.IsMovingForward, ref PlayerUnit.MovingInfo.myforward, PlayerUnit.WindowTitle); } SendKey.KeyDown(ConstController.WindowsVirtualKey.VK_LEFT, !PlayerUnit.MovingInfo.IsTurningLeft, ref PlayerUnit.MovingInfo.myleft, PlayerUnit.WindowTitle); SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_RIGHT, PlayerUnit.MovingInfo.IsTurningRight, ref PlayerUnit.MovingInfo.myright, PlayerUnit.WindowTitle); } else if (mydiff > 0) { if (DisableForward) { SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_UP, PlayerUnit.MovingInfo.IsMovingForward, ref PlayerUnit.MovingInfo.myforward, PlayerUnit.WindowTitle); } SendKey.KeyDown(ConstController.WindowsVirtualKey.VK_RIGHT, !PlayerUnit.MovingInfo.IsTurningRight, ref PlayerUnit.MovingInfo.myright, PlayerUnit.WindowTitle); SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_LEFT, PlayerUnit.MovingInfo.IsTurningLeft, ref PlayerUnit.MovingInfo.myleft, PlayerUnit.WindowTitle); } return false; }
public static double Calculateangle(WoWPlayer Target, WoWPlayer Player) { float vx = Target.Position.X - Player.Position.X; float vy = Target.Position.Y - Player.Position.Y; return Math.Sign(vy) * Math.Acos((vx * 1 + vy * 0) / (Math.Sqrt(vx * vx + vy * vy))); }
//protected bool WalkingTowards(WoWUnit mPlayerUnit, WoWUnit mTargetUnit, double mPositionThreshhold) { // return WalkingTowards(mPlayerUnit, mTargetUnit.Position, mPositionThreshhold); //} protected void Halt(WoWPlayer PlayerUnit) { SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_UP, PlayerUnit.MovingInfo.IsMovingForward, ref PlayerUnit.MovingInfo.myforward, PlayerUnit.WindowTitle); SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_LEFT, PlayerUnit.MovingInfo.IsTurningLeft, ref PlayerUnit.MovingInfo.myleft, PlayerUnit.WindowTitle); SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_RIGHT, PlayerUnit.MovingInfo.IsTurningRight, ref PlayerUnit.MovingInfo.myright, PlayerUnit.WindowTitle); }