public override void Update(double secondsElapsed, ExternalUtilsCSharp.KeyUtils keyUtils, SharpDX.Vector2 cursorPoint, bool checkMouse = false)
        {
            base.Update(secondsElapsed, keyUtils, cursorPoint, checkMouse);
            Framework fw = WithOverlay.Framework;
            if (fw.LocalPlayer == null)
                return;
            if (!fw.LocalPlayer.IsValid())
                return;

            if(fw.LocalPlayer.m_iTeamNum == (int)Team.Terrorists)
            {
                this.AlliesColor = Color.Red;
                this.EnemiesColor = Color.LightBlue;
            }
            else
            {
                this.AlliesColor = Color.LightBlue;
                this.EnemiesColor = Color.Red;
            }

            this.RotationDegrees = fw.ViewAngles.Y + 90;
            this.CenterCoordinate = new SharpDX.Vector2(fw.LocalPlayer.m_vecOrigin.X, fw.LocalPlayer.m_vecOrigin.Y);

            var enemies = fw.Players.Where(x => x.Item2.IsValid() && x.Item2.m_iHealth > 0 && x.Item2.m_iTeamNum != fw.LocalPlayer.m_iTeamNum);
            this.Enemies = enemies.Select(x => new Vector2(x.Item2.m_vecOrigin.X, x.Item2.m_vecOrigin.Y)).ToArray();

            var allies = fw.Players.Where(x => x.Item2.IsValid() && x.Item2.m_iHealth > 0 && x.Item2.m_iTeamNum == fw.LocalPlayer.m_iTeamNum);
            this.Allies = allies.Select(x => new Vector2(x.Item2.m_vecOrigin.X, x.Item2.m_vecOrigin.Y)).ToArray();
        }
 public override void Draw(ExternalUtilsCSharp.SharpDXRenderer.SharpDXRenderer renderer)
 {
     Vector2 location = this.GetAbsoluteLocation();
     Vector2 size = this.GetSize();
     renderer.DrawRectangle(this.BackColor, location + Vector2.One * 4, size - Vector2.One * 8, 8f);
     renderer.DrawRectangle(this.ForeColor, location, size);
     renderer.DrawRectangle(this.ForeColor, location + Vector2.One * 8, size - Vector2.One * 16);
     base.Draw(renderer);
 }
        void ClickerWindow_MouseMovedEvent(object sender, ExternalUtilsCSharp.UI.Control<ExternalUtilsCSharp.SharpDXRenderer.SharpDXRenderer, Color, Vector2, SharpDX.DirectWrite.TextFormat>.MouseEventArgs e)
        {
            Vector2 location = this.GetAbsoluteLocation();
            Vector2 localMousePos = e.Position - location;
            Vector2 localLastMousePos = LastMousePos - location;
            if (mouseDrag)
            {

                if (localLastMousePos.X > this.Width - 8)
                {
                    this.Width += e.Position.X - LastMousePos.X;
                }
                if (localLastMousePos.Y > this.Height - 8)
                {
                    this.Height += e.Position.Y - LastMousePos.Y;
                }
                else
                {
                    this.X += e.Position.X - LastMousePos.X;
                    this.Y += e.Position.Y - LastMousePos.Y;
                }
            }
        }
Example #4
0
        public override void Draw(ExternalUtilsCSharp.SharpDXRenderer.SharpDXRenderer renderer)
        {
            if (!WithOverlay.ConfigUtils.GetValue<bool>("espEnabled"))
                return;
            Framework fw = WithOverlay.Framework;

            if (!fw.IsPlaying())
                return;
            if (Player == null || fw.LocalPlayer == null)
                return;
            if (Player.Address == fw.LocalPlayer.Address)
                return;

            float distance = Player.m_vecOrigin.DistanceTo(fw.LocalPlayer.m_vecOrigin);
            if (!Player.IsValid() || Player.m_vecOrigin == ExternalUtilsCSharp.MathObjects.Vector3.Zero || distance > MAX_DISTANCE || Player.m_iHealth == 0)
                return;

            #region Bones + W2S
            ExternalUtilsCSharp.MathObjects.Vector3[] arms = new ExternalUtilsCSharp.MathObjects.Vector3[]
            {
                Player.Bones.LeftHand,
                Player.Bones.LeftElbow,
                Player.Bones.LeftShoulder,
                Player.Bones.Spine5,
                Player.Bones.RightShoulder,
                Player.Bones.RightElbow,
                Player.Bones.RightHand
            };
            ExternalUtilsCSharp.MathObjects.Vector3[] legs = new ExternalUtilsCSharp.MathObjects.Vector3[]
            {
                Player.Bones.LeftFoot,
                Player.Bones.LeftKnee,
                Player.Bones.LeftHip,
                Player.Bones.Spine1,
                Player.Bones.RightHip,
                Player.Bones.RightKnee,
                Player.Bones.RightFoot
            };
            ExternalUtilsCSharp.MathObjects.Vector3[] spine = new ExternalUtilsCSharp.MathObjects.Vector3[]
            {
                Player.Bones.Spine1,
                Player.Bones.Spine2,
                Player.Bones.Spine3,
                Player.Bones.Spine4,
                Player.Bones.Spine5,
                Player.Bones.Neck + new ExternalUtilsCSharp.MathObjects.Vector3(0,0,5)
            };
            ExternalUtilsCSharp.MathObjects.Vector3[] body = MiscUtils.MergeArrays(arms, legs, spine);

            if (body.Count(x=>x == ExternalUtilsCSharp.MathObjects.Vector3.Zero) > 0)
                return;
            if (body.Count(x => x.DistanceTo(Player.m_vecOrigin) > 100) > 0)
                return;

            Vector2[] w2sArms = W2S(arms);
            Vector2[] w2sLegs = W2S(legs);
            Vector2[] w2sSpine = W2S(spine);

            Vector2[] w2sBody = MiscUtils.MergeArrays(w2sArms, w2sLegs, w2sSpine);
            if (w2sBody.Count(x=>x == Vector2.Zero) > 0)
                return;
            Vector2 left = w2sBody.First(x => x.X == w2sBody.Min(x2 => x2.X));
            Vector2 right = w2sBody.First(x => x.X == w2sBody.Max(x2 => x2.X));
            Vector2 upper = w2sBody.First(x => x.Y == w2sBody.Min(x2 => x2.Y));
            Vector2 lower = w2sBody.First(x => x.Y == w2sBody.Max(x2 => x2.Y));

            Vector2 outerSize = new Vector2(right.X - left.X + BORDER_MARGIN * 2, lower.Y - upper.Y + BORDER_MARGIN * 2) + Vector2.One * BORDER_SIZE * 2;
            Vector2 outerLocation = new Vector2(left.X - BORDER_MARGIN, upper.Y - BORDER_MARGIN) - Vector2.One * BORDER_SIZE;
            #endregion

            #region Color
            if (this.Player.m_iTeamNum == (int)Team.Terrorists)
                this.BackColor = new Color(1f, 0f, 0f, 1f);
            else
                this.BackColor = new Color(0.5f, 0.8f, 0.9f, 0.9f);
            #endregion

            #region Box
            if (WithOverlay.ConfigUtils.GetValue<bool>("espBox"))
            {
                renderer.DrawRectangle(this.ForeColor, outerLocation, outerSize, BORDER_SIZE + 2f);
                renderer.DrawRectangle(this.BackColor, outerLocation, outerSize, BORDER_SIZE);
            }
            #endregion

            #region Skeleton
            if (WithOverlay.ConfigUtils.GetValue<bool>("espSkeleton"))
            {
                renderer.DrawLines(this.ForeColor, 3f, w2sArms);
                renderer.DrawLines(this.ForeColor, 3f, w2sLegs);
                renderer.DrawLines(this.ForeColor, 3f, w2sSpine);
                renderer.DrawLines(this.BackColor, w2sArms);
                renderer.DrawLines(this.BackColor, w2sLegs);
                renderer.DrawLines(this.BackColor, w2sSpine);
            }
            #endregion

            #region Name + Stats
            string name = string.Format("{0} [{1}/{2}]", fw.Names[Player.m_iID], fw.Kills[Player.m_iID], fw.Deaths[Player.m_iID]);
            Vector2 nameSize = renderer.MeasureString(name, this.Font);
            Vector2 nameBoxSize = new Vector2((float)Math.Max(outerSize.X, nameSize.X), nameSize.Y);
            Vector2 nameBoxLocation = outerLocation - Vector2.UnitY * (BORDER_SIZE + 2f) - Vector2.UnitY * nameSize.Y + Vector2.UnitX * (outerSize.X/2f - nameBoxSize.X/2f);
            Vector2 nameLocation = nameBoxLocation + Vector2.UnitX * (nameBoxSize.X / 2f - nameSize.X / 2f);

            if (WithOverlay.ConfigUtils.GetValue<bool>("espName"))
            {
                renderer.FillRectangle(this.BackColor, nameBoxLocation, nameBoxSize);
                renderer.DrawRectangle(this.ForeColor, nameBoxLocation, nameBoxSize);

                renderer.DrawText(name, this.ForeColor, this.Font, nameLocation);
            }
            #endregion

            #region Health
            Vector2 hpLocation = outerLocation + (Vector2.UnitX * outerSize.X) + (Vector2.UnitX * BORDER_MARGIN);
            Vector2 hpSize = new Vector2(1, outerSize.Y);
            Vector2 hpFillSize = new Vector2(1, hpSize.Y / 100f * (float)(Math.Min(100, Player.m_iHealth)));
            Vector2 hpFillLocation = hpLocation + Vector2.UnitY * (hpSize.Y - hpFillSize.Y);

            if (WithOverlay.ConfigUtils.GetValue<bool>("espHealth"))
            {
                renderer.DrawLine(this.ForeColor, hpLocation, hpLocation + hpSize, BORDER_SIZE * 2f + 2f);
                renderer.DrawLine(Color.Green, hpFillLocation, hpFillLocation + hpFillSize, BORDER_SIZE * 2f);
            }
            #endregion
            base.Draw(renderer);
        }
Example #5
0
        private Vector2[] W2S(ExternalUtilsCSharp.MathObjects.Vector3[] points)
        {
            ExternalUtilsCSharp.MathObjects.Matrix vMatrix = WithOverlay.Framework.ViewMatrix;
            ExternalUtilsCSharp.MathObjects.Vector2 screenSize = new ExternalUtilsCSharp.MathObjects.Vector2(WithOverlay.SHDXOverlay.Width, WithOverlay.SHDXOverlay.Height);
            ExternalUtilsCSharp.MathObjects.Vector3 origin = Player.m_vecOrigin;

            return SharpDXConverter.Vector2EUCtoSDX(MathUtils.WorldToScreen(vMatrix, screenSize, points));
        }
 void ClickerWindow_MouseClickEventUp(object sender, ExternalUtilsCSharp.UI.Control<ExternalUtilsCSharp.SharpDXRenderer.SharpDXRenderer, Color, Vector2, SharpDX.DirectWrite.TextFormat>.MouseEventArgs e)
 {
     if (e.LeftButton)
         mouseDrag = false;
 }
 static void button_MouseClickEventUp(object sender, ExternalUtilsCSharp.UI.Control<SharpDXRenderer, SharpDX.Color, SharpDX.Vector2, TextFormat>.MouseEventArgs e)
 {
     if (!e.LeftButton)
         return;
     SharpDXPanel panel = (SharpDXPanel)((SharpDXButton)sender).Tag;
     panel.Visible = !panel.Visible;
 }